CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackTransformerForCosmicMuons Class Reference

#include <TrackTransformerForCosmicMuons.h>

Inheritance diagram for TrackTransformerForCosmicMuons:
TrackTransformerBase

Public Member Functions

edm::ESHandle< TrajectoryFitterfitter (bool, int, float) const
 the refitter used to refit the reco::Track More...
 
TransientTrackingRecHit::ConstRecHitContainer getTransientRecHits (const reco::TransientTrack &track) const
 
const MagneticFieldmagneticField () const
 the magnetic field More...
 
virtual void setServices (const edm::EventSetup &)
 set the services needed by the TrackTransformer More...
 
bool SlopeSum (TransientTrackingRecHit::ConstRecHitContainer) const
 calculate the sum of slopes for the track More...
 
edm::ESHandle< TrajectorySmoothersmoother (bool, int, float) const
 the smoother used to smooth the trajectory which came from the refitting step More...
 
float SumDy (TransientTrackingRecHit::ConstRecHitContainer) const
 decide if the track should be reversed More...
 
edm::ESHandle
< GlobalTrackingGeometry
trackingGeometry () const
 the tracking geometry More...
 
 TrackTransformerForCosmicMuons (const edm::ParameterSet &)
 Constructor. More...
 
virtual std::vector< Trajectorytransform (const reco::Track &) const
 Convert a reco::Track into Trajectory. More...
 
virtual ~TrackTransformerForCosmicMuons ()
 Destructor. More...
 
- Public Member Functions inherited from TrackTransformerBase
 TrackTransformerBase ()
 Constructor. More...
 
virtual ~TrackTransformerBase ()
 Destructor. More...
 

Private Member Functions

edm::ESHandle< Propagatorpropagator (bool, int, float) const
 

Private Attributes

unsigned long long theCacheId_GTG
 
unsigned long long theCacheId_MG
 
unsigned long long theCacheId_TC
 
unsigned long long theCacheId_TRH
 
edm::ESHandle< TrajectoryFittertheFitterIO
 
edm::ESHandle< TrajectoryFittertheFitterOI
 
edm::ESHandle< MagneticFieldtheMGField
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theMuonRecHitBuilder
 
std::string theMuonRecHitBuilderName
 
edm::ESHandle< PropagatorthePropagatorIO
 
edm::ESHandle< PropagatorthePropagatorOI
 
bool theRPCInTheFit
 
edm::ESHandle< TrajectorySmoothertheSmootherIO
 
edm::ESHandle< TrajectorySmoothertheSmootherOI
 
edm::ESHandle
< TransientTrackingRecHitBuilder
theTrackerRecHitBuilder
 
std::string theTrackerRecHitBuilderName
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 

Detailed Description

Definition at line 48 of file TrackTransformerForCosmicMuons.h.

Constructor & Destructor Documentation

TrackTransformerForCosmicMuons::TrackTransformerForCosmicMuons ( const edm::ParameterSet parameterSet)

Constructor.

Definition at line 42 of file TrackTransformerForCosmicMuons.cc.

References edm::ParameterSet::getParameter().

42  {
43 
44  theTrackerRecHitBuilderName = parameterSet.getParameter<string>("TrackerRecHitBuilder");
45  theMuonRecHitBuilderName = parameterSet.getParameter<string>("MuonRecHitBuilder");
46 
47  theRPCInTheFit = parameterSet.getParameter<bool>("RefitRPCHits");
48 
50 }
T getParameter(std::string const &) const
TrackTransformerForCosmicMuons::~TrackTransformerForCosmicMuons ( )
virtual

Destructor.

Definition at line 53 of file TrackTransformerForCosmicMuons.cc.

53 {}

Member Function Documentation

ESHandle< TrajectoryFitter > TrackTransformerForCosmicMuons::fitter ( bool  up,
int  quad,
float  sumy 
) const

the refitter used to refit the reco::Track

Definition at line 191 of file TrackTransformerForCosmicMuons.cc.

191  {
192  if(quad ==1) {if (sumy < 0) return theFitterOI; else return theFitterIO;}
193  if(quad ==2) {if (sumy < 0) return theFitterOI; else return theFitterIO;}
194  if(quad ==3) {if (sumy > 0) return theFitterOI; else return theFitterIO;}
195  if(quad ==4) {if (sumy > 0) return theFitterOI; else return theFitterIO;}
196 
197  if(up) return theFitterOI;
198  else return theFitterIO;
199 }
edm::ESHandle< TrajectoryFitter > theFitterOI
edm::ESHandle< TrajectoryFitter > theFitterIO
TransientTrackingRecHit::ConstRecHitContainer TrackTransformerForCosmicMuons::getTransientRecHits ( const reco::TransientTrack track) const

if ( quad1 && slopeSum < 0) printout = true;

if ( quad3 && slopeSum > 0) printout = true; if ( quad4 && slopeSum < 0) printout = true;

Definition at line 102 of file TrackTransformerForCosmicMuons.cc.

References filterCSVwithJSON::copy, MuonSubdetId::CSC, CSCDetId, DetId::det(), MuonSubdetId::DT, LogTrace, DetId::Muon, reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), MuonSubdetId::RPC, RPCDetId, DetId::subdetId(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

102  {
103 
106 
107  bool printout = false;
108 
109  bool quad1 = false;
110  bool quad2 = false;
111  bool quad3 = false;
112  bool quad4 = false;
113 
114  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit)
115  if((*hit)->isValid())
116  if ( (*hit)->geographicalId().det() == DetId::Muon ){
117  if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
118  LogTrace("Reco|TrackingTools|TrackTransformer") << "RPC Rec Hit discarged";
119  continue;
120  }
121  staHits.push_back(theMuonRecHitBuilder->build(&**hit));
122  DetId hitId = staHits.back()->geographicalId();
123  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
124  float gpy=glbpoint.y();
125  float gpz=glbpoint.z();
126 // if (gpy != 0 && gpz !=0) slopeSum += gpy / gpz;
127 
128  if (gpy > 0 && gpz > 0) quad1 = true;
129  else if (gpy > 0 && gpz < 0) quad2 = true;
130  else if (gpy < 0 && gpz < 0) quad3 = true;
131  else if (gpy < 0 && gpz > 0) quad4 = true;
132  else return tkHits;
133  }
134 
135  if(staHits.empty()) return staHits;
136 
137  if (quad1 && quad2) return tkHits;
138  if (quad1 && quad3) return tkHits;
139  if (quad1 && quad4) return tkHits;
140  if (quad2 && quad3) return tkHits;
141  if (quad2 && quad4) return tkHits;
142  if (quad3 && quad4) return tkHits;
143 
144 
145  bool doReverse = staHits.front()->globalPosition().y()>0 ? true : false;
146 
147  if (quad1) doReverse = SlopeSum(staHits);
148  if (quad2) doReverse = SlopeSum(staHits);
149  if (quad3) doReverse = SlopeSum(staHits);
150  if (quad4) doReverse = SlopeSum(staHits);
151  if(doReverse){
152  reverse(staHits.begin(),staHits.end());
153  }
154 
155  copy(staHits.begin(),staHits.end(),back_inserter(tkHits));
156 
157 
159 // if ( quad2 && slopeSum > 0) printout = true;
162 // swap = printout;
163 
164  printout = quad1;
165 
166  if (printout) for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator hit = tkHits.begin();
167  hit !=tkHits.end(); ++hit){
168 
169  DetId hitId = (*hit)->geographicalId();
170  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
171 
172 
173  if(hitId.det() == DetId::Muon) {
174  if(hitId.subdetId() == MuonSubdetId::DT)
175  LogTrace("TrackFitters") << glbpoint << " I am DT " << DTWireId(hitId);
176 // std::cout<< glbpoint << " I am DT " << DTWireId(hitId)<<std::endl;
177  else if (hitId.subdetId() == MuonSubdetId::CSC )
178  LogTrace("TrackFitters") << glbpoint << " I am CSC " << CSCDetId(hitId);
179 // std::cout<< glbpoint << " I am CSC " << CSCDetId(hitId)<<std::endl;
180  else if (hitId.subdetId() == MuonSubdetId::RPC )
181  LogTrace("TrackFitters") << glbpoint << " I am RPC " << RPCDetId(hitId);
182  else
183  LogTrace("TrackFitters") << " UNKNOWN MUON HIT TYPE ";
184  }
185  }
186  return tkHits;
187 }
T y() const
Definition: PV3DBase.h:62
static const int CSC
Definition: MuonSubdetId.h:15
T z() const
Definition: PV3DBase.h:63
bool SlopeSum(TransientTrackingRecHit::ConstRecHitContainer) const
calculate the sum of slopes for the track
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
#define LogTrace(id)
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:20
static const int RPC
Definition: MuonSubdetId.h:16
static const int DT
Definition: MuonSubdetId.h:14
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
const MagneticField* TrackTransformerForCosmicMuons::magneticField ( ) const
inline

the magnetic field

Definition at line 64 of file TrackTransformerForCosmicMuons.h.

References theMGField.

64 {return &*theMGField;}
edm::ESHandle< MagneticField > theMGField
ESHandle< Propagator > TrackTransformerForCosmicMuons::propagator ( bool  up,
int  quad,
float  sumy 
) const
private

Definition at line 211 of file TrackTransformerForCosmicMuons.cc.

211  {
212  if(quad ==1) {if (sumy > 0) return thePropagatorOI; else return thePropagatorIO;}
213  if(quad ==2) {if (sumy > 0) return thePropagatorOI; else return thePropagatorIO;}
214  if(quad ==3) {if (sumy < 0) return thePropagatorOI; else return thePropagatorIO;}
215  if(quad ==4) {if (sumy < 0) return thePropagatorOI; else return thePropagatorIO;}
216  if(up) return thePropagatorIO;
217  else return thePropagatorOI;
218 }
edm::ESHandle< Propagator > thePropagatorIO
edm::ESHandle< Propagator > thePropagatorOI
void TrackTransformerForCosmicMuons::setServices ( const edm::EventSetup setup)
virtual

set the services needed by the TrackTransformer

Implements TrackTransformerBase.

Definition at line 56 of file TrackTransformerForCosmicMuons.cc.

References edm::EventSetup::get(), LogTrace, and metname.

56  {
57 
58  const std::string metname = "Reco|TrackingTools|TrackTransformer";
59 
60  setup.get<TrajectoryFitter::Record>().get("KFFitterForRefitInsideOut",theFitterIO);
61  setup.get<TrajectoryFitter::Record>().get("KFSmootherForRefitInsideOut",theSmootherIO);
62  setup.get<TrajectoryFitter::Record>().get("KFFitterForRefitOutsideIn",theFitterOI);
63  setup.get<TrajectoryFitter::Record>().get("KFSmootherForRefitOutsideIn",theSmootherOI);
64 
65  unsigned long long newCacheId_TC = setup.get<TrackingComponentsRecord>().cacheIdentifier();
66 
67  if ( newCacheId_TC != theCacheId_TC ){
68  LogTrace(metname) << "Tracking Component changed!";
69  theCacheId_TC = newCacheId_TC;
70  setup.get<TrackingComponentsRecord>().get("SmartPropagatorRK",thePropagatorIO);
71  setup.get<TrackingComponentsRecord>().get("SmartPropagatorRKOpposite",thePropagatorOI);
72  }
73 
74  // Global Tracking Geometry
75  unsigned long long newCacheId_GTG = setup.get<GlobalTrackingGeometryRecord>().cacheIdentifier();
76  if ( newCacheId_GTG != theCacheId_GTG ) {
77  LogTrace(metname) << "GlobalTrackingGeometry changed!";
78  theCacheId_GTG = newCacheId_GTG;
80  }
81 
82  // Magfield Field
83  unsigned long long newCacheId_MG = setup.get<IdealMagneticFieldRecord>().cacheIdentifier();
84  if ( newCacheId_MG != theCacheId_MG ) {
85  LogTrace(metname) << "Magnetic Field changed!";
86  theCacheId_MG = newCacheId_MG;
88  }
89 
90  // Transient Rechit Builders
91  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
92  if ( newCacheId_TRH != theCacheId_TRH ) {
93  theCacheId_TRH = newCacheId_TRH;
94  LogTrace(metname) << "TransientRecHitRecord changed!";
97  }
98 }
edm::ESHandle< Propagator > thePropagatorIO
edm::ESHandle< TrajectorySmoother > theSmootherOI
const std::string metname
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
edm::ESHandle< TrajectorySmoother > theSmootherIO
edm::ESHandle< Propagator > thePropagatorOI
edm::ESHandle< TrajectoryFitter > theFitterOI
edm::ESHandle< TransientTrackingRecHitBuilder > theTrackerRecHitBuilder
edm::ESHandle< TrajectoryFitter > theFitterIO
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< MagneticField > theMGField
bool TrackTransformerForCosmicMuons::SlopeSum ( TransientTrackingRecHit::ConstRecHitContainer  tkHits) const

calculate the sum of slopes for the track

decide if the track should be reversed

Definition at line 357 of file TrackTransformerForCosmicMuons.cc.

References DetId::det(), alignCSCRings::e, first, DetId::Muon, DetId::subdetId(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

357  {
358 
359  bool retval = false;
360  float y1 = 0 ;
361  float z1 = 0 ;
362 
363  bool first = true;
364 
365  std::vector<float> py;
366  std::vector<float> pz;
367 // int quadrant = -1;
368 
369  float sumdy = 0;
370  float sumdz = 0;
371 
372  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator hit = tkHits.begin();
373  hit !=tkHits.end(); ++hit){
374 
375  DetId hitId = (*hit)->geographicalId();
376  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
377  if ( hitId.det() != DetId::Muon || hitId.subdetId() == 3 )continue;
378 
379  float y2 = glbpoint.y();
380  float z2 = glbpoint.z();
381  float dslope = 0;
382  float dy = y2 - y1;
383  float dz = z2 - z1;
384 
385 // if (y2 > 0 && z2 > 0) quadrant = 1;
386 // else if (y2 > 0 && z2 < 0) quadrant = 2;
387 // else if (y2 < 0 && z2 < 0) quadrant = 3;
388 // else if (y2 < 0 && z2 > 0) quadrant = 4;
389 
390 
391  if (fabs(dz) > 1e-3) dslope = dy / dz;
392  if ( !first) {
393  retval+=dslope;
394  sumdy +=dy;
395  sumdz +=dz;
396  }
397  first = false;
398  py.push_back(y1);
399  pz.push_back(z1);
400  y1 = y2;
401  z1 = z2;
402  }
403 // std::cout<<"quadrant "<<quadrant;
404 // std::cout<<"\tsum dy = "<<sumdy;
405 // std::cout<<"\tsum dz = "<<sumdz;
406 // std::cout<<std::endl;
407 
408 
409  if ( sumdz < 0) retval = true;
410 
411  return retval;
412 
413 }
T y() const
Definition: PV3DBase.h:62
T z() const
Definition: PV3DBase.h:63
bool first
Definition: L1TdeRCT.cc:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
ESHandle< TrajectorySmoother > TrackTransformerForCosmicMuons::smoother ( bool  up,
int  quad,
float  sumy 
) const

the smoother used to smooth the trajectory which came from the refitting step

Definition at line 202 of file TrackTransformerForCosmicMuons.cc.

202  {
203  if(quad ==1){ if (sumy < 0) return theSmootherOI; else return theSmootherIO;}
204  if(quad ==2){ if (sumy < 0) return theSmootherOI; else return theSmootherIO;}
205  if(quad ==3){ if (sumy > 0) return theSmootherOI; else return theSmootherIO;}
206  if(quad ==4){ if (sumy > 0) return theSmootherOI; else return theSmootherIO;}
207  if(up) return theSmootherOI;
208  else return theSmootherIO;
209 }
edm::ESHandle< TrajectorySmoother > theSmootherOI
edm::ESHandle< TrajectorySmoother > theSmootherIO
float TrackTransformerForCosmicMuons::SumDy ( TransientTrackingRecHit::ConstRecHitContainer  tkHits) const

decide if the track should be reversed

Definition at line 417 of file TrackTransformerForCosmicMuons.cc.

References DetId::det(), alignCSCRings::e, first, DetId::Muon, DetId::subdetId(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

417  {
418 
419  bool retval = false;
420  float y1 = 0 ;
421  float z1 = 0 ;
422 
423  bool first = true;
424 
425  std::vector<float> py;
426  std::vector<float> pz;
427 // int quadrant = -1;
428 
429  float sumdy = 0;
430  float sumdz = 0;
431 
432 
433 
434  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator hit = tkHits.begin();
435  hit !=tkHits.end(); ++hit){
436 
437  DetId hitId = (*hit)->geographicalId();
438  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
439  if ( hitId.det() != DetId::Muon || hitId.subdetId() == 3 )continue;
440 
441  float y2 = glbpoint.y();
442  float z2 = glbpoint.z();
443  float dslope = 0;
444  float dy = y2 - y1;
445  float dz = z2 - z1;
446 
447 // if (y2 > 0 && z2 > 0) quadrant = 1;
448 // else if (y2 > 0 && z2 < 0) quadrant = 2;
449 // else if (y2 < 0 && z2 < 0) quadrant = 3;
450 // else if (y2 < 0 && z2 > 0) quadrant = 4;
451 
452 
453  if (fabs(dz) > 1e-3) dslope = dy / dz;
454  if ( !first) {
455  retval+=dslope;
456  sumdy +=dy;
457  sumdz +=dz;
458  }
459  first = false;
460  py.push_back(y1);
461  pz.push_back(z1);
462  y1 = y2;
463  z1 = z2;
464  }
465 // std::cout<<"quadrant "<<quadrant;
466 // std::cout<<"\tsum dy = "<<sumdy;
467 // std::cout<<"\tsum dz = "<<sumdz;
468 // std::cout<<std::endl;
469 
470  return sumdy;
471 }
T y() const
Definition: PV3DBase.h:62
T z() const
Definition: PV3DBase.h:63
bool first
Definition: L1TdeRCT.cc:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
edm::ESHandle<GlobalTrackingGeometry> TrackTransformerForCosmicMuons::trackingGeometry ( ) const
inline

the tracking geometry

Definition at line 67 of file TrackTransformerForCosmicMuons.h.

References theTrackingGeometry.

67 {return theTrackingGeometry;}
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
vector< Trajectory > TrackTransformerForCosmicMuons::transform ( const reco::Track tr) const
virtual

Convert a reco::Track into Trajectory.

Convert Tracks into Trajectories.

Implements TrackTransformerBase.

Definition at line 223 of file TrackTransformerForCosmicMuons.cc.

References alongMomentum, filterCSVwithJSON::copy, gather_cfg::cout, MuonSubdetId::CSC, CSCDetId, MuonSubdetId::DT, reco::Track::innerDetId(), reco::TransientTrack::innermostMeasurementState(), LogTrace, metname, DetId::Muon, oppositeToMomentum, reco::Track::outerDetId(), reco::TransientTrack::outermostMeasurementState(), LargeD0_PixelPairStep_cff::propagator, reco::TransientTrack::recHitsBegin(), reco::TransientTrack::recHitsEnd(), DetId::subdetId(), reco::TransientTrack::track(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

223  {
224 
225  const std::string metname = "Reco|TrackingTools|TrackTransformer";
226 
228 
229  // Build the transient Rechits
230  TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit;// = getTransientRecHits(track);
232 
233 
234  bool quad1 = false;
235  bool quad2 = false;
236  bool quad3 = false;
237  bool quad4 = false;
238  int quadrant = 0;
239 
240  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit)
241  if((*hit)->isValid())
242  if ( (*hit)->geographicalId().det() == DetId::Muon ){
243  if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
244  LogTrace("Reco|TrackingTools|TrackTransformer") << "RPC Rec Hit discarged";
245  continue;
246  }
247  staHits.push_back(theMuonRecHitBuilder->build(&**hit));
248  DetId hitId = staHits.back()->geographicalId();
249  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
250  float gpy=glbpoint.y();
251  float gpz=glbpoint.z();
252 // if (gpy != 0 && gpz !=0) slopeSum += gpy / gpz;
253 
254  if (gpy > 0 && gpz > 0) {quad1 = true; quadrant = 1;}
255  else if (gpy > 0 && gpz < 0){quad2 = true; quadrant = 2;}
256  else if (gpy < 0 && gpz < 0){quad3 = true; quadrant = 3;}
257  else if (gpy < 0 && gpz > 0){quad4 = true; quadrant = 4;}
258  else return vector<Trajectory>();
259  }
260 
261 
262  if(staHits.empty()) return vector<Trajectory>();
263 
264  if (quad1 && quad2) return vector<Trajectory>();
265  if (quad1 && quad3) return vector<Trajectory>();
266  if (quad1 && quad4) return vector<Trajectory>();
267  if (quad2 && quad3) return vector<Trajectory>();
268  if (quad2 && quad4) return vector<Trajectory>();
269  if (quad3 && quad4) return vector<Trajectory>();
270 
271  bool doReverse = false;
272 
273  if (quad1) doReverse = SlopeSum(staHits);
274  if (quad2) doReverse = SlopeSum(staHits);
275  if (quad3) doReverse = SlopeSum(staHits);
276  if (quad4) doReverse = SlopeSum(staHits);
277 
278 
279  if(doReverse){
280  reverse(staHits.begin(),staHits.end());
281  }
282 
283  copy(staHits.begin(),staHits.end(),back_inserter(recHitsForReFit));
284 
290 
291 
292  if(recHitsForReFit.size() < 2) return vector<Trajectory>();
293 
294  bool up = recHitsForReFit.back()->globalPosition().y()>0 ? true : false;
295  LogTrace(metname) << "Up ? " << up;
296 
297  float sumdy = SumDy(recHitsForReFit);
298 
299 
300  PropagationDirection propagationDirection = doReverse ? oppositeToMomentum : alongMomentum;
301  TrajectoryStateOnSurface firstTSOS = doReverse ? track.outermostMeasurementState() : track.innermostMeasurementState();
302  unsigned int innerId = doReverse ? track.track().outerDetId() : track.track().innerDetId();
303 
304  LogTrace(metname) << "Prop Dir: " << propagationDirection << " FirstId " << innerId << " firstTSOS " << firstTSOS;
305 
307 
308 
309  if(recHitsForReFit.front()->geographicalId() != DetId(innerId)){
310  LogTrace(metname)<<"Propagation occurring"<<endl;
311  firstTSOS = propagator(up, quadrant, sumdy)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
312  LogTrace(metname)<<"Final destination: " << recHitsForReFit.front()->det()->surface().position() << endl;
313  if(!firstTSOS.isValid()){
314  std::cout<<"Propagation error! Dumping RecHits..."<<std::endl;
315 
316  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator hit = recHitsForReFit.begin();
317  hit !=recHitsForReFit.end(); ++hit){
318 
319  DetId hitId = (*hit)->geographicalId();
320  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
321  if(hitId.subdetId() == MuonSubdetId::DT)
322  std::cout<< glbpoint << " I am DT " << DTWireId(hitId)<<std::endl;
323  else if (hitId.subdetId() == MuonSubdetId::CSC )
324  std::cout<< glbpoint << " I am CSC " << CSCDetId(hitId)<<std::endl;
325  }
326 
327 
328  LogTrace(metname)<<"Propagation error!"<<endl;
329  return vector<Trajectory>();
330  }
331  }
332 
333 
334  vector<Trajectory> trajectories = fitter(up, quadrant, sumdy)->fit(seed,recHitsForReFit,firstTSOS);
335 
336  if(trajectories.empty()){
337  LogTrace(metname)<<"No Track refitted!"<<endl;
338  return vector<Trajectory>();
339  }
340 
341  Trajectory trajectoryBW = trajectories.front();
342 
343  vector<Trajectory> trajectoriesSM = smoother(up, quadrant, sumdy)->trajectories(trajectoryBW);
344 
345  if(trajectoriesSM.empty()){
346  LogTrace(metname)<<"No Track smoothed!"<<endl;
347  return vector<Trajectory>();
348  }
349 
350  return trajectoriesSM;
351 
352 }
edm::ESHandle< Propagator > propagator(bool, int, float) const
const std::string metname
T y() const
Definition: PV3DBase.h:62
float SumDy(TransientTrackingRecHit::ConstRecHitContainer) const
decide if the track should be reversed
PropagationDirection
edm::ESHandle< TrajectoryFitter > fitter(bool, int, float) const
the refitter used to refit the reco::Track
static const int CSC
Definition: MuonSubdetId.h:15
T z() const
Definition: PV3DBase.h:63
bool SlopeSum(TransientTrackingRecHit::ConstRecHitContainer) const
calculate the sum of slopes for the track
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:20
edm::ESHandle< TrajectorySmoother > smoother(bool, int, float) const
the smoother used to smooth the trajectory which came from the refitting step
tuple cout
Definition: gather_cfg.py:121
static const int DT
Definition: MuonSubdetId.h:14
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
const MagneticField * magneticField() const
the magnetic field

Member Data Documentation

unsigned long long TrackTransformerForCosmicMuons::theCacheId_GTG
private

Definition at line 95 of file TrackTransformerForCosmicMuons.h.

unsigned long long TrackTransformerForCosmicMuons::theCacheId_MG
private

Definition at line 96 of file TrackTransformerForCosmicMuons.h.

unsigned long long TrackTransformerForCosmicMuons::theCacheId_TC
private

Definition at line 94 of file TrackTransformerForCosmicMuons.h.

unsigned long long TrackTransformerForCosmicMuons::theCacheId_TRH
private

Definition at line 97 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<TrajectoryFitter> TrackTransformerForCosmicMuons::theFitterIO
private

Definition at line 104 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<TrajectoryFitter> TrackTransformerForCosmicMuons::theFitterOI
private

Definition at line 105 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<MagneticField> TrackTransformerForCosmicMuons::theMGField
private

Definition at line 102 of file TrackTransformerForCosmicMuons.h.

Referenced by magneticField().

edm::ESHandle<TransientTrackingRecHitBuilder> TrackTransformerForCosmicMuons::theMuonRecHitBuilder
private

Definition at line 114 of file TrackTransformerForCosmicMuons.h.

std::string TrackTransformerForCosmicMuons::theMuonRecHitBuilderName
private

Definition at line 113 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<Propagator> TrackTransformerForCosmicMuons::thePropagatorIO
private

Definition at line 89 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<Propagator> TrackTransformerForCosmicMuons::thePropagatorOI
private

Definition at line 90 of file TrackTransformerForCosmicMuons.h.

bool TrackTransformerForCosmicMuons::theRPCInTheFit
private

Definition at line 99 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<TrajectorySmoother> TrackTransformerForCosmicMuons::theSmootherIO
private

Definition at line 107 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<TrajectorySmoother> TrackTransformerForCosmicMuons::theSmootherOI
private

Definition at line 108 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<TransientTrackingRecHitBuilder> TrackTransformerForCosmicMuons::theTrackerRecHitBuilder
private

Definition at line 111 of file TrackTransformerForCosmicMuons.h.

std::string TrackTransformerForCosmicMuons::theTrackerRecHitBuilderName
private

Definition at line 110 of file TrackTransformerForCosmicMuons.h.

edm::ESHandle<GlobalTrackingGeometry> TrackTransformerForCosmicMuons::theTrackingGeometry
private

Definition at line 101 of file TrackTransformerForCosmicMuons.h.

Referenced by trackingGeometry().