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;
49 LogDebug(
"TrackFitters") <<
" killing trajectory"
55 myTraj.reserve(hitSize);
58 TSOS predTsos = (*start).forwardPredictedState();
62 auto hitCounter = hitSize;
63 for (std::vector<TM>::const_reverse_iterator itm =
start; itm != (avtm.rend()); ++itm, --hitCounter) {
70 LogDebug(
"TrackFitters") <<
" Error: invalid hit with no GeomDet attached .... skipping";
75 predTsos = usePropagator->
propagate(currTsos, *(
hit->surface()));
79 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: predicted tsos not valid!";
80 LogDebug(
"TrackFitters") <<
" retry with last hit removed"
84 <<
"tsos not valid " << currTsos.
globalMomentum().
perp() <<
' ' << hitSize <<
' ' << hitCounter <<
' '
85 <<
int(
hit->geographicalId()) <<
' ' <<
hit->surface()->position().perp() <<
' ' <<
hit->surface()->eta()
86 <<
' ' <<
hit->surface()->phi() << std::endl;
93 TSOS combTsos, smooTsos;
105 combTsos = itm->forwardPredictedState();
106 else if (hitCounter == 1)
109 combTsos =
combiner(predTsos, itm->forwardPredictedState());
113 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: combined tsos not valid!\n"
116 <<
"TrackingRecHit: " <<
hit->surface()->toGlobal(
hit->localPosition()) <<
"\n";
122 assert((
hit->geographicalId() != 0
U) | (!
hit->canImproveWithTrack()));
125 assert((!(
hit)->canImproveWithTrack()) | (
nullptr != dynamic_cast<BaseTrackerRecHit const*>(
hit.get())));
127 assert(preciseHit->isValid());
128 assert((preciseHit->geographicalId() != 0
U) | (!preciseHit->canImproveWithTrack()));
129 assert(preciseHit->surface() !=
nullptr);
131 dump(*
hit, hitCounter,
"TrackFitters");
135 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos"
141 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos"
150 <<
"Failed updating state with hit. Rolling back to non-updated state.\n"
151 <<
"State: " << predTsos <<
"Hit local pos: " <<
hit->localPosition() <<
"\n"
152 <<
"Hit local err: " <<
hit->localPositionError() <<
"\n"
153 <<
"Hit global pos: " <<
hit->globalPosition() <<
"\n"
154 <<
"Hit global err: " <<
hit->globalPositionError().matrix() <<
"\n";
159 smooTsos = itm->updatedState();
160 else if (hitCounter == 1)
163 smooTsos =
combiner(itm->forwardPredictedState(), currTsos);
167 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: smoothed tsos not valid!";
177 estimate = itm->estimate();
179 LogTrace(
"TrackFitters") <<
"predTsos !"
181 << predTsos <<
" with local position " << predTsos.
localPosition() <<
"\n\n"
185 <<
" with local position " << currTsos.
localPosition() <<
"\n\n"
188 << smooTsos <<
" with local position " << smooTsos.
localPosition() <<
"\n\n"
189 <<
"smoothing estimate (with combTSOS)=" << estimate <<
"\n"
190 <<
"filtering estimate=" << itm->estimate() <<
"\n";
193 if (preciseHit->det())
194 myTraj.push(
TM(itm->forwardPredictedState(),
202 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, smooTsos, preciseHit, estimate),
207 LogDebug(
"TrackFitters") <<
"----------------- HIT #" << hitCounter <<
" (INVALID)-----------------------";
213 combTsos = itm->forwardPredictedState();
214 else if (hitCounter == 1)
217 combTsos =
combiner(predTsos, itm->forwardPredictedState());
221 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: combined tsos not valid!";
224 assert((
hit->det() ==
nullptr) ||
hit->geographicalId() != 0
U);
229 myTraj.push(
TM(itm->forwardPredictedState(), predTsos, combTsos,
hit, 0));