32 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother::trajectories starting with " << avtm.size() <<
" HITS\n";
33 for (
unsigned int j = 0;
j < avtm.size();
j++) {
35 LogTrace(
"TrackFitters") <<
"hit #:" <<
j + 1 <<
" rawId=" << avtm[
j].recHit()->det()->geographicalId().rawId()
36 <<
" validity=" << avtm[
j].recHit()->isValid();
38 LogTrace(
"TrackFitters") <<
"hit #:" <<
j + 1 <<
" Hit with no Det information";
40 #endif // EDM_ML_DEBUG 44 auto start = avtm.rbegin();
47 auto hitSize = avtm.rend() -
start;
50 LogDebug(
"TrackFitters") <<
" killing trajectory" 56 myTraj.reserve(hitSize);
59 TSOS predTsos = (*start).forwardPredictedState();
63 auto hitCounter = hitSize;
64 for (std::vector<TM>::const_reverse_iterator itm =
start; itm != (avtm.rend()); ++itm, --hitCounter) {
70 UNLIKELY(hit->surface() ==
nullptr) {
71 LogDebug(
"TrackFitters") <<
" Error: invalid hit with no GeomDet attached .... skipping";
76 predTsos = usePropagator->
propagate(currTsos, *(hit->surface()));
80 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: predicted tsos not valid!";
81 LogDebug(
"TrackFitters") <<
" retry with last hit removed" 85 <<
"tsos not valid " << currTsos.
globalMomentum().
perp() <<
' ' << hitSize <<
' ' << hitCounter <<
' ' 86 <<
int(hit->geographicalId()) <<
' ' << hit->surface()->position().perp() <<
' ' << hit->surface()->eta()
87 <<
' ' << hit->surface()->phi() << std::endl;
94 TSOS combTsos, smooTsos;
106 combTsos = itm->forwardPredictedState();
107 else if (hitCounter == 1)
110 combTsos =
combiner(predTsos, itm->forwardPredictedState());
114 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: combined tsos not valid!\n" 117 <<
"TrackingRecHit: " << hit->surface()->toGlobal(hit->localPosition()) <<
"\n";
123 assert((hit->geographicalId() != 0
U) | (!hit->canImproveWithTrack()));
124 assert(hit->surface() !=
nullptr);
125 assert((!(hit)->canImproveWithTrack()) | (
nullptr !=
theHitCloner));
126 assert((!(hit)->canImproveWithTrack()) | (
nullptr != dynamic_cast<BaseTrackerRecHit const*>(hit.get())));
128 assert(preciseHit->isValid());
129 assert((preciseHit->geographicalId() != 0
U) | (!preciseHit->canImproveWithTrack()));
130 assert(preciseHit->surface() !=
nullptr);
132 dump(*hit, hitCounter,
"TrackFitters");
136 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" 142 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" 151 <<
"Failed updating state with hit. Rolling back to non-updated state.\n" 152 <<
"State: " << predTsos <<
"Hit local pos: " << hit->
localPosition() <<
"\n" 153 <<
"Hit local err: " << hit->localPositionError() <<
"\n" 154 <<
"Hit global pos: " << hit->globalPosition() <<
"\n" 155 <<
"Hit global err: " << hit->globalPositionError().matrix() <<
"\n";
160 smooTsos = itm->updatedState();
161 else if (hitCounter == 1)
164 smooTsos =
combiner(itm->forwardPredictedState(), currTsos);
168 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: smoothed tsos not valid!";
178 estimate = itm->estimate();
180 LogTrace(
"TrackFitters") <<
"predTsos !" 182 << predTsos <<
" with local position " << predTsos.
localPosition() <<
"\n\n" 186 <<
" with local position " << currTsos.
localPosition() <<
"\n\n" 189 << smooTsos <<
" with local position " << smooTsos.
localPosition() <<
"\n\n" 190 <<
"smoothing estimate (with combTSOS)=" << estimate <<
"\n" 191 <<
"filtering estimate=" << itm->estimate() <<
"\n";
194 if (preciseHit->det())
195 myTraj.push(
TM(itm->forwardPredictedState(),
203 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, smooTsos, preciseHit, estimate),
208 LogDebug(
"TrackFitters") <<
"----------------- HIT #" << hitCounter <<
" (INVALID)-----------------------";
214 combTsos = itm->forwardPredictedState();
215 else if (hitCounter == 1)
218 combTsos =
combiner(predTsos, itm->forwardPredictedState());
222 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: combined tsos not valid!";
225 assert((hit->det() ==
nullptr) || hit->geographicalId() != 0
U);
228 itm->forwardPredictedState(), predTsos, combTsos, hit, 0,
theGeometry->
idToLayer(hit->geographicalId())));
230 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, combTsos, hit, 0));
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
ret
prodAgent to be discontinued
const DetLayerGeometry * theGeometry
LocalPoint localPosition() const
GlobalPoint globalPosition() const
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
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