17 const bool materialBeforeUpdate,
23 theUpdator(aUpdator.
clone()),
24 theEstimator(aEstimator.
clone()),
25 theMerger(aMerger.
clone()),
26 theMatBeforeUpdate(materialBeforeUpdate),
27 theErrorRescaling(errorRescaling),
28 theGeometry(detLayerGeometry)
30 auto p = aPropagator.
clone();
64 if( not usePropagator) {
68 Trajectory myTraj(aTraj.
seed(), usePropagator->propagationDirection());
72 TSOS predTsos = avtm.back().forwardPredictedState();
77 <<
"GsfTrajectorySmoother: predicted tsos of last measurement not valid!";
83 if(avtm.back().recHit()->isValid()) {
86 currTsos =
updator()->
update(predTsos, *avtm.back().recHit());
90 edm::LogInfo(
"GsfTrajectorySmoother") <<
"GsfTrajectorySmoother: tsos not valid after update!";
95 if (!avtm.back().forwardPredictedState().isValid() || !predTsos.
isValid() || !avtm.back().updatedState().isValid()){
100 myTraj.push(
TM(avtm.back().forwardPredictedState(),
102 avtm.back().updatedState(),
103 avtm.back().recHit(),
104 avtm.back().estimate(),
110 if (!avtm.back().forwardPredictedState().isValid()){
115 myTraj.push(
TM(avtm.back().forwardPredictedState(),
116 avtm.back().recHit(),
123 int hitcounter = avtm.size()-1;
124 for(std::vector<TM>::const_reverse_iterator itm = avtm.rbegin() + 1;
125 itm < avtm.rend() - 1; ++itm) {
127 predTsos = usePropagator->propagate(currTsos,
131 usePropagator->propagationDirection());
133 edm::LogInfo(
"GsfTrackFitters") <<
"GsfTrajectorySmoother: predicted tsos not valid!";
138 if((*itm).recHit()->isValid()) {
144 usePropagator->propagationDirection());
147 <<
"GsfTrajectorySmoother: tsos not valid after update / material effects!";
154 TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState());
157 "KFTrajectorySmoother: combined tsos not valid!\n"<<
160 "TrackingRecHit: "<<(*itm).recHit()->surface()->toGlobal((*itm).recHit()->localPosition())<<
"\n" ;
164 TSOS smooTsos = combiner((*itm).updatedState(), predTsos);
168 "KFTrajectorySmoother: smoothed tsos not valid!";
172 if (!(*itm).forwardPredictedState().isValid() || !predTsos.
isValid() || !smooTsos.
isValid() ){
173 edm::LogError(
"InvalidState")<<
"inside hits with combination.";
178 myTraj.push(
TM((*itm).forwardPredictedState(),
185 LogDebug(
"GsfTrackFitters") <<
"added measurement #" << hitcounter-- <<
" with chi2 " <<
chi2;
186 dump(predTsos,
"predTsos");
187 dump(smooTsos,
"smooTsos");
192 TSOS combTsos = combiner(predTsos, (*itm).forwardPredictedState());
196 "KFTrajectorySmoother: combined tsos not valid!";
200 if (!(*itm).forwardPredictedState().isValid() || !predTsos.
isValid() || !combTsos.
isValid() ){
201 edm::LogError(
"InvalidState")<<
"inside hits with invalid rechit.";
205 myTraj.push(
TM((*itm).forwardPredictedState(),
211 LogDebug(
"GsfTrackFitters") <<
"added invalid measurement #" << hitcounter--;
212 dump(predTsos,
"predTsos");
213 dump(combTsos,
"smooTsos");
217 dump(currTsos,
"currTsos");
221 predTsos = usePropagator->propagate(currTsos,
222 *avtm.front().recHit()->
surface());
225 usePropagator->propagationDirection());
227 edm::LogInfo(
"GsfTrackFitters") <<
"GsfTrajectorySmoother: predicted tsos not valid!";
232 if(avtm.front().recHit()->isValid()) {
234 currTsos =
updator()->
update(predTsos, *avtm.front().recHit());
237 usePropagator->propagationDirection());
240 <<
"GsfTrajectorySmoother: tsos not valid after update / material effects!";
244 if (!avtm.front().forwardPredictedState().isValid() || !predTsos.
isValid() || !currTsos.
isValid() ){
250 myTraj.push(
TM(avtm.front().forwardPredictedState(),
253 avtm.front().recHit(),
257 LogDebug(
"GsfTrackFitters") <<
"added measurement #" << hitcounter-- <<
" with chi2 " <<
chi2;
258 dump(predTsos,
"predTsos");
259 dump(currTsos,
"smooTsos");
263 if (!avtm.front().forwardPredictedState().isValid()){
267 myTraj.push(
TM(avtm.front().forwardPredictedState(),
268 avtm.front().recHit(),
271 LogDebug(
"GsfTrackFitters") <<
"added invalid measurement #" << hitcounter--;
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
const MeasurementEstimator * estimator() const
const GsfPropagatorAdapter * theGeomPropagator
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
virtual Trajectory trajectory(const Trajectory &aTraj) const override
virtual ~GsfTrajectorySmoother()
GlobalPoint globalPosition() const
TrajectoryStateOnSurface merge(const TrajectoryStateOnSurface &tsos) const
FullConvolutionWithMaterial * clone() const
Clone.
const TrajectoryStateUpdator * updator() const
const FullConvolutionWithMaterial * theConvolutor
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
GsfTrajectorySmoother(const GsfPropagatorWithMaterial &aPropagator, const TrajectoryStateUpdator &aUpdator, const MeasurementEstimator &aEstimator, const MultiTrajectoryStateMerger &merger, float errorRescaling, const bool materialBeforeUpdate=true, const DetLayerGeometry *detLayerGeometry=0)
virtual GsfPropagatorWithMaterial * clone() const override
const DetLayerGeometry * theGeometry
PropagationDirection const & direction() const
U second(std::pair< T, U > const &p)
DataContainer const & measurements() const
const SurfaceType & surface() const
const MultiTrajectoryStateMerger * theMerger
const DetLayerGeometry dummyGeometry
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
const GsfPropagatorWithMaterial * theAlongPropagator
const Propagator & geometricalPropagator() const
Access to the geometrical propagator.
GlobalVector globalMomentum() const
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
const GsfPropagatorWithMaterial * theOppositePropagator
virtual const DetLayer * idToLayer(const DetId &detId) const
const FullConvolutionWithMaterial & convolutionWithMaterial() const
Access to the convolutor and thus to the material effects.