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)
 
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)
 
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:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
bool theDirectionValidity
Definition: Trajectory.h:337
signed short theNumberOfLostHits
Definition: Trajectory.h:334
signed char theNLoops
Definition: Trajectory.h:341
float theDPhiCache
Definition: Trajectory.h:340
bool theValid
Definition: Trajectory.h:338
PropagationDirection theDirection
Definition: Trajectory.h:336
float theChiSquared
Definition: Trajectory.h:330
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:326
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
Trajectory::Trajectory ( const TrajectorySeed seed)
inline

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:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
bool theDirectionValidity
Definition: Trajectory.h:337
signed short theNumberOfLostHits
Definition: Trajectory.h:334
signed char theNLoops
Definition: Trajectory.h:341
float theDPhiCache
Definition: Trajectory.h:340
bool theValid
Definition: Trajectory.h:338
PropagationDirection theDirection
Definition: Trajectory.h:336
float theChiSquared
Definition: Trajectory.h:330
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:326
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
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:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
bool theDirectionValidity
Definition: Trajectory.h:337
signed short theNumberOfLostHits
Definition: Trajectory.h:334
signed char theNLoops
Definition: Trajectory.h:341
float theDPhiCache
Definition: Trajectory.h:340
bool theValid
Definition: Trajectory.h:338
PropagationDirection theDirection
Definition: Trajectory.h:336
float theChiSquared
Definition: Trajectory.h:330
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:326
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
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:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
bool theDirectionValidity
Definition: Trajectory.h:337
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:265
signed short theNumberOfLostHits
Definition: Trajectory.h:334
signed char theNLoops
Definition: Trajectory.h:341
float theDPhiCache
Definition: Trajectory.h:340
bool theValid
Definition: Trajectory.h:338
PropagationDirection theDirection
Definition: Trajectory.h:336
float theChiSquared
Definition: Trajectory.h:330
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:326
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
dbl *** dir
Definition: mlp_gen.cc:35

Member Function Documentation

void Trajectory::check ( void  ) const
private

Definition at line 200 of file Trajectory.cc.

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

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

Definition at line 269 of file Trajectory.cc.

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

Referenced by TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), and ConversionSeedFilter::getTSOS().

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

obsolete name, use measurements() instead.

Definition at line 205 of file Trajectory.h.

References measurements().

Referenced by HICMeasurementEstimator::setCuts().

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

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

Definition at line 195 of file Trajectory.cc.

References edm::hlt::Exception.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), CkfDebugger::analyseRecHitNotFound(), GroupedCkfTrajectoryBuilder::backwardFit(), FWTrackProxyBuilderFF::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), MuonRoadTrajectoryBuilder::cleanTrajectory(), GlobalTrackerMuonAlignment::debugTrajectory(), KFSplittingFitter::fit(), NuclearTrackCorrector::getNewTrackExtra(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), ConversionHitChecker::nHitsBeforeVtx(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), KfTrackProducerBase::putInEvt(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), sortTrajectoryMeasurements(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), KFTrajectorySmoother::trajectories(), and trajectoryToResiduals().

195  {
197  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
198 }
bool theDirectionValidity
Definition: Trajectory.h:337
PropagationDirection theDirection
Definition: Trajectory.h:336
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 312 of file Trajectory.h.

References theDPhiCache.

Referenced by GroupedTrajCandLess::score().

312 { return theDPhiCache;}
float theDPhiCache
Definition: Trajectory.h:340
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 194 of file Trajectory.h.

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

Referenced by CosmicTrajectoryBuilder::AddHit(), CkfDebugger::analyseCompatibleMeasurements(), GroupedCkfTrajectoryBuilder::backwardFit(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), KFTrajectoryFitter::fit(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), TransientInitialStateEstimator::innerState(), TrackerToMuonPropagator::produce(), KfTrackProducerBase::putInEvt(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CRackTrajectoryBuilder::run(), and CosmicMuonTrajectoryBuilder::trajectories().

194  {
195  check();
196  if (theData.front().recHit()->hit()!=0) return theData.front();
197  else if (theData.size()>2) return *(theData.begin()+1);
198  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
199  }
DataContainer theData
Definition: Trajectory.h:329
void check() const
Definition: Trajectory.cc:200
int Trajectory::foundHits ( ) const
inline
TrajectoryStateOnSurface Trajectory::geometricalInnermostState ( ) const

Definition at line 232 of file Trajectory.cc.

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

Referenced by MuonTrackLoader::buildTrackAtPCA().

232  {
233 
234  check();
235 
236  //if trajectory is in one half, return the end closer to origin point
237  if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0
238  && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
239  lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() ) > 0 ) ) {
240  return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ?
242  }
243 
244  //more complicated in case of traversing and low-pt trajectories with loops
245  return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState();
246 
247 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void check() const
Definition: Trajectory.cc:200
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:269
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
TrajectoryStateOnSurface updatedState() const
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
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.
static bool Trajectory::inactive ( )
inlinestatic

Definition of inactive Det from the Trajectory point of view.

Definition at line 270 of file Trajectory.h.

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

Definition at line 322 of file Trajectory.h.

References theNLoops.

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

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 262 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

262 { theValid = false;}
bool theValid
Definition: Trajectory.h:338
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 221 of file Trajectory.cc.

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

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

Definition at line 318 of file Trajectory.h.

References theNLoops.

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

Redundant method, returns the layer of lastMeasurement() .

Definition at line 284 of file Trajectory.h.

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

Referenced by CkfDebugger::analyseRecHitNotFound().

284  {
285  check();
286  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
287  else if (theData.size()>2) return (theData.end()-2)->layer();
288  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
289  }
DataContainer theData
Definition: Trajectory.h:329
void check() const
Definition: Trajectory.cc:200
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 181 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(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), HICTrajectoryBuilder::findCompatibleMeasurements(), CosmicMuonTrajectoryBuilder::flipTrajectory(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), CkfDebugger::nextCorrectHits(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), KfTrackProducerBase::putInEvt(), GsfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), MinPtTrajectoryFilter::qualityFilter(), ThresholdPtTrajectoryFilter::qualityFilter(), HICTrajectoryBuilder::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::run(), StandAloneMuonRefitter::singleRefit(), CRackTrajectoryBuilder::SortHits(), MinPtTrajectoryFilter::toBeContinued(), ThresholdPtTrajectoryFilter::toBeContinued(), StandAloneMuonTrajectoryBuilder::trajectories(), and CosmicMuonTrajectoryBuilder::trajectories().

181  {
182  check();
183  if (theData.back().recHit()->hit()!=0) return theData.back();
184  else if (theData.size()>2) return *(theData.end()-2);
185  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
186  }
DataContainer theData
Definition: Trajectory.h:329
void check() const
Definition: Trajectory.cc:200
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 205 of file Trajectory.cc.

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

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

206 {
207  if ( hit.isValid()) return false;
208  else {
209  // // A DetLayer is always inactive in this logic.
210  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
211  // // is compatible with the predicted state, so we don't really expect
212  // // a hit in this case.
213 
214  if(hit.geographicalId().rawId() == 0) {return false;}
215  else{
216  return hit.getType() == TrackingRecHit::missing;
217  }
218  }
219 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
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 231 of file Trajectory.h.

References theNumberOfLostHits.

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

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

Return all measurements in a container.

Definition at line 203 of file Trajectory.h.

References theData.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), BaseCkfTrajectoryBuilder::addToResult(), DeDxDiscriminatorLearner::algoAnalyze(), SiStripGainFromData::algoAnalyze(), CkfDebugger::analyseCompatibleMeasurements(), SiPixelLorentzAngle::analyze(), FWTrackProxyBuilderFF::buildTrack(), KFFittingSmoother::checkForNans(), MuonRoadTrajectoryBuilder::cleanTrajectory(), MuonTrackResidualAnalyzer::computeResolution(), StandAloneMuonFilter::createDefaultTrajectory(), data(), EnergyLossPlain::estimate(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), AlignmentMonitorTracksFromTrajectories::event(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), TrackerValidationVariables::fillHitQuantities(), MuonKinkFinder::fillTrkKink(), DynamicTruncation::filter(), HICTrajectoryBuilder::findCompatibleMeasurements(), SiStripFineDelayTLA::findtrackangle(), CosmicMuonSmoother::fit(), TransientInitialStateEstimator::innerState(), CRackTrajectoryBuilder::innerState(), GlobalTrackQualityProducer::kink(), MuonResidualsFromTrack::MuonResidualsFromTrack(), GlobalTrackQualityProducer::newChi2(), ConversionHitChecker::nHitsBeforeVtx(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), PlotRecTracks::printRecTracks(), ShallowTrackClustersProducer::produce(), HLTTrackClusterRemover::produce(), TrackClusterRemover::produce(), TkAlCaOverlapTagger::produce(), DeDxDiscriminatorProducer::produce(), TrackClusterSplitter::produce(), ShallowGainCalibration::produce(), reco::modules::CosmicTrackSplitter::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), HICTrajectoryBuilder::qualityFilter(), TrajectoryCleanerMerger::reOrderMeasurements(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), MuonMillepedeAlgorithm::run(), HIPAlignmentAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), CSCOverlapsAlignmentAlgorithm::run(), NuclearInteractionFinder::run(), GlobalMuonRefitter::selectMuonHits(), HICMeasurementEstimator::setCuts(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), TempTrajectory::TempTrajectory(), ClusterShapeTrajectoryFilter::toBeContinued(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), KFTrajectorySmoother::trajectories(), trajectoryToResiduals(), and HICMuonUpdator::update().

203 { return theData;}
DataContainer theData
Definition: Trajectory.h:329
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:221
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
signed char Trajectory::nLoops ( ) const
inline

Definition at line 319 of file Trajectory.h.

References theNLoops.

Referenced by GroupedCkfTrajectoryBuilder::backwardFit().

319 {return theNLoops;}
signed char theNLoops
Definition: Trajectory.h:341
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(), TrajectoryCleanerMerger::reOrderMeasurements(), 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:234
float theChiSquaredBad
Definition: Trajectory.h:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:205
signed short theNumberOfLostHits
Definition: Trajectory.h:334
DataContainer theData
Definition: Trajectory.h:329
float theChiSquared
Definition: Trajectory.h:330
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:221
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:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
bool theDirectionValidity
Definition: Trajectory.h:337
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:205
signed short theNumberOfLostHits
Definition: Trajectory.h:334
ConstRecHitPointer recHit() const
DataContainer theData
Definition: Trajectory.h:329
PropagationDirection theDirection
Definition: Trajectory.h:336
float theChiSquared
Definition: Trajectory.h:330
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:221
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")) << "\n";
162  hits.push_back(hitA);
163  hits.push_back(hitB);
164  }
165  }else if(typeid(*(itm->recHit()->hit())) == typeid(ProjectedSiStripRecHit2D)){
166  //hits.push_back(itm->recHit()->transientHits()[0]); //Use 2D SiStripRecHit
167  if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
168  hits.push_back(itm->recHit()->transientHits()[0]->transientHits()[0]); //Use 1D SiStripRecHit
169  }else{
170  hits.push_back(itm->recHit()->transientHits()[0]); //Use 2D SiStripRecHit
171  }
172  // ===================================================================================
173  }else if(typeid(*(itm->recHit()->hit())) == typeid(SiStripRecHit2D)){
174  //hits.push_back(itm->recHit()); //Use 2D SiStripRecHit
175  if(!itm->recHit()->detUnit()->type().isEndcap()){
176  hits.push_back(itm->recHit()->transientHits()[0]); //Use 1D SiStripRecHit
177  }else{
178  hits.push_back(itm->recHit()); //Use 2D SiStripRecHit
179  }
180  }else{
181  hits.push_back(itm->recHit());
182  }
183  }//end loop on measurements
184  }
185 }
DataContainer theData
Definition: Trajectory.h:329
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
T z() const
Definition: PV3DBase.h:63
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .
Definition: matutil.cc:184
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 159 of file Trajectory.h.

References theData.

Referenced by StandAloneMuonFilter::createDefaultTrajectory(), KFTrajectoryFitter::fit(), TempTrajectory::toTrajectory(), and KFTrajectorySmoother::trajectories().

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

References alongMomentum, and oppositeToMomentum.

276  {
277  // reverse the direction (without changing it if it's not along or opposite)
280  // reverse the order of the hits
281  std::reverse(theData.begin(), theData.end());
282 }
DataContainer theData
Definition: Trajectory.h:329
PropagationDirection theDirection
Definition: Trajectory.h:336
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 296 of file Trajectory.h.

References seedRef_.

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

296 { return seedRef_; }
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
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 316 of file Trajectory.h.

References theDPhiCache.

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

Definition at line 298 of file Trajectory.h.

References seedRef(), and seedRef_.

Referenced by GlobalTrajectoryBuilderBase::build(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), and cms::CkfTrackCandidateMakerBase::produceBase().

298 { seedRef_ = seedRef ; }
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:296
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
const boost::shared_ptr<const TrajectorySeed>& Trajectory::sharedSeed ( ) const
inline

Definition at line 308 of file Trajectory.h.

References theSeed.

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

Just valid hits..

Definition at line 187 of file Trajectory.cc.

Referenced by TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), and NuclearTrackCorrector::getTrackFromTrajectory().

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

Member Data Documentation

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

Definition at line 327 of file Trajectory.h.

Referenced by seedRef(), and setSeedRef().

float Trajectory::theChiSquared
private

Definition at line 330 of file Trajectory.h.

Referenced by chiSquared().

float Trajectory::theChiSquaredBad
private

Definition at line 331 of file Trajectory.h.

Referenced by chiSquared().

DataContainer Trajectory::theData
private

Definition at line 329 of file Trajectory.h.

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

PropagationDirection Trajectory::theDirection
private

Definition at line 336 of file Trajectory.h.

bool Trajectory::theDirectionValidity
private

Definition at line 337 of file Trajectory.h.

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

Definition at line 341 of file Trajectory.h.

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

signed short Trajectory::theNumberOfFoundHits
private

Definition at line 333 of file Trajectory.h.

Referenced by chiSquared(), and foundHits().

signed short Trajectory::theNumberOfLostHits
private

Definition at line 334 of file Trajectory.h.

Referenced by lostHits().

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

Definition at line 326 of file Trajectory.h.

Referenced by seed(), and sharedSeed().

bool Trajectory::theValid
private

Definition at line 338 of file Trajectory.h.

Referenced by invalidate(), and isValid().