4 |
|
|
5 |
|
#include "TrackingTools/PatternTools/interface/Trajectory.h" |
6 |
|
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" |
7 |
+ |
#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" |
8 |
|
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" |
9 |
|
|
10 |
|
#include "MagneticField/Engine/interface/MagneticField.h" |
18 |
|
#include "FWCore/Framework/interface/ESHandle.h" |
19 |
|
#include "boost/foreach.hpp" |
20 |
|
|
21 |
+ |
|
22 |
|
ShallowTrackClustersProducer::ShallowTrackClustersProducer(const edm::ParameterSet& iConfig) |
23 |
|
: theTracksLabel( iConfig.getParameter<edm::InputTag>("Tracks") ), |
24 |
+ |
theClustersLabel( iConfig.getParameter<edm::InputTag>("Clusters") ), |
25 |
|
Suffix ( iConfig.getParameter<std::string>("Suffix") ), |
26 |
|
Prefix ( iConfig.getParameter<std::string>("Prefix") ) |
27 |
|
{ |
42 |
|
produces <std::vector<float> > ( Prefix + "insidistance"+ Suffix ); |
43 |
|
produces <std::vector<float> > ( Prefix + "covered" + Suffix ); |
44 |
|
produces <std::vector<float> > ( Prefix + "projwidth" + Suffix ); |
45 |
< |
produces <std::vector<float> > ( Prefix + "projlength" + Suffix ); |
45 |
> |
produces <std::vector<float> > ( Prefix + "BdotY" + Suffix ); |
46 |
|
|
47 |
|
produces <std::vector<float> > ( Prefix + "rhlocalx" + Suffix ); |
48 |
|
produces <std::vector<float> > ( Prefix + "rhlocaly" + Suffix ); |
54 |
|
produces <std::vector<float> > ( Prefix + "rhstrip" + Suffix ); |
55 |
|
produces <std::vector<float> > ( Prefix + "rhmerr" + Suffix ); |
56 |
|
|
57 |
+ |
produces <std::vector<float> > ( Prefix + "ubstrip" + Suffix ); |
58 |
+ |
produces <std::vector<float> > ( Prefix + "ubmerr" + Suffix ); |
59 |
+ |
|
60 |
|
produces <std::vector<float> > ( Prefix + "driftx" + Suffix ); |
61 |
|
produces <std::vector<float> > ( Prefix + "drifty" + Suffix ); |
62 |
|
produces <std::vector<float> > ( Prefix + "driftz" + Suffix ); |
63 |
+ |
produces <std::vector<float> > ( Prefix + "globalZofunitlocalY" + Suffix ); |
64 |
|
} |
65 |
|
|
66 |
|
void ShallowTrackClustersProducer:: |
67 |
|
produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { |
68 |
< |
shallow::CLUSTERMAP clustermap = shallow::make_cluster_map(iEvent); |
68 |
> |
shallow::CLUSTERMAP clustermap = shallow::make_cluster_map(iEvent,theClustersLabel); |
69 |
|
|
70 |
|
int size = clustermap.size(); |
71 |
|
std::auto_ptr<std::vector<unsigned int> > trackmulti ( new std::vector<unsigned int>(size, 0) ); |
84 |
|
std::auto_ptr<std::vector<float> > globalz ( new std::vector<float> (size, -10000) ); |
85 |
|
std::auto_ptr<std::vector<float> > insidistance ( new std::vector<float> (size, -1) ); |
86 |
|
std::auto_ptr<std::vector<float> > projwidth ( new std::vector<float> (size, -1000) ); |
87 |
+ |
std::auto_ptr<std::vector<float> > BdotY ( new std::vector<float> (size, -1000) ); |
88 |
|
std::auto_ptr<std::vector<float> > covered ( new std::vector<float> (size, -1000) ); |
81 |
– |
std::auto_ptr<std::vector<float> > projlength ( new std::vector<float> (size, -1000) ); |
89 |
|
std::auto_ptr<std::vector<float> > rhlocalx ( new std::vector<float>(size, -10000 )); |
90 |
|
std::auto_ptr<std::vector<float> > rhlocaly ( new std::vector<float>(size, -10000 )); |
91 |
|
std::auto_ptr<std::vector<float> > rhlocalxerr ( new std::vector<float>(size, -1 )); |
95 |
|
std::auto_ptr<std::vector<float> > rhglobalz ( new std::vector<float>(size, -10000 )); |
96 |
|
std::auto_ptr<std::vector<float> > rhstrip ( new std::vector<float>(size, -10000 )); |
97 |
|
std::auto_ptr<std::vector<float> > rhmerr ( new std::vector<float>(size, -10000 )); |
98 |
+ |
std::auto_ptr<std::vector<float> > ubstrip ( new std::vector<float>(size, -10000 )); |
99 |
+ |
std::auto_ptr<std::vector<float> > ubmerr ( new std::vector<float>(size, -10000 )); |
100 |
|
std::auto_ptr<std::vector<float> > driftx ( new std::vector<float>(size, -10000 )); |
101 |
|
std::auto_ptr<std::vector<float> > drifty ( new std::vector<float>(size, -10000 )); |
102 |
|
std::auto_ptr<std::vector<float> > driftz ( new std::vector<float>(size, -10000 )); |
103 |
+ |
std::auto_ptr<std::vector<float> > globalZofunitlocalY ( new std::vector<float>(size, -1000)); |
104 |
|
|
105 |
|
edm::ESHandle<TrackerGeometry> theTrackerGeometry; iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry ); |
106 |
|
edm::ESHandle<MagneticField> magfield; iSetup.get<IdealMagneticFieldRecord>().get(magfield); |
107 |
|
edm::ESHandle<SiStripLorentzAngle> SiStripLorentzAngle; iSetup.get<SiStripLorentzAngleRcd>().get(SiStripLorentzAngle); |
108 |
|
|
109 |
< |
edm::Handle<std::vector<reco::Track> > tracks; iEvent.getByLabel(theTracksLabel, tracks); |
109 |
> |
edm::Handle<edm::View<reco::Track> > tracks; iEvent.getByLabel(theTracksLabel, tracks); |
110 |
|
edm::Handle<TrajTrackAssociationCollection> associations; iEvent.getByLabel(theTracksLabel, associations); |
111 |
|
|
112 |
+ |
TrajectoryStateCombiner combiner; |
113 |
+ |
|
114 |
|
for( TrajTrackAssociationCollection::const_iterator association = associations->begin(); |
115 |
|
association != associations->end(); association++) { |
116 |
|
const Trajectory* traj = association->key.get(); |
118 |
|
|
119 |
|
BOOST_FOREACH( const TrajectoryMeasurement measurement, traj->measurements() ) { |
120 |
|
const TrajectoryStateOnSurface tsos = measurement.updatedState(); |
121 |
+ |
const TrajectoryStateOnSurface unbiased = combiner(measurement.forwardPredictedState(), measurement.backwardPredictedState()); |
122 |
|
const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*> ( measurement.recHit()->hit() ); |
123 |
|
|
124 |
|
if(!hit) break; |
129 |
|
if( 0 == (trackmulti->at(i))++ ) { |
130 |
|
const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( theTrackerGeometry->idToDet( hit->geographicalId() ) ); |
131 |
|
LocalVector drift = shallow::drift( theStripDet, *magfield, *SiStripLorentzAngle); |
132 |
< |
|
132 |
> |
|
133 |
|
trackindex->at(i) = shallow::findTrackIndex(tracks, track); |
134 |
|
localtheta->at(i) = (theStripDet->toLocal(tsos.globalDirection())).theta(); |
135 |
|
localphi->at(i) = (theStripDet->toLocal(tsos.globalDirection())).phi(); |
145 |
|
globalz->at(i) = tsos.globalPosition().z(); |
146 |
|
insidistance->at(i) = 1./fabs(cos(localtheta->at(i))); |
147 |
|
projwidth->at(i) = tan(localtheta->at(i))*cos(localphi->at(i)); |
148 |
+ |
BdotY->at(i) = (theStripDet->surface()).toLocal( magfield->inTesla(theStripDet->surface().position())).y(); |
149 |
|
covered->at(i) = drift.z()/localpitch->at(i) * fabs(projwidth->at(i) - drift.x()/drift.z()); |
136 |
– |
projlength->at(i) = tan(localtheta->at(i))*cos(localphi->at(i)) ; |
150 |
|
rhlocalx->at(i) = hit->localPosition().x(); |
151 |
|
rhlocaly->at(i) = hit->localPosition().y(); |
152 |
|
rhlocalxerr->at(i) = sqrt(hit->localPositionError().xx()); |
156 |
|
rhglobalz->at(i) = theStripDet->toGlobal(hit->localPosition()).z(); |
157 |
|
rhstrip->at(i) = theStripDet->specificTopology().strip(hit->localPosition()); |
158 |
|
rhmerr->at(i) = sqrt(theStripDet->specificTopology().measurementError(hit->localPosition(), hit->localPositionError()).uu()); |
159 |
< |
driftx->push_back(drift.x()); |
160 |
< |
drifty->push_back(drift.y()); |
161 |
< |
driftz->push_back(drift.z()); |
159 |
> |
ubstrip->at(i) = theStripDet->specificTopology().strip(unbiased.localPosition()); |
160 |
> |
ubmerr->at(i) = sqrt(theStripDet->specificTopology().measurementError(unbiased.localPosition(), unbiased.localError().positionError()).uu()); |
161 |
> |
driftx->at(i) = drift.x(); |
162 |
> |
drifty->at(i) = drift.y(); |
163 |
> |
driftz->at(i) = drift.z(); |
164 |
> |
globalZofunitlocalY->at(i) = (theStripDet->toGlobal(LocalVector(0,1,0))).z(); |
165 |
|
} |
166 |
|
} |
167 |
|
} |
183 |
|
iEvent.put(insidistance,Prefix + "insidistance"+ Suffix ); |
184 |
|
iEvent.put(covered, Prefix + "covered" + Suffix ); |
185 |
|
iEvent.put(projwidth, Prefix + "projwidth" + Suffix ); |
186 |
< |
iEvent.put(projlength, Prefix + "projlength" + Suffix ); |
186 |
> |
iEvent.put(BdotY, Prefix + "BdotY" + Suffix ); |
187 |
|
iEvent.put(rhlocalx, Prefix + "rhlocalx" + Suffix ); |
188 |
|
iEvent.put(rhlocaly, Prefix + "rhlocaly" + Suffix ); |
189 |
|
iEvent.put(rhlocalxerr, Prefix + "rhlocalxerr" + Suffix ); |
193 |
|
iEvent.put(rhglobalz, Prefix + "rhglobalz" + Suffix ); |
194 |
|
iEvent.put(rhstrip, Prefix + "rhstrip" + Suffix ); |
195 |
|
iEvent.put(rhmerr, Prefix + "rhmerr" + Suffix ); |
196 |
< |
iEvent.put( driftx, Prefix + "driftx" ); |
197 |
< |
iEvent.put( drifty, Prefix + "drifty" ); |
198 |
< |
iEvent.put( driftz, Prefix + "driftz" ); |
196 |
> |
iEvent.put(ubstrip, Prefix + "ubstrip" + Suffix ); |
197 |
> |
iEvent.put(ubmerr, Prefix + "ubmerr" + Suffix ); |
198 |
> |
iEvent.put( driftx, Prefix + "driftx" + Suffix ); |
199 |
> |
iEvent.put( drifty, Prefix + "drifty" + Suffix ); |
200 |
> |
iEvent.put( driftz, Prefix + "driftz" + Suffix ); |
201 |
> |
iEvent.put( globalZofunitlocalY, Prefix + "globalZofunitlocalY" + Suffix ); |
202 |
|
} |