#include <TrackingTools/GsfTracking/interface/GsfTrajectorySmoother.h>
Public Member Functions | |
virtual GsfTrajectorySmoother * | clone () const |
const MeasurementEstimator * | estimator () const |
GsfTrajectorySmoother (const GsfPropagatorWithMaterial &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &merger, float errorRescaling, const bool materialBeforeUpdate=true) | |
Constructor with explicit components for propagation, update, chi2 calculation, merging and flag for merging before / after the update (i.e. | |
const Propagator * | propagator () const |
propagator used (full propagator, if material effects are applied before the update, otherwise purely geometrical part) | |
virtual std::vector< Trajectory > | trajectories (const Trajectory &aTraj) const |
const TrajectoryStateUpdator * | updator () const |
virtual | ~GsfTrajectorySmoother () |
Private Types | |
typedef TrajectoryMeasurement | TM |
typedef TrajectoryStateOnSurface | TSOS |
Private Attributes | |
const FullConvolutionWithMaterial * | theConvolutor |
float | theErrorRescaling |
const MeasurementEstimator * | theEstimator |
const GsfPropagatorAdapter * | theGeomPropagator |
bool | theMatBeforeUpdate |
const MultiTrajectoryStateMerger * | theMerger |
GsfPropagatorWithMaterial * | thePropagator |
bool | theTiming |
const TrajectoryStateUpdator * | theUpdator |
Definition at line 20 of file GsfTrajectorySmoother.h.
typedef TrajectoryMeasurement GsfTrajectorySmoother::TM [private] |
Definition at line 25 of file GsfTrajectorySmoother.h.
typedef TrajectoryStateOnSurface GsfTrajectorySmoother::TSOS [private] |
Definition at line 24 of file GsfTrajectorySmoother.h.
GsfTrajectorySmoother::GsfTrajectorySmoother | ( | const GsfPropagatorWithMaterial & | aPropagator, | |
const TrajectoryStateUpdator & | aUpdator, | |||
const MeasurementEstimator & | aEstimator, | |||
const MultiTrajectoryStateMerger & | merger, | |||
float | errorRescaling, | |||
const bool | materialBeforeUpdate = true | |||
) |
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(), GsfPropagatorWithMaterial::geometricalPropagator(), theConvolutor, theGeomPropagator, theMatBeforeUpdate, and thePropagator.
Referenced by clone().
00014 : 00015 thePropagator(aPropagator.clone()), 00016 theGeomPropagator(0), 00017 theConvolutor(0), 00018 theUpdator(aUpdator.clone()), 00019 theEstimator(aEstimator.clone()), 00020 theMerger(aMerger.clone()), 00021 theMatBeforeUpdate(materialBeforeUpdate), 00022 theErrorRescaling(errorRescaling) 00023 { 00024 if ( !theMatBeforeUpdate ) { 00025 theGeomPropagator = new GsfPropagatorAdapter(thePropagator->geometricalPropagator()); 00026 theConvolutor = thePropagator->convolutionWithMaterial().clone(); 00027 } 00028 00029 // static SimpleConfigurable<bool> timeConf(false,"GsfTrajectorySmoother:activateTiming"); 00030 // theTiming = timeConf.value(); 00031 }
GsfTrajectorySmoother::~GsfTrajectorySmoother | ( | ) | [virtual] |
Definition at line 33 of file GsfTrajectorySmoother.cc.
References theConvolutor, theEstimator, theGeomPropagator, theMerger, thePropagator, and theUpdator.
00033 { 00034 delete thePropagator; 00035 delete theGeomPropagator; 00036 delete theConvolutor; 00037 delete theUpdator; 00038 delete theEstimator; 00039 delete theMerger; 00040 }
virtual GsfTrajectorySmoother* GsfTrajectorySmoother::clone | ( | void | ) | const [inline, virtual] |
Implements TrajectorySmoother.
Definition at line 52 of file GsfTrajectorySmoother.h.
References GsfTrajectorySmoother(), theErrorRescaling, theEstimator, theMatBeforeUpdate, theMerger, thePropagator, and theUpdator.
00053 { 00054 return new GsfTrajectorySmoother(*thePropagator,*theUpdator,*theEstimator, 00055 *theMerger,theErrorRescaling,theMatBeforeUpdate); 00056 }
const MeasurementEstimator* GsfTrajectorySmoother::estimator | ( | void | ) | const [inline] |
Definition at line 50 of file GsfTrajectorySmoother.h.
References theEstimator.
Referenced by trajectories().
00050 {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 45 of file GsfTrajectorySmoother.h.
References theGeomPropagator, and thePropagator.
Referenced by trajectories().
00045 { 00046 if ( thePropagator) return thePropagator; 00047 else return theGeomPropagator; 00048 }
std::vector< Trajectory > GsfTrajectorySmoother::trajectories | ( | const Trajectory & | aTraj | ) | const [virtual] |
Implements TrajectorySmoother.
Definition at line 43 of file GsfTrajectorySmoother.cc.
References alongMomentum, Trajectory::direction(), Trajectory::empty(), MeasurementEstimator::estimate(), TrajectoryMeasurement::estimate(), estimator(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), 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, theMatBeforeUpdate, theMerger, thePropagator, TrajectoryStateUpdator::update(), and updator().
00043 { 00044 00045 // static TimingReport::Item* propTimer = 00046 // &(*TimingReport::current())[string("GsfTrajectorySmoother:propagation")]; 00047 // propTimer->switchCPU(false); 00048 // if ( !theTiming ) propTimer->switchOn(false); 00049 // static TimingReport::Item* updateTimer = 00050 // &(*TimingReport::current())[string("GsfTrajectorySmoother:update")]; 00051 // updateTimer->switchCPU(false); 00052 // if ( !theTiming ) updateTimer->switchOn(false); 00053 00054 if(aTraj.empty()) return std::vector<Trajectory>(); 00055 00056 if ( aTraj.direction() == alongMomentum) { 00057 thePropagator->setPropagationDirection(oppositeToMomentum); 00058 } 00059 else { 00060 thePropagator->setPropagationDirection(alongMomentum); 00061 } 00062 00063 Trajectory myTraj(aTraj.seed(), propagator()->propagationDirection()); 00064 00065 std::vector<TM> avtm = aTraj.measurements(); 00066 00067 TSOS predTsos = avtm.back().forwardPredictedState(); 00068 predTsos.rescaleError(theErrorRescaling); 00069 00070 if(!predTsos.isValid()) { 00071 edm::LogInfo("GsfTrajectorySmoother") 00072 << "GsfTrajectorySmoother: predicted tsos of last measurement not valid!"; 00073 return std::vector<Trajectory>(); 00074 } 00075 TSOS currTsos; 00076 00077 //first smoothed tm is last fitted 00078 if(avtm.back().recHit()->isValid()) { 00079 { 00080 // TimeMe t(*updateTimer,false); 00081 currTsos = updator()->update(predTsos, *avtm.back().recHit()); 00082 } 00083 if(!currTsos.isValid()) { 00084 edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: tsos not valid after update!"; 00085 return std::vector<Trajectory>(); 00086 } 00087 myTraj.push(TM(avtm.back().forwardPredictedState(), 00088 predTsos, 00089 avtm.back().updatedState(), 00090 avtm.back().recHit(), 00091 avtm.back().estimate()), 00092 avtm.back().estimate()); 00093 } else { 00094 currTsos = predTsos; 00095 myTraj.push(TM(avtm.back().forwardPredictedState(), 00096 avtm.back().recHit())); 00097 } 00098 00099 TrajectoryStateCombiner combiner; 00100 00101 for(std::vector<TM>::reverse_iterator itm = avtm.rbegin() + 1; 00102 itm < avtm.rend() - 1; ++itm) { 00103 { 00104 // TimeMe t(*propTimer,false); 00105 // // 00106 // // check type of surface in case of invalid hit 00107 // // (in this version only propagations to planes are 00108 // // supported for multi trajectory states) 00109 // // 00110 // if ( !(*itm).recHit().isValid() ) { 00111 // const BoundPlane* plane = 00112 // dynamic_cast<const BoundPlane*>(&(*itm).recHit().det().surface()); 00113 // // 00114 // // no plane: insert invalid 00115 // if ( plane==0 ) { 00116 // myTraj.push(TM(TrajectoryStateOnSurface(), 00117 // (*itm).recHit()); 00118 // continue; 00119 // } 00120 // } 00121 predTsos = propagator()->propagate(currTsos, 00122 (*itm).recHit()->det()->surface()); 00123 } 00124 if ( predTsos.isValid() && theConvolutor && theMatBeforeUpdate ) 00125 predTsos = (*theConvolutor)(predTsos, 00126 propagator()->propagationDirection()); 00127 if(!predTsos.isValid()) { 00128 edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: predicted tsos not valid!"; 00129 return std::vector<Trajectory>(); 00130 } 00131 if ( theMerger ) predTsos = theMerger->merge(predTsos); 00132 00133 if((*itm).recHit()->isValid()) { 00134 //update 00135 { 00136 // TimeMe t(*updateTimer,false); 00137 currTsos = updator()->update(predTsos, *(*itm).recHit()); 00138 } 00139 if ( currTsos.isValid() && theConvolutor && !theMatBeforeUpdate ) 00140 currTsos = (*theConvolutor)(currTsos, 00141 propagator()->propagationDirection()); 00142 if(!currTsos.isValid()) { 00143 edm::LogInfo("GsfTrajectorySmoother") 00144 << "GsfTrajectorySmoother: tsos not valid after update / material effects!"; 00145 return std::vector<Trajectory>(); 00146 } 00147 //3 different possibilities to calculate smoothed state: 00148 //1: update combined predictions with hit 00149 //2: combine fwd-prediction with bwd-filter 00150 //3: combine bwd-prediction with fwd-filter 00151 TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState()); 00152 if(!combTsos.isValid()) { 00153 LogDebug("GsfTrajectorySmoother") << 00154 "KFTrajectorySmoother: combined tsos not valid!\n"<< 00155 "pred Tsos pos: "<<predTsos.globalPosition()<< "\n" << 00156 "pred Tsos mom: "<<predTsos.globalMomentum()<< "\n" << 00157 "TrackingRecHit: "<<(*itm).recHit()->surface()->toGlobal((*itm).recHit()->localPosition())<< "\n" ; 00158 return std::vector<Trajectory>(); 00159 } 00160 00161 TSOS smooTsos = combiner((*itm).updatedState(), predTsos); 00162 00163 if(!smooTsos.isValid()) { 00164 LogDebug("GsfTrajectorySmoother") << 00165 "KFTrajectorySmoother: smoothed tsos not valid!"; 00166 return std::vector<Trajectory>(); 00167 } 00168 00169 myTraj.push(TM((*itm).forwardPredictedState(), 00170 predTsos, 00171 smooTsos, 00172 (*itm).recHit(), 00173 estimator()->estimate(combTsos, *(*itm).recHit()).second), 00174 (*itm).estimate()); 00175 } 00176 else { 00177 currTsos = predTsos; 00178 TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState()); 00179 00180 if(!combTsos.isValid()) { 00181 LogDebug("GsfTrajectorySmoother") << 00182 "KFTrajectorySmoother: combined tsos not valid!"; 00183 return std::vector<Trajectory>(); 00184 } 00185 00186 myTraj.push(TM((*itm).forwardPredictedState(), 00187 predTsos, 00188 combTsos, 00189 (*itm).recHit())); 00190 } 00191 if ( theMerger ) currTsos = theMerger->merge(currTsos); 00192 } 00193 00194 //last smoothed tm is last filtered 00195 { 00196 // TimeMe t(*propTimer,false); 00197 predTsos = propagator()->propagate(currTsos, 00198 avtm.front().recHit()->det()->surface()); 00199 } 00200 if ( predTsos.isValid() && theConvolutor && theMatBeforeUpdate ) 00201 predTsos = (*theConvolutor)(predTsos, 00202 propagator()->propagationDirection()); 00203 if(!predTsos.isValid()) { 00204 edm::LogInfo("GsfTrajectorySmoother") << "GsfTrajectorySmoother: predicted tsos not valid!"; 00205 return std::vector<Trajectory>(); 00206 } 00207 if ( theMerger ) predTsos = theMerger->merge(predTsos); 00208 00209 if(avtm.front().recHit()->isValid()) { 00210 //update 00211 { 00212 // TimeMe t(*updateTimer,false); 00213 currTsos = updator()->update(predTsos, *avtm.front().recHit()); 00214 } 00215 if ( currTsos.isValid() && theConvolutor && !theMatBeforeUpdate ) 00216 currTsos = (*theConvolutor)(currTsos, 00217 propagator()->propagationDirection()); 00218 if(!currTsos.isValid()) { 00219 edm::LogInfo("GsfTrajectorySmoother") 00220 << "GsfTrajectorySmoother: tsos not valid after update / material effects!"; 00221 return std::vector<Trajectory>(); 00222 } 00223 00224 myTraj.push(TM(avtm.front().forwardPredictedState(), 00225 predTsos, 00226 currTsos, 00227 avtm.front().recHit(), 00228 estimator()->estimate(predTsos, *avtm.front().recHit()).second), 00229 avtm.front().estimate()); 00230 //estimator()->estimate(predTsos, avtm.front().recHit())); 00231 } 00232 else { 00233 myTraj.push(TM(avtm.front().forwardPredictedState(), 00234 avtm.front().recHit())); 00235 } 00236 00237 return std::vector<Trajectory>(1, myTraj); 00238 }
const TrajectoryStateUpdator* GsfTrajectorySmoother::updator | ( | ) | const [inline] |
Definition at line 49 of file GsfTrajectorySmoother.h.
References theUpdator.
Referenced by trajectories().
00049 {return theUpdator;}
const FullConvolutionWithMaterial* GsfTrajectorySmoother::theConvolutor [private] |
Definition at line 61 of file GsfTrajectorySmoother.h.
Referenced by GsfTrajectorySmoother(), trajectories(), and ~GsfTrajectorySmoother().
float GsfTrajectorySmoother::theErrorRescaling [private] |
const MeasurementEstimator* GsfTrajectorySmoother::theEstimator [private] |
Definition at line 63 of file GsfTrajectorySmoother.h.
Referenced by clone(), estimator(), and ~GsfTrajectorySmoother().
const GsfPropagatorAdapter* GsfTrajectorySmoother::theGeomPropagator [private] |
Definition at line 60 of file GsfTrajectorySmoother.h.
Referenced by GsfTrajectorySmoother(), propagator(), and ~GsfTrajectorySmoother().
Definition at line 67 of file GsfTrajectorySmoother.h.
Referenced by clone(), GsfTrajectorySmoother(), and trajectories().
const MultiTrajectoryStateMerger* GsfTrajectorySmoother::theMerger [private] |
Definition at line 64 of file GsfTrajectorySmoother.h.
Referenced by clone(), trajectories(), and ~GsfTrajectorySmoother().
Definition at line 59 of file GsfTrajectorySmoother.h.
Referenced by clone(), GsfTrajectorySmoother(), propagator(), trajectories(), and ~GsfTrajectorySmoother().
bool GsfTrajectorySmoother::theTiming [private] |
Definition at line 66 of file GsfTrajectorySmoother.h.
const TrajectoryStateUpdator* GsfTrajectorySmoother::theUpdator [private] |
Definition at line 62 of file GsfTrajectorySmoother.h.
Referenced by clone(), updator(), and ~GsfTrajectorySmoother().