#include <TrackingTools/PatternTools/interface/TempTrajectory.h>
Public Types | |
typedef TransientTrackingRecHit::ConstRecHitContainer | ConstRecHitContainer |
typedef cmsutils::bqueue < 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. | |
PropagationDirection | direction () const |
Direction of "growing" of the trajectory. | |
bool | empty () const |
True if trajectory has no measurements. | |
const TrajectoryMeasurement & | firstMeasurement () const |
Access to the first measurement. | |
int | foundHits () const |
obsolete name, use measurements() instead. | |
void | invalidate () |
Method to invalidate a trajectory. Useful during ambiguity resolution. | |
bool | isValid () const |
Returns true if the Trajectory is valid. | |
const DetLayer * | lastLayer () const |
Redundant method, returns the layer of lastMeasurement() . | |
const TrajectoryMeasurement & | lastMeasurement () const |
Access to the last measurement. | |
int | lostHits () const |
Number of detector layers crossed without valid RecHits. | |
const DataContainer & | measurements () const |
Return all measurements in a container. | |
void | pop () |
Remove the last measurement from the trajectory. | |
void | popInvalidTail () |
Pops out all the invalid hits on the tail. | |
void | push (const TrajectoryMeasurement &tm, double chi2Increment) |
same as the one-argument push, but the trajectory Chi2 is incremented by chi2Increment. | |
void | push (const TempTrajectory &segment) |
Add a new sets of measurements to a Trajectory The sorting of hits in the other trajectory must match the one inside this trajectory (that is, both along or both opposite to momentum). | |
void | push (const TrajectoryMeasurement &tm) |
Add a new measurement to a Trajectory. | |
const TrajectorySeed & | seed () const |
Access to the seed used to reconstruct the Trajectory. | |
TempTrajectory (const Trajectory &traj) | |
construct TempTrajectory from standard Trajectory | |
TempTrajectory (const TrajectorySeed &seed, PropagationDirection dir) | |
Constructor of an empty trajectory with defined direction. | |
TempTrajectory (const TrajectorySeed &seed) | |
Constructor of an empty trajectory with undefined direction. | |
TempTrajectory () | |
Default constructor of an empty trajectory with undefined seed and undefined direction. | |
Trajectory | toTrajectory () const |
Convert to a standard Trajectory. | |
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 | |
double | theChiSquared |
DataContainer | theData |
PropagationDirection | theDirection |
bool | theDirectionValidity |
int | theNumberOfFoundHits |
int | theNumberOfLostHits |
boost::shared_ptr< TrajectorySeed > | theSeed |
bool | theValid |
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 41 of file TempTrajectory.h.
Definition at line 46 of file TempTrajectory.h.
Definition at line 45 of file TempTrajectory.h.
Definition at line 47 of file TempTrajectory.h.
TempTrajectory::TempTrajectory | ( | ) | [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 55 of file TempTrajectory.h.
00055 : theChiSquared(0), theValid(true), 00056 theNumberOfFoundHits(0), theNumberOfLostHits(0), 00057 theDirection(alongMomentum), theDirectionValidity(false), 00058 theSeed(new TrajectorySeed()) 00059 {}
TempTrajectory::TempTrajectory | ( | 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 68 of file TempTrajectory.h.
00068 : 00069 theChiSquared(0), theValid(true), 00070 theNumberOfFoundHits(0), theNumberOfLostHits(0), 00071 theDirection(alongMomentum), theDirectionValidity(false), 00072 theSeed( new TrajectorySeed(seed) ) 00073 {}
TempTrajectory::TempTrajectory | ( | 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 79 of file TempTrajectory.h.
00079 : 00080 theChiSquared(0), theValid(true), 00081 theNumberOfFoundHits(0), theNumberOfLostHits(0), 00082 theDirection(dir), theDirectionValidity(true), 00083 theSeed( new TrajectorySeed(seed) ) 00084 {}
TempTrajectory::TempTrajectory | ( | const Trajectory & | traj | ) |
construct TempTrajectory from standard Trajectory
Definition at line 7 of file TempTrajectory.cc.
References begin, end, it, Trajectory::measurements(), and push().
00007 : 00008 theChiSquared(0), theValid(traj.isValid()), 00009 theNumberOfFoundHits(0), theNumberOfLostHits(0), 00010 theDirection(traj.direction()), theDirectionValidity(true), 00011 theSeed( new TrajectorySeed(traj.seed()) ){ 00012 00013 Trajectory::DataContainer::const_iterator begin=traj.measurements().begin(); 00014 Trajectory::DataContainer::const_iterator end=traj.measurements().end(); 00015 00016 for(Trajectory::DataContainer::const_iterator it=begin; it!=end; ++it){ 00017 push(*it); 00018 } 00019 00020 00021 }
Definition at line 118 of file TempTrajectory.cc.
References cmsutils::bqueue< T >::size(), and theData.
Referenced by firstMeasurement(), lastLayer(), and lastMeasurement().
00118 { 00119 if ( theData.size() == 0) 00120 throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory"); 00121 }
double TempTrajectory::chiSquared | ( | ) | const [inline] |
Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.
Definition at line 161 of file TempTrajectory.h.
References theChiSquared.
Referenced by HICTrajectoryBuilder::qualityFilter(), and GroupedTrajCandLess::score().
00161 { return theChiSquared;}
PropagationDirection TempTrajectory::direction | ( | void | ) | const |
Direction of "growing" of the trajectory.
Possible values are alongMomentum (outwards) and oppositeToMomentum (inwards).
Definition at line 113 of file TempTrajectory.cc.
References Exception, theDirection, and theDirectionValidity.
Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), HICTrajectoryBuilder::findCompatibleMeasurements(), MuonCkfTrajectoryBuilder::findCompatibleMeasurements(), BaseCkfTrajectoryBuilder::findStateAndLayers(), and push().
00113 { 00114 if (theDirectionValidity) return theDirection; 00115 else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set"); 00116 }
True if trajectory has no measurements.
Definition at line 158 of file TempTrajectory.h.
References cmsutils::bqueue< T >::empty(), and theData.
Referenced by BaseCkfTrajectoryBuilder::addToResult(), MuonCkfTrajectoryBuilder::findCompatibleMeasurements(), BaseCkfTrajectoryBuilder::findStateAndLayers(), pop(), and HICTrajectoryBuilder::trajectories().
const TrajectoryMeasurement& TempTrajectory::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 128 of file TempTrajectory.h.
References check(), cmsutils::bqueue< T >::front(), and theData.
int TempTrajectory::foundHits | ( | ) | const [inline] |
obsolete name, use measurements() instead.
Return all RecHits in a container. 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 148 of file TempTrajectory.h.
References theNumberOfFoundHits.
Referenced by TrajectoryLessByFoundHits::operator()(), HICTrajectoryBuilder::qualityFilter(), ThresholdPtTrajectoryFilter::qualityFilter(), GroupedTrajCandLess::score(), BaseCkfTrajectoryBuilder::toBeContinued(), ThresholdPtTrajectoryFilter::toBeContinued(), and MinPtTrajectoryFilter::toBeContinued().
00148 { return theNumberOfFoundHits;}
static bool TempTrajectory::inactive | ( | ) | [inline, static] |
Definition of inactive Det from the Trajectory point of view.
Definition at line 183 of file TempTrajectory.h.
void TempTrajectory::invalidate | ( | ) | [inline] |
Method to invalidate a trajectory. Useful during ambiguity resolution.
Definition at line 175 of file TempTrajectory.h.
References theValid.
00175 { theValid = false;}
Returns true if the Trajectory is valid.
Trajectories are invalidated e.g. during ambiguity resolution.
Definition at line 172 of file TempTrajectory.h.
References theValid.
Referenced by IntermediateTrajectoryCleaner::clean(), GroupedCkfTrajectoryBuilder::groupedIntermediaryClean(), and ChargeSignificanceTrajectoryFilter::qualityFilter().
00172 { return theValid;}
const DetLayer* TempTrajectory::lastLayer | ( | ) | const [inline] |
Redundant method, returns the layer of lastMeasurement() .
Definition at line 192 of file TempTrajectory.h.
References cmsutils::bqueue< T >::back(), check(), and theData.
Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer(), HICTrajectoryBuilder::findCompatibleMeasurements(), MuonCkfTrajectoryBuilder::findCompatibleMeasurements(), CkfTrajectoryBuilder::findCompatibleMeasurements(), BaseCkfTrajectoryBuilder::findStateAndLayers(), and BaseCkfTrajectoryBuilder::toBeContinued().
const TrajectoryMeasurement& TempTrajectory::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 118 of file TempTrajectory.h.
References cmsutils::bqueue< T >::back(), check(), and theData.
Referenced by BaseCkfTrajectoryBuilder::addToResult(), HICTrajectoryBuilder::findCompatibleMeasurements(), MuonCkfTrajectoryBuilder::findCompatibleMeasurements(), BaseCkfTrajectoryBuilder::findStateAndLayers(), ThresholdPtTrajectoryFilter::qualityFilter(), TrajectorySegmentBuilder::redoMeasurements(), BaseCkfTrajectoryBuilder::toBeContinued(), ThresholdPtTrajectoryFilter::toBeContinued(), and MinPtTrajectoryFilter::toBeContinued().
bool TempTrajectory::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 123 of file TempTrajectory.cc.
References TrackingRecHit::geographicalId(), TrackingRecHit::getType(), TrackingRecHit::isValid(), TrackingRecHit::missing, and DetId::rawId().
Referenced by pop(), and push().
00124 { 00125 if ( hit.isValid()) return false; 00126 else { 00127 // // A DetLayer is always inactive in this logic. 00128 // // The DetLayer is the Det of an invalid RecHit only if no DetUnit 00129 // // is compatible with the predicted state, so we don't really expect 00130 // // a hit in this case. 00131 00132 if(hit.geographicalId().rawId() == 0) {return false;} 00133 else{ 00134 return hit.getType() == TrackingRecHit::missing; 00135 } 00136 } 00137 }
int TempTrajectory::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 155 of file TempTrajectory.h.
References theNumberOfLostHits.
Referenced by GroupedTrajCandLess::score(), BaseCkfTrajectoryBuilder::toBeContinued(), and HICTrajectoryBuilder::toBeContinued().
00155 { return theNumberOfLostHits;}
const DataContainer& TempTrajectory::measurements | ( | ) | const [inline] |
Return all measurements in a container.
Definition at line 134 of file TempTrajectory.h.
References theData.
Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), HICTrajectoryBuilder::findCompatibleMeasurements(), HICTrajectoryBuilder::limitedCandidates(), push(), GroupedCkfTrajectoryBuilder::rebuildSeedingRegion(), BaseCkfTrajectoryBuilder::toBeContinued(), ClusterShapeTrajectoryFilter::toBeContinued(), and HICTrajectoryBuilder::toBeContinued().
00134 { return theData; }
Remove the last measurement from the trajectory.
Definition at line 23 of file TempTrajectory.cc.
References cmsutils::bqueue< T >::back(), empty(), lost(), cmsutils::bqueue< T >::pop_back(), theData, theNumberOfFoundHits, and theNumberOfLostHits.
Referenced by BaseCkfTrajectoryBuilder::addToResult().
00023 { 00024 if (!empty()) { 00025 if (theData.back().recHit()->isValid()) theNumberOfFoundHits--; 00026 else if(lost(* (theData.back().recHit()) )) theNumberOfLostHits--; 00027 theData.pop_back(); 00028 } 00029 }
void TempTrajectory::popInvalidTail | ( | ) |
Pops out all the invalid hits on the tail.
void TempTrajectory::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 63 of file TempTrajectory.cc.
References alongMomentum, cmsutils::bqueue< T >::back(), cmsutils::bqueue< T >::front(), lost(), oppositeToMomentum, cmsutils::bqueue< T >::push_back(), TrajectoryMeasurement::recHit(), cmsutils::bqueue< T >::size(), theChiSquared, theData, theDirection, theDirectionValidity, theNumberOfFoundHits, and theNumberOfLostHits.
00064 { 00065 theData.push_back(tm); 00066 if ( tm.recHit()->isValid()) { 00067 theNumberOfFoundHits++; 00068 } 00069 //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++; 00070 else if (lost( *(tm.recHit()) ) ) theNumberOfLostHits++; 00071 00072 00073 theChiSquared += chi2Increment; 00074 00075 // in case of a Trajectory constructed without direction, 00076 // determine direction from the radii of the first two measurements 00077 00078 if ( !theDirectionValidity && theData.size() >= 2) { 00079 if (theData.front().updatedState().globalPosition().perp() < 00080 theData.back().updatedState().globalPosition().perp()) 00081 theDirection = alongMomentum; 00082 else theDirection = oppositeToMomentum; 00083 theDirectionValidity = true; 00084 } 00085 }
void TempTrajectory::push | ( | const TempTrajectory & | segment | ) |
Add a new sets of measurements to a Trajectory The sorting of hits in the other trajectory must match the one inside this trajectory (that is, both along or both opposite to momentum).
Definition at line 87 of file TempTrajectory.cc.
References direction(), it, list(), measurements(), push(), cmsutils::bqueue< T >::rbegin(), cmsutils::bqueue< T >::rend(), and theDirection.
00087 { 00088 assert (segment.direction() == theDirection) ; 00089 __gnu_cxx::slist<const TrajectoryMeasurement*> list; 00090 for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it) { 00091 list.push_front(&(*it)); 00092 } 00093 for(__gnu_cxx::slist<const TrajectoryMeasurement*>::const_iterator it = list.begin(), ed = list.end(); it != ed; ++it) { 00094 push(**it); 00095 } 00096 }
void TempTrajectory::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 59 of file TempTrajectory.cc.
References TrajectoryMeasurement::estimate().
Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer(), HICTrajectoryBuilder::createStartingTrajectory(), push(), TempTrajectory(), CkfTrajectoryBuilder::updateTrajectory(), HICTrajectoryBuilder::updateTrajectory(), and TrajectorySegmentBuilder::updateTrajectory().
const TrajectorySeed& TempTrajectory::seed | ( | ) | const [inline] |
Access to the seed used to reconstruct the Trajectory.
Definition at line 178 of file TempTrajectory.h.
References theSeed.
Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), MuonCkfTrajectoryBuilder::findCompatibleMeasurements(), BaseCkfTrajectoryBuilder::findStateAndLayers(), and GroupedCkfTrajectoryBuilder::rebuildSeedingRegion().
00178 { return *theSeed;}
Trajectory TempTrajectory::toTrajectory | ( | ) | const |
Convert to a standard Trajectory.
Definition at line 139 of file TempTrajectory.cc.
References it, list(), Trajectory::push(), cmsutils::bqueue< T >::rbegin(), cmsutils::bqueue< T >::rend(), Trajectory::reserve(), cmsutils::bqueue< T >::size(), theData, theDirection, and theSeed.
Referenced by BaseCkfTrajectoryBuilder::addToResult(), HICTrajectoryBuilder::addToResult(), CkfDebugTrajectoryBuilder::analyzeMeasurementsDebugger(), HICTrajectoryBuilder::findCompatibleMeasurements(), HICTrajectoryBuilder::qualityFilter(), and HICTrajectoryBuilder::updateTrajectory().
00139 { 00140 Trajectory traj(*theSeed, theDirection); 00141 00142 traj.reserve(theData.size()); 00143 __gnu_cxx::slist<const TrajectoryMeasurement*> list; 00144 for (TempTrajectory::DataContainer::const_iterator it = theData.rbegin(), ed = theData.rend(); it != ed; --it) { 00145 list.push_front(&(*it)); 00146 } 00147 for(__gnu_cxx::slist<const TrajectoryMeasurement*>::const_iterator it = list.begin(), ed = list.end(); it != ed; ++it) { 00148 traj.push(**it); 00149 } 00150 return traj; 00151 }
double TempTrajectory::theChiSquared [private] |
DataContainer TempTrajectory::theData [private] |
Definition at line 203 of file TempTrajectory.h.
Referenced by check(), empty(), firstMeasurement(), lastLayer(), lastMeasurement(), measurements(), pop(), push(), and toTrajectory().
Definition at line 210 of file TempTrajectory.h.
Referenced by direction(), push(), and toTrajectory().
bool TempTrajectory::theDirectionValidity [private] |
int TempTrajectory::theNumberOfFoundHits [private] |
int TempTrajectory::theNumberOfLostHits [private] |
boost::shared_ptr<TrajectorySeed> TempTrajectory::theSeed [private] |
bool TempTrajectory::theValid [private] |