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

using ConstRecHitContainer = TrackingRecHit::ConstRecHitContainer
 
typedef std::vector
< TrajectoryMeasurement
DataContainer
 
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
 
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
 
 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)
 

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_
 
float theCCCThreshold_
 
float theChiSquared
 
float theChiSquaredBad
 
DataContainer theData
 
PropagationDirection theDirection
 
bool theDirectionValidity
 
float theDPhiCache
 
signed char theNLoops
 
signed short theNumberOfCCCBadHits_
 
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 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.

53  :
54  theSeed(),
55  seedRef_(),
56  theChiSquared(0),
62  theDirectionValidity(false),
63  theValid(false),
64  theDPhiCache(0),
66  theNLoops(0),
68  {}
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
signed short theNumberOfLostHits
Definition: Trajectory.h:411
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
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 77 of file Trajectory.h.

77  :
78  theSeed( new TrajectorySeed(seed) ),
79  seedRef_(),
80  theChiSquared(0),
86  theDirectionValidity(false),
87  theValid(true),
88  theDPhiCache(0),
90  theNLoops(0),
92  {}
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
signed short theNumberOfLostHits
Definition: Trajectory.h:411
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
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 98 of file Trajectory.h.

98  :
99  theSeed( new TrajectorySeed(seed) ),
100  seedRef_(),
101  theChiSquared(0),
102  theChiSquaredBad(0),
106  theDirection(dir),
107  theDirectionValidity(true),
108  theValid(true),
109  theDPhiCache(0),
111  theNLoops(0),
113  {}
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
signed short theNumberOfLostHits
Definition: Trajectory.h:411
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
dbl *** dir
Definition: mlp_gen.cc:35
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
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 119 of file Trajectory.h.

119  :
120  theSeed( seed ),
121  seedRef_(),
122  theChiSquared(0),
123  theChiSquaredBad(0),
127  theDirection(dir),
128  theDirectionValidity(true),
129  theValid(true),
130  theDPhiCache(0),
132  theNLoops(0),
134  {}
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:330
signed short theNumberOfLostHits
Definition: Trajectory.h:411
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
dbl *** dir
Definition: mlp_gen.cc:35
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
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 140 of file Trajectory.h.

140  :
141  theSeed(),
142  seedRef_(),
143  theChiSquared(0),
144  theChiSquaredBad(0),
148  theDirection(dir),
149  theDirectionValidity(true),
150  theValid(true),
151  theDPhiCache(0),
153  theNLoops(0),
155  {}
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
signed short theNumberOfLostHits
Definition: Trajectory.h:411
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
dbl *** dir
Definition: mlp_gen.cc:35
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
Trajectory::Trajectory ( Trajectory const &  rh)
default
Trajectory::Trajectory ( Trajectory &&  rh)
inline

Definition at line 161 of file Trajectory.h.

161  :
172  theValid(rh.theValid),
175  theNLoops(rh.theNLoops),
177  {}
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
signed short theNumberOfLostHits
Definition: Trajectory.h:411
DataContainer theData
Definition: Trajectory.h:406
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
def move
Definition: eostools.py:510
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412

Member Function Documentation

bool Trajectory::badForCCC ( const TrajectoryMeasurement tm)
private

Definition at line 162 of file Trajectory.cc.

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

162  {
163  auto const * thit = dynamic_cast<const BaseTrackerRecHit*>( tm.recHit()->hit() );
164  if (!thit)
165  return false;
166  if (thit->isPixel())
167  return false;
168  if (!tm.updatedState().isValid())
169  return false;
170  return siStripClusterTools::chargePerCM(thit->rawId(),
171  thit->firstClusterRef().stripCluster(),
173 }
ConstRecHitPointer const & recHit() const
const LocalTrajectoryParameters & localParameters() const
float chargePerCM(DetId detid, Iter a, Iter b)
float theCCCThreshold_
Definition: Trajectory.h:419
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 292 of file Trajectory.h.

References theNumberOfCCCBadHits_.

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

Definition at line 380 of file Trajectory.h.

References theCCCThreshold_.

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

Definition at line 130 of file Trajectory.cc.

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

130  {
131  if ( theData.empty())
132  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
133 }
DataContainer theData
Definition: Trajectory.h:406
float Trajectory::chiSquared ( ) const
inline
TrajectoryMeasurement const & Trajectory::closestMeasurement ( GlobalPoint  point) const

Definition at line 232 of file Trajectory.cc.

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

Referenced by ConversionSeedFilter::getTSOS().

232  {
233  check();
234  vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().begin(), measurements().end(), LessMag(point) );
235 
236  return (*iter);
237 }
void check() const
Definition: Trajectory.cc:130
DataContainer const & measurements() const
Definition: Trajectory.h:250
#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 254 of file Trajectory.h.

References measurements().

Referenced by cuy.FindIssue::__init__().

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

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

Definition at line 125 of file Trajectory.cc.

References Exception.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), CkfDebugger::analyseRecHitNotFound(), GroupedCkfTrajectoryBuilder::backwardFit(), FWTrackProxyBuilderFullFramework::buildTrack(), DAFTrackProducerAlgorithm::buildTrack(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), KFSplittingFitter::fitOne(), NuclearTrackCorrector::getNewTrackExtra(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), ConversionHitChecker::nHitsBeforeVtx(), 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().

125  {
127  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
128 }
bool theDirectionValidity
Definition: Trajectory.h:415
PropagationDirection theDirection
Definition: Trajectory.h:414
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 378 of file Trajectory.h.

References theDPhiCache.

378 { return theDPhiCache;}
float theDPhiCache
Definition: Trajectory.h:418
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 241 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().

241  {
242  check();
243  if (theData.front().recHitR().hit()!=0) return theData.front();
244  else if (theData.size()>2) return *(theData.begin()+1);
245  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
246  }
DataContainer theData
Definition: Trajectory.h:406
void check() const
Definition: Trajectory.cc:130
int Trajectory::foundHits ( ) const
inline
TrajectoryStateOnSurface Trajectory::geometricalInnermostState ( ) const

Definition at line 195 of file Trajectory.cc.

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

Referenced by MuonTrackLoader::buildTrackAtPCA().

195  {
196 
197  check();
198 
199  //if trajectory is in one half, return the end closer to origin point
200  if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0
201  && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
202  lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() ) > 0 ) ) {
203  return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ?
205  }
206 
207  //more complicated in case of traversing and low-pt trajectories with loops
208  return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState();
209 
210 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void check() const
Definition: Trajectory.cc:130
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:232
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:228
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:241
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 335 of file Trajectory.h.

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

Definition at line 390 of file Trajectory.h.

References theNLoops.

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

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 327 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

327 { theValid = false;}
bool theValid
Definition: Trajectory.h:416
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 151 of file Trajectory.cc.

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

152 {
153  if ( hit.isValid()) return false;
154  else {
155  if(hit.geographicalId().rawId() == 0) {return false;}
156  else{
157  return hit.getType() == TrackingRecHit::bad;
158  }
159  }
160 }
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 386 of file Trajectory.h.

References theNLoops.

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

Redundant method, returns the layer of lastMeasurement() .

Definition at line 349 of file Trajectory.h.

References check(), Exception, and theData.

Referenced by CkfDebugger::analyseRecHitNotFound().

349  {
350  check();
351  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
352  else if (theData.size()>2) return (theData.end()-2)->layer();
353  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
354  }
DataContainer theData
Definition: Trajectory.h:406
void check() const
Definition: Trajectory.cc:130
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 228 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().

228  {
229  check();
230  if (theData.back().recHitR().hit()!=0) return theData.back();
231  else if (theData.size()>2) return *(theData.end()-2);
232  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
233  }
DataContainer theData
Definition: Trajectory.h:406
void check() const
Definition: Trajectory.cc:130
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 135 of file Trajectory.cc.

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

Referenced by MaxConsecLostHitsTrajectoryFilter::TBC().

136 {
137  if ( hit.isValid()) return false;
138  else {
139  // // A DetLayer is always inactive in this logic.
140  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
141  // // is compatible with the predicted state, so we don't really expect
142  // // a hit in this case.
143 
144  if(hit.geographicalId().rawId() == 0) {return false;}
145  else{
146  return hit.getType() == TrackingRecHit::missing;
147  }
148  }
149 }
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 286 of file Trajectory.h.

References theNumberOfLostHits.

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

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

Return all measurements in a container.

Definition at line 250 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(), CosmicMuonSmoother::fit(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), GlobalTrackQualityProducer::kink(), MuonResidualsFromTrack::MuonResidualsFromTrack(), GlobalTrackQualityProducer::newChi2(), ConversionHitChecker::nHitsBeforeVtx(), Traj2TrackHits::operator()(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), ShallowTrackClustersProducer::produce(), TkAlCaOverlapTagger::produce(), HLTTrackClusterRemoverNew::produce(), HITrackClusterRemover::produce(), ShallowGainCalibration::produce(), TrackClusterSplitter::produce(), reco::modules::CosmicTrackSplitter::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), StripSubClusterShapeTrajectoryFilter::qualityFilter(), GroupedDAFHitCollector::recHits(), SimpleDAFHitCollector::recHits(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), MuonMillepedeAlgorithm::run(), HIPAlignmentAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::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().

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

Definition at line 251 of file Trajectory.h.

References theData.

251 { return theData;}
DataContainer theData
Definition: Trajectory.h:406
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 85 of file Trajectory.cc.

References bookConverter::max, DetId::Muon, and HLT_25ns10e33_v2_cff::recHits.

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

85  {
86  Trajectory::RecHitContainer && transRecHits = recHits();
87 
88  int dof = 0;
89  int dofBad = 0;
90 
91  for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
92  rechit != transRecHits.end(); ++rechit) {
93  if((*rechit)->isValid())
94  dof += (*rechit)->dimension();
95  else if( isBad(**rechit) && (*rechit)->geographicalId().det()==DetId::Muon )
96  dofBad += (*rechit)->dimension();
97  }
98 
99  // If dof!=0 (there is at least 1 valid hit),
100  // return ndof=ndof(fit)
101  // If dof=0 (all rec hits are invalid, only for STA trajectories),
102  // return ndof=ndof(invalid hits)
103  if(dof) {
104  int constr = bon ? 5 : 4;
105  return std::max(dof - constr, 0);
106  }
107  else {
108  // A STA can have < 5 (invalid) hits
109  // if this is the case ==> ndof = 1
110  // (to avoid divisions by 0)
111  int constr = bon ? 5 : 4;
112  return std::max(dofBad - constr, 1);
113  }
114 }
ConstRecHitContainer recHits() const
Definition: Trajectory.h:258
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:46
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:151
signed char Trajectory::nLoops ( ) const
inline

Definition at line 387 of file Trajectory.h.

References theNLoops.

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

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

Definition at line 190 of file Trajectory.cc.

190  {
191  updateBadForCCC(ccc_threshold);
192  return theNumberOfCCCBadHits_;
193 }
void updateBadForCCC(float ccc_threshold)
Definition: Trajectory.cc:175
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
Trajectory& Trajectory::operator= ( Trajectory const &  rh)
default
Trajectory& Trajectory::operator= ( Trajectory &&  rh)
inline

Definition at line 179 of file Trajectory.h.

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

179  {
180  using std::swap;
181  swap(theData,rh.theData);
184  theValid=rh.theValid;
187  theNLoops=rh.theNLoops;
194  swap(theSeed,rh.theSeed);
195  swap(seedRef_,rh.seedRef_);
196 
197  return *this;
198 
199  }
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
signed short theNumberOfLostHits
Definition: Trajectory.h:411
DataContainer theData
Definition: Trajectory.h:406
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
float theDPhiCache
Definition: Trajectory.h:418
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
void Trajectory::pop ( )

Remove the last measurement from the trajectory.

Definition at line 16 of file Trajectory.cc.

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

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

16  {
17  if (!empty()) {
18  if(theData.back().recHit()->isValid()) {
20  theChiSquared -= theData.back().estimate();
21  }
22  else if(lost(* (theData.back().recHit()) )) {
24  }
25  else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==DetId::Muon ) {
26  theChiSquaredBad -= theData.back().estimate();
27  }
28  else if(badForCCC(theData.back())) theNumberOfCCCBadHits_--;
29 
30  theData.pop_back();
31  }
32 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:299
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
signed short theNumberOfLostHits
Definition: Trajectory.h:411
DataContainer theData
Definition: Trajectory.h:406
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:162
float theChiSquared
Definition: Trajectory.h:407
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:151
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
static bool lost(const TrackingRecHit &hit)
Definition: Trajectory.cc:135
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 46 of file Trajectory.cc.

46  {
47  theData.push_back(tm); pushAux(chi2Increment);
48 }
void pushAux(double chi2Increment)
Definition: Trajectory.cc:55
DataContainer theData
Definition: Trajectory.h:406
void Trajectory::push ( TrajectoryMeasurement &&  tm)

Definition at line 40 of file Trajectory.cc.

40  {
41  push( tm, tm.estimate());
42 }
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:35
void Trajectory::push ( TrajectoryMeasurement &&  tm,
double  chi2Increment 
)

Definition at line 50 of file Trajectory.cc.

50  {
51  theData.push_back(tm); pushAux(chi2Increment);
52 }
void pushAux(double chi2Increment)
Definition: Trajectory.cc:55
DataContainer theData
Definition: Trajectory.h:406
void Trajectory::pushAux ( double  chi2Increment)
private

Definition at line 55 of file Trajectory.cc.

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

55  {
56  const TrajectoryMeasurement& tm = theData.back();
57  if ( tm.recHit()->isValid()) {
58  theChiSquared += chi2Increment;
60  }
61  // else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
62  else if (lost( *(tm.recHit()) ) ) {
64  }
65 
66  else if (isBad( *(tm.recHit()) ) && tm.recHit()->geographicalId().det()==DetId::Muon ) {
67  theChiSquaredBad += chi2Increment;
68  }
69 
70  else if (badForCCC(tm)) theNumberOfCCCBadHits_++;
71 
72  // in case of a Trajectory constructed without direction,
73  // determine direction from the radii of the first two measurements
74 
75  if ( !theDirectionValidity && theData.size() >= 2) {
76  if (theData[0].updatedState().globalPosition().perp2() <
77  theData.back().updatedState().globalPosition().perp2())
80  theDirectionValidity = true;
81  }
82 }
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
bool theDirectionValidity
Definition: Trajectory.h:415
ConstRecHitPointer const & recHit() const
signed short theNumberOfLostHits
Definition: Trajectory.h:411
DataContainer theData
Definition: Trajectory.h:406
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:162
PropagationDirection theDirection
Definition: Trajectory.h:414
float theChiSquared
Definition: Trajectory.h:407
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:151
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
static bool lost(const TrackingRecHit &hit)
Definition: Trajectory.cc:135
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 204 of file Trajectory.h.

References theData.

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

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

References alongMomentum, and oppositeToMomentum.

239  {
240  // reverse the direction (without changing it if it's not along or opposite)
243  // reverse the order of the hits
244  std::reverse(theData.begin(), theData.end());
245 }
DataContainer theData
Definition: Trajectory.h:406
PropagationDirection theDirection
Definition: Trajectory.h:414
TrajectorySeed const& Trajectory::seed ( ) const
inline
unsigned int Trajectory::seedNHits ( ) const
inline

Definition at line 295 of file Trajectory.h.

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

295 { return seed().nHits();}
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:330
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 361 of file Trajectory.h.

References seedRef_.

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

361 { return seedRef_; }
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
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 384 of file Trajectory.h.

References theDPhiCache.

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

Definition at line 363 of file Trajectory.h.

References seedRef(), and seedRef_.

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

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

Definition at line 374 of file Trajectory.h.

References seed(), and theSeed.

Referenced by BaseCkfTrajectoryBuilder::addToResult().

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

Definition at line 373 of file Trajectory.h.

References theSeed.

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

Definition at line 393 of file Trajectory.h.

References stopReason_.

393 {return stopReason_;}
StopReason stopReason_
Definition: Trajectory.h:421
void Trajectory::updateBadForCCC ( float  ccc_threshold)
private

Definition at line 175 of file Trajectory.cc.

References h.

175  {
176  // If the supplied threshold is the same as the currently cached
177  // one, then return the current number of bad hits for CCC,
178  // otherwise do a new full rescan.
179  if (ccc_threshold == theCCCThreshold_)
180  return;
181 
182  theCCCThreshold_ = ccc_threshold;
184  for (auto const & h : theData) {
185  if (badForCCC(h))
187  }
188 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
DataContainer theData
Definition: Trajectory.h:406
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:162
float theCCCThreshold_
Definition: Trajectory.h:419
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
void Trajectory::validRecHits ( ConstRecHitContainer cont) const

Just valid hits..

Definition at line 117 of file Trajectory.cc.

Referenced by NuclearTrackCorrector::getTrackFromTrajectory().

117  {
118  hits.reserve(foundHits());
119  for (Trajectory::DataContainer::const_iterator itm
120  = theData.begin(); itm != theData.end(); itm++)
121  if ((*itm).recHit()->isValid()) hits.push_back((*itm).recHit());
122 }
int foundHits() const
Definition: Trajectory.h:279
DataContainer theData
Definition: Trajectory.h:406

Member Data Documentation

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

Definition at line 404 of file Trajectory.h.

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

StopReason Trajectory::stopReason_
private

Definition at line 421 of file Trajectory.h.

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

float Trajectory::theCCCThreshold_
private

Definition at line 419 of file Trajectory.h.

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

float Trajectory::theChiSquared
private

Definition at line 407 of file Trajectory.h.

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

float Trajectory::theChiSquaredBad
private

Definition at line 408 of file Trajectory.h.

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

DataContainer Trajectory::theData
private
PropagationDirection Trajectory::theDirection
private

Definition at line 414 of file Trajectory.h.

Referenced by operator=().

bool Trajectory::theDirectionValidity
private

Definition at line 415 of file Trajectory.h.

Referenced by operator=().

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

Definition at line 420 of file Trajectory.h.

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

signed short Trajectory::theNumberOfCCCBadHits_
private

Definition at line 412 of file Trajectory.h.

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

signed short Trajectory::theNumberOfFoundHits
private

Definition at line 410 of file Trajectory.h.

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

signed short Trajectory::theNumberOfLostHits
private

Definition at line 411 of file Trajectory.h.

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

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

Definition at line 403 of file Trajectory.h.

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

bool Trajectory::theValid
private

Definition at line 416 of file Trajectory.h.

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