51 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother::trajectories starting with " << avtm.size() <<
" HITS\n";
52 for (
unsigned int j=0;
j<avtm.size();
j++) {
53 if (avtm[
j].recHit()->det())
54 LogTrace(
"TrackFitters") <<
"hit #:" <<
j+1 <<
" rawId=" << avtm[
j].recHit()->det()->geographicalId().rawId()
55 <<
" validity=" << avtm[
j].recHit()->isValid();
57 LogTrace(
"TrackFitters") <<
"hit #:" <<
j+1 <<
" Hit with no Det information";
59 #endif // EDM_ML_DEBUG
65 auto start = avtm.rbegin();
68 auto hitSize = avtm.rend()-
start;
70 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
75 myTraj.reserve(hitSize);
78 TSOS predTsos = (*start).forwardPredictedState();
82 auto hitCounter = hitSize;
83 for(std::vector<TM>::const_reverse_iterator itm =
start; itm != (avtm.rend()); ++itm,--hitCounter) {
90 LogDebug(
"TrackFitters") <<
" Error: invalid hit with no GeomDet attached .... skipping";
96 predTsos = usePropagator->
propagate( currTsos, *(hit->surface()) );
99 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: predicted tsos not valid!";
100 LogDebug(
"TrackFitters") <<
" retry with last hit removed" <<
"\n";
104 << hitSize <<
' ' << hitCounter <<
' ' << hit->geographicalId().rawId() <<
' '
105 << hit->surface()->position().perp() <<
' ' << hit->surface()->eta() <<
' ' << hit->surface()->phi() << std::endl;
115 <<
"----------------- HIT #" << hitCounter <<
" (VALID)-----------------------\n"
116 <<
"HIT IS AT R " << hit->globalPosition().perp() <<
"\n"
117 <<
"HIT IS AT Z " << hit->globalPosition().z() <<
"\n"
118 <<
"HIT IS AT Phi " << hit->globalPosition().phi() <<
"\n"
119 <<
"HIT IS AT Loc " << hit->localPosition() <<
"\n"
120 <<
"WITH LocError " << hit->localPositionError() <<
"\n"
121 <<
"HIT IS AT Glo " << hit->globalPosition() <<
"\n"
122 <<
"SURFACE POSITION: " << hit->surface()->position() <<
"\n"
123 <<
"SURFACE ROTATION: " << hit->surface()->rotation() <<
"\n"
124 <<
"hit geographicalId=" << hit->geographicalId().rawId();
126 DetId hitId = hit->geographicalId();
142 LogTrace(
"TrackFitters") <<
" UNKNOWN TRACKER HIT TYPE ";
152 LogTrace(
"TrackFitters") <<
" UNKNOWN MUON HIT TYPE ";
155 LogTrace(
"TrackFitters") <<
" UNKNOWN HIT TYPE ";
156 #endif //EDM_ML_DEBUG
160 TSOS combTsos,smooTsos;
171 if (itm ==
start) combTsos = itm->forwardPredictedState();
172 else if (hitCounter == 1) combTsos = predTsos;
173 else combTsos =
combiner(predTsos, itm->forwardPredictedState());
177 "KFTrajectorySmoother: combined tsos not valid!\n" <<
180 "TrackingRecHit: " << hit->surface()->toGlobal(hit->localPosition()) <<
"\n" ;
186 assert( (hit->geographicalId()!=0U) | (!hit->canImproveWithTrack()) );
187 assert(hit->surface()!=
nullptr);
189 assert( (!(hit)->canImproveWithTrack()) | (
nullptr!=dynamic_cast<BaseTrackerRecHit const*>(hit.get())));
191 assert(preciseHit->isValid());
192 assert( (preciseHit->geographicalId()!=0U) | (!preciseHit->canImproveWithTrack()) );
193 assert(preciseHit->surface()!=
nullptr);
195 if unlikely(!preciseHit->isValid()){
196 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" <<
"\n";
200 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" <<
"\n";
207 "Failed updating state with hit. Rolling back to non-updated state.\n" <<
208 "State: " << predTsos <<
210 "Hit local err: " << hit->localPositionError() <<
"\n" <<
211 "Hit global pos: " << hit->globalPosition() <<
"\n" <<
212 "Hit global err: " << hit->globalPositionError().matrix() <<
217 if (itm ==
start) smooTsos = itm->updatedState();
218 else if (hitCounter == 1) smooTsos = currTsos;
219 else smooTsos =
combiner(itm->forwardPredictedState(), currTsos);
222 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: smoothed tsos not valid!";
230 else estimate = itm->estimate();
233 <<
"predTsos !" <<
"\n"
235 <<
" with local position " << predTsos.
localPosition() <<
"\n\n"
236 <<
"currTsos !" <<
"\n"
238 <<
" with local position " << currTsos.
localPosition() <<
"\n\n"
239 <<
"smooTsos !" <<
"\n"
241 <<
" with local position " << smooTsos.
localPosition() <<
"\n\n"
242 <<
"smoothing estimate (with combTSOS)=" << estimate <<
"\n"
243 <<
"filtering estimate=" << itm->estimate() <<
"\n";
246 if (preciseHit->det()) myTraj.push(
TM(itm->forwardPredictedState(),
253 else myTraj.push(
TM(itm->forwardPredictedState(),
263 <<
"----------------- HIT #" << hitCounter <<
" (INVALID)-----------------------";
268 if (itm ==
start) combTsos = itm->forwardPredictedState();
269 else if (hitCounter == 1) combTsos = predTsos;
270 else combTsos =
combiner(predTsos, itm->forwardPredictedState());
274 "KFTrajectorySmoother: combined tsos not valid!";
277 assert( (hit->det()==
nullptr) || hit->geographicalId()!=0U);
279 myTraj.push(
TM(itm->forwardPredictedState(),
285 else myTraj.push(
TM(itm->forwardPredictedState(),
294 if (!retry)
return ret;
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
tuple ret
prodAgent to be discontinued
tuple start
Check for commandline option errors.
unsigned int layer() const
layer id
virtual Trajectory trajectory(const Trajectory &aTraj) const override
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
virtual ~KFTrajectorySmoother()
const DetLayerGeometry * theGeometry
LocalPoint localPosition() const
GlobalPoint globalPosition() const
virtual PropagationDirection propagationDirection() const final
unsigned int layer() const
layer id
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
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
unsigned int disk() const
disk id
const TrajectoryStateUpdator * updator() const
TrackingRecHit *operator()[[cms TrackingRecHit::ConstRecHitPointer makeShared(TrackingRecHit::ConstRecHitPointer const &hit, TrajectoryStateOnSurface const &tsos) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
unsigned int wheel() const
wheel id
unsigned int layer() const
layer id
GlobalVector globalMomentum() const
const Propagator * theAlongPropagator
const Propagator * theOppositePropagator
virtual const DetLayer * idToLayer(const DetId &detId) const
Detector det() const
get the detector field from this detid
TkCloner const * theHitCloner
unsigned int wheel() const
wheel id