1 |
bbetchar |
1.1 |
#include "UserCode/ShallowTools/interface/ShallowTrackClustersProducer.h"
|
2 |
|
|
|
3 |
|
|
#include "UserCode/ShallowTools/interface/ShallowTools.h"
|
4 |
|
|
|
5 |
|
|
#include "TrackingTools/PatternTools/interface/Trajectory.h"
|
6 |
|
|
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
|
7 |
bbetchar |
1.5 |
#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h"
|
8 |
bbetchar |
1.1 |
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
|
9 |
|
|
|
10 |
|
|
#include "MagneticField/Engine/interface/MagneticField.h"
|
11 |
|
|
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
|
12 |
|
|
#include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
|
13 |
|
|
#include "CondFormats/DataRecord/interface/SiStripLorentzAngleRcd.h"
|
14 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
|
15 |
|
|
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
|
16 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
|
17 |
|
|
#include "Geometry/CommonTopologies/interface/StripTopology.h"
|
18 |
|
|
#include "FWCore/Framework/interface/ESHandle.h"
|
19 |
bbetchar |
1.2 |
#include "boost/foreach.hpp"
|
20 |
bbetchar |
1.1 |
|
21 |
bbetchar |
1.5 |
|
22 |
bbetchar |
1.1 |
ShallowTrackClustersProducer::ShallowTrackClustersProducer(const edm::ParameterSet& iConfig)
|
23 |
|
|
: theTracksLabel( iConfig.getParameter<edm::InputTag>("Tracks") ),
|
24 |
|
|
Suffix ( iConfig.getParameter<std::string>("Suffix") ),
|
25 |
|
|
Prefix ( iConfig.getParameter<std::string>("Prefix") )
|
26 |
|
|
{
|
27 |
|
|
produces <std::vector<unsigned int> > ( Prefix + "trackmulti" + Suffix );
|
28 |
|
|
produces <std::vector<int> > ( Prefix + "trackindex" + Suffix );
|
29 |
|
|
produces <std::vector<float> > ( Prefix + "localtheta" + Suffix );
|
30 |
|
|
produces <std::vector<float> > ( Prefix + "localphi" + Suffix );
|
31 |
|
|
produces <std::vector<float> > ( Prefix + "localpitch" + Suffix );
|
32 |
|
|
produces <std::vector<float> > ( Prefix + "localx" + Suffix );
|
33 |
|
|
produces <std::vector<float> > ( Prefix + "localy" + Suffix );
|
34 |
|
|
produces <std::vector<float> > ( Prefix + "localz" + Suffix );
|
35 |
|
|
produces <std::vector<float> > ( Prefix + "strip" + Suffix );
|
36 |
|
|
produces <std::vector<float> > ( Prefix + "globaltheta" + Suffix );
|
37 |
|
|
produces <std::vector<float> > ( Prefix + "globalphi" + Suffix );
|
38 |
|
|
produces <std::vector<float> > ( Prefix + "globalx" + Suffix );
|
39 |
|
|
produces <std::vector<float> > ( Prefix + "globaly" + Suffix );
|
40 |
|
|
produces <std::vector<float> > ( Prefix + "globalz" + Suffix );
|
41 |
|
|
produces <std::vector<float> > ( Prefix + "insidistance"+ Suffix );
|
42 |
|
|
produces <std::vector<float> > ( Prefix + "covered" + Suffix );
|
43 |
|
|
produces <std::vector<float> > ( Prefix + "projwidth" + Suffix );
|
44 |
bbetchar |
1.6 |
produces <std::vector<float> > ( Prefix + "BdotY" + Suffix );
|
45 |
bbetchar |
1.1 |
|
46 |
|
|
produces <std::vector<float> > ( Prefix + "rhlocalx" + Suffix );
|
47 |
|
|
produces <std::vector<float> > ( Prefix + "rhlocaly" + Suffix );
|
48 |
|
|
produces <std::vector<float> > ( Prefix + "rhlocalxerr" + Suffix );
|
49 |
|
|
produces <std::vector<float> > ( Prefix + "rhlocalyerr" + Suffix );
|
50 |
|
|
produces <std::vector<float> > ( Prefix + "rhglobalx" + Suffix );
|
51 |
|
|
produces <std::vector<float> > ( Prefix + "rhglobaly" + Suffix );
|
52 |
|
|
produces <std::vector<float> > ( Prefix + "rhglobalz" + Suffix );
|
53 |
|
|
produces <std::vector<float> > ( Prefix + "rhstrip" + Suffix );
|
54 |
|
|
produces <std::vector<float> > ( Prefix + "rhmerr" + Suffix );
|
55 |
|
|
|
56 |
bbetchar |
1.5 |
produces <std::vector<float> > ( Prefix + "ubstrip" + Suffix );
|
57 |
|
|
produces <std::vector<float> > ( Prefix + "ubmerr" + Suffix );
|
58 |
|
|
|
59 |
bbetchar |
1.1 |
produces <std::vector<float> > ( Prefix + "driftx" + Suffix );
|
60 |
|
|
produces <std::vector<float> > ( Prefix + "drifty" + Suffix );
|
61 |
|
|
produces <std::vector<float> > ( Prefix + "driftz" + Suffix );
|
62 |
bbetchar |
1.7 |
produces <std::vector<float> > ( Prefix + "globalZofunitlocalY" + Suffix );
|
63 |
bbetchar |
1.1 |
}
|
64 |
|
|
|
65 |
|
|
void ShallowTrackClustersProducer::
|
66 |
|
|
produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
|
67 |
|
|
shallow::CLUSTERMAP clustermap = shallow::make_cluster_map(iEvent);
|
68 |
|
|
|
69 |
|
|
int size = clustermap.size();
|
70 |
|
|
std::auto_ptr<std::vector<unsigned int> > trackmulti ( new std::vector<unsigned int>(size, 0) );
|
71 |
|
|
std::auto_ptr<std::vector<int> > trackindex ( new std::vector<int> (size, -1) );
|
72 |
|
|
std::auto_ptr<std::vector<float> > localtheta ( new std::vector<float> (size, -100) );
|
73 |
|
|
std::auto_ptr<std::vector<float> > localphi ( new std::vector<float> (size, -100) );
|
74 |
|
|
std::auto_ptr<std::vector<float> > localpitch ( new std::vector<float> (size, -100) );
|
75 |
|
|
std::auto_ptr<std::vector<float> > localx ( new std::vector<float> (size, -100) );
|
76 |
|
|
std::auto_ptr<std::vector<float> > localy ( new std::vector<float> (size, -100) );
|
77 |
|
|
std::auto_ptr<std::vector<float> > localz ( new std::vector<float> (size, -100) );
|
78 |
|
|
std::auto_ptr<std::vector<float> > strip ( new std::vector<float> (size, -100) );
|
79 |
|
|
std::auto_ptr<std::vector<float> > globaltheta ( new std::vector<float> (size, -100) );
|
80 |
|
|
std::auto_ptr<std::vector<float> > globalphi ( new std::vector<float> (size, -100) );
|
81 |
|
|
std::auto_ptr<std::vector<float> > globalx ( new std::vector<float> (size, -10000) );
|
82 |
|
|
std::auto_ptr<std::vector<float> > globaly ( new std::vector<float> (size, -10000) );
|
83 |
|
|
std::auto_ptr<std::vector<float> > globalz ( new std::vector<float> (size, -10000) );
|
84 |
|
|
std::auto_ptr<std::vector<float> > insidistance ( new std::vector<float> (size, -1) );
|
85 |
|
|
std::auto_ptr<std::vector<float> > projwidth ( new std::vector<float> (size, -1000) );
|
86 |
bbetchar |
1.6 |
std::auto_ptr<std::vector<float> > BdotY ( new std::vector<float> (size, -1000) );
|
87 |
bbetchar |
1.1 |
std::auto_ptr<std::vector<float> > covered ( new std::vector<float> (size, -1000) );
|
88 |
|
|
std::auto_ptr<std::vector<float> > rhlocalx ( new std::vector<float>(size, -10000 ));
|
89 |
|
|
std::auto_ptr<std::vector<float> > rhlocaly ( new std::vector<float>(size, -10000 ));
|
90 |
|
|
std::auto_ptr<std::vector<float> > rhlocalxerr ( new std::vector<float>(size, -1 ));
|
91 |
|
|
std::auto_ptr<std::vector<float> > rhlocalyerr ( new std::vector<float>(size, -1 ));
|
92 |
|
|
std::auto_ptr<std::vector<float> > rhglobalx ( new std::vector<float>(size, -10000 ));
|
93 |
|
|
std::auto_ptr<std::vector<float> > rhglobaly ( new std::vector<float>(size, -10000 ));
|
94 |
|
|
std::auto_ptr<std::vector<float> > rhglobalz ( new std::vector<float>(size, -10000 ));
|
95 |
|
|
std::auto_ptr<std::vector<float> > rhstrip ( new std::vector<float>(size, -10000 ));
|
96 |
|
|
std::auto_ptr<std::vector<float> > rhmerr ( new std::vector<float>(size, -10000 ));
|
97 |
bbetchar |
1.5 |
std::auto_ptr<std::vector<float> > ubstrip ( new std::vector<float>(size, -10000 ));
|
98 |
|
|
std::auto_ptr<std::vector<float> > ubmerr ( new std::vector<float>(size, -10000 ));
|
99 |
bbetchar |
1.1 |
std::auto_ptr<std::vector<float> > driftx ( new std::vector<float>(size, -10000 ));
|
100 |
|
|
std::auto_ptr<std::vector<float> > drifty ( new std::vector<float>(size, -10000 ));
|
101 |
|
|
std::auto_ptr<std::vector<float> > driftz ( new std::vector<float>(size, -10000 ));
|
102 |
bbetchar |
1.7 |
std::auto_ptr<std::vector<float> > globalZofunitlocalY ( new std::vector<float>(size, -1000));
|
103 |
bbetchar |
1.1 |
|
104 |
|
|
edm::ESHandle<TrackerGeometry> theTrackerGeometry; iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry );
|
105 |
|
|
edm::ESHandle<MagneticField> magfield; iSetup.get<IdealMagneticFieldRecord>().get(magfield);
|
106 |
|
|
edm::ESHandle<SiStripLorentzAngle> SiStripLorentzAngle; iSetup.get<SiStripLorentzAngleRcd>().get(SiStripLorentzAngle);
|
107 |
|
|
|
108 |
bbetchar |
1.3 |
edm::Handle<edm::View<reco::Track> > tracks; iEvent.getByLabel(theTracksLabel, tracks);
|
109 |
bbetchar |
1.1 |
edm::Handle<TrajTrackAssociationCollection> associations; iEvent.getByLabel(theTracksLabel, associations);
|
110 |
|
|
|
111 |
bbetchar |
1.5 |
TrajectoryStateCombiner combiner;
|
112 |
|
|
|
113 |
bbetchar |
1.1 |
for( TrajTrackAssociationCollection::const_iterator association = associations->begin();
|
114 |
|
|
association != associations->end(); association++) {
|
115 |
|
|
const Trajectory* traj = association->key.get();
|
116 |
|
|
const reco::Track* track = association->val.get();
|
117 |
|
|
|
118 |
|
|
BOOST_FOREACH( const TrajectoryMeasurement measurement, traj->measurements() ) {
|
119 |
|
|
const TrajectoryStateOnSurface tsos = measurement.updatedState();
|
120 |
bbetchar |
1.5 |
const TrajectoryStateOnSurface unbiased = combiner(measurement.forwardPredictedState(), measurement.backwardPredictedState());
|
121 |
bbetchar |
1.1 |
const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*> ( measurement.recHit()->hit() );
|
122 |
|
|
|
123 |
|
|
if(!hit) break;
|
124 |
|
|
shallow::CLUSTERMAP::const_iterator cluster = clustermap.find( std::make_pair(hit->geographicalId().rawId(), hit->cluster()->firstStrip() ));
|
125 |
|
|
if(cluster == clustermap.end() ) break;
|
126 |
|
|
|
127 |
|
|
unsigned i = cluster->second;
|
128 |
|
|
if( 0 == (trackmulti->at(i))++ ) {
|
129 |
|
|
const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( theTrackerGeometry->idToDet( hit->geographicalId() ) );
|
130 |
bbetchar |
1.2 |
LocalVector drift = shallow::drift( theStripDet, *magfield, *SiStripLorentzAngle);
|
131 |
bbetchar |
1.6 |
|
132 |
bbetchar |
1.1 |
trackindex->at(i) = shallow::findTrackIndex(tracks, track);
|
133 |
|
|
localtheta->at(i) = (theStripDet->toLocal(tsos.globalDirection())).theta();
|
134 |
|
|
localphi->at(i) = (theStripDet->toLocal(tsos.globalDirection())).phi();
|
135 |
|
|
localpitch->at(i) = (theStripDet->specificTopology()).localPitch(theStripDet->toLocal(tsos.globalPosition()));
|
136 |
|
|
localx->at(i) = (theStripDet->toLocal(tsos.globalPosition())).x();
|
137 |
|
|
localy->at(i) = (theStripDet->toLocal(tsos.globalPosition())).y();
|
138 |
|
|
localz->at(i) = (theStripDet->toLocal(tsos.globalPosition())).z();
|
139 |
|
|
strip->at(i) = (theStripDet->specificTopology()).strip(theStripDet->toLocal(tsos.globalPosition()));
|
140 |
|
|
globaltheta->at(i) = tsos.globalDirection().theta();
|
141 |
|
|
globalphi->at(i) = tsos.globalDirection().phi();
|
142 |
|
|
globalx->at(i) = tsos.globalPosition().x();
|
143 |
|
|
globaly->at(i) = tsos.globalPosition().y();
|
144 |
|
|
globalz->at(i) = tsos.globalPosition().z();
|
145 |
|
|
insidistance->at(i) = 1./fabs(cos(localtheta->at(i)));
|
146 |
|
|
projwidth->at(i) = tan(localtheta->at(i))*cos(localphi->at(i));
|
147 |
bbetchar |
1.6 |
BdotY->at(i) = (theStripDet->surface()).toLocal( magfield->inTesla(theStripDet->surface().position())).y();
|
148 |
bbetchar |
1.2 |
covered->at(i) = drift.z()/localpitch->at(i) * fabs(projwidth->at(i) - drift.x()/drift.z());
|
149 |
bbetchar |
1.1 |
rhlocalx->at(i) = hit->localPosition().x();
|
150 |
|
|
rhlocaly->at(i) = hit->localPosition().y();
|
151 |
|
|
rhlocalxerr->at(i) = sqrt(hit->localPositionError().xx());
|
152 |
|
|
rhlocalyerr->at(i) = sqrt(hit->localPositionError().yy());
|
153 |
|
|
rhglobalx->at(i) = theStripDet->toGlobal(hit->localPosition()).x();
|
154 |
|
|
rhglobaly->at(i) = theStripDet->toGlobal(hit->localPosition()).y();
|
155 |
|
|
rhglobalz->at(i) = theStripDet->toGlobal(hit->localPosition()).z();
|
156 |
|
|
rhstrip->at(i) = theStripDet->specificTopology().strip(hit->localPosition());
|
157 |
|
|
rhmerr->at(i) = sqrt(theStripDet->specificTopology().measurementError(hit->localPosition(), hit->localPositionError()).uu());
|
158 |
bbetchar |
1.5 |
ubstrip->at(i) = theStripDet->specificTopology().strip(unbiased.localPosition());
|
159 |
|
|
ubmerr->at(i) = sqrt(theStripDet->specificTopology().measurementError(unbiased.localPosition(), unbiased.localError().positionError()).uu());
|
160 |
bbetchar |
1.4 |
driftx->at(i) = drift.x();
|
161 |
|
|
drifty->at(i) = drift.y();
|
162 |
|
|
driftz->at(i) = drift.z();
|
163 |
bbetchar |
1.7 |
globalZofunitlocalY->at(i) = (theStripDet->toGlobal(LocalVector(0,1,0))).z();
|
164 |
bbetchar |
1.1 |
}
|
165 |
|
|
}
|
166 |
|
|
}
|
167 |
|
|
|
168 |
|
|
iEvent.put(trackmulti, Prefix + "trackmulti" + Suffix );
|
169 |
|
|
iEvent.put(trackindex, Prefix + "trackindex" + Suffix );
|
170 |
|
|
iEvent.put(localtheta, Prefix + "localtheta" + Suffix );
|
171 |
|
|
iEvent.put(localphi, Prefix + "localphi" + Suffix );
|
172 |
|
|
iEvent.put(localpitch, Prefix + "localpitch" + Suffix );
|
173 |
|
|
iEvent.put(localx, Prefix + "localx" + Suffix );
|
174 |
|
|
iEvent.put(localy, Prefix + "localy" + Suffix );
|
175 |
|
|
iEvent.put(localz, Prefix + "localz" + Suffix );
|
176 |
|
|
iEvent.put(strip, Prefix + "strip" + Suffix );
|
177 |
|
|
iEvent.put(globaltheta, Prefix + "globaltheta" + Suffix );
|
178 |
|
|
iEvent.put(globalphi, Prefix + "globalphi" + Suffix );
|
179 |
|
|
iEvent.put(globalx, Prefix + "globalx" + Suffix );
|
180 |
|
|
iEvent.put(globaly, Prefix + "globaly" + Suffix );
|
181 |
|
|
iEvent.put(globalz, Prefix + "globalz" + Suffix );
|
182 |
|
|
iEvent.put(insidistance,Prefix + "insidistance"+ Suffix );
|
183 |
|
|
iEvent.put(covered, Prefix + "covered" + Suffix );
|
184 |
|
|
iEvent.put(projwidth, Prefix + "projwidth" + Suffix );
|
185 |
bbetchar |
1.6 |
iEvent.put(BdotY, Prefix + "BdotY" + Suffix );
|
186 |
bbetchar |
1.1 |
iEvent.put(rhlocalx, Prefix + "rhlocalx" + Suffix );
|
187 |
|
|
iEvent.put(rhlocaly, Prefix + "rhlocaly" + Suffix );
|
188 |
|
|
iEvent.put(rhlocalxerr, Prefix + "rhlocalxerr" + Suffix );
|
189 |
|
|
iEvent.put(rhlocalyerr, Prefix + "rhlocalyerr" + Suffix );
|
190 |
|
|
iEvent.put(rhglobalx, Prefix + "rhglobalx" + Suffix );
|
191 |
|
|
iEvent.put(rhglobaly, Prefix + "rhglobaly" + Suffix );
|
192 |
|
|
iEvent.put(rhglobalz, Prefix + "rhglobalz" + Suffix );
|
193 |
|
|
iEvent.put(rhstrip, Prefix + "rhstrip" + Suffix );
|
194 |
|
|
iEvent.put(rhmerr, Prefix + "rhmerr" + Suffix );
|
195 |
bbetchar |
1.5 |
iEvent.put(ubstrip, Prefix + "ubstrip" + Suffix );
|
196 |
|
|
iEvent.put(ubmerr, Prefix + "ubmerr" + Suffix );
|
197 |
bbetchar |
1.7 |
iEvent.put( driftx, Prefix + "driftx" + Suffix );
|
198 |
|
|
iEvent.put( drifty, Prefix + "drifty" + Suffix );
|
199 |
|
|
iEvent.put( driftz, Prefix + "driftz" + Suffix );
|
200 |
|
|
iEvent.put( globalZofunitlocalY, Prefix + "globalZofunitlocalY" + Suffix );
|
201 |
bbetchar |
1.1 |
}
|