#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. | |
PropagationDirection const & | direction () const |
float | dPhiCacheForLoopersReconstruction () const |
bool | empty () const |
True if trajectory has no measurements. | |
TrajectoryMeasurement const & | firstMeasurement () const |
int | foundHits () const |
TrajectoryStateOnSurface | geometricalInnermostState () const |
void | incrementLoops () |
void | invalidate () |
Method to invalidate a trajectory. Useful during ambiguity resolution. | |
bool | isLooper () const |
bool | isValid () const |
const DetLayer * | lastLayer () const |
Redundant method, returns the layer of lastMeasurement() . | |
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. | |
edm::RefToBase< TrajectorySeed > | seedRef (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 boost::shared_ptr< const TrajectorySeed > &seed, PropagationDirection dir) | |
Trajectory (const TrajectorySeed &seed) | |
Trajectory (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< TrajectorySeed > | seedRef_ |
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 |
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.
Definition at line 43 of file Trajectory.h.
typedef std::vector<TrajectoryMeasurement> Trajectory::DataContainer |
Definition at line 42 of file Trajectory.h.
Definition at line 44 of file Trajectory.h.
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.
: theSeed(), seedRef_(), theChiSquared(0), theChiSquaredBad(0), theNumberOfFoundHits(0), theNumberOfLostHits(0), theDirection(alongMomentum), theDirectionValidity(false), theValid(true),theDPhiCache(0),theNLoops(0) {}
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.
: theSeed( new TrajectorySeed(seed) ), seedRef_(), theChiSquared(0), theChiSquaredBad(0), theNumberOfFoundHits(0), theNumberOfLostHits(0), theDirection(alongMomentum), theDirectionValidity(false), theValid(true),theDPhiCache(0),theNLoops(0) {}
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.
: theSeed( new TrajectorySeed(seed) ), seedRef_(), theChiSquared(0), theChiSquaredBad(0), theNumberOfFoundHits(0), theNumberOfLostHits(0), theDirection(dir), theDirectionValidity(true), theValid(true),theDPhiCache(0),theNLoops(0) {}
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.
: theSeed( seed ), seedRef_(), theChiSquared(0), theChiSquaredBad(0), theNumberOfFoundHits(0), theNumberOfLostHits(0), theDirection(dir), theDirectionValidity(true), theValid(true),theDPhiCache(0),theNLoops(0) {}
void Trajectory::check | ( | void | ) | const [private] |
Definition at line 200 of file Trajectory.cc.
Referenced by firstMeasurement(), lastLayer(), and lastMeasurement().
{ if ( theData.empty()) throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory"); }
double Trajectory::chiSquared | ( | ) | const [inline] |
Definition at line 242 of file Trajectory.h.
References theChiSquared, theChiSquaredBad, and theNumberOfFoundHits.
Referenced by CRackTrajectoryBuilder::AddHit(), SiStripGainFromData::algoAnalyze(), SiPixelLorentzAngle::analyze(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackAtPCA(), GlobalTrackerMuonAlignment::debugTrajectory(), AlignmentMonitorTracksFromTrajectories::event(), cms::CompareTrajChi::operator()(), ConversionTrackFinder::ExtractChi2::operator()(), cms::CompareTrajLay::operator()(), GroupedTrajCandLess::score(), GlobalTrajectoryBuilderBase::trackProbability(), GlobalTrackQualityProducer::trackProbability(), and CosmicMuonTrajectoryBuilder::trajectories().
{ return (theNumberOfFoundHits ? theChiSquared : theChiSquaredBad);}
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().
{ check(); vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().begin(), measurements().end(), LessMag(point) ); return (*iter); }
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().
{ return measurements();}
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 Exception.
Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), CkfDebugger::analyseRecHitNotFound(), GroupedCkfTrajectoryBuilder::backwardFit(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), MuonRoadTrajectoryBuilder::cleanTrajectory(), GlobalTrackerMuonAlignment::debugTrajectory(), KFSplittingFitter::fit(), NuclearTrackCorrector::getNewTrackExtra(), CRackTrajectoryBuilder::innerState(), TransientInitialStateEstimator::innerState(), ConversionHitChecker::nHitsBeforeVtx(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), sortTrajectoryMeasurements(), KFTrajectorySmoother::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), and trajectoryToResiduals().
{ if (theDirectionValidity) return theDirection; else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set"); }
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().
{ return theDPhiCache;}
bool Trajectory::empty | ( | void | ) | const [inline] |
True if trajectory has no measurements.
Definition at line 234 of file Trajectory.h.
References theData.
Referenced by BaseCkfTrajectoryBuilder::addToResult(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), CosmicMuonSmoother::initialState(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), CosmicMuonTrajectoryBuilder::selfDuplicate(), CosmicMuonSmoother::smooth(), KFTrajectorySmoother::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().
{ return theData.empty();}
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(), Exception, and theData.
Referenced by CRackTrajectoryBuilder::AddHit(), CkfDebugger::analyseCompatibleMeasurements(), GroupedCkfTrajectoryBuilder::backwardFit(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), KFTrajectoryFitter::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), TransientInitialStateEstimator::innerState(), TrackerToMuonPropagator::produce(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), and CosmicMuonTrajectoryBuilder::trajectories().
int Trajectory::foundHits | ( | ) | const [inline] |
Number of valid RecHits used to determine the trajectory. Can be less than the number of measurements in data() since detector layers crossed without using RecHits from them are also stored as measurements.
Definition at line 224 of file Trajectory.h.
References theNumberOfFoundHits.
Referenced by CRackTrajectoryBuilder::AddHit(), BaseCkfTrajectoryBuilder::addToResult(), SiStripGainFromData::algoAnalyze(), KalmanAlignmentTrackRefitter::debugTrackData(), GlobalTrackerMuonAlignment::debugTrajectory(), KFTrajectoryFitter::fit(), GsfTrajectoryFitter::fit(), MuonRoadTrajectoryBuilder::GatherHits(), CRackTrajectoryBuilder::innerState(), cms::CompareTrajChi::operator()(), TrajectoryLessByFoundHits::operator()(), cms::CompareTrajLay::operator()(), ConversionTrackFinder::ExtractNumOfHits::operator()(), ThresholdPtTrajectoryFilter::qualityFilter(), MinPtTrajectoryFilter::qualityFilter(), CRackTrajectoryBuilder::qualityFilter(), CosmicTrajectoryBuilder::qualityFilter(), NuclearInteractionFinder::run(), GroupedTrajCandLess::score(), ThresholdPtTrajectoryFilter::toBeContinued(), MinPtTrajectoryFilter::toBeContinued(), KFTrajectorySmoother::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().
{ return theNumberOfFoundHits;}
TrajectoryStateOnSurface Trajectory::geometricalInnermostState | ( | ) | const |
Definition at line 232 of file Trajectory.cc.
References CastorDataFrameFilter_impl::check(), dot(), mag(), and perp().
Referenced by MuonTrackLoader::buildTrackAtPCA().
{ check(); //if trajectory is in one half, return the end closer to origin point if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0 && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) * lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() ) > 0 ) ) { return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ? firstMeasurement().updatedState() : lastMeasurement().updatedState(); } //more complicated in case of traversing and low-pt trajectories with loops return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState(); }
static bool Trajectory::inactive | ( | ) | [inline, static] |
Definition of inactive Det from the Trajectory point of view.
Definition at line 270 of file Trajectory.h.
{return false;}//FIXME
void Trajectory::incrementLoops | ( | ) | [inline] |
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().
{ theValid = false;}
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 cond::ecalcond::bad(), TrackingRecHit::geographicalId(), TrackingRecHit::getType(), TrackingRecHit::isValid(), and DetId::rawId().
{ if ( hit.isValid()) return false; else { if(hit.geographicalId().rawId() == 0) {return false;} else{ return hit.getType() == TrackingRecHit::bad; } } }
bool Trajectory::isLooper | ( | ) | const [inline] |
bool Trajectory::isValid | ( | void | ) | const [inline] |
Returns true if the Trajectory is valid. Trajectories are invalidated e.g. during ambiguity resolution.
Definition at line 259 of file Trajectory.h.
References theValid.
Referenced by GlobalTrackerMuonAlignment::debugTrajectory(), KFFittingSmoother::fit(), cms::CkfTrackCandidateMakerBase::produceBase(), ChargeSignificanceTrajectoryFilter::qualityFilter(), NuclearInteractionFinder::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), and CosmicMuonTrajectoryBuilder::trajectories().
{ return theValid;}
const DetLayer* Trajectory::lastLayer | ( | ) | const [inline] |
Redundant method, returns the layer of lastMeasurement() .
Definition at line 284 of file Trajectory.h.
References check(), Exception, and theData.
Referenced by CkfDebugger::analyseRecHitNotFound().
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(), Exception, and theData.
Referenced by 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(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), ThresholdPtTrajectoryFilter::qualityFilter(), MinPtTrajectoryFilter::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::run(), StandAloneMuonRefitter::singleRefit(), CRackTrajectoryBuilder::SortHits(), ThresholdPtTrajectoryFilter::toBeContinued(), MinPtTrajectoryFilter::toBeContinued(), CosmicMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().
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(), combine::missing, and DetId::rawId().
Referenced by FastTrackMerger::produce(), MaxConsecLostHitsTrajectoryFilter::TBC(), and HICTrajectoryBuilder::toBeContinued().
{ if ( hit.isValid()) return false; else { // // A DetLayer is always inactive in this logic. // // The DetLayer is the Det of an invalid RecHit only if no DetUnit // // is compatible with the predicted state, so we don't really expect // // a hit in this case. if(hit.geographicalId().rawId() == 0) {return false;} else{ return hit.getType() == TrackingRecHit::missing; } } }
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().
{ return theNumberOfLostHits;}
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(), SiPixelTrackResidualSource::analyze(), SiPixelLorentzAngle::analyze(), MuonRoadTrajectoryBuilder::cleanTrajectory(), StandAloneMuonFilter::createDefaultTrajectory(), data(), VertexTrackCompatibilityEstimator< 5 >::estimate(), AlignmentMonitorTracksFromTrajectories::event(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), TrackerValidationVariables::fillHitQuantities(), MuonKinkFinder::fillTrkKink(), DynamicTruncation::filter(), HICTrajectoryBuilder::findCompatibleMeasurements(), SiStripFineDelayTLA::findtrackangle(), CosmicMuonSmoother::fit(), CRackTrajectoryBuilder::innerState(), TransientInitialStateEstimator::innerState(), GlobalTrackQualityProducer::kink(), MuonResidualsFromTrack::MuonResidualsFromTrack(), GlobalTrackQualityProducer::newChi2(), ConversionHitChecker::nHitsBeforeVtx(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), PlotRecTracks::printRecTracks(), HLTTrackClusterRemover::produce(), reco::modules::CosmicTrackSplitter::produce(), TrackClusterSplitter::produce(), ShallowTrackClustersProducer::produce(), TkAlCaOverlapTagger::produce(), TrackClusterRemover::produce(), DeDxDiscriminatorProducer::produce(), ShallowGainCalibration::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), HICTrajectoryBuilder::qualityFilter(), TrajectoryCleanerMerger::reOrderMeasurements(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), CSCOverlapsAlignmentAlgorithm::run(), NuclearInteractionFinder::run(), HIPAlignmentAlgorithm::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::run(), MuonMillepedeAlgorithm::run(), GlobalTrajectoryBuilderBase::selectMuonHits(), HICMeasurementEstimator::setCuts(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), TempTrajectory::TempTrajectory(), ClusterShapeTrajectoryFilter::toBeContinued(), KFTrajectorySmoother::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), trajectoryToResiduals(), and HICMuonUpdator::update().
{ return theData;}
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(), GlobalTrajectoryBuilderBase::trackProbability(), and GlobalTrackQualityProducer::trackProbability().
{ const Trajectory::RecHitContainer transRecHits = recHits(); int dof = 0; int dofBad = 0; for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin(); rechit != transRecHits.end(); ++rechit) { if((*rechit)->isValid()) dof += (*rechit)->dimension(); else if( isBad(**rechit) && (*rechit)->geographicalId().det()==DetId::Muon ) dofBad += (*rechit)->dimension(); } // If dof!=0 (there is at least 1 valid hit), // return ndof=ndof(fit) // If dof=0 (all rec hits are invalid, only for STA trajectories), // return ndof=ndof(invalid hits) if(dof) { int constr = bon ? 5 : 4; return std::max(dof - constr, 0); } else { // A STA can have < 5 (invalid) hits // if this is the case ==> ndof = 1 // (to avoid divisions by 0) int constr = bon ? 5 : 4; return std::max(dofBad - constr, 1); } }
signed char Trajectory::nLoops | ( | ) | const [inline] |
Definition at line 319 of file Trajectory.h.
References theNLoops.
Referenced by GroupedCkfTrajectoryBuilder::backwardFit().
{return theNLoops;}
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().
{ if (!empty()) { if(theData.back().recHit()->isValid()) { theNumberOfFoundHits--; theChiSquared -= theData.back().estimate(); } else if(lost(* (theData.back().recHit()) )) { theNumberOfLostHits--; } else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==DetId::Muon ) { theChiSquaredBad -= theData.back().estimate(); } theData.pop_back(); } }
void Trajectory::push | ( | const TrajectoryMeasurement & | tm | ) |
Add a new measurement to a Trajectory. The Chi2 of the trajectory is incremented by the value of tm.estimate() .
Definition at line 35 of file Trajectory.cc.
References TrajectoryMeasurement::estimate().
Referenced by CRackTrajectoryBuilder::AddHit(), GroupedCkfTrajectoryBuilder::backwardFit(), MuonRoadTrajectoryBuilder::cleanTrajectory(), StandAloneMuonFilter::createDefaultTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::createSeedTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), KFFittingSmoother::fit(), GsfTrajectoryFitter::fit(), MuonRoadTrajectoryBuilder::GatherHits(), NuclearTrackCorrector::newTrajNeeded(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), MuonMillepedeTrackRefitter::produce(), TrackerToMuonPropagator::produce(), CSCOverlapsTrackPreparation::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), TrajectoryCleanerMerger::reOrderMeasurements(), sortTrajectoryMeasurements(), TempTrajectory::toTrajectory(), KFTrajectorySmoother::trajectories(), TrackTransformer::transform(), and MuonTrajectoryUpdator::update().
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().
{ theData.push_back(tm); if ( tm.recHit()->isValid()) { theChiSquared += chi2Increment; theNumberOfFoundHits++; } // else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++; else if (lost( *(tm.recHit()) ) ) { theNumberOfLostHits++; } else if (isBad( *(tm.recHit()) ) && tm.recHit()->geographicalId().det()==DetId::Muon ) { theChiSquaredBad += chi2Increment; } // in case of a Trajectory constructed without direction, // determine direction from the radii of the first two measurements if ( !theDirectionValidity && theData.size() >= 2) { if (theData[0].updatedState().globalPosition().perp() < theData.back().updatedState().globalPosition().perp()) theDirection = alongMomentum; else theDirection = oppositeToMomentum; theDirectionValidity = true; } }
Trajectory::RecHitContainer Trajectory::recHits | ( | bool | splitting = false | ) | const |
Return all RecHits in a container.
Definition at line 67 of file Trajectory.cc.
Referenced by CachingSeedCleanerByHitPosition::add(), SiStripGainFromData::algoAnalyze(), GroupedCkfTrajectoryBuilder::backwardFit(), MuonTrackLoader::buildTrackExtra(), CkfDebugger::correctTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), CosmicMuonTrajectoryBuilder::flipTrajectory(), CosmicMuonTrajectoryBuilder::getDirectionByTime(), CosmicMuonUtilities::isTraversing(), cms::CompareTrajLay::operator()(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CRackTrajectoryBuilder::qualityFilter(), CosmicTrajectoryBuilder::qualityFilter(), StandAloneMuonRefitter::refit(), CosmicMuonTrajectoryBuilder::selfDuplicate(), and StandAloneMuonRefitter::singleRefit().
{ RecHitContainer hits; recHitsV(hits,splitting); return hits; }
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().
{ hits.reserve(theData.size()); if(!splitting){ for (Trajectory::DataContainer::const_iterator itm = theData.begin(); itm != theData.end(); itm++){ hits.push_back((*itm).recHit()); } }else{ for (Trajectory::DataContainer::const_iterator itm = theData.begin(); itm != theData.end(); itm++){ // ====== WARNING: this is a temporary solution ========= // all this part of code should be implemented internally // in the TrackingRecHit classes. The concrete types of rechit // should be transparent to the Trajectory class if( typeid(*(itm->recHit()->hit())) == typeid(SiStripMatchedRecHit2D)){ LocalPoint firstLocalPos = itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[0]->globalPosition()); LocalPoint secondLocalPos = itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[1]->globalPosition()); LocalVector Delta = secondLocalPos - firstLocalPos; float scalar = Delta.z() * (itm->updatedState().localDirection().z()); TransientTrackingRecHit::ConstRecHitPointer hitA, hitB; // Get 2D strip Hits from a matched Hit. //hitA = itm->recHit()->transientHits()[0]; //hitB = itm->recHit()->transientHits()[1]; // Get 2D strip Hits from a matched Hit. Then get the 1D hit from the 2D hit if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){ hitA = itm->recHit()->transientHits()[0]->transientHits()[0]; hitB = itm->recHit()->transientHits()[1]->transientHits()[0]; }else{ //don't use 1D hit in the endcap yet hitA = itm->recHit()->transientHits()[0]; hitB = itm->recHit()->transientHits()[1]; } if( (scalar>=0 && direction()==alongMomentum) || (scalar<0 && direction()==oppositeToMomentum)){ hits.push_back(hitA); hits.push_back(hitB); }else if( (scalar>=0 && direction()== oppositeToMomentum) || (scalar<0 && direction()== alongMomentum)){ hits.push_back(hitB); hits.push_back(hitA); }else { //throw cms::Exception("Error in Trajectory::recHitsV(). Direction is not defined"); edm::LogError("Trajectory_recHitsV_UndefinedTrackDirection") << "Error in Trajectory::recHitsV: scalar = " << scalar << ", direction = " << (direction()==alongMomentum ? "along" : (direction()==oppositeToMomentum ? "opposite" : "undefined")) << "\n"; hits.push_back(hitA); hits.push_back(hitB); } }else if(typeid(*(itm->recHit()->hit())) == typeid(ProjectedSiStripRecHit2D)){ //hits.push_back(itm->recHit()->transientHits()[0]); //Use 2D SiStripRecHit if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){ hits.push_back(itm->recHit()->transientHits()[0]->transientHits()[0]); //Use 1D SiStripRecHit }else{ hits.push_back(itm->recHit()->transientHits()[0]); //Use 2D SiStripRecHit } // =================================================================================== }else if(typeid(*(itm->recHit()->hit())) == typeid(SiStripRecHit2D)){ //hits.push_back(itm->recHit()); //Use 2D SiStripRecHit if(!itm->recHit()->detUnit()->type().isEndcap()){ hits.push_back(itm->recHit()->transientHits()[0]); //Use 1D SiStripRecHit }else{ hits.push_back(itm->recHit()); //Use 2D SiStripRecHit } }else{ hits.push_back(itm->recHit()); } }//end loop on measurements } }
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().
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.
{ // reverse the direction (without changing it if it's not along or opposite) if (theDirection == alongMomentum) theDirection = oppositeToMomentum; else if (theDirection == oppositeToMomentum) theDirection = alongMomentum; // reverse the order of the hits std::reverse(theData.begin(), theData.end()); }
TrajectorySeed const& Trajectory::seed | ( | ) | const [inline] |
Access to the seed used to reconstruct the Trajectory.
Definition at line 265 of file Trajectory.h.
References theSeed.
Referenced by CRackTrajectoryBuilder::AddHit(), GroupedCkfTrajectoryBuilder::backwardFit(), MuonRoadTrajectoryBuilder::cleanTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), CosmicMuonTrajectoryBuilder::flipTrajectory(), NuclearTrackCorrector::getTrackFromTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), StandAloneMuonRefitter::singleRefit(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), KFTrajectorySmoother::trajectories(), and GsfTrajectorySmoother::trajectories().
{ return *theSeed;}
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(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), and setSeedRef().
{ return seedRef_; }
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.
{ theDPhiCache = dphi;}
void Trajectory::setNLoops | ( | signed char | value | ) | [inline] |
Definition at line 321 of file Trajectory.h.
References theNLoops, and relativeConstraints::value.
Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), cms::CkfTrackCandidateMakerBase::produceBase(), and TempTrajectory::toTrajectory().
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::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), and cms::CkfTrackCandidateMakerBase::produceBase().
const boost::shared_ptr<const TrajectorySeed>& Trajectory::sharedSeed | ( | ) | const [inline] |
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().
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] |
Definition at line 340 of file Trajectory.h.
Referenced by dPhiCacheForLoopersReconstruction(), and setDPhiCacheForLoopersReconstruction().
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().