31 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother::trajectories starting with " << avtm.size() <<
" HITS\n";
32 for (
unsigned int j = 0;
j < avtm.size();
j++) {
34 LogTrace(
"TrackFitters") <<
"hit #:" <<
j + 1 <<
" rawId=" << avtm[
j].recHit()->det()->geographicalId().rawId()
35 <<
" validity=" << avtm[
j].recHit()->isValid();
37 LogTrace(
"TrackFitters") <<
"hit #:" <<
j + 1 <<
" Hit with no Det information";
39 #endif // EDM_ML_DEBUG 43 auto start = avtm.rbegin();
46 auto hitSize = avtm.rend() -
start;
48 LogDebug(
"TrackFitters") <<
" killing trajectory" 54 myTraj.reserve(hitSize);
57 TSOS predTsos = (*start).forwardPredictedState();
61 auto hitCounter = hitSize;
62 for (std::vector<TM>::const_reverse_iterator itm =
start; itm != (avtm.rend()); ++itm, --hitCounter) {
68 LogDebug(
"TrackFitters") <<
" Error: invalid hit with no GeomDet attached .... skipping";
73 predTsos = usePropagator->
propagate(currTsos, *(
hit->surface()));
76 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: predicted tsos not valid!";
77 LogDebug(
"TrackFitters") <<
" retry with last hit removed" 81 <<
"tsos not valid " << currTsos.
globalMomentum().
perp() <<
' ' << hitSize <<
' ' << hitCounter <<
' ' 82 <<
int(
hit->geographicalId()) <<
' ' <<
hit->surface()->position().perp() <<
' ' <<
hit->surface()->eta()
83 <<
' ' <<
hit->surface()->phi() << std::endl;
90 TSOS combTsos, smooTsos;
102 combTsos = itm->forwardPredictedState();
103 else if (hitCounter == 1)
106 combTsos =
combiner(predTsos, itm->forwardPredictedState());
109 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: combined tsos not valid!\n" 112 <<
"TrackingRecHit: " <<
hit->surface()->toGlobal(
hit->localPosition()) <<
"\n";
118 assert((
hit->geographicalId() != 0
U) || (!
hit->canImproveWithTrack()));
121 assert((!(
hit)->canImproveWithTrack()) || (
nullptr != dynamic_cast<BaseTrackerRecHit const*>(
hit.get())));
123 assert(preciseHit->isValid());
124 assert((preciseHit->geographicalId() != 0
U) || (!preciseHit->canImproveWithTrack()));
125 assert(preciseHit->surface() !=
nullptr);
127 dump(*
hit, hitCounter,
"TrackFitters");
129 if UNLIKELY (!preciseHit->isValid()) {
130 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" 135 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" 143 <<
"Failed updating state with hit. Rolling back to non-updated state.\n" 144 <<
"State: " << predTsos <<
"Hit local pos: " <<
hit->localPosition() <<
"\n" 145 <<
"Hit local err: " <<
hit->localPositionError() <<
"\n" 146 <<
"Hit global pos: " <<
hit->globalPosition() <<
"\n" 147 <<
"Hit global err: " <<
hit->globalPositionError().matrix() <<
"\n";
152 smooTsos = itm->updatedState();
153 else if (hitCounter == 1)
156 smooTsos =
combiner(itm->forwardPredictedState(), currTsos);
159 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: smoothed tsos not valid!";
169 estimate = itm->estimate();
171 LogTrace(
"TrackFitters") <<
"predTsos !" 173 << predTsos <<
" with local position " << predTsos.
localPosition() <<
"\n\n" 177 <<
" with local position " << currTsos.
localPosition() <<
"\n\n" 180 << smooTsos <<
" with local position " << smooTsos.
localPosition() <<
"\n\n" 181 <<
"smoothing estimate (with combTSOS)=" << estimate <<
"\n" 182 <<
"filtering estimate=" << itm->estimate() <<
"\n";
185 if (preciseHit->det())
186 myTraj.push(
TM(itm->forwardPredictedState(),
194 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, smooTsos, preciseHit, estimate),
199 LogDebug(
"TrackFitters") <<
"----------------- HIT #" << hitCounter <<
" (INVALID)-----------------------";
205 combTsos = itm->forwardPredictedState();
206 else if (hitCounter == 1)
209 combTsos =
combiner(predTsos, itm->forwardPredictedState());
212 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: combined tsos not valid!";
215 assert((
hit->det() ==
nullptr) ||
hit->geographicalId() != 0
U);
220 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, combTsos,
hit, 0));
void rescaleError(double factor)
virtual const DetLayer * idToLayer(const DetId &detId) const
Trajectory trajectory(const Trajectory &aTraj) const override
LocalPoint localPosition() const
~KFTrajectorySmoother() override
ret
prodAgent to be discontinued
const DetLayerGeometry * theGeometry
virtual PropagationDirection propagationDirection() const final
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
DataContainer const & measurements() const
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
GlobalPoint globalPosition() const
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
PropagationDirection const & direction() const
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
const MeasurementEstimator * estimator() const
bool empty() const
True if trajectory has no measurements.
GlobalVector globalMomentum() const
const TrajectoryStateUpdator * updator() const
const Propagator * theAlongPropagator
const Propagator * theOppositePropagator
Log< level::Warning, false > LogWarning
TkCloner const * theHitCloner