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));