#include <GsfTrajectorySmoother.h>
A GSF smoother, similar to KFTrajectorySmoother, but (for testing purposes) without combination with the forward fit.
Definition at line 21 of file GsfTrajectorySmoother.h.
typedef TrajectoryMeasurement GsfTrajectorySmoother::TM [private] |
Definition at line 26 of file GsfTrajectorySmoother.h.
typedef TrajectoryStateOnSurface GsfTrajectorySmoother::TSOS [private] |
Definition at line 25 of file GsfTrajectorySmoother.h.
GsfTrajectorySmoother::GsfTrajectorySmoother | ( | const GsfPropagatorWithMaterial & | aPropagator, |
const TrajectoryStateUpdator & | aUpdator, | ||
const MeasurementEstimator & | aEstimator, | ||
const MultiTrajectoryStateMerger & | merger, | ||
float | errorRescaling, | ||
const bool | materialBeforeUpdate = true , |
||
const DetLayerGeometry * | detLayerGeometry = 0 |
||
) |
Constructor with explicit components for propagation, update, chi2 calculation, merging and flag for merging before / after the update (i.e. fully configured). It clones the algorithms.
Definition at line 9 of file GsfTrajectorySmoother.cc.
References FullConvolutionWithMaterial::clone(), GsfPropagatorWithMaterial::convolutionWithMaterial(), dummyGeometry, GsfPropagatorWithMaterial::geometricalPropagator(), theConvolutor, theGeometry, theGeomPropagator, theMatBeforeUpdate, and thePropagator.
Referenced by clone().
: thePropagator(aPropagator.clone()), theGeomPropagator(0), theConvolutor(0), theUpdator(aUpdator.clone()), theEstimator(aEstimator.clone()), theMerger(aMerger.clone()), theMatBeforeUpdate(materialBeforeUpdate), theErrorRescaling(errorRescaling), theGeometry(detLayerGeometry) { if ( !theMatBeforeUpdate ) { theGeomPropagator = new GsfPropagatorAdapter(thePropagator->geometricalPropagator()); theConvolutor = thePropagator->convolutionWithMaterial().clone(); } if(!theGeometry) theGeometry = &dummyGeometry; // static SimpleConfigurable<bool> timeConf(false,"GsfTrajectorySmoother:activateTiming"); // theTiming = timeConf.value(); }
GsfTrajectorySmoother::~GsfTrajectorySmoother | ( | ) | [virtual] |
Definition at line 37 of file GsfTrajectorySmoother.cc.
References theConvolutor, theEstimator, theGeomPropagator, theMerger, thePropagator, and theUpdator.
{ delete thePropagator; delete theGeomPropagator; delete theConvolutor; delete theUpdator; delete theEstimator; delete theMerger; }
virtual GsfTrajectorySmoother* GsfTrajectorySmoother::clone | ( | void | ) | const [inline, virtual] |
Implements TrajectorySmoother.
Definition at line 54 of file GsfTrajectorySmoother.h.
References GsfTrajectorySmoother(), theErrorRescaling, theEstimator, theGeometry, theMatBeforeUpdate, theMerger, thePropagator, and theUpdator.
{ return new GsfTrajectorySmoother(*thePropagator,*theUpdator,*theEstimator, *theMerger,theErrorRescaling,theMatBeforeUpdate,theGeometry); }
const MeasurementEstimator* GsfTrajectorySmoother::estimator | ( | void | ) | const [inline] |
Definition at line 52 of file GsfTrajectorySmoother.h.
References theEstimator.
Referenced by trajectories().
{return theEstimator;}
const Propagator* GsfTrajectorySmoother::propagator | ( | void | ) | const [inline] |
propagator used (full propagator, if material effects are applied before the update, otherwise purely geometrical part)
Definition at line 47 of file GsfTrajectorySmoother.h.
References theGeomPropagator, and thePropagator.
Referenced by trajectories().
{ if ( thePropagator) return thePropagator; else return theGeomPropagator; }
std::vector< Trajectory > GsfTrajectorySmoother::trajectories | ( | const Trajectory & | aTraj | ) | const [virtual] |
Implements TrajectorySmoother.
Definition at line 47 of file GsfTrajectorySmoother.cc.
References alongMomentum, heavyFlavorValidationHarvestingSequence_cff::combiner, Trajectory::direction(), Trajectory::empty(), MeasurementEstimator::estimate(), TrajectoryMeasurement::estimate(), estimator(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), DetLayerGeometry::idToLayer(), TrajectoryStateOnSurface::isValid(), LogDebug, Trajectory::measurements(), MultiTrajectoryStateMerger::merge(), oppositeToMomentum, Propagator::propagate(), Propagator::propagationDirection(), propagator(), TrajectoryStateOnSurface::rescaleError(), edm::second(), Trajectory::seed(), GsfPropagatorWithMaterial::setPropagationDirection(), TrajectoryStateOnSurface::surface(), theConvolutor, theErrorRescaling, theGeometry, theMatBeforeUpdate, theMerger, thePropagator, TrajectoryStateUpdator::update(), and updator().
{ // static TimingReport::Item* propTimer = // &(*TimingReport::current())[string("GsfTrajectorySmoother:propagation")]; // propTimer->switchCPU(false); // if ( !theTiming ) propTimer->switchOn(false); // static TimingReport::Item* updateTimer = // &(*TimingReport::current())[string("GsfTrajectorySmoother:update")]; // updateTimer->switchCPU(false); // if ( !theTiming ) updateTimer->switchOn(false); if(aTraj.empty()) return std::vector<Trajectory>(); if ( aTraj.direction() == alongMomentum) { thePropagator->setPropagationDirection(oppositeToMomentum); } else { thePropagator->setPropagationDirection(alongMomentum); } Trajectory myTraj(aTraj.seed(), propagator()->propagationDirection()); std::vector<TM> avtm = aTraj.measurements(); TSOS predTsos = avtm.back().forwardPredictedState(); predTsos.rescaleError(theErrorRescaling); if(!predTsos.isValid()) { edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: predicted tsos of last measurement not valid!"; return std::vector<Trajectory>(); } TSOS currTsos; //first smoothed tm is last fitted if(avtm.back().recHit()->isValid()) { { // TimeMe t(*updateTimer,false); currTsos = updator()->update(predTsos, *avtm.back().recHit()); } if(!currTsos.isValid()) { edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: tsos not valid after update!"; return std::vector<Trajectory>(); } //check validity if (!avtm.back().forwardPredictedState().isValid() || !predTsos.isValid() || !avtm.back().updatedState().isValid()){ edm::LogError("InvalidState")<<"first hit"; return std::vector<Trajectory>(); } myTraj.push(TM(avtm.back().forwardPredictedState(), predTsos, avtm.back().updatedState(), avtm.back().recHit(), avtm.back().estimate(), theGeometry->idToLayer(avtm.back().recHit()->geographicalId()) ), avtm.back().estimate()); } else { currTsos = predTsos; //check validity if (!avtm.back().forwardPredictedState().isValid()){ edm::LogError("InvalidState")<<"first hit on invalid hit"; return std::vector<Trajectory>(); } myTraj.push(TM(avtm.back().forwardPredictedState(), avtm.back().recHit(), 0., theGeometry->idToLayer(avtm.back().recHit()->geographicalId() ) )); } TrajectoryStateCombiner combiner; for(std::vector<TM>::reverse_iterator itm = avtm.rbegin() + 1; itm < avtm.rend() - 1; ++itm) { { // TimeMe t(*propTimer,false); // // // // check type of surface in case of invalid hit // // (in this version only propagations to planes are // // supported for multi trajectory states) // // // if ( !(*itm).recHit().isValid() ) { // const BoundPlane* plane = // dynamic_cast<const BoundPlane*>(&(*itm).recHit().det().surface()); // // // // no plane: insert invalid // if ( plane==0 ) { // myTraj.push(TM(TrajectoryStateOnSurface(), // (*itm).recHit()); // continue; // } // } predTsos = propagator()->propagate(currTsos, *(*itm).recHit()->surface()); } if ( predTsos.isValid() && theConvolutor && theMatBeforeUpdate ) predTsos = (*theConvolutor)(predTsos, propagator()->propagationDirection()); if(!predTsos.isValid()) { edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: predicted tsos not valid!"; return std::vector<Trajectory>(); } if ( theMerger ) predTsos = theMerger->merge(predTsos); if((*itm).recHit()->isValid()) { //update { // TimeMe t(*updateTimer,false); currTsos = updator()->update(predTsos, *(*itm).recHit()); } if ( currTsos.isValid() && theConvolutor && !theMatBeforeUpdate ) currTsos = (*theConvolutor)(currTsos, propagator()->propagationDirection()); if(!currTsos.isValid()) { edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: tsos not valid after update / material effects!"; return std::vector<Trajectory>(); } //3 different possibilities to calculate smoothed state: //1: update combined predictions with hit //2: combine fwd-prediction with bwd-filter //3: combine bwd-prediction with fwd-filter TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState()); if(!combTsos.isValid()) { LogDebug("GsfTrajectorySmoother") << "KFTrajectorySmoother: combined tsos not valid!\n"<< "pred Tsos pos: "<<predTsos.globalPosition()<< "\n" << "pred Tsos mom: "<<predTsos.globalMomentum()<< "\n" << "TrackingRecHit: "<<(*itm).recHit()->surface()->toGlobal((*itm).recHit()->localPosition())<< "\n" ; return std::vector<Trajectory>(); } TSOS smooTsos = combiner((*itm).updatedState(), predTsos); if(!smooTsos.isValid()) { LogDebug("GsfTrajectorySmoother") << "KFTrajectorySmoother: smoothed tsos not valid!"; return std::vector<Trajectory>(); } if (!(*itm).forwardPredictedState().isValid() || !predTsos.isValid() || !smooTsos.isValid() ){ edm::LogError("InvalidState")<<"inside hits with combination."; return std::vector<Trajectory>(); } myTraj.push(TM((*itm).forwardPredictedState(), predTsos, smooTsos, (*itm).recHit(), estimator()->estimate(combTsos, *(*itm).recHit()).second, theGeometry->idToLayer((*itm).recHit()->geographicalId() ) ), (*itm).estimate()); } else { currTsos = predTsos; TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState()); if(!combTsos.isValid()) { LogDebug("GsfTrajectorySmoother") << "KFTrajectorySmoother: combined tsos not valid!"; return std::vector<Trajectory>(); } if (!(*itm).forwardPredictedState().isValid() || !predTsos.isValid() || !combTsos.isValid() ){ edm::LogError("InvalidState")<<"inside hits with invalid rechit."; return std::vector<Trajectory>(); } myTraj.push(TM((*itm).forwardPredictedState(), predTsos, combTsos, (*itm).recHit(), 0., theGeometry->idToLayer((*itm).recHit()->geographicalId()) )); } if ( theMerger ) currTsos = theMerger->merge(currTsos); } //last smoothed tm is last filtered { // TimeMe t(*propTimer,false); predTsos = propagator()->propagate(currTsos, *avtm.front().recHit()->surface()); } if ( predTsos.isValid() && theConvolutor && theMatBeforeUpdate ) predTsos = (*theConvolutor)(predTsos, propagator()->propagationDirection()); if(!predTsos.isValid()) { edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: predicted tsos not valid!"; return std::vector<Trajectory>(); } if ( theMerger ) predTsos = theMerger->merge(predTsos); if(avtm.front().recHit()->isValid()) { //update { // TimeMe t(*updateTimer,false); currTsos = updator()->update(predTsos, *avtm.front().recHit()); } if ( currTsos.isValid() && theConvolutor && !theMatBeforeUpdate ) currTsos = (*theConvolutor)(currTsos, propagator()->propagationDirection()); if(!currTsos.isValid()) { edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: tsos not valid after update / material effects!"; return std::vector<Trajectory>(); } if (!avtm.front().forwardPredictedState().isValid() || !predTsos.isValid() || !currTsos.isValid() ){ edm::LogError("InvalidState")<<"last hit"; return std::vector<Trajectory>(); } myTraj.push(TM(avtm.front().forwardPredictedState(), predTsos, currTsos, avtm.front().recHit(), estimator()->estimate(predTsos, *avtm.front().recHit()).second, theGeometry->idToLayer(avtm.front().recHit()->geographicalId() )), avtm.front().estimate()); //estimator()->estimate(predTsos, avtm.front().recHit())); } else { if (!avtm.front().forwardPredictedState().isValid()){ edm::LogError("InvalidState")<<"last invalid hit"; return std::vector<Trajectory>(); } myTraj.push(TM(avtm.front().forwardPredictedState(), avtm.front().recHit(), 0., theGeometry->idToLayer(avtm.front().recHit()->geographicalId()) )); } return std::vector<Trajectory>(1, myTraj); }
const TrajectoryStateUpdator* GsfTrajectorySmoother::updator | ( | ) | const [inline] |
Definition at line 51 of file GsfTrajectorySmoother.h.
References theUpdator.
Referenced by trajectories().
{return theUpdator;}
const DetLayerGeometry GsfTrajectorySmoother::dummyGeometry [private] |
Definition at line 72 of file GsfTrajectorySmoother.h.
Referenced by GsfTrajectorySmoother().
const FullConvolutionWithMaterial* GsfTrajectorySmoother::theConvolutor [private] |
Definition at line 63 of file GsfTrajectorySmoother.h.
Referenced by GsfTrajectorySmoother(), trajectories(), and ~GsfTrajectorySmoother().
float GsfTrajectorySmoother::theErrorRescaling [private] |
Definition at line 70 of file GsfTrajectorySmoother.h.
Referenced by clone(), and trajectories().
const MeasurementEstimator* GsfTrajectorySmoother::theEstimator [private] |
Definition at line 65 of file GsfTrajectorySmoother.h.
Referenced by clone(), estimator(), and ~GsfTrajectorySmoother().
const DetLayerGeometry* GsfTrajectorySmoother::theGeometry [private] |
Definition at line 73 of file GsfTrajectorySmoother.h.
Referenced by clone(), GsfTrajectorySmoother(), and trajectories().
const GsfPropagatorAdapter* GsfTrajectorySmoother::theGeomPropagator [private] |
Definition at line 62 of file GsfTrajectorySmoother.h.
Referenced by GsfTrajectorySmoother(), propagator(), and ~GsfTrajectorySmoother().
bool GsfTrajectorySmoother::theMatBeforeUpdate [private] |
Definition at line 69 of file GsfTrajectorySmoother.h.
Referenced by clone(), GsfTrajectorySmoother(), and trajectories().
const MultiTrajectoryStateMerger* GsfTrajectorySmoother::theMerger [private] |
Definition at line 66 of file GsfTrajectorySmoother.h.
Referenced by clone(), trajectories(), and ~GsfTrajectorySmoother().
Definition at line 61 of file GsfTrajectorySmoother.h.
Referenced by clone(), GsfTrajectorySmoother(), propagator(), trajectories(), and ~GsfTrajectorySmoother().
bool GsfTrajectorySmoother::theTiming [private] |
Definition at line 68 of file GsfTrajectorySmoother.h.
const TrajectoryStateUpdator* GsfTrajectorySmoother::theUpdator [private] |
Definition at line 64 of file GsfTrajectorySmoother.h.
Referenced by clone(), updator(), and ~GsfTrajectorySmoother().