CMS 3D CMS Logo

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

#include <Trajectory.h>

Public Types

typedef
TransientTrackingRecHit::ConstRecHitContainer 
ConstRecHitContainer
 
typedef std::vector
< TrajectoryMeasurement
DataContainer
 
typedef ConstRecHitContainer RecHitContainer
 

Public Member Functions

double chiSquared () const
 
TrajectoryMeasurement const & closestMeasurement (GlobalPoint) const
 
DataContainer const & data () const
 obsolete name, use measurements() instead. More...
 
PropagationDirection const & direction () const
 
float dPhiCacheForLoopersReconstruction () const
 
bool empty () const
 True if trajectory has no measurements. More...
 
TrajectoryMeasurement const & firstMeasurement () const
 
int foundHits () const
 
TrajectoryStateOnSurface geometricalInnermostState () const
 
void incrementLoops ()
 
void invalidate ()
 Method to invalidate a trajectory. Useful during ambiguity resolution. More...
 
bool isLooper () const
 
bool isValid () const
 
const DetLayerlastLayer () const
 Redundant method, returns the layer of lastMeasurement() . More...
 
TrajectoryMeasurement const & lastMeasurement () const
 
int lostHits () const
 
DataContainer const & measurements () const
 
int ndof (bool bon=true) const
 
signed char nLoops () const
 
void pop ()
 
void push (const TrajectoryMeasurement &tm)
 
void push (const TrajectoryMeasurement &tm, double chi2Increment)
 
ConstRecHitContainer recHits (bool splitting=false) const
 
void recHitsV (ConstRecHitContainer &cont, bool splitting=false) const
 
void reserve (unsigned int n)
 
void reverse ()
 
TrajectorySeed const & seed () const
 Access to the seed used to reconstruct the Trajectory. More...
 
edm::RefToBase< TrajectorySeedseedRef (void) const
 
void setDPhiCacheForLoopersReconstruction (float dphi)
 
void setNLoops (signed char value)
 
void setSeedRef (const edm::RefToBase< TrajectorySeed > &seedRef)
 
void setSharedSeed (const boost::shared_ptr< const TrajectorySeed > &seed)
 
const boost::shared_ptr< const
TrajectorySeed > & 
sharedSeed () const
 
 Trajectory ()
 
 Trajectory (const TrajectorySeed &seed)
 
 Trajectory (const TrajectorySeed &seed, PropagationDirection dir)
 
 Trajectory (const boost::shared_ptr< const TrajectorySeed > &seed, PropagationDirection dir)
 
 Trajectory (PropagationDirection dir)
 
void validRecHits (ConstRecHitContainer &cont) const
 

Static Public Member Functions

static bool inactive ()
 
static bool isBad (const TransientTrackingRecHit &hit)
 
static bool lost (const TransientTrackingRecHit &hit)
 

Private Member Functions

void check () const
 

Private Attributes

edm::RefToBase< TrajectorySeedseedRef_
 
float theChiSquared
 
float theChiSquaredBad
 
DataContainer theData
 
PropagationDirection theDirection
 
bool theDirectionValidity
 
float theDPhiCache
 
signed char theNLoops
 
signed short theNumberOfFoundHits
 
signed short theNumberOfLostHits
 
boost::shared_ptr< const
TrajectorySeed
theSeed
 
bool theValid
 

Detailed Description

A class for detailed particle trajectory representation. It is used during trajectory building to "grow" a trajectory. The trajectory is represented as an ordered sequence of TrajectoryMeasurement objects with a stack-like interface. The measurements are added to the Trajectory in the order of increasing precision: each new TrajectoryMeasurement is assumed to improve the precision of the last one, normally by adding a constraint from a new RecHit. However the Trajectory class does not have the means to verify that measurements are added in the correct order, and thus cannot guarantee the order, which is the responsibility of the TrajectoryBuilder. The Trajectory provides some security by allowing to add or remove measurements only on one of it's ends, with push(TM) and pop() methods. The last measurement in a Trajectory can thus be either the innermost (closest to the interaction point) or the outermost, depending on the way the Trajectory was built. The direction of building is represented as a PropagationDirection, which has two possible values: alongMomentum (outwards) and oppositeToMomentum (inwards), and is accessed with the direction() method.

Definition at line 38 of file Trajectory.h.

Member Typedef Documentation

Definition at line 43 of file Trajectory.h.

Definition at line 42 of file Trajectory.h.

Definition at line 44 of file Trajectory.h.

Constructor & Destructor Documentation

Trajectory::Trajectory ( )
inline

Default constructor of an empty trajectory with undefined seed and undefined direction. This constructor is necessary in order to transiently copy vector<Trajectory> in the edm::Event

Definition at line 52 of file Trajectory.h.

52  :
53  theSeed(), seedRef_(),
57  {}
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
bool theDirectionValidity
Definition: Trajectory.h:350
signed short theNumberOfLostHits
Definition: Trajectory.h:347
signed char theNLoops
Definition: Trajectory.h:354
float theDPhiCache
Definition: Trajectory.h:353
bool theValid
Definition: Trajectory.h:351
PropagationDirection theDirection
Definition: Trajectory.h:349
float theChiSquared
Definition: Trajectory.h:343
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
Trajectory::Trajectory ( const TrajectorySeed seed)
inlineexplicit

Constructor of an empty trajectory with undefined direction. The direction will be defined at the moment of the push of a second measurement, from the relative radii of the first and second measurements.

Definition at line 66 of file Trajectory.h.

66  :
67  theSeed( new TrajectorySeed(seed) ), seedRef_(),
71  {}
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
bool theDirectionValidity
Definition: Trajectory.h:350
signed short theNumberOfLostHits
Definition: Trajectory.h:347
signed char theNLoops
Definition: Trajectory.h:354
float theDPhiCache
Definition: Trajectory.h:353
bool theValid
Definition: Trajectory.h:351
PropagationDirection theDirection
Definition: Trajectory.h:349
float theChiSquared
Definition: Trajectory.h:343
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
Trajectory::Trajectory ( const TrajectorySeed seed,
PropagationDirection  dir 
)
inline

Constructor of an empty trajectory with defined direction. No check is made in the push method that measurements are added in the correct direction.

Definition at line 77 of file Trajectory.h.

77  :
78  theSeed( new TrajectorySeed(seed) ), seedRef_(),
82 
83  {}
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
bool theDirectionValidity
Definition: Trajectory.h:350
signed short theNumberOfLostHits
Definition: Trajectory.h:347
signed char theNLoops
Definition: Trajectory.h:354
float theDPhiCache
Definition: Trajectory.h:353
bool theValid
Definition: Trajectory.h:351
PropagationDirection theDirection
Definition: Trajectory.h:349
float theChiSquared
Definition: Trajectory.h:343
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
dbl *** dir
Definition: mlp_gen.cc:35
Trajectory::Trajectory ( const boost::shared_ptr< const TrajectorySeed > &  seed,
PropagationDirection  dir 
)
inline

Constructor of an empty trajectory with defined direction. No check is made in the push method that measurements are added in the correct direction.

Definition at line 89 of file Trajectory.h.

89  :
90  theSeed( seed ), seedRef_(),
94  {}
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
bool theDirectionValidity
Definition: Trajectory.h:350
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:277
signed short theNumberOfLostHits
Definition: Trajectory.h:347
signed char theNLoops
Definition: Trajectory.h:354
float theDPhiCache
Definition: Trajectory.h:353
bool theValid
Definition: Trajectory.h:351
PropagationDirection theDirection
Definition: Trajectory.h:349
float theChiSquared
Definition: Trajectory.h:343
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
dbl *** dir
Definition: mlp_gen.cc:35
Trajectory::Trajectory ( PropagationDirection  dir)
inlineexplicit

Constructor of an empty trajectory with defined direction. No check is made in the push method that measurements are added in the correct direction.

Definition at line 100 of file Trajectory.h.

100  :
101  theSeed(), seedRef_(),
105 
106  {}
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
bool theDirectionValidity
Definition: Trajectory.h:350
signed short theNumberOfLostHits
Definition: Trajectory.h:347
signed char theNLoops
Definition: Trajectory.h:354
float theDPhiCache
Definition: Trajectory.h:353
bool theValid
Definition: Trajectory.h:351
PropagationDirection theDirection
Definition: Trajectory.h:349
float theChiSquared
Definition: Trajectory.h:343
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
dbl *** dir
Definition: mlp_gen.cc:35

Member Function Documentation

void Trajectory::check ( void  ) const
private

Definition at line 201 of file Trajectory.cc.

Referenced by firstMeasurement(), lastLayer(), and lastMeasurement().

201  {
202  if ( theData.empty())
203  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
204 }
DataContainer theData
Definition: Trajectory.h:342
double Trajectory::chiSquared ( ) const
inline
TrajectoryMeasurement const & Trajectory::closestMeasurement ( GlobalPoint  point) const

Definition at line 270 of file Trajectory.cc.

References begin, CastorDataFrameFilter_impl::check(), and end.

Referenced by ConversionSeedFilter::getTSOS().

270  {
271  check();
272  vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().begin(), measurements().end(), LessMag(point) );
273 
274  return (*iter);
275 }
void check() const
Definition: Trajectory.cc:201
DataContainer const & measurements() const
Definition: Trajectory.h:215
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
DataContainer const& Trajectory::data ( ) const
inline

obsolete name, use measurements() instead.

Definition at line 217 of file Trajectory.h.

References measurements().

Referenced by cuy.FindIssue::__init__().

217 { return measurements();}
DataContainer const & measurements() const
Definition: Trajectory.h:215
PropagationDirection const & Trajectory::direction ( ) const
float Trajectory::dPhiCacheForLoopersReconstruction ( ) const
inline

accessor to the delta phi angle betweem the directions of the two measurements on the last two layers crossed by the trajectory

Definition at line 325 of file Trajectory.h.

References theDPhiCache.

Referenced by GroupedTrajCandLess::score().

325 { return theDPhiCache;}
float theDPhiCache
Definition: Trajectory.h:353
bool Trajectory::empty ( void  ) const
inline
TrajectoryMeasurement const& Trajectory::firstMeasurement ( ) const
inline

Access to the first measurement. It is the least precise one in a trajectory before smoothing. It is precise in a smoothed trajectory. It's the innermost measurement if direction() == alongMomentum, the outermost one if direction() == oppositeToMomentum.

Definition at line 206 of file Trajectory.h.

References check(), edm::hlt::Exception, and theData.

Referenced by CosmicTrajectoryBuilder::AddHit(), CkfDebugger::analyseCompatibleMeasurements(), GroupedCkfTrajectoryBuilder::backwardFit(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), TransientInitialStateEstimator::innerState(), TrackerToMuonPropagator::produce(), KfTrackProducerBase::putInEvt(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CRackTrajectoryBuilder::run(), and CosmicMuonTrajectoryBuilder::trajectories().

206  {
207  check();
208  if (theData.front().recHitR().hit()!=0) return theData.front();
209  else if (theData.size()>2) return *(theData.begin()+1);
210  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
211  }
DataContainer theData
Definition: Trajectory.h:342
void check() const
Definition: Trajectory.cc:201
int Trajectory::foundHits ( ) const
inline
TrajectoryStateOnSurface Trajectory::geometricalInnermostState ( ) const

Definition at line 233 of file Trajectory.cc.

References CastorDataFrameFilter_impl::check(), dot(), mag(), and perp().

Referenced by MuonTrackLoader::buildTrackAtPCA().

233  {
234 
235  check();
236 
237  //if trajectory is in one half, return the end closer to origin point
238  if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0
239  && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
240  lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() ) > 0 ) ) {
241  return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ?
243  }
244 
245  //more complicated in case of traversing and low-pt trajectories with loops
246  return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState();
247 
248 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void check() const
Definition: Trajectory.cc:201
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:270
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:193
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:206
T perp() const
Magnitude of transverse component.
T dot(const Basic3DVector &v) const
Scalar product, or &quot;dot&quot; product, with a vector of same type.
TrajectoryStateOnSurface const & updatedState() const
static bool Trajectory::inactive ( )
inlinestatic

Definition of inactive Det from the Trajectory point of view.

Definition at line 282 of file Trajectory.h.

283  {return false;}//FIXME
void Trajectory::incrementLoops ( )
inline

Definition at line 335 of file Trajectory.h.

References theNLoops.

335 {theNLoops++;}
signed char theNLoops
Definition: Trajectory.h:354
void Trajectory::invalidate ( )
inline

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 274 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

274 { theValid = false;}
bool theValid
Definition: Trajectory.h:351
bool Trajectory::isBad ( const TransientTrackingRecHit hit)
static

Returns true if the hit type is TrackingRecHit::bad Used in stand-alone trajectory construction

Definition at line 222 of file Trajectory.cc.

References TrackingRecHit::bad, TrackingRecHit::geographicalId(), TrackingRecHit::getType(), TrackingRecHit::isValid(), and DetId::rawId().

223 {
224  if ( hit.isValid()) return false;
225  else {
226  if(hit.geographicalId().rawId() == 0) {return false;}
227  else{
228  return hit.getType() == TrackingRecHit::bad;
229  }
230  }
231 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Type getType() const
bool isValid() const
DetId geographicalId() const
bool Trajectory::isLooper ( ) const
inline

Definition at line 331 of file Trajectory.h.

References theNLoops.

331 { return (theNLoops>0);}
signed char theNLoops
Definition: Trajectory.h:354
bool Trajectory::isValid ( void  ) const
inline
const DetLayer* Trajectory::lastLayer ( ) const
inline

Redundant method, returns the layer of lastMeasurement() .

Definition at line 296 of file Trajectory.h.

References check(), edm::hlt::Exception, and theData.

Referenced by CkfDebugger::analyseRecHitNotFound().

296  {
297  check();
298  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
299  else if (theData.size()>2) return (theData.end()-2)->layer();
300  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
301  }
DataContainer theData
Definition: Trajectory.h:342
void check() const
Definition: Trajectory.cc:201
TrajectoryMeasurement const& Trajectory::lastMeasurement ( ) const
inline

Access to the last measurement. It's the most precise one in a trajectory before smoothing. It's the outermost measurement if direction() == alongMomentum, the innermost one if direction() == oppositeToMomentum.

Definition at line 193 of file Trajectory.h.

References check(), edm::hlt::Exception, and theData.

Referenced by CosmicTrajectoryBuilder::AddHit(), CRackTrajectoryBuilder::AddHit(), BaseCkfTrajectoryBuilder::addToResult(), CkfDebugger::analyseCompatibleMeasurements(), CkfDebugger::analyseRecHitNotFound(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), CosmicMuonTrajectoryBuilder::flipTrajectory(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), CkfDebugger::nextCorrectHits(), KfTrackProducerBase::putInEvt(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), ThresholdPtTrajectoryFilter::qualityFilter(), MinPtTrajectoryFilter::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), StandAloneMuonRefitter::singleRefit(), CRackTrajectoryBuilder::SortHits(), MinPtTrajectoryFilter::toBeContinued(), ThresholdPtTrajectoryFilter::toBeContinued(), StandAloneMuonTrajectoryBuilder::trajectories(), and CosmicMuonTrajectoryBuilder::trajectories().

193  {
194  check();
195  if (theData.back().recHitR().hit()!=0) return theData.back();
196  else if (theData.size()>2) return *(theData.end()-2);
197  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
198  }
DataContainer theData
Definition: Trajectory.h:342
void check() const
Definition: Trajectory.cc:201
bool Trajectory::lost ( const TransientTrackingRecHit hit)
static

Definition of what it means for a hit to be "lost". This definition is also used by the TrajectoryBuilder.

Definition at line 206 of file Trajectory.cc.

References TrackingRecHit::geographicalId(), TrackingRecHit::getType(), TrackingRecHit::isValid(), TrackingRecHit::missing, and DetId::rawId().

Referenced by FastTrackMerger::produce(), and MaxConsecLostHitsTrajectoryFilter::TBC().

207 {
208  if ( hit.isValid()) return false;
209  else {
210  // // A DetLayer is always inactive in this logic.
211  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
212  // // is compatible with the predicted state, so we don't really expect
213  // // a hit in this case.
214 
215  if(hit.geographicalId().rawId() == 0) {return false;}
216  else{
217  return hit.getType() == TrackingRecHit::missing;
218  }
219  }
220 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Type getType() const
bool isValid() const
DetId geographicalId() const
int Trajectory::lostHits ( ) const
inline

Number of detector layers crossed without valid RecHits. Used mainly as a criteria for abandoning a trajectory candidate during trajectory building.

Definition at line 243 of file Trajectory.h.

References theNumberOfLostHits.

Referenced by BaseCkfTrajectoryBuilder::addToResult(), TrajectoryCleanerBySharedHits::clean(), and GroupedTrajCandLess::score().

243 { return theNumberOfLostHits;}
signed short theNumberOfLostHits
Definition: Trajectory.h:347
DataContainer const& Trajectory::measurements ( ) const
inline

Return all measurements in a container.

Definition at line 215 of file Trajectory.h.

References theData.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), BaseCkfTrajectoryBuilder::addToResult(), DeDxDiscriminatorLearner::algoAnalyze(), SiStripGainFromData::algoAnalyze(), CkfDebugger::analyseCompatibleMeasurements(), SiPixelLorentzAngle::analyze(), GroupedCkfTrajectoryBuilder::backwardFit(), FWTrackProxyBuilderFullFramework::buildTrack(), MuonRoadTrajectoryBuilder::cleanTrajectory(), MuonTrackResidualAnalyzer::computeResolution(), StandAloneMuonFilter::createDefaultTrajectory(), data(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), AlignmentMonitorTracksFromTrajectories::event(), TrackerValidationVariables::fillHitQuantities(), MuonKinkFinder::fillTrkKink(), DynamicTruncation::filter(), SiStripFineDelayTLA::findtrackangle(), CosmicMuonSmoother::fit(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), GlobalTrackQualityProducer::kink(), MuonResidualsFromTrack::MuonResidualsFromTrack(), GlobalTrackQualityProducer::newChi2(), ConversionHitChecker::nHitsBeforeVtx(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), ShallowTrackClustersProducer::produce(), TkAlCaOverlapTagger::produce(), HLTTrackClusterRemover::produce(), HLTTrackClusterRemoverNew::produce(), TrackClusterRemover::produce(), DeDxDiscriminatorProducer::produce(), ShallowGainCalibration::produce(), TrackClusterSplitter::produce(), reco::modules::CosmicTrackSplitter::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), MuonMillepedeAlgorithm::run(), HIPAlignmentAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::run(), CSCOverlapsAlignmentAlgorithm::run(), NuclearInteractionFinder::run(), GlobalMuonRefitter::selectMuonHits(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), TempTrajectory::TempTrajectory(), ClusterShapeTrajectoryFilter::toBeContinued(), CosmicMuonTrajectoryBuilder::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), and trajectoryToResiduals().

215 { return theData;}
DataContainer theData
Definition: Trajectory.h:342
int Trajectory::ndof ( bool  bon = true) const

Number of dof of the trajectory. The method accepts a bool in order to properly take into account the presence of magnetic field in the dof computation. By default the MF is considered ON.

Definition at line 74 of file Trajectory.cc.

References max(), and DetId::Muon.

Referenced by SiPixelLorentzAngle::analyze(), MuonTrackLoader::buildTrackAtPCA(), GlobalTrackQualityProducer::trackProbability(), and GlobalTrajectoryBuilderBase::trackProbability().

74  {
75  const Trajectory::RecHitContainer transRecHits = recHits();
76 
77  int dof = 0;
78  int dofBad = 0;
79 
80  for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
81  rechit != transRecHits.end(); ++rechit) {
82  if((*rechit)->isValid())
83  dof += (*rechit)->dimension();
84  else if( isBad(**rechit) && (*rechit)->geographicalId().det()==DetId::Muon )
85  dofBad += (*rechit)->dimension();
86  }
87 
88  // If dof!=0 (there is at least 1 valid hit),
89  // return ndof=ndof(fit)
90  // If dof=0 (all rec hits are invalid, only for STA trajectories),
91  // return ndof=ndof(invalid hits)
92  if(dof) {
93  int constr = bon ? 5 : 4;
94  return std::max(dof - constr, 0);
95  }
96  else {
97  // A STA can have < 5 (invalid) hits
98  // if this is the case ==> ndof = 1
99  // (to avoid divisions by 0)
100  int constr = bon ? 5 : 4;
101  return std::max(dofBad - constr, 1);
102  }
103 }
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
const T & max(const T &a, const T &b)
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:222
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
signed char Trajectory::nLoops ( ) const
inline

Definition at line 332 of file Trajectory.h.

References theNLoops.

Referenced by GroupedCkfTrajectoryBuilder::backwardFit().

332 {return theNLoops;}
signed char theNLoops
Definition: Trajectory.h:354
void Trajectory::pop ( )

Remove the last measurement from the trajectory.

Definition at line 17 of file Trajectory.cc.

References relativeConstraints::empty, and DetId::Muon.

Referenced by BaseCkfTrajectoryBuilder::addToResult(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), and CosmicMuonTrajectoryBuilder::trajectories().

17  {
18  if (!empty()) {
19  if(theData.back().recHit()->isValid()) {
21  theChiSquared -= theData.back().estimate();
22  }
23  else if(lost(* (theData.back().recHit()) )) {
25  }
26  else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==DetId::Muon ) {
27  theChiSquaredBad -= theData.back().estimate();
28  }
29 
30  theData.pop_back();
31  }
32 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:246
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:206
signed short theNumberOfLostHits
Definition: Trajectory.h:347
DataContainer theData
Definition: Trajectory.h:342
float theChiSquared
Definition: Trajectory.h:343
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:222
void Trajectory::push ( const TrajectoryMeasurement tm)
void Trajectory::push ( const TrajectoryMeasurement tm,
double  chi2Increment 
)

same as the one-argument push, but the trajectory Chi2 is incremented by chi2Increment. Useful e.g. in trajectory smoothing.

Definition at line 39 of file Trajectory.cc.

References alongMomentum, DetId::Muon, oppositeToMomentum, and TrajectoryMeasurement::recHit().

40 {
41  theData.push_back(tm);
42  if ( tm.recHit()->isValid()) {
43  theChiSquared += chi2Increment;
45  }
46  // else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
47  else if (lost( *(tm.recHit()) ) ) {
49  }
50 
51  else if (isBad( *(tm.recHit()) ) && tm.recHit()->geographicalId().det()==DetId::Muon ) {
52  theChiSquaredBad += chi2Increment;
53  }
54 
55  // in case of a Trajectory constructed without direction,
56  // determine direction from the radii of the first two measurements
57 
58  if ( !theDirectionValidity && theData.size() >= 2) {
59  if (theData[0].updatedState().globalPosition().perp() <
60  theData.back().updatedState().globalPosition().perp())
63  theDirectionValidity = true;
64  }
65 }
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
bool theDirectionValidity
Definition: Trajectory.h:350
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:206
ConstRecHitPointer const & recHit() const
signed short theNumberOfLostHits
Definition: Trajectory.h:347
DataContainer theData
Definition: Trajectory.h:342
PropagationDirection theDirection
Definition: Trajectory.h:349
float theChiSquared
Definition: Trajectory.h:343
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:222
Trajectory::RecHitContainer Trajectory::recHits ( bool  splitting = false) const
void Trajectory::recHitsV ( ConstRecHitContainer cont,
bool  splitting = false 
) const

Definition at line 107 of file Trajectory.cc.

References alongMomentum, oppositeToMomentum, hitfit::scalar(), and PV3DBase< T, PVType, FrameType >::z().

107  {
108  hits.reserve(theData.size());
109  if(!splitting){
110  for (Trajectory::DataContainer::const_iterator itm
111  = theData.begin(); itm != theData.end(); itm++){
112  hits.push_back((*itm).recHit());
113  }
114  }else{
115  for (Trajectory::DataContainer::const_iterator itm
116  = theData.begin(); itm != theData.end(); itm++){
117 
118  // ====== WARNING: this is a temporary solution =========
119  // all this part of code should be implemented internally
120  // in the TrackingRecHit classes. The concrete types of rechit
121  // should be transparent to the Trajectory class
122 
123  if( typeid(*(itm->recHit()->hit())) == typeid(SiStripMatchedRecHit2D)){
124  LocalPoint firstLocalPos =
125  itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[0]->globalPosition());
126 
127  LocalPoint secondLocalPos =
128  itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[1]->globalPosition());
129 
130  LocalVector Delta = secondLocalPos - firstLocalPos;
131  float scalar = Delta.z() * (itm->updatedState().localDirection().z());
132 
133 
135 
136  // Get 2D strip Hits from a matched Hit.
137  //hitA = itm->recHit()->transientHits()[0];
138  //hitB = itm->recHit()->transientHits()[1];
139 
140  // Get 2D strip Hits from a matched Hit. Then get the 1D hit from the 2D hit
141  if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
142  hitA = itm->recHit()->transientHits()[0]->transientHits()[0];
143  hitB = itm->recHit()->transientHits()[1]->transientHits()[0];
144  }else{ //don't use 1D hit in the endcap yet
145  hitA = itm->recHit()->transientHits()[0];
146  hitB = itm->recHit()->transientHits()[1];
147  }
148 
149  if( (scalar>=0 && direction()==alongMomentum) ||
150  (scalar<0 && direction()==oppositeToMomentum)){
151  hits.push_back(hitA);
152  hits.push_back(hitB);
153  }else if( (scalar>=0 && direction()== oppositeToMomentum) ||
154  (scalar<0 && direction()== alongMomentum)){
155  hits.push_back(hitB);
156  hits.push_back(hitA);
157  }else {
158  //throw cms::Exception("Error in Trajectory::recHitsV(). Direction is not defined");
159  edm::LogError("Trajectory_recHitsV_UndefinedTrackDirection")
160  << "Error in Trajectory::recHitsV: scalar = " << scalar
161  << ", direction = " << (direction()==alongMomentum ? "along " : (direction()==oppositeToMomentum ? "opposite " : "undefined "))
162  << theDirection <<"\n";
163  hits.push_back(hitA);
164  hits.push_back(hitB);
165  }
166  }else if(typeid(*(itm->recHit()->hit())) == typeid(ProjectedSiStripRecHit2D)){
167  //hits.push_back(itm->recHit()->transientHits()[0]); //Use 2D SiStripRecHit
168  if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
169  hits.push_back(itm->recHit()->transientHits()[0]->transientHits()[0]); //Use 1D SiStripRecHit
170  }else{
171  hits.push_back(itm->recHit()->transientHits()[0]); //Use 2D SiStripRecHit
172  }
173  // ===================================================================================
174  }else if(typeid(*(itm->recHit()->hit())) == typeid(SiStripRecHit2D)){
175  //hits.push_back(itm->recHit()); //Use 2D SiStripRecHit
176  if(!itm->recHit()->detUnit()->type().isEndcap()){
177  hits.push_back(itm->recHit()->transientHits()[0]); //Use 1D SiStripRecHit
178  }else{
179  hits.push_back(itm->recHit()); //Use 2D SiStripRecHit
180  }
181  }else{
182  hits.push_back(itm->recHit());
183  }
184  }//end loop on measurements
185  }
186 }
DataContainer theData
Definition: Trajectory.h:342
PropagationDirection const & direction() const
Definition: Trajectory.cc:196
T z() const
Definition: PV3DBase.h:64
PropagationDirection theDirection
Definition: Trajectory.h:349
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:183
void Trajectory::reserve ( unsigned int  n)
inline

Reserves space in the vector to avoid lots of allocations when push_back-ing measurements

Definition at line 171 of file Trajectory.h.

References theData.

Referenced by StandAloneMuonFilter::createDefaultTrajectory(), and TempTrajectory::toTrajectory().

171 { theData.reserve(n); }
DataContainer theData
Definition: Trajectory.h:342
void Trajectory::reverse ( )

Reverse the propagation direction and the order of the trajectory measurements. It doesn't reverse the forward and backward predicted states within each trajectory measurement

Definition at line 277 of file Trajectory.cc.

References alongMomentum, and oppositeToMomentum.

277  {
278  // reverse the direction (without changing it if it's not along or opposite)
281  // reverse the order of the hits
282  std::reverse(theData.begin(), theData.end());
283 }
DataContainer theData
Definition: Trajectory.h:342
PropagationDirection theDirection
Definition: Trajectory.h:349
TrajectorySeed const& Trajectory::seed ( ) const
inline
edm::RefToBase<TrajectorySeed> Trajectory::seedRef ( void  ) const
inline

return the Reference to the trajectory seed in the original seeds collection. If the collection has been dropped from the Event, the reference may be invalid. Its validity should be tested, before the reference is actually used.

Definition at line 308 of file Trajectory.h.

References seedRef_.

Referenced by MuonTrackLoader::buildTrackExtra(), KfTrackProducerBase::putInEvt(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), and setSeedRef().

308 { return seedRef_; }
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
void Trajectory::setDPhiCacheForLoopersReconstruction ( float  dphi)
inline

method to set the delta phi angle betweem the directions of the two measurements on the last two layers crossed by the trajectory

Definition at line 329 of file Trajectory.h.

References theDPhiCache.

329 { theDPhiCache = dphi;}
float theDPhiCache
Definition: Trajectory.h:353
void Trajectory::setNLoops ( signed char  value)
inline
void Trajectory::setSeedRef ( const edm::RefToBase< TrajectorySeed > &  seedRef)
inline

Definition at line 310 of file Trajectory.h.

References seedRef(), and seedRef_.

Referenced by GlobalTrajectoryBuilderBase::build(), and cms::CkfTrackCandidateMakerBase::produceBase().

310 { seedRef_ = seedRef ; }
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:308
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
void Trajectory::setSharedSeed ( const boost::shared_ptr< const TrajectorySeed > &  seed)
inline

Definition at line 321 of file Trajectory.h.

References seed(), and theSeed.

Referenced by BaseCkfTrajectoryBuilder::addToResult().

321 { theSeed=seed;}
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:277
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
const boost::shared_ptr<const TrajectorySeed>& Trajectory::sharedSeed ( ) const
inline

Definition at line 320 of file Trajectory.h.

References theSeed.

320 { return theSeed; }
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
void Trajectory::validRecHits ( ConstRecHitContainer cont) const

Just valid hits..

Definition at line 188 of file Trajectory.cc.

Referenced by NuclearTrackCorrector::getTrackFromTrajectory().

188  {
189  hits.reserve(foundHits());
190  for (Trajectory::DataContainer::const_iterator itm
191  = theData.begin(); itm != theData.end(); itm++)
192  if ((*itm).recHit()->isValid()) hits.push_back((*itm).recHit());
193 }
int foundHits() const
Definition: Trajectory.h:236
DataContainer theData
Definition: Trajectory.h:342

Member Data Documentation

edm::RefToBase<TrajectorySeed> Trajectory::seedRef_
private

Definition at line 340 of file Trajectory.h.

Referenced by seedRef(), and setSeedRef().

float Trajectory::theChiSquared
private

Definition at line 343 of file Trajectory.h.

Referenced by chiSquared().

float Trajectory::theChiSquaredBad
private

Definition at line 344 of file Trajectory.h.

Referenced by chiSquared().

DataContainer Trajectory::theData
private

Definition at line 342 of file Trajectory.h.

Referenced by empty(), firstMeasurement(), lastLayer(), lastMeasurement(), measurements(), and reserve().

PropagationDirection Trajectory::theDirection
private

Definition at line 349 of file Trajectory.h.

bool Trajectory::theDirectionValidity
private

Definition at line 350 of file Trajectory.h.

float Trajectory::theDPhiCache
private
signed char Trajectory::theNLoops
private

Definition at line 354 of file Trajectory.h.

Referenced by incrementLoops(), isLooper(), nLoops(), and setNLoops().

signed short Trajectory::theNumberOfFoundHits
private

Definition at line 346 of file Trajectory.h.

Referenced by chiSquared(), and foundHits().

signed short Trajectory::theNumberOfLostHits
private

Definition at line 347 of file Trajectory.h.

Referenced by lostHits().

boost::shared_ptr<const TrajectorySeed> Trajectory::theSeed
private

Definition at line 339 of file Trajectory.h.

Referenced by seed(), setSharedSeed(), and sharedSeed().

bool Trajectory::theValid
private

Definition at line 351 of file Trajectory.h.

Referenced by invalidate(), and isValid().