CMS 3D CMS Logo

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

Trajectory Class Reference

#include <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
TrajectoryMeasurement const & closestMeasurement (GlobalPoint) const
DataContainer const & data () const
 obsolete name, use measurements() instead.
PropagationDirection const & direction () const
bool empty () const
 True if trajectory has no measurements.
TrajectoryMeasurement const & firstMeasurement () const
int foundHits () const
TrajectoryStateOnSurface geometricalInnermostState () const
void invalidate ()
 Method to invalidate a trajectory. Useful during ambiguity resolution.
bool isValid () const
const DetLayerlastLayer () const
 Redundant method, returns the layer of lastMeasurement() .
TrajectoryMeasurement const & lastMeasurement () const
int lostHits () const
DataContainer const & measurements () const
int ndof (bool bon=true) const
void pop ()
void push (const TrajectoryMeasurement &tm)
void push (const TrajectoryMeasurement &tm, double chi2Increment)
ConstRecHitContainer recHits (bool splitting=false) const
void recHitsV (ConstRecHitContainer &cont, bool splitting=false) const
void reserve (unsigned int n)
void reverse ()
TrajectorySeed const & seed () const
 Access to the seed used to reconstruct the Trajectory.
edm::RefToBase< 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 boost::shared_ptr< const TrajectorySeed > &seed, PropagationDirection dir)
 Trajectory (const TrajectorySeed &seed, PropagationDirection dir)
void validRecHits (ConstRecHitContainer &cont) const

Static Public Member Functions

static bool inactive ()
static bool isBad (const TransientTrackingRecHit &hit)
static bool lost (const TransientTrackingRecHit &hit)

Private Member Functions

void check () const

Private Attributes

edm::RefToBase< TrajectorySeedseedRef_
float theChiSquared
float theChiSquaredBad
DataContainer theData
PropagationDirection theDirection
bool theDirectionValidity
signed short theNumberOfFoundHits
signed short 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.

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

Constructor of an empty trajectory with undefined direction. The direction will be defined at the moment of the push of a second measurement, from the relative radii of the first and second measurements.

Definition at line 66 of file Trajectory.h.

Trajectory::Trajectory ( const TrajectorySeed seed,
PropagationDirection  dir 
) [inline]

Constructor of an empty trajectory with defined direction. No check is made in the push method that measurements are added in the correct direction.

Definition at line 77 of file Trajectory.h.

Trajectory::Trajectory ( const boost::shared_ptr< const TrajectorySeed > &  seed,
PropagationDirection  dir 
) [inline]

Constructor of an empty trajectory with defined direction. No check is made in the push method that measurements are added in the correct direction.

Definition at line 89 of file Trajectory.h.


Member Function Documentation

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

Definition at line 200 of file Trajectory.cc.

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

                             {
  if ( theData.empty()) 
    throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
}
double Trajectory::chiSquared ( ) const [inline]
TrajectoryMeasurement const & Trajectory::closestMeasurement ( GlobalPoint  point) const

Definition at line 269 of file Trajectory.cc.

References begin, CastorDataFrameFilter_impl::check(), and end.

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

                                                                                    {
  check();
  vector<TrajectoryMeasurement>::const_iterator iter = std::min_element(measurements().begin(), measurements().end(), LessMag(point) );

  return (*iter);
}
DataContainer const& Trajectory::data ( ) const [inline]

obsolete name, use measurements() instead.

Definition at line 199 of file Trajectory.h.

References measurements().

Referenced by HICMeasurementEstimator::setCuts().

{ return measurements();}
PropagationDirection const & Trajectory::direction ( ) const

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

Definition at line 195 of file Trajectory.cc.

References Exception.

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

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

References check(), Exception, and theData.

Referenced by CRackTrajectoryBuilder::AddHit(), CkfDebugger::analyseCompatibleMeasurements(), GroupedCkfTrajectoryBuilder::backwardFit(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), DAFTrackProducerAlgorithm::buildTrack(), MTFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), KFTrajectoryFitter::fit(), GsfTrajectoryFitter::fit(), KFSplittingFitter::fit(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), TransientInitialStateEstimator::innerState(), TrackerToMuonPropagator::produce(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), and CosmicMuonTrajectoryBuilder::trajectories().

                                                         {
    check(); 
    if (theData.front().recHit()->hit()!=0) return theData.front();
    else if (theData.size()>2) return *(theData.begin()+1);
    else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
  }
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().

                                                                     {

  check();

  //if trajectory is in one half, return the end closer to origin point
  if ( firstMeasurement().updatedState().globalMomentum().perp() > 1.0
      && ( firstMeasurement().updatedState().globalPosition().basicVector().dot( firstMeasurement().updatedState().globalMomentum().basicVector() ) *
       lastMeasurement().updatedState().globalPosition().basicVector().dot( lastMeasurement().updatedState().globalMomentum().basicVector() )  > 0 ) ) {
     return (firstMeasurement().updatedState().globalPosition().mag() < lastMeasurement().updatedState().globalPosition().mag() ) ?
            firstMeasurement().updatedState() : lastMeasurement().updatedState();
  }

  //more complicated in case of traversing and low-pt trajectories with loops
  return closestMeasurement(GlobalPoint(0.0,0.0,0.0)).updatedState();

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

Definition of inactive Det from the Trajectory point of view.

Definition at line 264 of file Trajectory.h.

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

Method to invalidate a trajectory. Useful during ambiguity resolution.

Definition at line 256 of file Trajectory.h.

References theValid.

Referenced by TrajectoryCleanerBySharedHits::clean().

{ theValid = false;}
bool Trajectory::isBad ( const TransientTrackingRecHit hit) [static]

Returns true if the hit type is TrackingRecHit::bad Used in stand-alone trajectory construction

Definition at line 221 of file Trajectory.cc.

References cond::ecalcond::bad(), TrackingRecHit::geographicalId(), TrackingRecHit::getType(), TrackingRecHit::isValid(), and DetId::rawId().

{
  if ( hit.isValid()) return false;
  else {
    if(hit.geographicalId().rawId() == 0) {return false;}
    else{
      return hit.getType() == TrackingRecHit::bad;
    }
  }
}
bool Trajectory::isValid ( void  ) const [inline]
const DetLayer* Trajectory::lastLayer ( ) const [inline]

Redundant method, returns the layer of lastMeasurement() .

Definition at line 278 of file Trajectory.h.

References check(), Exception, and theData.

Referenced by CkfDebugger::analyseRecHitNotFound().

                                    {
    check();
    if (theData.back().recHit()->hit()!=0) return theData.back().layer();
    else if (theData.size()>2) return (theData.end()-2)->layer();
    else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
  }
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 175 of file Trajectory.h.

References check(), Exception, and theData.

Referenced by CRackTrajectoryBuilder::AddHit(), BaseCkfTrajectoryBuilder::addToResult(), CkfDebugger::analyseCompatibleMeasurements(), CkfDebugger::analyseRecHitNotFound(), CosmicMuonTrajectoryBuilder::build(), CosmicMuonTrajectoryBuilder::buildSecondHalf(), DAFTrackProducerAlgorithm::buildTrack(), MTFTrackProducerAlgorithm::buildTrack(), TrackProducerAlgorithm< reco::Track >::buildTrack(), TrackProducerAlgorithm< reco::GsfTrack >::buildTrack(), MuonTrackLoader::buildTrackExtra(), GlobalTrackerMuonAlignment::debugTrajectory(), CosmicMuonTrajectoryBuilder::estimateDirection(), HICTrajectoryBuilder::findCompatibleMeasurements(), CosmicMuonTrajectoryBuilder::flipTrajectory(), NuclearTrackCorrector::getNewTrackExtra(), CosmicMuonSmoother::initialState(), CkfDebugger::nextCorrectHits(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), GsfTrackProducerBase::putInEvt(), KfTrackProducerBase::putInEvt(), TrackProducerWithSCAssociation::putInEvt(), HICTrajectoryBuilder::qualityFilter(), ThresholdPtTrajectoryFilter::qualityFilter(), MinPtTrajectoryFilter::qualityFilter(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::run(), StandAloneMuonRefitter::singleRefit(), CRackTrajectoryBuilder::SortHits(), ThresholdPtTrajectoryFilter::toBeContinued(), MinPtTrajectoryFilter::toBeContinued(), CosmicMuonTrajectoryBuilder::trajectories(), and StandAloneMuonTrajectoryBuilder::trajectories().

                                                        {
    check(); 
    if (theData.back().recHit()->hit()!=0) return theData.back();
    else if (theData.size()>2) return *(theData.end()-2);
    else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
  }
bool Trajectory::lost ( const TransientTrackingRecHit hit) [static]

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

Definition at line 205 of file Trajectory.cc.

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

Referenced by FastTrackMerger::produce(), MaxConsecLostHitsTrajectoryFilter::TBC(), and HICTrajectoryBuilder::toBeContinued().

{
  if ( hit.isValid()) return false;
  else {
  //     // A DetLayer is always inactive in this logic.
  //     // The DetLayer is the Det of an invalid RecHit only if no DetUnit 
  //     // is compatible with the predicted state, so we don't really expect
  //     // a hit in this case.
  
    if(hit.geographicalId().rawId() == 0) {return false;}
    else{
      return hit.getType() == TrackingRecHit::missing;
    }
  }
}
int Trajectory::lostHits ( ) const [inline]

Number of detector layers crossed without valid RecHits. Used mainly as a criteria for abandoning a trajectory candidate during trajectory building.

Definition at line 225 of file Trajectory.h.

References theNumberOfLostHits.

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

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

Return all measurements in a container.

Definition at line 197 of file Trajectory.h.

References theData.

Referenced by PFTrackTransformer::addPoints(), PFTrackTransformer::addPointsAndBrems(), BaseCkfTrajectoryBuilder::addToResult(), DeDxDiscriminatorLearner::algoAnalyze(), SiStripGainFromData::algoAnalyze(), CkfDebugger::analyseCompatibleMeasurements(), SiPixelTrackResidualSource::analyze(), SiPixelLorentzAngle::analyze(), MuonRoadTrajectoryBuilder::cleanTrajectory(), StandAloneMuonFilter::createDefaultTrajectory(), data(), VertexTrackCompatibilityEstimator< 5 >::estimate(), AlignmentMonitorTracksFromTrajectories::event(), AlignmentMonitorTemplate::event(), AlignmentMonitorMuonVsCurvature::event(), AlignmentMonitorMuonResiduals::event(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), TrackerValidationVariables::fillHitQuantities(), MuonKinkFinder::fillTrkKink(), DynamicTruncation::filter(), HICTrajectoryBuilder::findCompatibleMeasurements(), SiStripFineDelayTLA::findtrackangle(), CosmicMuonSmoother::fit(), CRackTrajectoryBuilder::innerState(), TransientInitialStateEstimator::innerState(), GlobalTrackQualityProducer::kink(), MuonResidualsFromTrack::MuonResidualsFromTrack(), GlobalTrackQualityProducer::newChi2(), ConversionHitChecker::nHitsBeforeVtx(), TrajectoryFactoryBase::orderedTrajectoryMeasurements(), RoadSearchTrackCandidateMakerAlgorithm::PrepareTrackCandidates(), PlotRecTracks::printRecTracks(), HLTTrackClusterRemover::produce(), reco::modules::CosmicTrackSplitter::produce(), TkAlCaOverlapTagger::produce(), ShallowTrackClustersProducer::produce(), TrackClusterRemover::produce(), ShallowGainCalibration::produce(), DeDxDiscriminatorProducer::produce(), reco::modules::TrackerTrackHitFilter::produceFromTrajectory(), GsfTrackProducerBase::putInEvt(), HICTrajectoryBuilder::qualityFilter(), SimpleDAFHitCollector::recHits(), GroupedDAFHitCollector::recHits(), TrajectoryCleanerMerger::reOrderMeasurements(), CosmicMuonTrajectoryBuilder::reverseTrajectory(), CosmicMuonTrajectoryBuilder::reverseTrajectoryPropagationDirection(), CSCOverlapsAlignmentAlgorithm::run(), NuclearInteractionFinder::run(), HIPAlignmentAlgorithm::run(), RoadSearchTrackCandidateMakerAlgorithm::run(), MuonDTLocalMillepedeAlgorithm::run(), MuonMillepedeAlgorithm::run(), MTFTrackProducerAlgorithm::runWithCandidate(), GlobalTrajectoryBuilderBase::selectMuonHits(), HICMeasurementEstimator::setCuts(), CosmicMuonSmoother::smooth(), sortTrajectoryMeasurements(), TempTrajectory::TempTrajectory(), ClusterShapeTrajectoryFilter::toBeContinued(), KFTrajectorySmoother::trajectories(), GlobalCosmicMuonTrajectoryBuilder::trajectories(), GsfTrajectorySmoother::trajectories(), CosmicMuonTrajectoryBuilder::trajectories(), trajectoryToResiduals(), and HICMuonUpdator::update().

{ return theData;}
int Trajectory::ndof ( bool  bon = true) const

Number of dof of the trajectory. The method accepts a bool in order to properly take into account the presence of magnetic field in the dof computation. By default the MF is considered ON.

Definition at line 74 of file Trajectory.cc.

References max(), and DetId::Muon.

Referenced by SiPixelLorentzAngle::analyze(), MuonTrackLoader::buildTrackAtPCA(), GlobalTrajectoryBuilderBase::trackProbability(), and GlobalTrackQualityProducer::trackProbability().

                                   {
  const Trajectory::RecHitContainer transRecHits = recHits();
  
  int dof = 0;
  int dofBad = 0;
  
  for(Trajectory::RecHitContainer::const_iterator rechit = transRecHits.begin();
      rechit != transRecHits.end(); ++rechit) {
    if((*rechit)->isValid())
      dof += (*rechit)->dimension();
    else if( isBad(**rechit) && (*rechit)->geographicalId().det()==DetId::Muon )
      dofBad += (*rechit)->dimension();
  }

  // If dof!=0 (there is at least 1 valid hit),
  //    return ndof=ndof(fit)
  // If dof=0 (all rec hits are invalid, only for STA trajectories),
  //    return ndof=ndof(invalid hits)
  if(dof) {
    int constr = bon ? 5 : 4;
    return std::max(dof - constr, 0);
  }
  else {
    // A STA can have < 5 (invalid) hits
    // if this is the case ==> ndof = 1
    // (to avoid divisions by 0)
    int constr = bon ? 5 : 4;
    return std::max(dofBad - constr, 1);
  }
}
void Trajectory::pop ( )

Remove the last measurement from the trajectory.

Definition at line 17 of file Trajectory.cc.

References relativeConstraints::empty, and DetId::Muon.

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

                     {
  if (!empty()) {
    if(theData.back().recHit()->isValid()) {
      theNumberOfFoundHits--;
      theChiSquared -= theData.back().estimate();
    }
    else if(lost(* (theData.back().recHit()) )) {
      theNumberOfLostHits--;
    }
    else if(isBad(* (theData.back().recHit()) ) && theData.back().recHit()->geographicalId().det()==DetId::Muon ) {
      theChiSquaredBad -= theData.back().estimate();
    }

    theData.pop_back();
  }
}
void Trajectory::push ( const TrajectoryMeasurement tm)
void Trajectory::push ( const TrajectoryMeasurement tm,
double  chi2Increment 
)

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

Definition at line 39 of file Trajectory.cc.

References alongMomentum, DetId::Muon, oppositeToMomentum, and TrajectoryMeasurement::recHit().

{
  theData.push_back(tm);
  if ( tm.recHit()->isValid()) {
    theChiSquared += chi2Increment;
    theNumberOfFoundHits++;
  }
  // else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
  else if (lost( *(tm.recHit()) ) ) {
    theNumberOfLostHits++;
  }
 
  else if (isBad( *(tm.recHit()) ) && tm.recHit()->geographicalId().det()==DetId::Muon ) {
    theChiSquaredBad += chi2Increment;
  }
 
  // in case of a Trajectory constructed without direction, 
  // determine direction from the radii of the first two measurements

  if ( !theDirectionValidity && theData.size() >= 2) {
    if (theData[0].updatedState().globalPosition().perp() <
        theData.back().updatedState().globalPosition().perp())
      theDirection = alongMomentum;
    else theDirection = oppositeToMomentum;
    theDirectionValidity = true;
  }
}
Trajectory::RecHitContainer Trajectory::recHits ( bool  splitting = false) const
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().

                                                                          {
  hits.reserve(theData.size());
  if(!splitting){  
    for (Trajectory::DataContainer::const_iterator itm
           = theData.begin(); itm != theData.end(); itm++){    
      hits.push_back((*itm).recHit());
    }
  }else{    
    for (Trajectory::DataContainer::const_iterator itm
           = theData.begin(); itm != theData.end(); itm++){    

      // ====== WARNING: this is a temporary solution =========
      //        all this part of code should be implemented internally 
      //        in the TrackingRecHit classes. The concrete types of rechit 
      //        should be transparent to the Trajectory class

      if( typeid(*(itm->recHit()->hit())) == typeid(SiStripMatchedRecHit2D)){
        LocalPoint firstLocalPos = 
          itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[0]->globalPosition());
        
        LocalPoint secondLocalPos = 
          itm->updatedState().surface().toLocal(itm->recHit()->transientHits()[1]->globalPosition());
        
        LocalVector Delta = secondLocalPos - firstLocalPos;
        float scalar  = Delta.z() * (itm->updatedState().localDirection().z());
        

        TransientTrackingRecHit::ConstRecHitPointer hitA, hitB;

        // Get 2D strip Hits from a matched Hit.
        //hitA = itm->recHit()->transientHits()[0];
        //hitB = itm->recHit()->transientHits()[1];

        // Get 2D strip Hits from a matched Hit. Then get the 1D hit from the 2D hit
        if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
          hitA = itm->recHit()->transientHits()[0]->transientHits()[0];
          hitB = itm->recHit()->transientHits()[1]->transientHits()[0];
        }else{ //don't use 1D hit in the endcap yet
          hitA = itm->recHit()->transientHits()[0];
          hitB = itm->recHit()->transientHits()[1];
        }

        if( (scalar>=0 && direction()==alongMomentum) ||
            (scalar<0 && direction()==oppositeToMomentum)){
          hits.push_back(hitA);
          hits.push_back(hitB);
        }else if( (scalar>=0 && direction()== oppositeToMomentum) ||
                  (scalar<0 && direction()== alongMomentum)){
          hits.push_back(hitB);
          hits.push_back(hitA);
        }else {
          //throw cms::Exception("Error in Trajectory::recHitsV(). Direction is not defined");  
          edm::LogError("Trajectory_recHitsV_UndefinedTrackDirection") << 
                "Error in Trajectory::recHitsV: scalar = " << scalar << 
                ", direction = " << (direction()==alongMomentum ? "along" : (direction()==oppositeToMomentum ? "opposite" : "undefined")) << "\n";
          hits.push_back(hitA);
          hits.push_back(hitB);
        }         
      }else if(typeid(*(itm->recHit()->hit())) == typeid(ProjectedSiStripRecHit2D)){
        //hits.push_back(itm->recHit()->transientHits()[0]);    //Use 2D SiStripRecHit
        if(!itm->recHit()->transientHits()[0]->detUnit()->type().isEndcap()){
          hits.push_back(itm->recHit()->transientHits()[0]->transientHits()[0]);        //Use 1D SiStripRecHit
        }else{
          hits.push_back(itm->recHit()->transientHits()[0]);    //Use 2D SiStripRecHit
        }
        // ===================================================================================  
      }else if(typeid(*(itm->recHit()->hit())) == typeid(SiStripRecHit2D)){
        //hits.push_back(itm->recHit());  //Use 2D SiStripRecHit
        if(!itm->recHit()->detUnit()->type().isEndcap()){
          hits.push_back(itm->recHit()->transientHits()[0]); //Use 1D SiStripRecHit
        }else{
          hits.push_back(itm->recHit());  //Use 2D SiStripRecHit
        }
      }else{
        hits.push_back(itm->recHit());
      }
    }//end loop on measurements
  }
}
void Trajectory::reserve ( unsigned int  n) [inline]

Reserves space in the vector to avoid lots of allocations when push_back-ing measurements

Definition at line 153 of file Trajectory.h.

References theData.

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

{ theData.reserve(n); }
void Trajectory::reverse ( )

Reverse the propagation direction and the order of the trajectory measurements. It doesn't reverse the forward and backward predicted states within each trajectory measurement

Definition at line 276 of file Trajectory.cc.

References alongMomentum, and oppositeToMomentum.

                         {
    // reverse the direction (without changing it if it's not along or opposite)
    if (theDirection == alongMomentum)           theDirection = oppositeToMomentum;
    else if (theDirection == oppositeToMomentum) theDirection = alongMomentum;
    // reverse the order of the hits
    std::reverse(theData.begin(), theData.end());
}
TrajectorySeed const& Trajectory::seed ( ) const [inline]
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 290 of file Trajectory.h.

References seedRef_.

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

{ return seedRef_; }
void Trajectory::setSeedRef ( const edm::RefToBase< TrajectorySeed > &  seedRef) [inline]
const boost::shared_ptr<const TrajectorySeed>& Trajectory::sharedSeed ( ) const [inline]

Definition at line 302 of file Trajectory.h.

References theSeed.

{ return theSeed; }
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().

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

Member Data Documentation

Definition at line 306 of file Trajectory.h.

Referenced by seedRef(), and setSeedRef().

float Trajectory::theChiSquared [private]

Definition at line 309 of file Trajectory.h.

Referenced by chiSquared().

Definition at line 310 of file Trajectory.h.

Referenced by chiSquared().

Definition at line 308 of file Trajectory.h.

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

Definition at line 315 of file Trajectory.h.

Definition at line 316 of file Trajectory.h.

signed short Trajectory::theNumberOfFoundHits [private]

Definition at line 312 of file Trajectory.h.

Referenced by chiSquared(), and foundHits().

signed short Trajectory::theNumberOfLostHits [private]

Definition at line 313 of file Trajectory.h.

Referenced by lostHits().

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

Definition at line 305 of file Trajectory.h.

Referenced by seed(), and sharedSeed().

bool Trajectory::theValid [private]

Definition at line 317 of file Trajectory.h.

Referenced by invalidate(), and isValid().