31 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother::trajectories starting with " << avtm.size() <<
" HITS\n";
32 for (
unsigned int j = 0;
j < avtm.size();
j++) {
33 if (avtm[
j].recHit()->det())
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) {
67 if UNLIKELY (hit->surface() ==
nullptr) {
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() != 0U) | (!hit->canImproveWithTrack()));
119 assert(hit->surface() !=
nullptr);
121 assert((!(hit)->canImproveWithTrack()) | (
nullptr != dynamic_cast<BaseTrackerRecHit const*>(hit.get())));
123 assert(preciseHit->isValid());
124 assert((preciseHit->geographicalId() != 0U) | (!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() != 0U);
218 itm->forwardPredictedState(), predTsos, combTsos, hit, 0,
theGeometry->
idToLayer(hit->geographicalId())));
220 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, combTsos, hit, 0));
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
tuple ret
prodAgent to be discontinued
Trajectory trajectory(const Trajectory &aTraj) const override
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
~KFTrajectorySmoother() override
const DetLayerGeometry * theGeometry
LocalPoint localPosition() const
GlobalPoint globalPosition() const
virtual PropagationDirection propagationDirection() const final
TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
PropagationDirection const & direction() const
DataContainer const & measurements() const
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const =0
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
const MeasurementEstimator * estimator() const
const MeasurementEstimator * theEstimator
const TrajectoryStateUpdator * theUpdator
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
const TrajectoryStateUpdator * updator() const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
GlobalVector globalMomentum() const
const Propagator * theAlongPropagator
const Propagator * theOppositePropagator
Log< level::Warning, false > LogWarning
virtual const DetLayer * idToLayer(const DetId &detId) const
tuple dump
OutputFilePath = cms.string('/tmp/zhokin/'), OutputFileExt = cms.string(''),.
TkCloner const * theHitCloner