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
 
bool empty () const
 True if trajectory has no measurements. More...
 
TrajectoryMeasurement const & firstMeasurement () const
 
int foundHits () const
 
TrajectoryStateOnSurface geometricalInnermostState () const
 
void invalidate ()
 Method to invalidate a trajectory. Useful during ambiguity resolution. More...
 
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
 
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 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_
 
double theChiSquared
 
double theChiSquaredBad
 
DataContainer theData
 
PropagationDirection theDirection
 
bool theDirectionValidity
 
int theNumberOfFoundHits
 
int 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  : theChiSquared(0), theChiSquaredBad(0), theValid(true),
55  theSeed(), seedRef_()
56  {}
int theNumberOfLostHits
Definition: Trajectory.h:284
bool theDirectionValidity
Definition: Trajectory.h:287
double theChiSquaredBad
Definition: Trajectory.h:280
bool theValid
Definition: Trajectory.h:281
double theChiSquared
Definition: Trajectory.h:279
PropagationDirection theDirection
Definition: Trajectory.h:286
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:289
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:290
int theNumberOfFoundHits
Definition: Trajectory.h:283
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 65 of file Trajectory.h.

65  :
69  theSeed( new TrajectorySeed(seed) ), seedRef_()
70  {}
int theNumberOfLostHits
Definition: Trajectory.h:284
bool theDirectionValidity
Definition: Trajectory.h:287
double theChiSquaredBad
Definition: Trajectory.h:280
bool theValid
Definition: Trajectory.h:281
double theChiSquared
Definition: Trajectory.h:279
PropagationDirection theDirection
Definition: Trajectory.h:286
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:289
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:290
int theNumberOfFoundHits
Definition: Trajectory.h:283
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 76 of file Trajectory.h.

76  :
80  theSeed( new TrajectorySeed(seed) ), seedRef_()
81  {}
int theNumberOfLostHits
Definition: Trajectory.h:284
bool theDirectionValidity
Definition: Trajectory.h:287
double theChiSquaredBad
Definition: Trajectory.h:280
bool theValid
Definition: Trajectory.h:281
double theChiSquared
Definition: Trajectory.h:279
PropagationDirection theDirection
Definition: Trajectory.h:286
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:289
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:290
dbl *** dir
Definition: mlp_gen.cc:35
int theNumberOfFoundHits
Definition: Trajectory.h:283
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 87 of file Trajectory.h.

87  :
91  theSeed( seed ), seedRef_()
92  {}
int theNumberOfLostHits
Definition: Trajectory.h:284
bool theDirectionValidity
Definition: Trajectory.h:287
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:231
double theChiSquaredBad
Definition: Trajectory.h:280
bool theValid
Definition: Trajectory.h:281
double theChiSquared
Definition: Trajectory.h:279
PropagationDirection theDirection
Definition: Trajectory.h:286
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:289
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:290
dbl *** dir
Definition: mlp_gen.cc:35
int theNumberOfFoundHits
Definition: Trajectory.h:283

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:278
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(), and TrackProducerAlgorithm< reco::GsfTrack >::buildTrack().

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:169
#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 171 of file Trajectory.h.

References measurements().

Referenced by HICMeasurementEstimator::setCuts().

171 { return measurements();}
DataContainer const & measurements() const
Definition: Trajectory.h:169
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(), DAFTrackProducerAlgorithm::buildTrack(), MTFTrackProducerAlgorithm::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(), GroupedDAFHitCollector::recHits(), 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:287
PropagationDirection theDirection
Definition: Trajectory.h:286
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 160 of file Trajectory.h.

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

Referenced by CosmicTrajectoryBuilder::AddHit(), CkfDebugger::analyseCompatibleMeasurements(), GroupedCkfTrajectoryBuilder::backwardFit(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), DAFTrackProducerAlgorithm::buildTrack(), MTFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), TrackProducerAlgorithm< reco::Track >::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().

160  {
161  check();
162  if (theData.front().recHit()->hit()!=0) return theData.front();
163  else if (theData.size()>2) return *(theData.begin()+1);
164  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
165  }
DataContainer theData
Definition: Trajectory.h:278
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:147
TrajectoryStateOnSurface updatedState() const
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:160
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 236 of file Trajectory.h.

237  {return false;}//FIXME
void Trajectory::invalidate ( )
inline

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 228 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

228 { theValid = false;}
bool theValid
Definition: Trajectory.h:281
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::isValid ( void  ) const
inline
const DetLayer* Trajectory::lastLayer ( ) const
inline

Redundant method, returns the layer of lastMeasurement() .

Definition at line 250 of file Trajectory.h.

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

Referenced by CkfDebugger::analyseRecHitNotFound().

250  {
251  check();
252  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
253  else if (theData.size()>2) return (theData.end()-2)->layer();
254  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
255  }
DataContainer theData
Definition: Trajectory.h:278
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 147 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(), DAFTrackProducerAlgorithm::buildTrack(), MTFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), TrackProducerAlgorithm< reco::Track >::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(), ThresholdPtTrajectoryFilter::toBeContinued(), MinPtTrajectoryFilter::toBeContinued(), StandAloneMuonTrajectoryBuilder::trajectories(), and CosmicMuonTrajectoryBuilder::trajectories().

147  {
148  check();
149  if (theData.back().recHit()->hit()!=0) return theData.back();
150  else if (theData.size()>2) return *(theData.end()-2);
151  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
152  }
DataContainer theData
Definition: Trajectory.h:278
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 197 of file Trajectory.h.

References theNumberOfLostHits.

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

197 { return theNumberOfLostHits;}
int theNumberOfLostHits
Definition: Trajectory.h:284
DataContainer const& Trajectory::measurements ( ) const
inline

Return all measurements in a container.

Definition at line 169 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(), MuonTrackResidualAnalyzer::computeResolution(), StandAloneMuonFilter::createDefaultTrajectory(), data(), EnergyLossPlain::estimate(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonResiduals::event(), AlignmentMonitorTracksFromTrajectories::event(), AlignmentMonitorMuonVsCurvature::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(), TrackClusterRemover::produce(), HLTTrackClusterRemover::produce(), TkAlCaOverlapTagger::produce(), DeDxDiscriminatorProducer::produce(), ShallowGainCalibration::produce(), reco::modules::CosmicTrackSplitter::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), HICTrajectoryBuilder::qualityFilter(), SimpleDAFHitCollector::recHits(), GroupedDAFHitCollector::recHits(), TrajectoryCleanerMerger::reOrderMeasurements(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), MuonMillepedeAlgorithm::run(), HIPAlignmentAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), CSCOverlapsAlignmentAlgorithm::run(), NuclearInteractionFinder::run(), MTFTrackProducerAlgorithm::runWithCandidate(), GlobalMuonRefitter::selectMuonHits(), HICMeasurementEstimator::setCuts(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), TempTrajectory::TempTrajectory(), ClusterShapeTrajectoryFilter::toBeContinued(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), KFTrajectorySmoother::trajectories(), trajectoryToResiduals(), and HICMuonUpdator::update().

169 { return theData;}
DataContainer theData
Definition: Trajectory.h:278
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
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:200
int theNumberOfLostHits
Definition: Trajectory.h:284
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:205
double theChiSquaredBad
Definition: Trajectory.h:280
DataContainer theData
Definition: Trajectory.h:278
double theChiSquared
Definition: Trajectory.h:279
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:221
int theNumberOfFoundHits
Definition: Trajectory.h:283
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 }
int theNumberOfLostHits
Definition: Trajectory.h:284
bool theDirectionValidity
Definition: Trajectory.h:287
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:205
double theChiSquaredBad
Definition: Trajectory.h:280
ConstRecHitPointer recHit() const
DataContainer theData
Definition: Trajectory.h:278
double theChiSquared
Definition: Trajectory.h:279
PropagationDirection theDirection
Definition: Trajectory.h:286
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:221
int theNumberOfFoundHits
Definition: Trajectory.h:283
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, 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:278
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
T z() const
Definition: PV3DBase.h:58
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 125 of file Trajectory.h.

References theData.

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

125 { theData.reserve(n); }
DataContainer theData
Definition: Trajectory.h:278
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:278
PropagationDirection theDirection
Definition: Trajectory.h:286
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 262 of file Trajectory.h.

References seedRef_.

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

262 { return seedRef_; }
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:290
void Trajectory::setSeedRef ( const edm::RefToBase< TrajectorySeed > &  seedRef)
inline

Definition at line 264 of file Trajectory.h.

References seedRef(), and seedRef_.

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

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

Definition at line 274 of file Trajectory.h.

References theSeed.

274 { return theSeed; }
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:289
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:190
DataContainer theData
Definition: Trajectory.h:278

Member Data Documentation

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

Definition at line 290 of file Trajectory.h.

Referenced by seedRef(), and setSeedRef().

double Trajectory::theChiSquared
private

Definition at line 279 of file Trajectory.h.

Referenced by chiSquared().

double Trajectory::theChiSquaredBad
private

Definition at line 280 of file Trajectory.h.

Referenced by chiSquared().

DataContainer Trajectory::theData
private

Definition at line 278 of file Trajectory.h.

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

PropagationDirection Trajectory::theDirection
private

Definition at line 286 of file Trajectory.h.

bool Trajectory::theDirectionValidity
private

Definition at line 287 of file Trajectory.h.

int Trajectory::theNumberOfFoundHits
private

Definition at line 283 of file Trajectory.h.

Referenced by chiSquared(), and foundHits().

int Trajectory::theNumberOfLostHits
private

Definition at line 284 of file Trajectory.h.

Referenced by lostHits().

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

Definition at line 289 of file Trajectory.h.

Referenced by seed(), and sharedSeed().

bool Trajectory::theValid
private

Definition at line 281 of file Trajectory.h.

Referenced by invalidate(), and isValid().