#include <KFTrajectoryFitter.h>
Public Member Functions | |
virtual KFTrajectoryFitter * | clone () const |
const MeasurementEstimator * | estimator () const |
virtual std::vector< Trajectory > | fit (const TrajectorySeed &aSeed, const RecHitContainer &hits) const |
virtual std::vector< Trajectory > | fit (const Trajectory &aTraj) const |
virtual std::vector< Trajectory > | fit (const TrajectorySeed &aSeed, const RecHitContainer &hits, const TSOS &firstPredTsos) const |
KFTrajectoryFitter (const Propagator &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, int minHits=3, const DetLayerGeometry *detLayerGeometry=0) | |
KFTrajectoryFitter (const Propagator *aPropagator, const TrajectoryStateUpdator *aUpdator, const MeasurementEstimator *aEstimator, int minHits=3, const DetLayerGeometry *detLayerGeometry=0) | |
const Propagator * | propagator () const |
const TrajectoryStateUpdator * | updator () const |
~KFTrajectoryFitter () | |
Private Types | |
typedef FreeTrajectoryState | FTS |
typedef TrajectoryMeasurement | TM |
typedef TrajectoryStateOnSurface | TSOS |
Private Member Functions | |
KFTrajectoryFitter (KFTrajectoryFitter const &) | |
Private Attributes | |
int | minHits_ |
bool | owner |
const MeasurementEstimator * | theEstimator |
const DetLayerGeometry * | theGeometry |
const Propagator * | thePropagator |
const TrajectoryStateUpdator * | theUpdator |
Static Private Attributes | |
static const DetLayerGeometry | dummyGeometry |
A Kalman track fit that splits matched RecHits into individual components before fitting them. Ported from ORCA
A Standard Kalman fit. Ported from ORCA
Definition at line 22 of file KFTrajectoryFitter.h.
typedef FreeTrajectoryState KFTrajectoryFitter::FTS [private] |
Reimplemented in KFSplittingFitter.
Definition at line 27 of file KFTrajectoryFitter.h.
typedef TrajectoryMeasurement KFTrajectoryFitter::TM [private] |
Reimplemented in KFSplittingFitter.
Definition at line 28 of file KFTrajectoryFitter.h.
typedef TrajectoryStateOnSurface KFTrajectoryFitter::TSOS [private] |
Reimplemented in KFSplittingFitter.
Definition at line 26 of file KFTrajectoryFitter.h.
KFTrajectoryFitter::KFTrajectoryFitter | ( | const Propagator & | aPropagator, |
const TrajectoryStateUpdator & | aUpdator, | ||
const MeasurementEstimator & | aEstimator, | ||
int | minHits = 3 , |
||
const DetLayerGeometry * | detLayerGeometry = 0 |
||
) | [inline] |
Definition at line 34 of file KFTrajectoryFitter.h.
References dummyGeometry, and theGeometry.
Referenced by clone().
: thePropagator(aPropagator.clone()), theUpdator(aUpdator.clone()), theEstimator(aEstimator.clone()), theGeometry(detLayerGeometry), minHits_(minHits), owner(true){ if(!theGeometry) theGeometry = &dummyGeometry; // FIXME. Why this first constructor is needed? who is using it? Can it be removed? // it is uses in many many places }
KFTrajectoryFitter::KFTrajectoryFitter | ( | const Propagator * | aPropagator, |
const TrajectoryStateUpdator * | aUpdator, | ||
const MeasurementEstimator * | aEstimator, | ||
int | minHits = 3 , |
||
const DetLayerGeometry * | detLayerGeometry = 0 |
||
) | [inline] |
Definition at line 51 of file KFTrajectoryFitter.h.
References dummyGeometry, and theGeometry.
: thePropagator(aPropagator), theUpdator(aUpdator), theEstimator(aEstimator), theGeometry(detLayerGeometry), minHits_(minHits), owner(false){ if(!theGeometry) theGeometry = &dummyGeometry; }
KFTrajectoryFitter::~KFTrajectoryFitter | ( | ) | [inline] |
Definition at line 65 of file KFTrajectoryFitter.h.
References owner, theEstimator, thePropagator, and theUpdator.
{ if (owner) { delete thePropagator; delete theUpdator; delete theEstimator; } }
KFTrajectoryFitter::KFTrajectoryFitter | ( | KFTrajectoryFitter const & | ) | [private] |
virtual KFTrajectoryFitter* KFTrajectoryFitter::clone | ( | void | ) | const [inline, virtual] |
Implements TrajectoryFitter.
Reimplemented in KFSplittingFitter.
Definition at line 85 of file KFTrajectoryFitter.h.
References KFTrajectoryFitter(), minHits_, owner, theEstimator, theGeometry, thePropagator, and theUpdator.
{ return owner ? new KFTrajectoryFitter(*thePropagator,*theUpdator,*theEstimator,minHits_,theGeometry) : new KFTrajectoryFitter(thePropagator,theUpdator,theEstimator,minHits_,theGeometry); }
const MeasurementEstimator* KFTrajectoryFitter::estimator | ( | void | ) | const [inline] |
Definition at line 83 of file KFTrajectoryFitter.h.
References theEstimator.
Referenced by KFSplittingFitter::clone(), and fit().
{return theEstimator;}
std::vector< Trajectory > KFTrajectoryFitter::fit | ( | const TrajectorySeed & | aSeed, |
const RecHitContainer & | hits, | ||
const TSOS & | firstPredTsos | ||
) | const [virtual] |
Implements TrajectoryFitter.
Reimplemented in KFSplittingFitter.
Definition at line 39 of file KFTrajectoryFitter.cc.
References anyDirection, TransientTrackingRecHit::clone(), CSC(), CSCDetId, DetId::det(), TrajectorySeed::direction(), PXFDetId::disk(), GeomDetEnumerators::DT, estimator(), Trajectory::foundHits(), TrackingRecHit::geographicalId(), TransientTrackingRecHit::globalPosition(), DetLayerGeometry::idToLayer(), TrackingRecHit::isValid(), TrajectoryStateOnSurface::isValid(), j, TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), TrackingRecHit::localPosition(), TrackingRecHit::localPositionError(), LogDebug, LogTrace, minHits_, DetId::Muon, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GloballyPositioned< T >::position(), Propagator::propagate(), Propagator::propagationDirection(), Trajectory::push(), DetId::rawId(), Trajectory::reserve(), runTheMatrix::ret, GloballyPositioned< T >::rotation(), dedefs::RPC, RPCDetId, edm::second(), DetId::subdetId(), TransientTrackingRecHit::surface(), sistripsummary::TEC, theGeometry, thePropagator, sistripsummary::TIB, sistripsummary::TID, sistripsummary::TOB, align::Tracker, TrajectoryStateUpdator::update(), updator(), TIDDetId::wheel(), TECDetId::wheel(), and PV3DBase< T, PVType, FrameType >::z().
{ if(hits.empty()) return std::vector<Trajectory>(); if (aSeed.direction() == anyDirection) throw cms::Exception("KFTrajectoryFitter","TrajectorySeed::direction() requested but not set"); SetPropagationDirection setDir(*thePropagator,aSeed.direction()); #ifdef EDM_LM_DEBUG LogDebug("TrackFitters") <<" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" <<" KFTrajectoryFitter::fit starting with " << hits.size() <<" HITS"; for (unsigned int j=0;j<hits.size();j++) { if (hits[j]->det()) LogTrace("TrackFitters") << "hit #:" << j+1 << " rawId=" << hits[j]->det()->geographicalId().rawId() << " validity=" << hits[j]->isValid(); else LogTrace("TrackFitters") << "hit #:" << j+1 << " Hit with no Det information"; } LogTrace("TrackFitters") << " INITIAL STATE "<< firstPredTsos; #endif std::vector<Trajectory> ret(1, Trajectory(aSeed, thePropagator->propagationDirection())); Trajectory & myTraj = ret.front(); myTraj.reserve(hits.size()); TSOS predTsos(firstPredTsos); TSOS currTsos; int hitcounter = 1; for(RecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ++ihit, ++hitcounter) { const TransientTrackingRecHit & hit = (**ihit); if (hit.isValid() == false && hit.surface() == 0) { LogDebug("TrackFitters")<< " Error: invalid hit with no GeomDet attached .... skipping"; continue; } #ifdef EDM_LM_DEBUG if (hit.isValid()) { LogTrace("TrackFitters") << " ----------------- HIT #" << hitcounter << " (VALID)-----------------------\n" << " HIT IS AT R " << hit.globalPosition().perp() << "\n" << " HIT IS AT Z " << hit.globalPosition().z() << "\n" << " HIT IS AT Phi " << hit.globalPosition().phi() << "\n" << " HIT IS AT Loc " << hit.localPosition() << "\n" << " WITH LocError " << hit.localPositionError() << "\n" << " HIT IS AT Glo " << hit.globalPosition() << "\n" << "SURFACE POSITION" << "\n" << hit.surface()->position()<<"\n" << "SURFACE ROTATION" << "\n" << hit.surface()->rotation(); DetId hitId = hit.geographicalId(); LogTrace("TrackFitters") << " hit det=" << hitId.rawId(); if(hitId.det() == DetId::Tracker) { if (hitId.subdetId() == StripSubdetector::TIB ) LogTrace("TrackFitters") << " I am TIB " << TIBDetId(hitId).layer(); else if (hitId.subdetId() == StripSubdetector::TOB ) LogTrace("TrackFitters") << " I am TOB " << TOBDetId(hitId).layer(); else if (hitId.subdetId() == StripSubdetector::TEC ) LogTrace("TrackFitters") << " I am TEC " << TECDetId(hitId).wheel(); else if (hitId.subdetId() == StripSubdetector::TID ) LogTrace("TrackFitters") << " I am TID " << TIDDetId(hitId).wheel(); else if (hitId.subdetId() == StripSubdetector::TID ) LogTrace("TrackFitters") << " I am TID " << TIDDetId(hitId).wheel(); else if (hitId.subdetId() == (int) PixelSubdetector::PixelBarrel ) LogTrace("TrackFitters") << " I am PixBar " << PXBDetId(hitId).layer(); else if (hitId.subdetId() == (int) PixelSubdetector::PixelEndcap ) LogTrace("TrackFitters") << " I am PixFwd " << PXFDetId(hitId).disk(); else LogTrace("TrackFitters") << " UNKNOWN TRACKER HIT TYPE "; } else if(hitId.det() == DetId::Muon) { if(hitId.subdetId() == MuonSubdetId::DT) LogTrace("TrackFitters") << " I am DT " << DTWireId(hitId); else if (hitId.subdetId() == MuonSubdetId::CSC ) LogTrace("TrackFitters") << " I am CSC " << CSCDetId(hitId); else if (hitId.subdetId() == MuonSubdetId::RPC ) LogTrace("TrackFitters") << " I am RPC " << RPCDetId(hitId); else LogTrace("TrackFitters") << " UNKNOWN MUON HIT TYPE "; } else LogTrace("TrackFitters") << " UNKNOWN HIT TYPE "; } else { LogTrace("TrackFitters") << " ----------------- INVALID HIT #" << hitcounter << " -----------------------"; } #endif if ( hitcounter != 1) //no propagation needed for the first hit predTsos = thePropagator->propagate( currTsos, *(hit.surface()) ); if(!predTsos.isValid()) { LogDebug("TrackFitters") << "SOMETHING WRONG !" << "\n" << "KFTrajectoryFitter: predicted tsos not valid!\n" << "current TSOS: " << currTsos << "\n"; if(hit.surface()) LogTrace("TrackFitters") << "next Surface: " << hit.surface()->position() << "\n"; if( myTraj.foundHits() >= minHits_ ) { LogDebug("TrackFitters") << " breaking trajectory" << "\n"; break; } else { LogDebug("TrackFitters") << " killing trajectory" << "\n"; return std::vector<Trajectory>(); } } if(hit.isValid()) { //update LogTrace("TrackFitters") << "THE HIT IS VALID: updating hit with predTsos"; TransientTrackingRecHit::RecHitPointer preciseHit = hit.clone(predTsos); if (preciseHit->isValid() == false){ LogTrace("TrackFitters") << "THE Precise HIT IS NOT VALID: using currTsos = predTsos" << "\n"; currTsos = predTsos; myTraj.push(TM(predTsos, *ihit,0,theGeometry->idToLayer((*ihit)->geographicalId()) )); }else{ LogTrace("TrackFitters") << "THE Precise HIT IS VALID: updating currTsos" << "\n"; currTsos = updator()->update(predTsos, *preciseHit); //check for valid hits with no det (refitter with constraints) if (!currTsos.isValid()){ edm::LogError("FailedUpdate")<<"updating with the hit failed. Not updating the trajectory with the hit"; myTraj.push(TM(predTsos, *ihit,0,theGeometry->idToLayer((*ihit)->geographicalId()) )); } else{ if (preciseHit->det()) myTraj.push(TM(predTsos, currTsos, preciseHit, estimator()->estimate(predTsos, *preciseHit).second, theGeometry->idToLayer(preciseHit->geographicalId()) )); else myTraj.push(TM(predTsos, currTsos, preciseHit, estimator()->estimate(predTsos, *preciseHit).second)); } } } else { //no update LogDebug("TrackFitters") << "THE HIT IS NOT VALID: using currTsos" << "\n"; currTsos = predTsos; myTraj.push(TM(predTsos, *ihit,0,theGeometry->idToLayer((*ihit)->geographicalId()) )); } LogTrace("TrackFitters") << "predTsos !" << "\n" << predTsos << "\n" <<"currTsos !" << "\n" << currTsos; } LogDebug("TrackFitters") << "Found 1 trajectory with " << myTraj.foundHits() << " valid hits\n"; return ret; }
std::vector< Trajectory > KFTrajectoryFitter::fit | ( | const TrajectorySeed & | aSeed, |
const RecHitContainer & | hits | ||
) | const [virtual] |
Implements TrajectoryFitter.
Definition at line 30 of file KFTrajectoryFitter.cc.
References Exception.
{ throw cms::Exception("TrackFitters", "KFTrajectoryFitter::fit(TrajectorySeed, <TransientTrackingRecHit>) not implemented"); return std::vector<Trajectory>(); }
std::vector< Trajectory > KFTrajectoryFitter::fit | ( | const Trajectory & | aTraj | ) | const [virtual] |
Implements TrajectoryFitter.
Reimplemented in KFSplittingFitter.
Definition at line 20 of file KFTrajectoryFitter.cc.
References Trajectory::empty(), Trajectory::firstMeasurement(), Trajectory::recHits(), Trajectory::seed(), and TrajectoryMeasurement::updatedState().
Referenced by CRackTrajectoryBuilder::AddHit().
{ if(aTraj.empty()) return std::vector<Trajectory>(); TM firstTM = aTraj.firstMeasurement(); TSOS firstTsos = TrajectoryStateWithArbitraryError()(firstTM.updatedState()); return fit(aTraj.seed(), aTraj.recHits(), firstTsos); }
const Propagator* KFTrajectoryFitter::propagator | ( | void | ) | const [inline] |
Definition at line 81 of file KFTrajectoryFitter.h.
References thePropagator.
Referenced by KFSplittingFitter::clone(), and KalmanAlignmentAlgorithm::initializeAlignmentSetups().
{return thePropagator;}
const TrajectoryStateUpdator* KFTrajectoryFitter::updator | ( | ) | const [inline] |
Definition at line 82 of file KFTrajectoryFitter.h.
References theUpdator.
Referenced by KFSplittingFitter::clone(), fit(), and KalmanAlignmentAlgorithm::initializeAlignmentSetups().
{return theUpdator;}
const DetLayerGeometry KFTrajectoryFitter::dummyGeometry [static, private] |
Definition at line 96 of file KFTrajectoryFitter.h.
Referenced by KFTrajectoryFitter().
int KFTrajectoryFitter::minHits_ [private] |
Definition at line 101 of file KFTrajectoryFitter.h.
bool KFTrajectoryFitter::owner [private] |
Definition at line 102 of file KFTrajectoryFitter.h.
Referenced by clone(), and ~KFTrajectoryFitter().
const MeasurementEstimator* KFTrajectoryFitter::theEstimator [private] |
Definition at line 99 of file KFTrajectoryFitter.h.
Referenced by clone(), estimator(), and ~KFTrajectoryFitter().
const DetLayerGeometry* KFTrajectoryFitter::theGeometry [private] |
Definition at line 100 of file KFTrajectoryFitter.h.
Referenced by clone(), fit(), and KFTrajectoryFitter().
const Propagator* KFTrajectoryFitter::thePropagator [private] |
Definition at line 97 of file KFTrajectoryFitter.h.
Referenced by clone(), fit(), propagator(), and ~KFTrajectoryFitter().
const TrajectoryStateUpdator* KFTrajectoryFitter::theUpdator [private] |
Definition at line 98 of file KFTrajectoryFitter.h.
Referenced by clone(), updator(), and ~KFTrajectoryFitter().