CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

BaseCkfTrajectoryBuilder Class Reference

#include <BaseCkfTrajectoryBuilder.h>

Inheritance diagram for BaseCkfTrajectoryBuilder:
TrajectoryBuilder CkfTrajectoryBuilder GroupedCkfTrajectoryBuilder HICTrajectoryBuilder CkfDebugTrajectoryBuilder MuonCkfTrajectoryBuilder

List of all members.

Public Types

typedef std::vector
< TempTrajectory
TempTrajectoryContainer
typedef std::vector< TrajectoryTrajectoryContainer
typedef
TrajectoryContainer::iterator 
TrajectoryIterator

Public Member Functions

 BaseCkfTrajectoryBuilder (const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter, const TrajectoryFilter *inOutFilter=0)
virtual void setDebugger (CkfDebugger *dbg) const
virtual void setEvent (const edm::Event &event) const
virtual TrajectoryContainer trajectories (const TrajectorySeed &) const =0
virtual void unset () const
virtual ~BaseCkfTrajectoryBuilder ()

Protected Types

typedef FreeTrajectoryState FTS
typedef std::pair< TSOS,
std::vector< const DetLayer * > > 
StateAndLayers
typedef TrajectoryMeasurement TM
typedef TrajectoryStateOnSurface TSOS

Protected Member Functions

void addToResult (TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
void addToResult (TempTrajectory &traj, TempTrajectoryContainer &result, bool inOut=false) const
virtual bool analyzeMeasurementsDebugger (TempTrajectory &traj, std::vector< TrajectoryMeasurement > meas, const MeasurementTracker *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
virtual bool analyzeMeasurementsDebugger (Trajectory &traj, std::vector< TrajectoryMeasurement > meas, const MeasurementTracker *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
TempTrajectory createStartingTrajectory (const TrajectorySeed &seed) const
virtual void fillSeedHistoDebugger (std::vector< TrajectoryMeasurement >::iterator begin, std::vector< TrajectoryMeasurement >::iterator end) const
StateAndLayers findStateAndLayers (const TempTrajectory &traj) const
bool qualityFilter (const TempTrajectory &traj, bool inOut=false) const
bool toBeContinued (TempTrajectory &traj, bool inOut=false) const

Protected Attributes

const PropagatortheBackwardPropagator
const
Chi2MeasurementEstimatorBase
theEstimator
const PropagatortheForwardPropagator
const LayerMeasurementstheLayerMeasurements
const MeasurementTrackertheMeasurementTracker
const PropagatorthePropagatorAlong
const PropagatorthePropagatorOpposite
const
TransientTrackingRecHitBuilder
theTTRHBuilder
const TrajectoryStateUpdatortheUpdator

Private Member Functions

void seedMeasurements (const TrajectorySeed &seed, std::vector< TrajectoryMeasurement > &result) const

Private Attributes

edm::InputTag clustersToSkip_
bool skipClusters_
const TrajectoryFiltertheFilter
const TrajectoryFiltertheInOutFilter

Detailed Description

The component of track reconstruction that, strating from a seed, reconstructs all possible trajectories. The resulting trajectories may be mutually exclusive and require cleaning by a TrajectoryCleaner. The Trajectories are normally not smoothed.

Definition at line 43 of file BaseCkfTrajectoryBuilder.h.


Member Typedef Documentation

Definition at line 46 of file BaseCkfTrajectoryBuilder.h.

typedef std::pair<TSOS,std::vector<const DetLayer*> > BaseCkfTrajectoryBuilder::StateAndLayers [protected]

Definition at line 49 of file BaseCkfTrajectoryBuilder.h.

Reimplemented in HICTrajectoryBuilder, and CkfTrajectoryBuilder.

Definition at line 54 of file BaseCkfTrajectoryBuilder.h.

Reimplemented in HICTrajectoryBuilder.

Definition at line 48 of file BaseCkfTrajectoryBuilder.h.

Reimplemented from TrajectoryBuilder.

Reimplemented in HICTrajectoryBuilder, and CkfTrajectoryBuilder.

Definition at line 53 of file BaseCkfTrajectoryBuilder.h.

typedef TrajectoryContainer::iterator BaseCkfTrajectoryBuilder::TrajectoryIterator

Reimplemented from TrajectoryBuilder.

Definition at line 55 of file BaseCkfTrajectoryBuilder.h.

Reimplemented in HICTrajectoryBuilder.

Definition at line 47 of file BaseCkfTrajectoryBuilder.h.


Constructor & Destructor Documentation

BaseCkfTrajectoryBuilder::BaseCkfTrajectoryBuilder ( const edm::ParameterSet conf,
const TrajectoryStateUpdator updator,
const Propagator propagatorAlong,
const Propagator propagatorOpposite,
const Chi2MeasurementEstimatorBase estimator,
const TransientTrackingRecHitBuilder RecHitBuilder,
const MeasurementTracker measurementTracker,
const TrajectoryFilter filter,
const TrajectoryFilter inOutFilter = 0 
)

Definition at line 24 of file BaseCkfTrajectoryBuilder.cc.

References clustersToSkip_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and skipClusters_.

                                                                           :
  theUpdator(updator),
  thePropagatorAlong(propagatorAlong),thePropagatorOpposite(propagatorOpposite),
  theEstimator(estimator),theTTRHBuilder(recHitBuilder),
  theMeasurementTracker(measurementTracker),
  theLayerMeasurements(new LayerMeasurements(theMeasurementTracker)),
  theForwardPropagator(0),theBackwardPropagator(0),
  theFilter(filter),
  theInOutFilter(inOutFilter)
{
  if (conf.exists("clustersToSkip")){
    skipClusters_=true;
    clustersToSkip_=conf.getParameter<edm::InputTag>("clustersToSkip");
  }
  else
    skipClusters_=false;
}
BaseCkfTrajectoryBuilder::~BaseCkfTrajectoryBuilder ( ) [virtual]

Definition at line 50 of file BaseCkfTrajectoryBuilder.cc.

References theLayerMeasurements.

                                                   {
  delete theLayerMeasurements;
}

Member Function Documentation

void BaseCkfTrajectoryBuilder::addToResult ( TempTrajectory traj,
TrajectoryContainer result,
bool  inOut = false 
) const [protected]

Definition at line 166 of file BaseCkfTrajectoryBuilder.cc.

References Trajectory::empty(), Trajectory::foundHits(), Trajectory::lastMeasurement(), LogDebug, Trajectory::lostHits(), TempTrajectory::measurements(), Trajectory::measurements(), Trajectory::pop(), qualityFilter(), TrajectoryMeasurement::recHit(), and TempTrajectory::toTrajectory().

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer(), and CkfTrajectoryBuilder::limitedCandidates().

{
  // quality check
  if ( !qualityFilter(tmptraj, inOut) )  return;
  Trajectory traj = tmptraj.toTrajectory();
  // discard latest dummy measurements
  while (!traj.empty() && !traj.lastMeasurement().recHit()->isValid()) traj.pop();
  LogDebug("CkfPattern")<<inOut<<"=inOut option. pushing a Trajectory with: "<<traj.foundHits()<<" found hits. "<<traj.lostHits()
                        <<" lost hits. Popped :"<<(tmptraj.measurements().size())-(traj.measurements().size())<<" hits.";
  result.push_back( traj);
}
void BaseCkfTrajectoryBuilder::addToResult ( TempTrajectory traj,
TempTrajectoryContainer result,
bool  inOut = false 
) const [protected]

Definition at line 180 of file BaseCkfTrajectoryBuilder.cc.

References TempTrajectory::empty(), TempTrajectory::foundHits(), TempTrajectory::lastMeasurement(), LogDebug, TempTrajectory::lostHits(), TempTrajectory::measurements(), TempTrajectory::pop(), qualityFilter(), and TrajectoryMeasurement::recHit().

{
  // quality check
  if ( !qualityFilter(tmptraj, inOut) )  return;
  // discard latest dummy measurements
  TempTrajectory traj = tmptraj;
  while (!traj.empty() && !traj.lastMeasurement().recHit()->isValid()) traj.pop();
  LogDebug("CkfPattern")<<inOut<<"=inOut option. pushing a TempTrajectory with: "<<traj.foundHits()<<" found hits. "<<traj.lostHits()
                        <<" lost hits. Popped :"<<(tmptraj.measurements().size())-(traj.measurements().size())<<" hits.";
  result.push_back( traj );
}
virtual bool BaseCkfTrajectoryBuilder::analyzeMeasurementsDebugger ( Trajectory traj,
std::vector< TrajectoryMeasurement meas,
const MeasurementTracker theMeasurementTracker,
const Propagator theForwardPropagator,
const Chi2MeasurementEstimatorBase theEstimator,
const TransientTrackingRecHitBuilder theTTRHBuilder 
) const [inline, protected, virtual]

Maximum number of lost hits per trajectory candidate. Maximum number of consecutive lost hits per trajectory candidate.

Reimplemented in CkfDebugTrajectoryBuilder.

Definition at line 84 of file BaseCkfTrajectoryBuilder.h.

Referenced by CkfTrajectoryBuilder::limitedCandidates().

                                                                                                        {return true;} 
virtual bool BaseCkfTrajectoryBuilder::analyzeMeasurementsDebugger ( TempTrajectory traj,
std::vector< TrajectoryMeasurement meas,
const MeasurementTracker theMeasurementTracker,
const Propagator theForwardPropagator,
const Chi2MeasurementEstimatorBase theEstimator,
const TransientTrackingRecHitBuilder theTTRHBuilder 
) const [inline, protected, virtual]

Reimplemented in CkfDebugTrajectoryBuilder.

Definition at line 89 of file BaseCkfTrajectoryBuilder.h.

                                                                                                        {return true;} 
TempTrajectory BaseCkfTrajectoryBuilder::createStartingTrajectory ( const TrajectorySeed seed) const [protected]

Reimplemented in HICTrajectoryBuilder.

Definition at line 106 of file BaseCkfTrajectoryBuilder.cc.

References alongMomentum, TrajectorySeed::direction(), PrintoutHelper::dumpCandidate(), i, LogDebug, query::result, seedMeasurements(), theBackwardPropagator, and theForwardPropagator.

Referenced by GroupedCkfTrajectoryBuilder::buildTrajectories(), GroupedCkfTrajectoryBuilder::rebuildSeedingRegion(), and CkfTrajectoryBuilder::trajectories().

{
  TempTrajectory result( seed, seed.direction());
  if (  seed.direction() == alongMomentum) {
    theForwardPropagator = &(*thePropagatorAlong);
    theBackwardPropagator = &(*thePropagatorOpposite);
  }
  else {
    theForwardPropagator = &(*thePropagatorOpposite);
    theBackwardPropagator = &(*thePropagatorAlong);
  }

  std::vector<TM> seedMeas;
  seedMeasurements(seed, seedMeas);
  for (std::vector<TM>::const_iterator i=seedMeas.begin(); i!=seedMeas.end(); i++)
    result.push(*i);            

  LogDebug("CkfPattern")
    <<" initial trajectory from the seed: "<<PrintoutHelper::dumpCandidate(result,true);
  
  return result;
}
virtual void BaseCkfTrajectoryBuilder::fillSeedHistoDebugger ( std::vector< TrajectoryMeasurement >::iterator  begin,
std::vector< TrajectoryMeasurement >::iterator  end 
) const [inline, protected, virtual]

Reimplemented in CkfDebugTrajectoryBuilder.

Definition at line 94 of file BaseCkfTrajectoryBuilder.h.

Referenced by seedMeasurements().

                                                                                         {;}
BaseCkfTrajectoryBuilder::StateAndLayers BaseCkfTrajectoryBuilder::findStateAndLayers ( const TempTrajectory traj) const [protected]

Definition at line 197 of file BaseCkfTrajectoryBuilder.cc.

References PTrajectoryStateOnDet::detId(), GeometricSearchTracker::detLayer(), TempTrajectory::direction(), TempTrajectory::empty(), TrajectoryStateOnSurface::freeState(), g, MeasurementTracker::geometricSearchTracker(), MeasurementTracker::geomTracker(), errorMatrix2Lands_multiChannel::id, TrackingGeometry::idToDet(), TempTrajectory::lastLayer(), TempTrajectory::lastMeasurement(), Propagator::magneticField(), DetLayer::nextLayers(), TempTrajectory::seed(), TrajectorySeed::startingState(), theForwardPropagator, theMeasurementTracker, trajectoryStateTransform::transientState(), and TrajectoryMeasurement::updatedState().

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer(), and CkfTrajectoryBuilder::findCompatibleMeasurements().

{
  if (traj.empty())
    {
      //set the currentState to be the one from the trajectory seed starting point
      PTrajectoryStateOnDet ptod = traj.seed().startingState();
      DetId id(ptod.detId());
      const GeomDet * g = theMeasurementTracker->geomTracker()->idToDet(id);                    
      const Surface * surface=&g->surface();
      
      
      TSOS currentState = TrajectoryStateOnSurface(trajectoryStateTransform::transientState(ptod,surface,theForwardPropagator->magneticField()));      
      const DetLayer* lastLayer = theMeasurementTracker->geometricSearchTracker()->detLayer(id);      
      return StateAndLayers(currentState,lastLayer->nextLayers( *currentState.freeState(), traj.direction()) );
    }
  else
    {  
      TSOS currentState = traj.lastMeasurement().updatedState();
      return StateAndLayers(currentState,traj.lastLayer()->nextLayers( *currentState.freeState(), traj.direction()) );
    }
}
bool BaseCkfTrajectoryBuilder::qualityFilter ( const TempTrajectory traj,
bool  inOut = false 
) const [protected]

Called at end of track building, to see if track should be kept

Definition at line 152 of file BaseCkfTrajectoryBuilder.cc.

References TrajectoryFilter::qualityFilter(), theFilter, and theInOutFilter.

Referenced by addToResult(), and CkfTrajectoryBuilder::limitedCandidates().

{
  // Called after building a trajectory is completed, to see if it is good enough
  // to keep.
  if (inOut) {
    if (theInOutFilter == 0) edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: trying to use dedicated filter for in-out tracking phase, when none specified";
    return theInOutFilter->qualityFilter(traj);
  } else {
    return theFilter->qualityFilter(traj);
  }
}
void BaseCkfTrajectoryBuilder::seedMeasurements ( const TrajectorySeed seed,
std::vector< TrajectoryMeasurement > &  result 
) const [private]

Definition at line 56 of file BaseCkfTrajectoryBuilder.cc.

References TransientTrackingRecHitBuilder::build(), GeometricSearchTracker::detLayer(), fillSeedHistoDebugger(), MeasurementTracker::geometricSearchTracker(), MeasurementTracker::geomTracker(), TrackingGeometry::idToDet(), Propagator::magneticField(), Propagator::propagate(), TrajectorySeed::recHits(), TrajectorySeed::startingState(), GeomDet::surface(), theBackwardPropagator, theForwardPropagator, theMeasurementTracker, theTTRHBuilder, theUpdator, trajectoryStateTransform::transientState(), and TrajectoryStateUpdator::update().

Referenced by createStartingTrajectory().

{
  

  TrajectorySeed::range hitRange = seed.recHits();
  for (TrajectorySeed::const_iterator ihit = hitRange.first; 
       ihit != hitRange.second; ihit++) {
    TransientTrackingRecHit::RecHitPointer recHit = theTTRHBuilder->build(&(*ihit));
    const GeomDet* hitGeomDet = 
      theMeasurementTracker->geomTracker()->idToDet( ihit->geographicalId());

    const DetLayer* hitLayer = 
      theMeasurementTracker->geometricSearchTracker()->detLayer(ihit->geographicalId());

    TSOS invalidState( new BasicSingleTrajectoryState( hitGeomDet->surface()));
    if (ihit == hitRange.second - 1) {
      // the seed trajectory state should correspond to this hit
      PTrajectoryStateOnDet pState( seed.startingState());
      const GeomDet* gdet = theMeasurementTracker->geomTracker()->idToDet( DetId(pState.detId()));
      if (&gdet->surface() != &hitGeomDet->surface()) {
        edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: the seed state is not on the surface of the detector of the last seed hit";
        return; // FIXME: should throw exception
      }

      TSOS updatedState = trajectoryStateTransform::transientState( pState, &(gdet->surface()), 
                                                      theForwardPropagator->magneticField());
      result.push_back(TM( invalidState, updatedState, recHit, 0, hitLayer));
    }
    else {
      PTrajectoryStateOnDet pState( seed.startingState());

      TSOS outerState = trajectoryStateTransform::transientState(pState,
                                                   &((theMeasurementTracker->geomTracker()->idToDet(
                                                                                     (hitRange.second - 1)->geographicalId()))->surface()),  
                                                   theForwardPropagator->magneticField());
      TSOS innerState   = theBackwardPropagator->propagate(outerState,hitGeomDet->surface());
      if(innerState.isValid()) {
        TSOS innerUpdated = theUpdator->update(innerState,*recHit);
        result.push_back(TM( invalidState, innerUpdated, recHit, 0, hitLayer));
      }
    }
  }

  // method for debugging
  fillSeedHistoDebugger(result.begin(),result.end());

}
virtual void BaseCkfTrajectoryBuilder::setDebugger ( CkfDebugger dbg) const [inline, virtual]

Reimplemented in CkfDebugTrajectoryBuilder.

Definition at line 74 of file BaseCkfTrajectoryBuilder.h.

{;}
void BaseCkfTrajectoryBuilder::setEvent ( const edm::Event event) const [virtual]
bool BaseCkfTrajectoryBuilder::toBeContinued ( TempTrajectory traj,
bool  inOut = false 
) const [protected]

Called after each new hit is added to the trajectory, to see if building this track should be continued

Definition at line 130 of file BaseCkfTrajectoryBuilder.cc.

References TempTrajectory::foundHits(), TempTrajectory::lastLayer(), TempTrajectory::lastMeasurement(), LogTrace, TempTrajectory::lostHits(), TempTrajectory::measurements(), TrajectoryMeasurement::predictedState(), DetLayer::subDetector(), theFilter, theInOutFilter, and TrajectoryFilter::toBeContinued().

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer(), and CkfTrajectoryBuilder::limitedCandidates().

{
  if (traj.measurements().size() > 400) {
    edm::LogError("BaseCkfTrajectoryBuilder_InfiniteLoop");
    LogTrace("BaseCkfTrajectoryBuilder_InfiniteLoop") << 
              "Cropping Track After 400 Measurements:\n" <<
              "   Last predicted state: " << traj.lastMeasurement().predictedState() << "\n" <<
              "   Last layer subdetector: " << (traj.lastLayer() ? traj.lastLayer()->subDetector() : -1) << "\n" <<
              "   Found hits: " << traj.foundHits() << ", lost hits: " << traj.lostHits() << "\n\n";
    return false;
  }
  // Called after each new hit is added to the trajectory, to see if it is 
  // worth continuing to build this track candidate.
  if (inOut) {
    if (theInOutFilter == 0) edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: trying to use dedicated filter for in-out tracking phase, when none specified";
    return theInOutFilter->toBeContinued(traj);
  } else {
    return theFilter->toBeContinued(traj);
  }
}
virtual TrajectoryContainer BaseCkfTrajectoryBuilder::trajectories ( const TrajectorySeed ) const [pure virtual]
void BaseCkfTrajectoryBuilder::unset ( ) const [virtual]

Member Data Documentation

Definition at line 145 of file BaseCkfTrajectoryBuilder.h.

Referenced by BaseCkfTrajectoryBuilder(), and setEvent().

Filter used at end of in-out tracking

Definition at line 144 of file BaseCkfTrajectoryBuilder.h.

Referenced by BaseCkfTrajectoryBuilder(), setEvent(), and unset().

Definition at line 141 of file BaseCkfTrajectoryBuilder.h.

Referenced by qualityFilter(), and toBeContinued().

Filter used at end of complete tracking

Definition at line 142 of file BaseCkfTrajectoryBuilder.h.

Referenced by qualityFilter(), and toBeContinued().

Reimplemented in HICTrajectoryBuilder.

Definition at line 121 of file BaseCkfTrajectoryBuilder.h.

Reimplemented in HICTrajectoryBuilder.

Definition at line 122 of file BaseCkfTrajectoryBuilder.h.