39 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother::trajectories starting with " << avtm.size() <<
" HITS\n";
40 for (
unsigned int j=0;j<avtm.size();j++) {
41 if (avtm[j].
recHit()->det())
42 LogTrace(
"TrackFitters") <<
"hit #:" << j+1 <<
" rawId=" << avtm[j].recHit()->det()->geographicalId().rawId()
43 <<
" validity=" << avtm[j].recHit()->isValid();
45 LogTrace(
"TrackFitters") <<
"hit #:" << j+1 <<
" Hit with no Det information";
47 #endif // EDM_ML_DEBUG 53 auto start = avtm.rbegin();
56 auto hitSize = avtm.rend()-
start;
58 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
66 TSOS predTsos = (*start).forwardPredictedState();
70 auto hitCounter = hitSize;
71 for(std::vector<TM>::const_reverse_iterator itm =
start; itm != (avtm.rend()); ++itm,--hitCounter) {
78 LogDebug(
"TrackFitters") <<
" Error: invalid hit with no GeomDet attached .... skipping";
84 predTsos = usePropagator->
propagate( currTsos, *(hit->surface()) );
87 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: predicted tsos not valid!";
88 LogDebug(
"TrackFitters") <<
" retry with last hit removed" <<
"\n";
92 << hitSize <<
' ' << hitCounter <<
' ' <<
int(hit->geographicalId()) <<
' ' 93 << hit->surface()->position().perp() <<
' ' << hit->surface()->eta() <<
' ' << hit->surface()->phi() << std::endl;
101 TSOS combTsos,smooTsos;
112 if (itm ==
start) combTsos = itm->forwardPredictedState();
113 else if (hitCounter == 1) combTsos = predTsos;
114 else combTsos = combiner(predTsos, itm->forwardPredictedState());
118 "KFTrajectorySmoother: combined tsos not valid!\n" <<
121 "TrackingRecHit: " << hit->surface()->toGlobal(hit->localPosition()) <<
"\n" ;
127 assert( (hit->geographicalId()!=0
U) | (!hit->canImproveWithTrack()) );
128 assert(hit->surface()!=
nullptr);
129 assert( (!(hit)->canImproveWithTrack()) | (
nullptr!=
theHitCloner));
130 assert( (!(hit)->canImproveWithTrack()) | (
nullptr!=dynamic_cast<BaseTrackerRecHit const*>(hit.get())));
132 assert(preciseHit->isValid());
133 assert( (preciseHit->geographicalId()!=0
U) | (!preciseHit->canImproveWithTrack()) );
134 assert(preciseHit->surface()!=
nullptr);
136 dump(*hit,hitCounter,
"TrackFitters");
138 if unlikely(!preciseHit->isValid()){
139 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" <<
"\n";
143 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" <<
"\n";
150 "Failed updating state with hit. Rolling back to non-updated state.\n" <<
151 "State: " << predTsos <<
153 "Hit local err: " << hit->localPositionError() <<
"\n" <<
154 "Hit global pos: " << hit->globalPosition() <<
"\n" <<
155 "Hit global err: " << hit->globalPositionError().matrix() <<
160 if (itm ==
start) smooTsos = itm->updatedState();
161 else if (hitCounter == 1) smooTsos = currTsos;
162 else smooTsos = combiner(itm->forwardPredictedState(), currTsos);
165 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: smoothed tsos not valid!";
173 else estimate = itm->estimate();
176 <<
"predTsos !" <<
"\n" 178 <<
" with local position " << predTsos.
localPosition() <<
"\n\n" 179 <<
"currTsos !" <<
"\n" 181 <<
" with local position " << currTsos.
localPosition() <<
"\n\n" 182 <<
"smooTsos !" <<
"\n" 184 <<
" with local position " << smooTsos.
localPosition() <<
"\n\n" 185 <<
"smoothing estimate (with combTSOS)=" << estimate <<
"\n" 186 <<
"filtering estimate=" << itm->estimate() <<
"\n";
189 if (preciseHit->det()) myTraj.push(
TM(itm->forwardPredictedState(),
196 else myTraj.push(
TM(itm->forwardPredictedState(),
206 <<
"----------------- HIT #" << hitCounter <<
" (INVALID)-----------------------";
211 if (itm ==
start) combTsos = itm->forwardPredictedState();
212 else if (hitCounter == 1) combTsos = predTsos;
213 else combTsos = combiner(predTsos, itm->forwardPredictedState());
217 "KFTrajectorySmoother: combined tsos not valid!";
220 assert( (hit->det()==
nullptr) || hit->geographicalId()!=0
U);
222 myTraj.push(
TM(itm->forwardPredictedState(),
228 else myTraj.push(
TM(itm->forwardPredictedState(),
237 if (!retry)
return ret;
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
~KFTrajectorySmoother() override
const DetLayerGeometry * theGeometry
LocalPoint localPosition() const
GlobalPoint globalPosition() const
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
void reserve(unsigned int n)
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
PropagationDirection const & direction() const
DataContainer const & measurements() const
virtual PropagationDirection propagationDirection() const final
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const MeasurementEstimator * estimator() const
Trajectory trajectory(const Trajectory &aTraj) const override
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator
const TrajectoryStateUpdator * updator() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
GlobalVector globalMomentum() const
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
const Propagator * theAlongPropagator
const Propagator * theOppositePropagator
virtual const DetLayer * idToLayer(const DetId &detId) const
TkCloner const * theHitCloner