19 KFTrajectorySmoother::~KFTrajectorySmoother() {
28 KFTrajectorySmoother::trajectory(
const Trajectory& aTraj)
const {
42 myTraj.reserve(avtm.size());
47 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother::trajectories starting with " << avtm.size() <<
" HITS\n";
48 for (
unsigned int j=0;
j<avtm.size();
j++) {
49 if (avtm[
j].recHit()->det())
50 LogTrace(
"TrackFitters") <<
"hit #:" <<
j+1 <<
" rawId=" << avtm[
j].recHit()->det()->geographicalId().rawId()
51 <<
" validity=" << avtm[
j].recHit()->isValid();
53 LogTrace(
"TrackFitters") <<
"hit #:" <<
j+1 <<
" Hit with no Det information";
55 #endif // EDM_ML_DEBUG
58 TSOS predTsos = avtm.back().forwardPredictedState();
64 unsigned int hitcounter = avtm.size();
65 for(std::vector<TM>::const_reverse_iterator itm = avtm.rbegin(); itm != (avtm.rend()); ++itm,--hitcounter) {
71 LogDebug(
"TrackFitters")<<
" Error: invalid hit with no GeomDet attached .... skipping";
75 if (hitcounter != avtm.size())
76 predTsos = thePropagator->propagate( currTsos, *(hit->surface()) );
79 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: predicted tsos not valid!";
80 if( myTraj.foundHits() >= minHits_ ) {
81 LogDebug(
"TrackFitters") <<
" breaking trajectory" <<
"\n";
83 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
93 <<
"----------------- HIT #" << hitcounter <<
" (VALID)-----------------------\n"
94 <<
"HIT IS AT R " << hit->globalPosition().perp() <<
"\n"
95 <<
"HIT IS AT Z " << hit->globalPosition().z() <<
"\n"
96 <<
"HIT IS AT Phi " << hit->globalPosition().phi() <<
"\n"
97 <<
"HIT IS AT Loc " << hit->localPosition() <<
"\n"
98 <<
"WITH LocError " << hit->localPositionError() <<
"\n"
99 <<
"HIT IS AT Glo " << hit->globalPosition() <<
"\n"
100 <<
"SURFACE POSITION: " << hit->surface()->position() <<
"\n"
101 <<
"SURFACE ROTATION: " << hit->surface()->rotation() <<
"\n"
102 <<
"hit geographicalId=" << hit->geographicalId().rawId();
104 DetId hitId = hit->geographicalId();
108 LogTrace(
"TrackFitters") <<
" I am TIB " << tTopo->tibLayer(hitId);
110 LogTrace(
"TrackFitters") <<
" I am TOB " << tTopo->tobLayer(hitId);
112 LogTrace(
"TrackFitters") <<
" I am TEC " << tTopo->tecWheel(hitId);
114 LogTrace(
"TrackFitters") <<
" I am TID " << tTopo->tidWheel(hitId);
116 LogTrace(
"TrackFitters") <<
" I am TID " << tTopo->tidWheel(hitId);
118 LogTrace(
"TrackFitters") <<
" I am PixBar " << tTopo->pxbLayer(hitId);
120 LogTrace(
"TrackFitters") <<
" I am PixFwd " << tTopo->pxfDisk(hitId);
122 LogTrace(
"TrackFitters") <<
" UNKNOWN TRACKER HIT TYPE ";
132 LogTrace(
"TrackFitters") <<
" UNKNOWN MUON HIT TYPE ";
135 LogTrace(
"TrackFitters") <<
" UNKNOWN HIT TYPE ";
136 #endif //EDM_ML_DEBUG
140 TSOS combTsos,smooTsos;
151 if (hitcounter == avtm.size()) combTsos = itm->forwardPredictedState();
152 else if (hitcounter == 1) combTsos = predTsos;
153 else combTsos =
combiner(predTsos, itm->forwardPredictedState());
157 "KFTrajectorySmoother: combined tsos not valid!\n" <<
160 "TrackingRecHit: " << hit->surface()->toGlobal(hit->localPosition()) <<
"\n" ;
161 if( myTraj.foundHits() >= minHits_ ) {
162 LogDebug(
"TrackFitters") <<
" breaking trajectory" <<
"\n";
164 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
172 if unlikely(!preciseHit->isValid()){
173 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" <<
"\n";
175 myTraj.push(TM(predTsos, hit, 0, theGeometry->idToLayer(hit->geographicalId()) ));
177 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" <<
"\n";
180 currTsos = updator()->
update(predTsos, *preciseHit);
184 "Failed updating state with hit. Rolling back to non-updated state.\n" <<
185 "State: " << predTsos <<
186 "Hit local pos: " << hit->localPosition() <<
"\n" <<
187 "Hit local err: " << hit->localPositionError() <<
"\n" <<
188 "Hit global pos: " << hit->globalPosition() <<
"\n" <<
189 "Hit global err: " << hit->globalPositionError().matrix() <<
194 if (hitcounter == avtm.size()) smooTsos = itm->updatedState();
195 else if (hitcounter == 1) smooTsos = currTsos;
196 else smooTsos =
combiner(itm->forwardPredictedState(), currTsos);
199 LogDebug(
"TrackFitters") <<
"KFTrajectorySmoother: smoothed tsos not valid!";
200 if( myTraj.foundHits() >= minHits_ ) {
201 LogDebug(
"TrackFitters") <<
" breaking trajectory" <<
"\n";
203 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
210 if (hitcounter != avtm.size()) estimate = estimator()->estimate(combTsos, *preciseHit ).second;
211 else estimate = itm->estimate();
214 <<
"predTsos !" <<
"\n"
216 <<
"currTsos !" <<
"\n"
218 <<
"smooTsos !" <<
"\n"
220 <<
"smoothing estimate (with combTSOS)=" << estimate <<
"\n"
221 <<
"filtering estimate=" << itm->estimate() <<
"\n";
224 if (preciseHit->det()) myTraj.push(TM(itm->forwardPredictedState(),
229 theGeometry->idToLayer(preciseHit->geographicalId()) ),
230 estimator()->estimate(predTsos,*preciseHit).second);
231 else myTraj.push(TM(itm->forwardPredictedState(),
236 estimator()->estimate(predTsos,*preciseHit).second);
241 <<
"----------------- HIT #" << hitcounter <<
" (INVALID)-----------------------";
246 if (hitcounter == avtm.size()) combTsos = itm->forwardPredictedState();
247 else if (hitcounter == 1) combTsos = predTsos;
248 else combTsos =
combiner(predTsos, itm->forwardPredictedState());
252 "KFTrajectorySmoother: combined tsos not valid!";
256 myTraj.push(TM(itm->forwardPredictedState(),
261 theGeometry->idToLayer(hit->geographicalId()) ));
bool empty() const
True if trajectory has no measurements.
void rescaleError(double factor)
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
GlobalPoint globalPosition() const
PropagationDirection const & direction() const
DataContainer const & measurements() const
void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
GlobalVector globalMomentum() const
Detector det() const
get the detector field from this detid