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 (const 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 (const 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 47 of file TrackTransformerForCosmicMuons.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 36 of file TrackTransformerForCosmicMuons.cc.

References edm::ParameterSet::getParameter().

36  {
37 
38  theTrackerRecHitBuilderName = parameterSet.getParameter<string>("TrackerRecHitBuilder");
39  theMuonRecHitBuilderName = parameterSet.getParameter<string>("MuonRecHitBuilder");
40 
41  theRPCInTheFit = parameterSet.getParameter<bool>("RefitRPCHits");
42 
44 }
T getParameter(std::string const &) const
TrackTransformerForCosmicMuons::~TrackTransformerForCosmicMuons ( )
virtual

Destructor.

Definition at line 47 of file TrackTransformerForCosmicMuons.cc.

47 {}

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 185 of file TrackTransformerForCosmicMuons.cc.

185  {
186  if(quad ==1) {if (sumy < 0) return theFitterOI; else return theFitterIO;}
187  if(quad ==2) {if (sumy < 0) return theFitterOI; else return theFitterIO;}
188  if(quad ==3) {if (sumy > 0) return theFitterOI; else return theFitterIO;}
189  if(quad ==4) {if (sumy > 0) return theFitterOI; else return theFitterIO;}
190 
191  if(up) return theFitterOI;
192  else return theFitterIO;
193 }
Definition: BitonicSort.h:8
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 96 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().

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

the magnetic field

Definition at line 63 of file TrackTransformerForCosmicMuons.h.

References theMGField.

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

Definition at line 205 of file TrackTransformerForCosmicMuons.cc.

205  {
206  if(quad ==1) {if (sumy > 0) return thePropagatorOI; else return thePropagatorIO;}
207  if(quad ==2) {if (sumy > 0) return thePropagatorOI; else return thePropagatorIO;}
208  if(quad ==3) {if (sumy < 0) return thePropagatorOI; else return thePropagatorIO;}
209  if(quad ==4) {if (sumy < 0) return thePropagatorOI; else return thePropagatorIO;}
210  if(up) return thePropagatorIO;
211  else return thePropagatorOI;
212 }
Definition: BitonicSort.h:8
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 50 of file TrackTransformerForCosmicMuons.cc.

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

50  {
51 
52  const std::string metname = "Reco|TrackingTools|TrackTransformer";
53 
54  setup.get<TrajectoryFitter::Record>().get("KFFitterForRefitInsideOut",theFitterIO);
55  setup.get<TrajectoryFitter::Record>().get("KFSmootherForRefitInsideOut",theSmootherIO);
56  setup.get<TrajectoryFitter::Record>().get("KFFitterForRefitOutsideIn",theFitterOI);
57  setup.get<TrajectoryFitter::Record>().get("KFSmootherForRefitOutsideIn",theSmootherOI);
58 
59  unsigned long long newCacheId_TC = setup.get<TrackingComponentsRecord>().cacheIdentifier();
60 
61  if ( newCacheId_TC != theCacheId_TC ){
62  LogTrace(metname) << "Tracking Component changed!";
63  theCacheId_TC = newCacheId_TC;
64  setup.get<TrackingComponentsRecord>().get("SmartPropagatorRK",thePropagatorIO);
65  setup.get<TrackingComponentsRecord>().get("SmartPropagatorRKOpposite",thePropagatorOI);
66  }
67 
68  // Global Tracking Geometry
69  unsigned long long newCacheId_GTG = setup.get<GlobalTrackingGeometryRecord>().cacheIdentifier();
70  if ( newCacheId_GTG != theCacheId_GTG ) {
71  LogTrace(metname) << "GlobalTrackingGeometry changed!";
72  theCacheId_GTG = newCacheId_GTG;
74  }
75 
76  // Magfield Field
77  unsigned long long newCacheId_MG = setup.get<IdealMagneticFieldRecord>().cacheIdentifier();
78  if ( newCacheId_MG != theCacheId_MG ) {
79  LogTrace(metname) << "Magnetic Field changed!";
80  theCacheId_MG = newCacheId_MG;
82  }
83 
84  // Transient Rechit Builders
85  unsigned long long newCacheId_TRH = setup.get<TransientRecHitRecord>().cacheIdentifier();
86  if ( newCacheId_TRH != theCacheId_TRH ) {
87  theCacheId_TRH = newCacheId_TRH;
88  LogTrace(metname) << "TransientRecHitRecord changed!";
91  }
92 }
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 ( const TransientTrackingRecHit::ConstRecHitContainer tkHits) const

calculate the sum of slopes for the track

decide if the track should be reversed

Definition at line 351 of file TrackTransformerForCosmicMuons.cc.

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

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

196  {
197  if(quad ==1){ if (sumy < 0) return theSmootherOI; else return theSmootherIO;}
198  if(quad ==2){ if (sumy < 0) return theSmootherOI; else return theSmootherIO;}
199  if(quad ==3){ if (sumy > 0) return theSmootherOI; else return theSmootherIO;}
200  if(quad ==4){ if (sumy > 0) return theSmootherOI; else return theSmootherIO;}
201  if(up) return theSmootherOI;
202  else return theSmootherIO;
203 }
Definition: BitonicSort.h:8
edm::ESHandle< TrajectorySmoother > theSmootherOI
edm::ESHandle< TrajectorySmoother > theSmootherIO
float TrackTransformerForCosmicMuons::SumDy ( const TransientTrackingRecHit::ConstRecHitContainer tkHits) const

decide if the track should be reversed

Definition at line 411 of file TrackTransformerForCosmicMuons.cc.

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

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

the tracking geometry

Definition at line 66 of file TrackTransformerForCosmicMuons.h.

References theTrackingGeometry.

66 {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 217 of file TrackTransformerForCosmicMuons.cc.

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

217  {
218 
219  const std::string metname = "Reco|TrackingTools|TrackTransformer";
220 
222 
223  // Build the transient Rechits
224  TransientTrackingRecHit::ConstRecHitContainer recHitsForReFit;// = getTransientRecHits(track);
226 
227 
228  bool quad1 = false;
229  bool quad2 = false;
230  bool quad3 = false;
231  bool quad4 = false;
232  int quadrant = 0;
233 
234  for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit)
235  if((*hit)->isValid())
236  if ( (*hit)->geographicalId().det() == DetId::Muon ){
237  if( (*hit)->geographicalId().subdetId() == 3 && !theRPCInTheFit){
238  LogTrace("Reco|TrackingTools|TrackTransformer") << "RPC Rec Hit discarged";
239  continue;
240  }
241  staHits.push_back(theMuonRecHitBuilder->build(&**hit));
242  DetId hitId = staHits.back()->geographicalId();
243  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
244  float gpy=glbpoint.y();
245  float gpz=glbpoint.z();
246 // if (gpy != 0 && gpz !=0) slopeSum += gpy / gpz;
247 
248  if (gpy > 0 && gpz > 0) {quad1 = true; quadrant = 1;}
249  else if (gpy > 0 && gpz < 0){quad2 = true; quadrant = 2;}
250  else if (gpy < 0 && gpz < 0){quad3 = true; quadrant = 3;}
251  else if (gpy < 0 && gpz > 0){quad4 = true; quadrant = 4;}
252  else return vector<Trajectory>();
253  }
254 
255 
256  if(staHits.empty()) return vector<Trajectory>();
257 
258  if (quad1 && quad2) return vector<Trajectory>();
259  if (quad1 && quad3) return vector<Trajectory>();
260  if (quad1 && quad4) return vector<Trajectory>();
261  if (quad2 && quad3) return vector<Trajectory>();
262  if (quad2 && quad4) return vector<Trajectory>();
263  if (quad3 && quad4) return vector<Trajectory>();
264 
265  bool doReverse = false;
266 
267  if (quad1) doReverse = SlopeSum(staHits);
268  if (quad2) doReverse = SlopeSum(staHits);
269  if (quad3) doReverse = SlopeSum(staHits);
270  if (quad4) doReverse = SlopeSum(staHits);
271 
272 
273  if(doReverse){
274  reverse(staHits.begin(),staHits.end());
275  }
276 
277  copy(staHits.begin(),staHits.end(),back_inserter(recHitsForReFit));
278 
284 
285 
286  if(recHitsForReFit.size() < 2) return vector<Trajectory>();
287 
288  bool up = recHitsForReFit.back()->globalPosition().y()>0 ? true : false;
289  LogTrace(metname) << "Up ? " << up;
290 
291  float sumdy = SumDy(recHitsForReFit);
292 
293 
294  PropagationDirection propagationDirection = doReverse ? oppositeToMomentum : alongMomentum;
295  TrajectoryStateOnSurface firstTSOS = doReverse ? track.outermostMeasurementState() : track.innermostMeasurementState();
296  unsigned int innerId = doReverse ? track.track().outerDetId() : track.track().innerDetId();
297 
298  LogTrace(metname) << "Prop Dir: " << propagationDirection << " FirstId " << innerId << " firstTSOS " << firstTSOS;
299 
301 
302 
303  if(recHitsForReFit.front()->geographicalId() != DetId(innerId)){
304  LogTrace(metname)<<"Propagation occurring"<<endl;
305  firstTSOS = propagator(up, quadrant, sumdy)->propagate(firstTSOS, recHitsForReFit.front()->det()->surface());
306  LogTrace(metname)<<"Final destination: " << recHitsForReFit.front()->det()->surface().position() << endl;
307  if(!firstTSOS.isValid()){
308  std::cout<<"Propagation error! Dumping RecHits..."<<std::endl;
309 
310  for(TransientTrackingRecHit::ConstRecHitContainer::const_iterator hit = recHitsForReFit.begin();
311  hit !=recHitsForReFit.end(); ++hit){
312 
313  DetId hitId = (*hit)->geographicalId();
314  GlobalPoint glbpoint = trackingGeometry()->idToDet(hitId)->position();
315  if(hitId.subdetId() == MuonSubdetId::DT)
316  std::cout<< glbpoint << " I am DT " << DTWireId(hitId)<<std::endl;
317  else if (hitId.subdetId() == MuonSubdetId::CSC )
318  std::cout<< glbpoint << " I am CSC " << CSCDetId(hitId)<<std::endl;
319  }
320 
321 
322  LogTrace(metname)<<"Propagation error!"<<endl;
323  return vector<Trajectory>();
324  }
325  }
326 
327 
328  vector<Trajectory> && trajectories = fitter(up, quadrant, sumdy)->fit(seed,recHitsForReFit,firstTSOS);
329 
330  if(trajectories.empty()){
331  LogTrace(metname)<<"No Track refitted!"<<endl;
332  return vector<Trajectory>();
333  }
334 
335  Trajectory const & trajectoryBW = trajectories.front();
336 
337  vector<Trajectory> && trajectoriesSM = smoother(up, quadrant, sumdy)->trajectories(trajectoryBW);
338 
339  if(trajectoriesSM.empty()){
340  LogTrace(metname)<<"No Track smoothed!"<<endl;
341  return vector<Trajectory>();
342  }
343 
344  return trajectoriesSM;
345 
346 }
Definition: BitonicSort.h:8
edm::ESHandle< Propagator > propagator(bool, int, float) const
const std::string metname
T y() const
Definition: PV3DBase.h:63
PropagationDirection
edm::ESHandle< TrajectoryFitter > fitter(bool, int, float) const
the refitter used to refit the reco::Track
float SumDy(const TransientTrackingRecHit::ConstRecHitContainer &) const
decide if the track should be reversed
static const int CSC
Definition: MuonSubdetId.h:13
T z() const
Definition: PV3DBase.h:64
bool SlopeSum(const 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:37
edm::ESHandle< TransientTrackingRecHitBuilder > theMuonRecHitBuilder
#define LogTrace(id)
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: DetId.h:18
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:12
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
the tracking geometry
const MagneticField * magneticField() const
the magnetic field
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection

Member Data Documentation

unsigned long long TrackTransformerForCosmicMuons::theCacheId_GTG
private

Definition at line 94 of file TrackTransformerForCosmicMuons.h.

unsigned long long TrackTransformerForCosmicMuons::theCacheId_MG
private

Definition at line 95 of file TrackTransformerForCosmicMuons.h.

unsigned long long TrackTransformerForCosmicMuons::theCacheId_TC
private

Definition at line 93 of file TrackTransformerForCosmicMuons.h.

unsigned long long TrackTransformerForCosmicMuons::theCacheId_TRH
private

Definition at line 96 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 103 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 104 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 101 of file TrackTransformerForCosmicMuons.h.

Referenced by magneticField().

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

Definition at line 113 of file TrackTransformerForCosmicMuons.h.

std::string TrackTransformerForCosmicMuons::theMuonRecHitBuilderName
private

Definition at line 112 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 88 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 89 of file TrackTransformerForCosmicMuons.h.

bool TrackTransformerForCosmicMuons::theRPCInTheFit
private

Definition at line 98 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 106 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 107 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 110 of file TrackTransformerForCosmicMuons.h.

std::string TrackTransformerForCosmicMuons::theTrackerRecHitBuilderName
private

Definition at line 109 of file TrackTransformerForCosmicMuons.h.

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

Definition at line 100 of file TrackTransformerForCosmicMuons.h.

Referenced by trackingGeometry().