CMS 3D CMS Logo

Trajectory Class Reference

A class for detailed particle trajectory representation. More...

#include <TrackingTools/PatternTools/interface/Trajectory.h>

List of all members.

Public Types

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

Public Member Functions

double chiSquared () const
 Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.
TrajectoryMeasurement const & closestMeasurement (GlobalPoint) const
DataContainer const & data () const
 obsolete name, use measurements() instead.
PropagationDirection const & direction () const
 Direction of "growing" of the trajectory.
bool empty () const
 True if trajectory has no measurements.
TrajectoryMeasurement const & firstMeasurement () const
 Access to the first measurement.
int foundHits () const
 Number of valid RecHits used to determine the trajectory.
TrajectoryStateOnSurface geometricalInnermostState () const
void invalidate ()
 Method to invalidate a trajectory. Useful during ambiguity resolution.
bool isValid () const
 Returns true if the Trajectory is valid.
const DetLayerlastLayer () const
 Redundant method, returns the layer of lastMeasurement() .
TrajectoryMeasurement const & lastMeasurement () const
 Access to the last measurement.
int lostHits () const
 Number of detector layers crossed without valid RecHits.
DataContainer const & measurements () const
 Return all measurements in a container.
int ndof (bool bon=true) const
 Number of dof of the trajectory.
void pop ()
 Remove the last measurement from the trajectory.
void push (const TrajectoryMeasurement &tm, double chi2Increment)
 same as the one-argument push, but the trajectory Chi2 is incremented by chi2Increment.
void push (const TrajectoryMeasurement &tm)
 Add a new measurement to a Trajectory.
ConstRecHitContainer recHits (bool splitting=false) const
 Return all RecHits in a container.
void recHitsV (ConstRecHitContainer &cont, bool splitting=false) const
void reserve (unsigned int n)
 Reserves space in the vector to avoid lots of allocations when push_back-ing measurements.
TrajectorySeed const & seed () const
 Access to the seed used to reconstruct the Trajectory.
edm::RefToBase< TrajectorySeedseedRef (void) const
 return the Reference to the trajectory seed in the original seeds collection.
void setSeedRef (const edm::RefToBase< TrajectorySeed > &seedRef)
 Trajectory (const TrajectorySeed &seed, PropagationDirection dir)
 Constructor of an empty trajectory with defined direction.
 Trajectory (const TrajectorySeed &seed)
 Constructor of an empty trajectory with undefined direction.
 Trajectory ()
 Default constructor of an empty trajectory with undefined seed and undefined direction.
void validRecHits (ConstRecHitContainer &cont) const
 Just valid hits.

Static Public Member Functions

static bool inactive ()
 Definition of inactive Det from the Trajectory point of view.
static bool lost (const TransientTrackingRecHit &hit)
 Definition of what it means for a hit to be "lost".

Private Member Functions

void check () const

Private Attributes

edm::RefToBase< TrajectorySeedseedRef_
double theChiSquared
DataContainer theData
PropagationDirection theDirection
bool theDirectionValidity
int theNumberOfFoundHits
int theNumberOfLostHits
TrajectorySeed theSeed
bool theValid

Classes

struct  LessMag
 used to determine closest measurement to given point More...


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


Member Typedef Documentation

typedef TransientTrackingRecHit::ConstRecHitContainer Trajectory::ConstRecHitContainer

Definition at line 42 of file Trajectory.h.

typedef std::vector<TrajectoryMeasurement> Trajectory::DataContainer

Definition at line 41 of file Trajectory.h.

typedef ConstRecHitContainer Trajectory::RecHitContainer

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

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

00064                                           : 
00065     theChiSquared(0), theValid(true),
00066     theNumberOfFoundHits(0), theNumberOfLostHits(0),
00067     theDirection(alongMomentum), theDirectionValidity(false),
00068     theSeed(seed), seedRef_()
00069   {}

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

00075                                                                     : 
00076     theChiSquared(0), theValid(true),
00077     theNumberOfFoundHits(0), theNumberOfLostHits(0),
00078     theDirection(dir), theDirectionValidity(true),
00079     theSeed(seed), seedRef_()
00080   {}


Member Function Documentation

void Trajectory::check ( void   )  const [private]

Definition at line 158 of file Trajectory.cc.

References theData.

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

00158                              {
00159   if ( theData.empty()) 
00160     throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
00161 }

double Trajectory::chiSquared (  )  const [inline]

Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.

Definition at line 156 of file Trajectory.h.

References theChiSquared.

Referenced by SiStripGainFromData::algoAnalyze(), DAFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackAtPCA(), AlignmentMonitorTracksFromTrajectories::event(), cms::CompareTrajChi::operator()(), ConversionTrackFinder::ExtractChi2::operator()(), cms::CompareTrajLay::operator()(), DeDxDiscriminatorProducer::produce(), GroupedTrajCandLess::score(), GlobalTrajectoryBuilderBase::trackProbability(), and CosmicMuonTrajectoryBuilder::trajectories().

00156 { return theChiSquared;}

TrajectoryMeasurement const & Trajectory::closestMeasurement ( GlobalPoint  point  )  const

Definition at line 196 of file Trajectory.cc.

References begin, check(), end, iter, and measurements().

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

00196                                                                                     {
00197   check();
00198   vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().begin(), measurements().end(), LessMag(point) );
00199 
00200   return (*iter);
00201 }

DataContainer const& Trajectory::data ( void   )  const [inline]

obsolete name, use measurements() instead.

Definition at line 124 of file Trajectory.h.

References measurements().

Referenced by HICMeasurementEstimator::setCuts().

00124 { return measurements();}

PropagationDirection const & Trajectory::direction ( void   )  const

Direction of "growing" of the trajectory.

Possible values are alongMomentum (outwards) and oppositeToMomentum (inwards).

Definition at line 153 of file Trajectory.cc.

References Exception, theDirection, and theDirectionValidity.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), CkfDebugger::analyseRecHitNotFound(), GroupedCkfTrajectoryBuilder::backwardFit(), DAFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), MuonRoadTrajectoryBuilder::cleanTrajectory(), TrackLocalAngle::findPixelParameters(), KFSplittingFitter::fit(), NuclearTrackCorrector::getNewTrackExtra(), CRackTrajectoryBuilder::innerState(), TransientInitialStateEstimator::innerState(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), MillePedeAlignmentAlgorithm::orderedTsos(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), GroupedDAFHitCollector::recHits(), recHitsV(), GlobalTrajectoryBuilderBase::refitTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), sortTrajectoryMeasurements(), KFTrajectorySmoother::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), and trajectoryToResiduals().

00153                                                          {
00154   if (theDirectionValidity) return theDirection;
00155   else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
00156 }

bool Trajectory::empty ( void   )  const [inline]

True if trajectory has no measurements.

Definition at line 153 of file Trajectory.h.

References theData.

Referenced by BaseCkfTrajectoryBuilder::addToResult(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), CosmicMuonSmoother::initialState(), pop(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), CosmicMuonTrajectoryBuilder::selfDuplicate(), CosmicMuonSmoother::smooth(), KFTrajectorySmoother::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().

00153 { 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 116 of file Trajectory.h.

References check(), and theData.

Referenced by CkfDebugger::analyseCompatibleMeasurements(), GroupedCkfTrajectoryBuilder::backwardFit(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), DAFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), CosmicMuonTrajectoryBuilder::estimateDirection(), TrackLocalAngle::findPixelParameters(), KFTrajectoryFitter::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), geometricalInnermostState(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), TrackerToMuonPropagator::produce(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), GlobalTrajectoryBuilderBase::refitTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), and CosmicMuonTrajectoryBuilder::trajectories().

00116                                                          {
00117     check(); return theData.front();
00118   }

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

References theNumberOfFoundHits.

Referenced by SiStripGainFromData::algoAnalyze(), KFTrajectoryFitter::fit(), GsfTrajectoryFitter::fit(), MuonRoadTrajectoryBuilder::GatherHits(), CRackTrajectoryBuilder::innerState(), TransientInitialStateEstimator::innerState(), cms::CompareTrajChi::operator()(), TrajectoryLessByFoundHits::operator()(), cms::CompareTrajLay::operator()(), ConversionTrackFinder::ExtractNumOfHits::operator()(), DeDxDiscriminatorProducer::produce(), ThresholdPtTrajectoryFilter::qualityFilter(), CRackTrajectoryBuilder::qualityFilter(), CosmicTrajectoryBuilder::qualityFilter(), NuclearInteractionFinder::run(), GroupedTrajCandLess::score(), ThresholdPtTrajectoryFilter::toBeContinued(), MinPtTrajectoryFilter::toBeContinued(), KFTrajectorySmoother::trajectories(), StandAloneMuonTrajectoryBuilder::trajectories(), and validRecHits().

00143 { return theNumberOfFoundHits;}

TrajectoryStateOnSurface Trajectory::geometricalInnermostState (  )  const

Definition at line 179 of file Trajectory.cc.

References check(), closestMeasurement(), dot(), firstMeasurement(), lastMeasurement(), muonGeometry::mag(), muonGeometry::perp(), and TrajectoryMeasurement::updatedState().

Referenced by MuonTrackLoader::buildTrackAtPCA().

00179                                                                      {
00180 
00181   check();
00182 
00183   //if trajectory is in one half, return the end closer to origin point
00184   if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0
00185       && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
00186        lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() )  > 0 ) ) {
00187      return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ?
00188             firstMeasurement().updatedState() : lastMeasurement().updatedState();
00189   }
00190 
00191   //more complicated in case of traversing and low-pt trajectories with loops
00192   return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState();
00193 
00194 }

static bool Trajectory::inactive (  )  [inline, static]

Definition of inactive Det from the Trajectory point of view.

Definition at line 184 of file Trajectory.h.

00185                         {return false;}//FIXME

void Trajectory::invalidate (  )  [inline]

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 176 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

00176 { theValid = false;}

bool Trajectory::isValid ( void   )  const [inline]

Returns true if the Trajectory is valid.

Trajectories are invalidated e.g. during ambiguity resolution.

Definition at line 173 of file Trajectory.h.

References theValid.

Referenced by KFFittingSmoother::fit(), cms::CkfTrackCandidateMakerBase::produceBase(), ChargeSignificanceTrajectoryFilter::qualityFilter(), NuclearInteractionFinder::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), and CosmicMuonTrajectoryBuilder::trajectories().

00173 { return theValid;}

const DetLayer* Trajectory::lastLayer (  )  const [inline]

Redundant method, returns the layer of lastMeasurement() .

Definition at line 193 of file Trajectory.h.

References check(), and theData.

Referenced by CkfDebugger::analyseRecHitNotFound(), and CosmicMuonTrajectoryBuilder::trajectories().

00193                                     {
00194     check(); return theData.back().layer();
00195   }

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

References check(), and theData.

Referenced by BaseCkfTrajectoryBuilder::addToResult(), CkfDebugger::analyseCompatibleMeasurements(), CkfDebugger::analyseRecHitNotFound(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), DAFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), CosmicMuonTrajectoryBuilder::estimateDirection(), HICTrajectoryBuilder::findCompatibleMeasurements(), TrackLocalAngle::findPixelParameters(), CosmicMuonTrajectoryBuilder::flipTrajectory(), geometricalInnermostState(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), CkfDebugger::nextCorrectHits(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), MuonHIPAlignmentRefitter::produce(), GoodSeedProducer::produce(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), ThresholdPtTrajectoryFilter::qualityFilter(), StandAloneMuonRefitter::refit(), GlobalTrajectoryBuilderBase::refitTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::run(), CRackTrajectoryBuilder::SortHits(), ThresholdPtTrajectoryFilter::toBeContinued(), MinPtTrajectoryFilter::toBeContinued(), CosmicMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().

00106                                                         {
00107     check(); return theData.back();
00108   }

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 163 of file Trajectory.cc.

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

Referenced by pop(), push(), MaxConsecLostHitsTrajectoryFilter::TBC(), and HICTrajectoryBuilder::toBeContinued().

00164 {
00165   if ( hit.isValid()) return false;
00166   else {
00167   //     // A DetLayer is always inactive in this logic.
00168   //     // The DetLayer is the Det of an invalid RecHit only if no DetUnit 
00169   //     // is compatible with the predicted state, so we don't really expect
00170   //     // a hit in this case.
00171   
00172     if(hit.geographicalId().rawId() == 0) {return false;}
00173     else{
00174       return hit.getType() == TrackingRecHit::missing;
00175     }
00176   }
00177 }

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

References theNumberOfLostHits.

Referenced by GroupedTrajCandLess::score().

00150 { return theNumberOfLostHits;}

DataContainer const& Trajectory::measurements (  )  const [inline]

Return all measurements in a container.

Definition at line 122 of file Trajectory.h.

References theData.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), SiStripGainFromData::algoAnalyze(), CkfDebugger::analyseCompatibleMeasurements(), SiPixelTrackResidualSource::analyze(), MuonRoadTrajectoryBuilder::cleanTrajectory(), closestMeasurement(), data(), AlignmentMonitorTracksFromTrajectories::event(), AlignmentMonitorMuonHIP::event(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), HICTrajectoryBuilder::findCompatibleMeasurements(), TrackLocalAngle::findPixelParameters(), SiStripFineDelayTLA::findtrackangle(), CosmicMuonSmoother::fit(), CRackTrajectoryBuilder::innerState(), TransientInitialStateEstimator::innerState(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), MillePedeAlignmentAlgorithm::orderedTsos(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), GoodSeedProducer::produce(), reco::modules::CosmicTrackSplitter::produce(), TrackClusterRemover::produce(), DeDxDiscriminatorProducer::produce(), HICTrajectoryBuilder::qualityFilter(), SimpleDAFHitCollector::recHits(), GroupedDAFHitCollector::recHits(), TrajectoryCleanerMerger::reOrderMeasurements(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), NuclearInteractionFinder::run(), HIPAlignmentAlgorithm::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), GlobalTrajectoryBuilderBase::selectMuonHits(), GlobalMuonRefitter::selectMuonHits(), HICMeasurementEstimator::setCuts(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), TempTrajectory::TempTrajectory(), ClusterShapeTrajectoryFilter::toBeContinued(), KFTrajectorySmoother::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), trajectoryToResiduals(), and HICMuonUpdator::update().

00122 { 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 84 of file Trajectory.cc.

References max, and recHits().

Referenced by MuonTrackLoader::buildTrackAtPCA().

00084                                    {
00085   const Trajectory::RecHitContainer transRecHits = recHits();
00086   
00087   int dof = 0;
00088   
00089   for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
00090       rechit != transRecHits.end(); ++rechit)
00091     if ((*rechit)->isValid()) dof += (*rechit)->dimension();
00092   
00093   int constr = bon ? 5 : 4;
00094   return std::max(dof - constr, 0); 
00095 }

void Trajectory::pop ( void   ) 

Remove the last measurement from the trajectory.

Definition at line 12 of file Trajectory.cc.

References empty(), lost(), theData, theNumberOfFoundHits, and theNumberOfLostHits.

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

00012                      {
00013   if (!empty()) {
00014     if (theData.back().recHit()->isValid())             theNumberOfFoundHits--;
00015     else if(lost(* (theData.back().recHit()) )) theNumberOfLostHits--;
00016     theData.pop_back();
00017   }
00018 }

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 53 of file Trajectory.cc.

References alongMomentum, lost(), oppositeToMomentum, TrajectoryMeasurement::recHit(), theChiSquared, theData, theDirection, theDirectionValidity, theNumberOfFoundHits, and theNumberOfLostHits.

00054 {
00055   theData.push_back(tm);
00056   if ( tm.recHit()->isValid()) {
00057     theNumberOfFoundHits++;
00058    }
00059   //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
00060   else if (lost( *(tm.recHit()) ) )   theNumberOfLostHits++;
00061   
00062  
00063   theChiSquared += chi2Increment;
00064 
00065   // in case of a Trajectory constructed without direction, 
00066   // determine direction from the radii of the first two measurements
00067 
00068   if ( !theDirectionValidity && theData.size() >= 2) {
00069     if (theData[0].updatedState().globalPosition().perp() <
00070         theData.back().updatedState().globalPosition().perp())
00071       theDirection = alongMomentum;
00072     else theDirection = oppositeToMomentum;
00073     theDirectionValidity = true;
00074   }
00075 }

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 49 of file Trajectory.cc.

References TrajectoryMeasurement::estimate().

Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), RoadSearchTrackCandidateMakerAlgorithm::createSeedTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), KFFittingSmoother::fit(), GsfTrajectoryFitter::fit(), MuonRoadTrajectoryBuilder::GatherHits(), NuclearTrackCorrector::newTrajNeeded(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), GoodSeedProducer::produce(), TrackerToMuonPropagator::produce(), TrajectoryCleanerMerger::reOrderMeasurements(), TempTrajectory::toTrajectory(), KFTrajectorySmoother::trajectories(), and MuonTrajectoryUpdator::update().

00049                                                       {
00050   push( tm, tm.estimate());
00051 }

Trajectory::RecHitContainer Trajectory::recHits ( bool  splitting = false  )  const

Return all RecHits in a container.

Definition at line 77 of file Trajectory.cc.

References recHitsV().

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(), ndof(), cms::CompareTrajLay::operator()(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CRackTrajectoryBuilder::qualityFilter(), CosmicTrajectoryBuilder::qualityFilter(), StandAloneMuonRefitter::refit(), GlobalTrajectoryBuilderBase::refitTrajectory(), CosmicMuonTrajectoryBuilder::selfDuplicate(), and GlobalTrajectoryBuilderBase::trackProbability().

00077                                                                   {
00078   RecHitContainer hits;
00079   recHitsV(hits,splitting);
00080   return hits;
00081 }

void Trajectory::recHitsV ( ConstRecHitContainer cont,
bool  splitting = false 
) const

Definition at line 99 of file Trajectory.cc.

References alongMomentum, direction(), Exception, oppositeToMomentum, theData, and PV3DBase< T, PVType, FrameType >::z().

Referenced by recHits().

00099                                                                           {
00100   hits.reserve(theData.size());
00101   if(!splitting){  
00102     for (Trajectory::DataContainer::const_iterator itm
00103            = theData.begin(); itm != theData.end(); itm++){    
00104       hits.push_back((*itm).recHit());
00105     }
00106   }else{    
00107     for (Trajectory::DataContainer::const_iterator itm
00108            = theData.begin(); itm != theData.end(); itm++){    
00109 
00110       // ====== WARNING: this is a temporary solution =========
00111       //        all this part of code should be implemented internally 
00112       //        in the TrackingRecHit classes. The concrete types of rechit 
00113       //        should be transparent to the Trajectory class
00114 
00115       if( typeid(*(itm->recHit()->hit())) == typeid(SiStripMatchedRecHit2D)){
00116         LocalPoint firstLocalPos = 
00117           itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[0]->globalPosition());
00118         
00119         LocalPoint secondLocalPos = 
00120           itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[1]->globalPosition());
00121         
00122         LocalVector Delta = secondLocalPos - firstLocalPos;
00123         float scalar  = Delta.z() * (itm->updatedState().localDirection().z());
00124         
00125         if( (scalar>0 && direction()==alongMomentum) ||
00126             (scalar<0 && direction()==oppositeToMomentum)){
00127           hits.push_back(itm->recHit()->transientHits()[0]);
00128           hits.push_back(itm->recHit()->transientHits()[1]);
00129         }else if( (scalar>0 && direction()== oppositeToMomentum) ||
00130                   (scalar<0 && direction()== alongMomentum)){
00131           hits.push_back(itm->recHit()->transientHits()[1]);
00132           hits.push_back(itm->recHit()->transientHits()[0]);
00133         }else
00134           throw cms::Exception("Error in Trajectory::recHitsV(). Direction is not defined");    
00135       }else if(typeid(*(itm->recHit()->hit())) == typeid(ProjectedSiStripRecHit2D)){
00136         hits.push_back(itm->recHit()->transientHits()[0]);      
00137         // ===================================================================================  
00138       }else{
00139         hits.push_back(itm->recHit());
00140       }
00141     }//end loop on measurements
00142   }
00143 }

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

References theData.

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

00084 { theData.reserve(n); }

TrajectorySeed const& Trajectory::seed (  )  const [inline]

Access to the seed used to reconstruct the Trajectory.

Definition at line 179 of file Trajectory.h.

References theSeed.

Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), MuonRoadTrajectoryBuilder::cleanTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), KFTrajectoryFitter::fit(), CosmicMuonSmoother::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), CosmicMuonTrajectoryBuilder::flipTrajectory(), NuclearTrackCorrector::getTrackFromTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), StandAloneMuonRefitter::refit(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), KFTrajectorySmoother::trajectories(), and GsfTrajectorySmoother::trajectories().

00179 { 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 202 of file Trajectory.h.

References seedRef_.

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

00202 { return seedRef_; }

void Trajectory::setSeedRef ( const edm::RefToBase< TrajectorySeed > &  seedRef  )  [inline]

Definition at line 204 of file Trajectory.h.

References seedRef_.

Referenced by GlobalTrajectoryBuilderBase::addTraj(), TrackProducerAlgorithm< reco::Track >::buildTrack(), and TrackProducerAlgorithm< reco::GsfTrack >::buildTrack().

00204 { seedRef_ = seedRef ; } 

void Trajectory::validRecHits ( ConstRecHitContainer cont  )  const

Just valid hits.

Definition at line 145 of file Trajectory.cc.

References foundHits(), and theData.

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

00145                                                                {
00146   hits.reserve(foundHits());
00147   for (Trajectory::DataContainer::const_iterator itm
00148          = theData.begin(); itm != theData.end(); itm++)
00149     if ((*itm).recHit()->isValid()) hits.push_back((*itm).recHit());
00150 }


Member Data Documentation

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

Definition at line 233 of file Trajectory.h.

Referenced by seedRef(), and setSeedRef().

double Trajectory::theChiSquared [private]

Definition at line 223 of file Trajectory.h.

Referenced by chiSquared(), and push().

DataContainer Trajectory::theData [private]

Definition at line 222 of file Trajectory.h.

Referenced by check(), empty(), firstMeasurement(), lastLayer(), lastMeasurement(), measurements(), pop(), push(), recHitsV(), reserve(), and validRecHits().

PropagationDirection Trajectory::theDirection [private]

Definition at line 229 of file Trajectory.h.

Referenced by direction(), and push().

bool Trajectory::theDirectionValidity [private]

Definition at line 230 of file Trajectory.h.

Referenced by direction(), and push().

int Trajectory::theNumberOfFoundHits [private]

Definition at line 226 of file Trajectory.h.

Referenced by foundHits(), pop(), and push().

int Trajectory::theNumberOfLostHits [private]

Definition at line 227 of file Trajectory.h.

Referenced by lostHits(), pop(), and push().

TrajectorySeed Trajectory::theSeed [private]

Definition at line 232 of file Trajectory.h.

Referenced by seed().

bool Trajectory::theValid [private]

Definition at line 224 of file Trajectory.h.

Referenced by invalidate(), and isValid().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:19 2009 for CMSSW by  doxygen 1.5.4