CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes

TempTrajectory Class Reference

#include <TempTrajectory.h>

List of all members.

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
float dPhiCacheForLoopersReconstruction () const
template<typename... Args>
void emplace (Args &&...args)
template<typename... Args>
void emplace (double chi2Increment, Args &&...args)
bool empty () const
 True if trajectory has no measurements.
const TrajectoryMeasurementfirstMeasurement () const
int foundHits () const
 obsolete name, use measurements() instead.
void incrementLoops ()
void invalidate ()
 Method to invalidate a trajectory. Useful during ambiguity resolution.
bool isLooper () const
bool isValid () const
void join (TempTrajectory &segment)
const DetLayerlastLayer () const
 Redundant method, returns the layer of lastMeasurement() .
const TrajectoryMeasurementlastMeasurement () const
int lostHits () const
const DataContainermeasurements () const
signed char nLoops () const
void pop ()
void popInvalidTail ()
 Pops out all the invalid hits on the tail.
void push (TempTrajectory const &segment)
void push (const TrajectoryMeasurement &tm)
void push (const TrajectoryMeasurement &tm, double chi2Increment)
void push (TrajectoryMeasurement &&tm, double chi2Increment)
void push (TrajectoryMeasurement &&tm)
void setDPhiCacheForLoopersReconstruction (float dphi)
void setNLoops (signed char value)
 TempTrajectory ()
 TempTrajectory (const Trajectory &traj)
 construct TempTrajectory from standard Trajectory
 TempTrajectory (PropagationDirection dir)
Trajectory toTrajectory () const
 Convert to a standard Trajectory.
 ~TempTrajectory ()
 destruct a TempTrajectory

Static Public Member Functions

static bool inactive ()

Private Member Functions

void check () const
void pushAux (double chi2Increment)

Static Private Member Functions

static bool lost (const TransientTrackingRecHit &hit) dso_internal

Private Attributes

float theChiSquared
DataContainer theData
signed char theDirection
bool theDirectionValidity
float theDPhiCache
signed char theNLoops
signed short theNumberOfFoundHits
signed short theNumberOfLostHits
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 39 of file TempTrajectory.h.


Member Typedef Documentation

Definition at line 44 of file TempTrajectory.h.

Definition at line 43 of file TempTrajectory.h.

Definition at line 45 of file TempTrajectory.h.


Constructor & Destructor Documentation

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 53 of file TempTrajectory.h.

TempTrajectory::TempTrajectory ( PropagationDirection  dir) [inline, explicit]

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 66 of file TempTrajectory.h.

TempTrajectory::TempTrajectory ( const Trajectory traj) [explicit]

construct TempTrajectory from standard Trajectory

Definition at line 6 of file TempTrajectory.cc.

References begin, cmsutils::bqueue< T >::begin(), cmsutils::bqueue< T >::end(), end, Trajectory::measurements(), and push().

                                                     :
  theChiSquared(0),
  theNumberOfFoundHits(0), theNumberOfLostHits(0),
  theDirection(traj.direction()), theDirectionValidity(true),
  theValid(traj.isValid()),
  theNLoops(traj.nLoops()),
  theDPhiCache(traj.dPhiCacheForLoopersReconstruction()) {
  
  Trajectory::DataContainer::const_iterator begin=traj.measurements().begin();
  Trajectory::DataContainer::const_iterator end=traj.measurements().end();
  
  for(Trajectory::DataContainer::const_iterator it=begin; it!=end; ++it){
    push(*it);
  }

}
TempTrajectory::~TempTrajectory ( ) [inline]

destruct a TempTrajectory

Definition at line 138 of file TempTrajectory.h.

{}

Member Function Documentation

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

Definition at line 108 of file TempTrajectory.cc.

References cmsutils::bqueue< T >::size(), and theData.

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

                                 {
  if ( theData.size() == 0) 
    throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
}
double TempTrajectory::chiSquared ( ) const [inline]

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

Definition at line 248 of file TempTrajectory.h.

References theChiSquared.

Referenced by GroupedTrajCandLess::score().

{ return theChiSquared;}
PropagationDirection TempTrajectory::direction ( ) const

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

Definition at line 103 of file TempTrajectory.cc.

References Exception, theDirection, and theDirectionValidity.

Referenced by GroupedCkfTrajectoryBuilder::backwardFit(), MuonCkfTrajectoryBuilder::findCompatibleMeasurements(), BaseCkfTrajectoryBuilder::findStateAndLayers(), and GroupedCkfTrajectoryBuilder::rebuildSeedingRegion().

                                                     {
  if (theDirectionValidity) return PropagationDirection(theDirection);
  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
}
float TempTrajectory::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 285 of file TempTrajectory.h.

References theDPhiCache.

Referenced by GroupedTrajCandLess::score().

{ return theDPhiCache;}
template<typename... Args>
void TempTrajectory::emplace ( Args &&...  args) [inline]
template<typename... Args>
void TempTrajectory::emplace ( double  chi2Increment,
Args &&...  args 
) [inline]

Definition at line 190 of file TempTrajectory.h.

References harvestRelVal::args, cmsutils::bqueue< T >::emplace_back(), pushAux(), and theData.

                                                      { // works only because the first Arg is never a double!
    theData.emplace_back(std::forward<Args>(args)...);
    pushAux(chi2Increment);
  }
bool TempTrajectory::empty ( void  ) const [inline]
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 215 of file TempTrajectory.h.

References check(), cmsutils::bqueue< T >::front(), and theData.

                                                         {
    check(); return theData.front();
  }
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 235 of file TempTrajectory.h.

References theNumberOfFoundHits.

Referenced by BaseCkfTrajectoryBuilder::addToResult(), GroupedCkfTrajectoryBuilder::advanceOneLayer(), GroupedCkfTrajectoryBuilder::backwardFit(), lessByFoundHits(), TrajectoryLessByFoundHits::operator()(), ThresholdPtTrajectoryFilter::qualityFilter(), MinPtTrajectoryFilter::qualityFilter(), GroupedTrajCandLess::score(), BaseCkfTrajectoryBuilder::toBeContinued(), ThresholdPtTrajectoryFilter::toBeContinued(), and MinPtTrajectoryFilter::toBeContinued().

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

Definition of inactive Det from the Trajectory point of view.

Definition at line 267 of file TempTrajectory.h.

                        {return false;}//FIXME
void TempTrajectory::incrementLoops ( ) [inline]

Definition at line 295 of file TempTrajectory.h.

References theNLoops.

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer().

{theNLoops++;}
void TempTrajectory::invalidate ( ) [inline]

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 262 of file TempTrajectory.h.

References theValid.

{ theValid = false;}
bool TempTrajectory::isLooper ( ) const [inline]

Definition at line 291 of file TempTrajectory.h.

References theNLoops.

{ return (theNLoops>0);}
bool TempTrajectory::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 TempTrajectory.h.

References theValid.

Referenced by IntermediateTrajectoryCleaner::clean(), GroupedCkfTrajectoryBuilder::groupedIntermediaryClean(), ChargeSignificanceTrajectoryFilter::qualityFilter(), and GroupedCkfTrajectoryBuilder::rebuildSeedingRegion().

{ return theValid;}
void TempTrajectory::join ( TempTrajectory segment)

Add a new sets of measurements to a Trajectory Exactly like push(TempTrajectory), but it doesn't copy the data (the input segment will be reset to an empty one)

Definition at line 73 of file TempTrajectory.cc.

References cmsutils::bqueue< T >::clear(), cmsutils::bqueue< T >::join(), push(), cmsutils::bqueue< T >::shared(), theChiSquared, theData, theDirection, theDirectionValidity, theNumberOfFoundHits, and theNumberOfLostHits.

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer().

                                                  {
  assert (segment.theDirection == theDirection) ;
  assert(theDirectionValidity);

  if (segment.theData.shared()) {
    push(segment); 
    segment.theData.clear(); // obey the contract, and increase the chances it will be not shared one day
  } else {
    theData.join(segment.theData);
    theNumberOfFoundHits+= segment.theNumberOfFoundHits;
    theNumberOfLostHits += segment.theNumberOfLostHits;
    theChiSquared += segment.theChiSquared;
  }
}
const DetLayer* TempTrajectory::lastLayer ( ) const [inline]
const TrajectoryMeasurement& TempTrajectory::lastMeasurement ( ) const [inline]
bool TempTrajectory::lost ( const TransientTrackingRecHit hit) [static, private]

Definition of what it means for a hit to be "lost". This definition is also used by the TrajectoryBuilder.

Definition at line 113 of file TempTrajectory.cc.

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

Referenced by pop(), and pushAux().

{
  if  likely(hit.isValid()) return false;

  //     // 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;}
  return hit.getType() == TrackingRecHit::missing;
}
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 242 of file TempTrajectory.h.

References theNumberOfLostHits.

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

const DataContainer& TempTrajectory::measurements ( ) const [inline]
signed char TempTrajectory::nLoops ( ) const [inline]

Definition at line 292 of file TempTrajectory.h.

References theNLoops.

Referenced by GroupedCkfTrajectoryBuilder::backwardFit().

{return theNLoops;}
void TempTrajectory::pop ( )
void TempTrajectory::popInvalidTail ( )

Pops out all the invalid hits on the tail.

void TempTrajectory::push ( const TrajectoryMeasurement tm) [inline]

Add a new measurement to a Trajectory. The Chi2 of the trajectory is incremented by the value of tm.estimate() .

Definition at line 144 of file TempTrajectory.h.

References TrajectoryMeasurement::estimate().

Referenced by join(), push(), GroupedCkfTrajectoryBuilder::rebuildSeedingRegion(), TempTrajectory(), and CkfTrajectoryBuilder::updateTrajectory().

                                             {
    push( tm, tm.estimate());
  }
void TempTrajectory::push ( TempTrajectory const &  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) (the input segment will be reset to an empty one)

Definition at line 57 of file TempTrajectory.cc.

References i, measurements(), N, cmsutils::bqueue< T >::push_back(), cmsutils::bqueue< T >::size(), theChiSquared, theData, theDirection, theDirectionValidity, theNumberOfFoundHits, theNumberOfLostHits, and tmp.

                                                       {
  assert (segment.theDirection == theDirection) ;
  assert(theDirectionValidity); // given the above...

  const int N = segment.measurements().size();
  TrajectoryMeasurement const * tmp[N];
  int i=0;
  //for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it)
  for ( auto const & tm : segment.measurements())
    tmp[i++] =&tm;
  while(i!=0) theData.push_back(*tmp[--i]);
  theNumberOfFoundHits+= segment.theNumberOfFoundHits;
  theNumberOfLostHits += segment.theNumberOfLostHits;
  theChiSquared += segment.theChiSquared;
}
void TempTrajectory::push ( TrajectoryMeasurement &&  tm) [inline]

Definition at line 148 of file TempTrajectory.h.

References push().

                                       {
    push( std::forward<TrajectoryMeasurement>(tm), tm.estimate());
  }
void TempTrajectory::push ( const TrajectoryMeasurement tm,
double  chi2Increment 
) [inline]

same as the one-argument push, but the trajectory Chi2 is incremented by chi2Increment. Useful e.g. in trajectory smoothing.

Definition at line 178 of file TempTrajectory.h.

References cmsutils::bqueue< T >::push_back(), pushAux(), and theData.

                                                                    {
      theData.push_back(tm);
      pushAux(chi2Increment);
  }
void TempTrajectory::push ( TrajectoryMeasurement &&  tm,
double  chi2Increment 
) [inline]

Definition at line 183 of file TempTrajectory.h.

References cmsutils::bqueue< T >::push_back(), pushAux(), and theData.

                                                               {
    theData.push_back(std::move(tm));
    pushAux(chi2Increment);
  }
void TempTrajectory::pushAux ( double  chi2Increment) [private]

Definition at line 34 of file TempTrajectory.cc.

References alongMomentum, cmsutils::bqueue< T >::back(), cmsutils::bqueue< T >::front(), TrajectoryStateOnSurface::globalPosition(), lost(), oppositeToMomentum, PV3DBase< T, PVType, FrameType >::perp2(), TrajectoryMeasurement::recHit(), cmsutils::bqueue< T >::size(), theChiSquared, theData, theDirection, theDirectionValidity, theNumberOfFoundHits, theNumberOfLostHits, and TrajectoryMeasurement::updatedState().

Referenced by emplace(), and push().

                                                 {
  const TrajectoryMeasurement& tm = theData.back();
  if ( tm.recHit()->isValid()) {
    theNumberOfFoundHits++;
   }
  //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
  else if (lost( *(tm.recHit()) ) )   theNumberOfLostHits++;
  
  
  theChiSquared += 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.front().updatedState().globalPosition().perp2() <
        theData.back().updatedState().globalPosition().perp2())
      theDirection = alongMomentum;
    else theDirection = oppositeToMomentum;
    theDirectionValidity = true;
  }
}
void TempTrajectory::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 289 of file TempTrajectory.h.

References theDPhiCache.

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer().

{  theDPhiCache = dphi;}
void TempTrajectory::setNLoops ( signed char  value) [inline]
Trajectory TempTrajectory::toTrajectory ( ) const

Member Data Documentation

Definition at line 311 of file TempTrajectory.h.

Referenced by chiSquared(), join(), push(), and pushAux().

signed char TempTrajectory::theDirection [private]

Definition at line 317 of file TempTrajectory.h.

Referenced by direction(), join(), push(), pushAux(), and toTrajectory().

Definition at line 318 of file TempTrajectory.h.

Referenced by direction(), join(), push(), pushAux(), and toTrajectory().

signed char TempTrajectory::theNLoops [private]

Definition at line 321 of file TempTrajectory.h.

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

signed short TempTrajectory::theNumberOfFoundHits [private]

Definition at line 313 of file TempTrajectory.h.

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

signed short TempTrajectory::theNumberOfLostHits [private]

Definition at line 314 of file TempTrajectory.h.

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

bool TempTrajectory::theValid [private]

Definition at line 319 of file TempTrajectory.h.

Referenced by invalidate(), and isValid().