CMS 3D CMS Logo

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

using ConstRecHitContainer = TrackingRecHit::ConstRecHitContainer
 
typedef std::vector< TrajectoryMeasurementDataContainer
 
using RecHitContainer = ConstRecHitContainer
 

Public Member Functions

int cccBadHits () const
 
float cccThreshold () const
 
float 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
 
int foundPixelHits () 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
 
DataContainermeasurements ()
 
int ndof (bool bon=true) const
 
signed char nLoops () const
 
int numberOfCCCBadHits (float ccc_threshold)
 
Trajectoryoperator= (Trajectory const &rh)=default
 
Trajectoryoperator= (Trajectory &&rh)
 
void pop ()
 
void push (const TrajectoryMeasurement &tm)
 
void push (const TrajectoryMeasurement &tm, double chi2Increment)
 
void push (TrajectoryMeasurement &&tm)
 
void push (TrajectoryMeasurement &&tm, double chi2Increment)
 
ConstRecHitContainer recHits () const
 
void reserve (unsigned int n)
 
void reverse ()
 
TrajectorySeed const & seed () const
 Access to the seed used to reconstruct the Trajectory. More...
 
unsigned int seedNHits () const
 
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)
 
void setStopReason (StopReason s)
 
const boost::shared_ptr< const TrajectorySeed > & sharedSeed () const
 
StopReason stopReason () const
 
int trailingFoundHits () 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)
 
 Trajectory (Trajectory const &rh)=default
 
 Trajectory (Trajectory &&rh)
 
void validRecHits (ConstRecHitContainer &cont) const
 

Static Public Member Functions

static bool inactive ()
 
static bool isBad (const TrackingRecHit &hit)
 
static bool lost (const TrackingRecHit &hit)
 
static bool pixel (const TrackingRecHit &hit)
 

Private Member Functions

bool badForCCC (const TrajectoryMeasurement &tm)
 
void check () const
 
void pushAux (double chi2Increment)
 
void updateBadForCCC (float ccc_threshold)
 

Private Attributes

edm::RefToBase< TrajectorySeedseedRef_
 
StopReason stopReason_ = StopReason::UNINITIALIZED
 
float theCCCThreshold_ =std::numeric_limits<float>::max()
 
float theChiSquared =0
 
float theChiSquaredBad =0
 
DataContainer theData
 
PropagationDirection theDirection =anyDirection
 
bool theDirectionValidity =false
 
float theDPhiCache =0
 
signed char theNLoops =0
 
signed short theNumberOfCCCBadHits_ =0
 
signed short theNumberOfFoundHits =0
 
signed short theNumberOfFoundPixelHits =0
 
signed short theNumberOfLostHits =0
 
signed short theNumberOfTrailingFoundHits =0
 
boost::shared_ptr< const TrajectorySeedtheSeed
 
bool theValid =false
 

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 40 of file Trajectory.h.

Member Typedef Documentation

Definition at line 45 of file Trajectory.h.

Definition at line 44 of file Trajectory.h.

Definition at line 46 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 53 of file Trajectory.h.

Referenced by Trajectory().

53 {}
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 62 of file Trajectory.h.

62  :
63  theSeed( new TrajectorySeed(seed) ),
64  theValid(true)
65  {}
bool theValid
Definition: Trajectory.h:378
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
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 71 of file Trajectory.h.

71  :
72  theSeed( new TrajectorySeed(seed) ),
75  theValid(true)
76  {}
bool theDirectionValidity
Definition: Trajectory.h:377
bool theValid
Definition: Trajectory.h:378
PropagationDirection theDirection
Definition: Trajectory.h:376
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
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 82 of file Trajectory.h.

82  :
83  theSeed( seed ),
86  theValid(true)
87  {}
bool theDirectionValidity
Definition: Trajectory.h:377
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:285
bool theValid
Definition: Trajectory.h:378
PropagationDirection theDirection
Definition: Trajectory.h:376
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
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 93 of file Trajectory.h.

References operator=(), and Trajectory().

93  :
96  theValid(true)
97  {}
bool theDirectionValidity
Definition: Trajectory.h:377
bool theValid
Definition: Trajectory.h:378
PropagationDirection theDirection
Definition: Trajectory.h:376
dbl *** dir
Definition: mlp_gen.cc:35
Trajectory::Trajectory ( Trajectory const &  rh)
default
Trajectory::Trajectory ( Trajectory &&  rh)
inline

Definition at line 103 of file Trajectory.h.

103  :
116  theValid(rh.theValid),
119  theNLoops(rh.theNLoops),
121  {}
signed short theNumberOfTrailingFoundHits
Definition: Trajectory.h:373
float theChiSquaredBad
Definition: Trajectory.h:368
signed short theNumberOfFoundHits
Definition: Trajectory.h:370
bool theDirectionValidity
Definition: Trajectory.h:377
signed short theNumberOfFoundPixelHits
Definition: Trajectory.h:371
signed short theNumberOfLostHits
Definition: Trajectory.h:372
DataContainer theData
Definition: Trajectory.h:366
float theCCCThreshold_
Definition: Trajectory.h:381
signed char theNLoops
Definition: Trajectory.h:382
float theDPhiCache
Definition: Trajectory.h:380
bool theValid
Definition: Trajectory.h:378
StopReason stopReason_
Definition: Trajectory.h:383
PropagationDirection theDirection
Definition: Trajectory.h:376
float theChiSquared
Definition: Trajectory.h:367
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:364
def move(src, dest)
Definition: eostools.py:511
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374

Member Function Documentation

bool Trajectory::badForCCC ( const TrajectoryMeasurement tm)
private

Definition at line 184 of file Trajectory.cc.

References siStripClusterTools::chargePerCM(), trackerHitRTTI::isFast(), trackerHitRTTI::isUndef(), TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localParameters(), TrajectoryMeasurement::recHit(), and TrajectoryMeasurement::updatedState().

Referenced by stopReason().

184  {
185  if (trackerHitRTTI::isUndef(*tm.recHit()) |
187  ) return false;
188  auto const * thit = static_cast<const BaseTrackerRecHit*>( tm.recHit()->hit() );
189  if (!thit)
190  return false;
191  if (thit->isPixel() || thit->isPhase2())
192  return false;
193  if (!tm.updatedState().isValid())
194  return false;
195  return siStripClusterTools::chargePerCM(thit->rawId(),
196  thit->firstClusterRef().stripCluster(),
198 }
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
float chargePerCM(DetId detid, Iter a, Iter b)
float theCCCThreshold_
Definition: Trajectory.h:381
bool isFast(TrackingRecHit const &hit)
bool isUndef(TrackingRecHit const &hit)
TrajectoryStateOnSurface const & updatedState() const
int Trajectory::cccBadHits ( ) const
inline

Number of hits that are not compatible with the CCC used during patter recognition. Used mainly as a criteria for abandoning a trajectory candidate during trajectory building.

Definition at line 247 of file Trajectory.h.

References theNumberOfCCCBadHits_.

247 { return theNumberOfCCCBadHits_;}
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374
float Trajectory::cccThreshold ( ) const
inline

Definition at line 340 of file Trajectory.h.

References theCCCThreshold_.

340 {return theCCCThreshold_;}
float theCCCThreshold_
Definition: Trajectory.h:381
void Trajectory::check ( void  ) const
private

Definition at line 145 of file Trajectory.cc.

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

145  {
146  if ( theData.empty())
147  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
148 }
DataContainer theData
Definition: Trajectory.h:366
float Trajectory::chiSquared ( ) const
inline
TrajectoryMeasurement const & Trajectory::closestMeasurement ( GlobalPoint  point) const

Definition at line 257 of file Trajectory.cc.

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

Referenced by ConversionSeedFilter::getTSOS(), and setSeedRef().

257  {
258  check();
259  vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().begin(), measurements().end(), LessMag(point) );
260 
261  return (*iter);
262 }
void check() const
Definition: Trajectory.cc:145
DataContainer const & measurements() const
Definition: Trajectory.h:196
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
DataContainer const& Trajectory::data ( ) const
inline

obsolete name, use measurements() instead.

Definition at line 200 of file Trajectory.h.

References measurements().

200 { return measurements();}
DataContainer const & measurements() const
Definition: Trajectory.h:196
PropagationDirection const & Trajectory::direction ( ) const

Direction of "growing" of the trajectory. Possible values are alongMomentum (outwards) and oppositeToMomentum (inwards).

Definition at line 140 of file Trajectory.cc.

References Exception.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), CkfDebugger::analyseRecHitNotFound(), GroupedCkfTrajectoryBuilder::backwardFit(), FWTrackProxyBuilderFullFramework::buildTrack(), DAFTrackProducerAlgorithm::buildTrack(), MuonTrackLoader::buildTrackExtra(), chiSquared(), GlobalTrackerMuonAlignment::debugTrajectory(), KFSplittingFitter::fitOne(), NuclearTrackCorrector::getNewTrackExtra(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), Traj2TrackHits::operator()(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), GroupedDAFHitCollector::recHits(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), DAFTrackProducerAlgorithm::runWithCandidate(), TrajAnnealing::TrajAnnealing(), CosmicMuonTrajectoryBuilder::trajectories(), GsfTrajectorySmoother::trajectory(), KFTrajectorySmoother::trajectory(), and trajectoryToResiduals().

140  {
142  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
143 }
bool theDirectionValidity
Definition: Trajectory.h:377
PropagationDirection theDirection
Definition: Trajectory.h:376
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 338 of file Trajectory.h.

References theDPhiCache.

338 { return theDPhiCache;}
float theDPhiCache
Definition: Trajectory.h:380
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 187 of file Trajectory.h.

References check(), Exception, and theData.

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

187  {
188  check();
189  if (theData.front().recHitR().hit()!=nullptr) return theData.front();
190  else if (theData.size()>2) return *(theData.begin()+1);
191  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
192  }
DataContainer theData
Definition: Trajectory.h:366
void check() const
Definition: Trajectory.cc:145
int Trajectory::foundHits ( ) const
inline
int Trajectory::foundPixelHits ( ) const
inline

Number of valid pixel RecHits used to determine the trajectory.

Definition at line 229 of file Trajectory.h.

References theNumberOfFoundPixelHits.

229 { return theNumberOfFoundPixelHits;}
signed short theNumberOfFoundPixelHits
Definition: Trajectory.h:371
TrajectoryStateOnSurface Trajectory::geometricalInnermostState ( ) const

Definition at line 220 of file Trajectory.cc.

References trackerTree::check(), dot(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), mag(), mag2(), perp(), point, TrackInfoProducer_cfi::updatedState, and TrajectoryMeasurement::updatedState().

Referenced by MuonTrackLoader::buildTrackAtPCA(), and setSeedRef().

220  {
221 
222  check();
223 
224  //if trajectory is in one half, return the end closer to origin point
225  if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0
226  && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
227  lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() ) > 0 ) ) {
228  return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ?
230  }
231 
232  //more complicated in case of traversing and low-pt trajectories with loops
233  return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState();
234 
235 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void check() const
Definition: Trajectory.cc:145
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:257
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:174
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:187
T perp() const
Magnitude of transverse component.
T dot(const Basic3DVector &v) const
Scalar product, or "dot" 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 290 of file Trajectory.h.

References isBad(), lost(), and pixel().

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

Definition at line 350 of file Trajectory.h.

References theNLoops.

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

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 282 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

282 { theValid = false;}
bool theValid
Definition: Trajectory.h:378
bool Trajectory::isBad ( const TrackingRecHit hit)
static

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

Definition at line 166 of file Trajectory.cc.

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

Referenced by inactive().

167 {
168  if ( hit.isValid()) return false;
169  else {
170  if(hit.geographicalId().rawId() == 0) {return false;}
171  else{
172  return hit.getType() == TrackingRecHit::bad;
173  }
174  }
175 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
Type getType() const
bool isValid() const
DetId geographicalId() const
bool Trajectory::isLooper ( ) const
inline

Definition at line 346 of file Trajectory.h.

References theNLoops.

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

Redundant method, returns the layer of lastMeasurement() .

Definition at line 309 of file Trajectory.h.

References check(), Exception, and theData.

Referenced by CkfDebugger::analyseRecHitNotFound().

309  {
310  check();
311  if (theData.back().recHit()->hit()!=nullptr) return theData.back().layer();
312  else if (theData.size()>2) return (theData.end()-2)->layer();
313  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
314  }
DataContainer theData
Definition: Trajectory.h:366
void check() const
Definition: Trajectory.cc:145
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 174 of file Trajectory.h.

References check(), Exception, and theData.

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

174  {
175  check();
176  if (theData.back().recHitR().hit()!=nullptr) return theData.back();
177  else if (theData.size()>2) return *(theData.end()-2);
178  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
179  }
DataContainer theData
Definition: Trajectory.h:366
void check() const
Definition: Trajectory.cc:145
bool Trajectory::lost ( const TrackingRecHit hit)
static

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

Definition at line 150 of file Trajectory.cc.

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

Referenced by inactive(), and MaxConsecLostHitsTrajectoryFilter::TBC().

151 {
152  if ( hit.isValid()) return false;
153  else {
154  // // A DetLayer is always inactive in this logic.
155  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
156  // // is compatible with the predicted state, so we don't really expect
157  // // a hit in this case.
158 
159  if(hit.geographicalId().rawId() == 0) {return false;}
160  else{
161  return hit.getType() == TrackingRecHit::missing;
162  }
163  }
164 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
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 236 of file Trajectory.h.

References theNumberOfLostHits.

Referenced by BaseCkfTrajectoryBuilder::addToResult().

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

Return all measurements in a container.

Definition at line 196 of file Trajectory.h.

References theData.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), BaseCkfTrajectoryBuilder::addToResult(), DeDxDiscriminatorLearner::algoAnalyze(), SiStripGainFromData::algoAnalyze(), CkfDebugger::analyseCompatibleMeasurements(), analyzer::SiPixelLorentzAngle::analyze(), GroupedCkfTrajectoryBuilder::backwardFit(), FWTrackProxyBuilderFullFramework::buildTrack(), DAFTrackProducerAlgorithm::calculateNdof(), DAFTrackProducerAlgorithm::checkHits(), MuonTrackResidualAnalyzer::computeResolution(), DAFTrackProducerAlgorithm::countingGoodHits(), StandAloneMuonFilter::createDefaultTrajectory(), data(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), AlignmentMonitorTracksFromTrajectories::event(), TrackerValidationVariables::fillHitQuantities(), ApeEstimator::fillTrackVariables(), MuonKinkFinder::fillTrkKink(), DynamicTruncation::filter(), SiStripFineDelayTLA::findtrackangle(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), GlobalTrackQualityProducer::kink(), MuonResidualsFromTrack::MuonResidualsFromTrack(), GlobalTrackQualityProducer::newChi2(), Traj2TrackHits::operator()(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), ShallowTrackClustersProducer::produce(), TkAlCaOverlapTagger::produce(), HLTTrackClusterRemoverNew::produce(), ShallowGainCalibration::produce(), reco::modules::CosmicTrackSplitter::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), StripSubClusterShapeTrajectoryFilter::qualityFilter(), GroupedDAFHitCollector::recHits(), SimpleDAFHitCollector::recHits(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), MuonMillepedeAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::run(), HIPAlignmentAlgorithm::run(), CSCOverlapsAlignmentAlgorithm::run(), NuclearInteractionFinder::run(), GlobalMuonRefitter::selectMuonHits(), CosmicMuonSmoother::smooth(), ClusterShapeTrajectoryFilter::toBeContinued(), TrajAnnealing::TrajAnnealing(), CosmicMuonTrajectoryBuilder::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), GsfTrajectorySmoother::trajectory(), KFTrajectorySmoother::trajectory(), trajectoryToResiduals(), and DAFTrackProducerAlgorithm::updateHits().

196 { return theData;}
DataContainer theData
Definition: Trajectory.h:366
DataContainer& Trajectory::measurements ( )
inline

Definition at line 197 of file Trajectory.h.

References theData.

197 { return theData;}
DataContainer theData
Definition: Trajectory.h:366
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 102 of file Trajectory.cc.

References pat::helper::ParametrizationHelper::dimension(), SiStripPI::max, and DetId::Muon.

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

102  {
103  Trajectory::RecHitContainer && transRecHits = recHits();
104 
105  int dof = 0;
106  int dofBad = 0;
107 
108  for(auto & rechit : transRecHits) {
109  if((rechit)->isValid())
110  dof += (rechit)->dimension();
111  else if( isBad(*rechit) && (rechit)->geographicalId().det()==DetId::Muon )
112  dofBad += (rechit)->dimension();
113  }
114 
115  // If dof!=0 (there is at least 1 valid hit),
116  // return ndof=ndof(fit)
117  // If dof=0 (all rec hits are invalid, only for STA trajectories),
118  // return ndof=ndof(invalid hits)
119  if(dof) {
120  int constr = bon ? 5 : 4;
121  return std::max(dof - constr, 0);
122  }
123  else {
124  // A STA can have < 5 (invalid) hits
125  // if this is the case ==> ndof = 1
126  // (to avoid divisions by 0)
127  int constr = bon ? 5 : 4;
128  return std::max(dofBad - constr, 1);
129  }
130 }
ConstRecHitContainer recHits() const
Definition: Trajectory.h:204
bool isValid() const
Definition: Trajectory.h:279
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:46
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:166
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
signed char Trajectory::nLoops ( ) const
inline

Definition at line 347 of file Trajectory.h.

References theNLoops.

Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), and TransientInitialStateEstimator::innerState().

347 {return theNLoops;}
signed char theNLoops
Definition: Trajectory.h:382
int Trajectory::numberOfCCCBadHits ( float  ccc_threshold)

Definition at line 215 of file Trajectory.cc.

Referenced by stopReason(), and TempTrajectory::toTrajectory().

215  {
216  updateBadForCCC(ccc_threshold);
217  return theNumberOfCCCBadHits_;
218 }
void updateBadForCCC(float ccc_threshold)
Definition: Trajectory.cc:200
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374
Trajectory& Trajectory::operator= ( Trajectory const &  rh)
default

Referenced by Trajectory().

Trajectory& Trajectory::operator= ( Trajectory &&  rh)
inline

Definition at line 123 of file Trajectory.h.

References seedRef_, stopReason_, edm::swap(), std::swap(), theCCCThreshold_, theChiSquared, theChiSquaredBad, theData, theDirection, theDirectionValidity, theDPhiCache, theNLoops, theNumberOfCCCBadHits_, theNumberOfFoundHits, theNumberOfFoundPixelHits, theNumberOfLostHits, theNumberOfTrailingFoundHits, theSeed, and theValid.

123  {
124  using std::swap;
125  swap(theData,rh.theData);
128  theValid=rh.theValid;
131  theNLoops=rh.theNLoops;
140  swap(theSeed,rh.theSeed);
141  swap(seedRef_,rh.seedRef_);
142 
143  return *this;
144 
145  }
signed short theNumberOfTrailingFoundHits
Definition: Trajectory.h:373
float theChiSquaredBad
Definition: Trajectory.h:368
signed short theNumberOfFoundHits
Definition: Trajectory.h:370
bool theDirectionValidity
Definition: Trajectory.h:377
signed short theNumberOfFoundPixelHits
Definition: Trajectory.h:371
signed short theNumberOfLostHits
Definition: Trajectory.h:372
DataContainer theData
Definition: Trajectory.h:366
float theCCCThreshold_
Definition: Trajectory.h:381
signed char theNLoops
Definition: Trajectory.h:382
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
float theDPhiCache
Definition: Trajectory.h:380
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool theValid
Definition: Trajectory.h:378
StopReason stopReason_
Definition: Trajectory.h:383
PropagationDirection theDirection
Definition: Trajectory.h:376
float theChiSquared
Definition: Trajectory.h:367
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:364
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374
bool Trajectory::pixel ( const TrackingRecHit hit)
static

Returns true if the hit type is TrackingRecHit::bad Used in trajectory filtering

Definition at line 177 of file Trajectory.cc.

References TrackingRecHit::hit(), BaseTrackerRecHit::isPixel(), and trackerHitRTTI::isUndef().

Referenced by inactive(), SeedExtensionTrajectoryFilter::looseTBC(), TempTrajectory::pop(), and TempTrajectory::pushAux().

177  {
178  if (trackerHitRTTI::isUndef(hit))
179  return false;
180  auto const * thit = static_cast<const BaseTrackerRecHit*>( hit.hit() );
181  return thit->isPixel();
182 }
virtual bool isPixel() const
virtual TrackingRecHit const * hit() const
bool isUndef(TrackingRecHit const &hit)
void Trajectory::pop ( )

Remove the last measurement from the trajectory.

Definition at line 29 of file Trajectory.cc.

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

Referenced by BaseCkfTrajectoryBuilder::addToResult(), cms::CkfTrackCandidateMakerBase::produceBase(), reserve(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), and CosmicMuonTrajectoryBuilder::trajectories().

29  {
30  if (!empty()) {
31  if(theData.back().recHit()->isValid()) {
33  theChiSquared -= theData.back().estimate();
35  if(pixel(*(theData.back().recHit()))) theNumberOfFoundPixelHits--;
36  }
37  else if(lost(* (theData.back().recHit()) )) {
39  }
40  else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==DetId::Muon ) {
41  theChiSquaredBad -= theData.back().estimate();
42  }
43 
44  theData.pop_back();
45  theNumberOfTrailingFoundHits=countTrailingValidHits(theData);
46  }
47 }
signed short theNumberOfTrailingFoundHits
Definition: Trajectory.h:373
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:254
float theChiSquaredBad
Definition: Trajectory.h:368
signed short theNumberOfFoundHits
Definition: Trajectory.h:370
signed short theNumberOfFoundPixelHits
Definition: Trajectory.h:371
signed short theNumberOfLostHits
Definition: Trajectory.h:372
DataContainer theData
Definition: Trajectory.h:366
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:184
static bool pixel(const TrackingRecHit &hit)
Definition: Trajectory.cc:177
float theChiSquared
Definition: Trajectory.h:367
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:166
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374
static bool lost(const TrackingRecHit &hit)
Definition: Trajectory.cc:150
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 61 of file Trajectory.cc.

61  {
62  theData.push_back(tm); pushAux(chi2Increment);
63 }
void pushAux(double chi2Increment)
Definition: Trajectory.cc:70
DataContainer theData
Definition: Trajectory.h:366
void Trajectory::push ( TrajectoryMeasurement &&  tm)

Definition at line 55 of file Trajectory.cc.

55  {
56  push( tm, tm.estimate());
57 }
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:50
void Trajectory::push ( TrajectoryMeasurement &&  tm,
double  chi2Increment 
)

Definition at line 65 of file Trajectory.cc.

65  {
66  theData.push_back(tm); pushAux(chi2Increment);
67 }
void pushAux(double chi2Increment)
Definition: Trajectory.cc:70
DataContainer theData
Definition: Trajectory.h:366
void Trajectory::pushAux ( double  chi2Increment)
private

Definition at line 70 of file Trajectory.cc.

References alongMomentum, DetId::Muon, oppositeToMomentum, digitizers_cfi::pixel, TrajectoryMeasurement::recHit(), and TrackInfoProducer_cfi::updatedState.

Referenced by stopReason().

70  {
71  const TrajectoryMeasurement& tm = theData.back();
72  if ( tm.recHit()->isValid()) {
73  theChiSquared += chi2Increment;
77  if(pixel(*(tm.recHit()))) theNumberOfFoundPixelHits++;
78  }
79  // else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
80  else if (lost( *(tm.recHit()) ) ) {
83  }
84 
85  else if (isBad( *(tm.recHit()) ) && tm.recHit()->geographicalId().det()==DetId::Muon ) {
86  theChiSquaredBad += chi2Increment;
87  }
88 
89  // in case of a Trajectory constructed without direction,
90  // determine direction from the radii of the first two measurements
91 
92  if ( !theDirectionValidity && theData.size() >= 2) {
93  if (theData[0].updatedState().globalPosition().perp2() <
94  theData.back().updatedState().globalPosition().perp2())
97  theDirectionValidity = true;
98  }
99 }
signed short theNumberOfTrailingFoundHits
Definition: Trajectory.h:373
float theChiSquaredBad
Definition: Trajectory.h:368
signed short theNumberOfFoundHits
Definition: Trajectory.h:370
bool theDirectionValidity
Definition: Trajectory.h:377
ConstRecHitPointer const & recHit() const
signed short theNumberOfFoundPixelHits
Definition: Trajectory.h:371
signed short theNumberOfLostHits
Definition: Trajectory.h:372
DataContainer theData
Definition: Trajectory.h:366
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:184
static bool pixel(const TrackingRecHit &hit)
Definition: Trajectory.cc:177
PropagationDirection theDirection
Definition: Trajectory.h:376
float theChiSquared
Definition: Trajectory.h:367
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:166
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374
static bool lost(const TrackingRecHit &hit)
Definition: Trajectory.cc:150
ConstRecHitContainer Trajectory::recHits ( void  ) const
inline
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 150 of file Trajectory.h.

References pop(), push(), and theData.

Referenced by StandAloneMuonFilter::createDefaultTrajectory(), KFTrajectoryFitter::fitOne(), cms::CkfTrackCandidateMakerBase::produceBase(), TempTrajectory::toTrajectory(), and KFTrajectorySmoother::trajectory().

150 { theData.reserve(n); }
DataContainer theData
Definition: Trajectory.h:366
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 264 of file Trajectory.cc.

References alongMomentum, oppositeToMomentum, and groupFilesInBlocks::reverse.

Referenced by setSeedRef().

264  {
265  // reverse the direction (without changing it if it's not along or opposite)
268  // reverse the order of the hits
269  std::reverse(theData.begin(), theData.end());
270 }
DataContainer theData
Definition: Trajectory.h:366
PropagationDirection theDirection
Definition: Trajectory.h:376
TrajectorySeed const& Trajectory::seed ( ) const
inline
unsigned int Trajectory::seedNHits ( ) const
inline

Definition at line 250 of file Trajectory.h.

References TrajectorySeed::nHits(), and seed().

250 { return seed().nHits();}
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:285
unsigned int nHits() const
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 321 of file Trajectory.h.

References seedRef_.

Referenced by MuonTrackLoader::buildTrackExtra(), cms::CkfTrackCandidateMakerBase::produceBase(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), setSeedRef(), and MuonTrackLoader::~MuonTrackLoader().

321 { return seedRef_; }
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:364
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 344 of file Trajectory.h.

References theDPhiCache.

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

Definition at line 323 of file Trajectory.h.

References closestMeasurement(), geometricalInnermostState(), reverse(), seedRef(), and seedRef_.

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

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

Definition at line 334 of file Trajectory.h.

References seed(), and theSeed.

Referenced by BaseCkfTrajectoryBuilder::addToResult().

334 { theSeed=seed;}
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:285
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
void Trajectory::setStopReason ( StopReason  s)
inline
const boost::shared_ptr<const TrajectorySeed>& Trajectory::sharedSeed ( ) const
inline

Definition at line 333 of file Trajectory.h.

References theSeed.

333 { return theSeed; }
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:363
StopReason Trajectory::stopReason ( ) const
inline

Definition at line 353 of file Trajectory.h.

References badForCCC(), numberOfCCCBadHits(), pushAux(), stopReason_, and updateBadForCCC().

353 {return stopReason_;}
StopReason stopReason_
Definition: Trajectory.h:383
int Trajectory::trailingFoundHits ( ) const
inline

Number of valid RecHits at the end of the trajectory after last lost hit.

Definition at line 240 of file Trajectory.h.

References theNumberOfTrailingFoundHits.

signed short theNumberOfTrailingFoundHits
Definition: Trajectory.h:373
void Trajectory::updateBadForCCC ( float  ccc_threshold)
private

Definition at line 200 of file Trajectory.cc.

References h.

Referenced by stopReason().

200  {
201  // If the supplied threshold is the same as the currently cached
202  // one, then return the current number of bad hits for CCC,
203  // otherwise do a new full rescan.
204  if (ccc_threshold == theCCCThreshold_)
205  return;
206 
207  theCCCThreshold_ = ccc_threshold;
209  for (auto const & h : theData) {
210  if (badForCCC(h))
212  }
213 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
DataContainer theData
Definition: Trajectory.h:366
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:184
float theCCCThreshold_
Definition: Trajectory.h:381
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:374
void Trajectory::validRecHits ( ConstRecHitContainer cont) const

Just valid hits..

Definition at line 133 of file Trajectory.cc.

Referenced by NuclearTrackCorrector::getTrackFromTrajectory(), and recHits().

133  {
134  hits.reserve(foundHits());
135  for (auto const & tm : theData)
136  if (tm.recHit()->isValid()) hits.push_back(tm.recHit());
137 }
int foundHits() const
Definition: Trajectory.h:225
DataContainer theData
Definition: Trajectory.h:366

Member Data Documentation

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

Definition at line 364 of file Trajectory.h.

Referenced by operator=(), seedRef(), and setSeedRef().

StopReason Trajectory::stopReason_ = StopReason::UNINITIALIZED
private

Definition at line 383 of file Trajectory.h.

Referenced by operator=(), setStopReason(), and stopReason().

float Trajectory::theCCCThreshold_ =std::numeric_limits<float>::max()
private

Definition at line 381 of file Trajectory.h.

Referenced by cccThreshold(), and operator=().

float Trajectory::theChiSquared =0
private

Definition at line 367 of file Trajectory.h.

Referenced by chiSquared(), and operator=().

float Trajectory::theChiSquaredBad =0
private

Definition at line 368 of file Trajectory.h.

Referenced by chiSquared(), and operator=().

DataContainer Trajectory::theData
private
PropagationDirection Trajectory::theDirection =anyDirection
private

Definition at line 376 of file Trajectory.h.

Referenced by operator=().

bool Trajectory::theDirectionValidity =false
private

Definition at line 377 of file Trajectory.h.

Referenced by operator=().

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

Definition at line 382 of file Trajectory.h.

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

signed short Trajectory::theNumberOfCCCBadHits_ =0
private

Definition at line 374 of file Trajectory.h.

Referenced by cccBadHits(), and operator=().

signed short Trajectory::theNumberOfFoundHits =0
private

Definition at line 370 of file Trajectory.h.

Referenced by chiSquared(), foundHits(), and operator=().

signed short Trajectory::theNumberOfFoundPixelHits =0
private

Definition at line 371 of file Trajectory.h.

Referenced by foundPixelHits(), and operator=().

signed short Trajectory::theNumberOfLostHits =0
private

Definition at line 372 of file Trajectory.h.

Referenced by lostHits(), and operator=().

signed short Trajectory::theNumberOfTrailingFoundHits =0
private

Definition at line 373 of file Trajectory.h.

Referenced by operator=(), and trailingFoundHits().

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

Definition at line 363 of file Trajectory.h.

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

bool Trajectory::theValid =false
private

Definition at line 378 of file Trajectory.h.

Referenced by invalidate(), isValid(), and operator=().