28 const RecHitContainer&, fitType)
const{
31 "KFTrajectoryFitter::fit(TrajectorySeed, <TransientTrackingRecHit>) not implemented");
37 const RecHitContainer& hits,
38 const TSOS& firstPredTsos,fitType)
const
44 throw cms::Exception(
"KFTrajectoryFitter",
"TrajectorySeed::direction() requested but not set");
50 <<
" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
51 <<
" KFTrajectoryFitter::fit starting with " << hits.size() <<
" HITS";
53 for (
unsigned int j=0;
j<hits.size();
j++) {
55 LogTrace(
"TrackFitters") <<
"hit #:" <<
j+1 <<
" rawId=" << hits[
j]->det()->geographicalId().rawId()
56 <<
" validity=" << hits[
j]->isValid();
58 LogTrace(
"TrackFitters") <<
"hit #:" <<
j+1 <<
" Hit with no Det information";
60 LogTrace(
"TrackFitters") <<
" INITIAL STATE "<< firstPredTsos;
65 myTraj.reserve(hits.size());
67 TSOS predTsos(firstPredTsos);
71 for(RecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ++ihit, ++hitcounter) {
76 LogDebug(
"TrackFitters")<<
" Error: invalid hit with no GeomDet attached .... skipping";
83 <<
" ----------------- HIT #" << hitcounter <<
" (VALID)-----------------------\n"
90 <<
"SURFACE POSITION" <<
"\n"
92 <<
"SURFACE ROTATION" <<
"\n"
101 LogTrace(
"TrackFitters") <<
" I am TIB " << tTopo->tibLayer(hitId);
103 LogTrace(
"TrackFitters") <<
" I am TOB " << tTopo->tobLayer(hitId);
105 LogTrace(
"TrackFitters") <<
" I am TEC " << tTopo->tecWheel(hitId);
107 LogTrace(
"TrackFitters") <<
" I am TID " << tTopo->tidWheel(hitId);
109 LogTrace(
"TrackFitters") <<
" I am TID " << tTopo->tidWheel(hitId);
111 LogTrace(
"TrackFitters") <<
" I am PixBar " << tTopo->pxbLayer(hitId);
113 LogTrace(
"TrackFitters") <<
" I am PixFwd " << tTopo->pxfDisk(hitId);
115 LogTrace(
"TrackFitters") <<
" UNKNOWN TRACKER HIT TYPE ";
125 LogTrace(
"TrackFitters") <<
" UNKNOWN MUON HIT TYPE ";
128 LogTrace(
"TrackFitters") <<
" UNKNOWN HIT TYPE ";
132 <<
" ----------------- INVALID HIT #" << hitcounter <<
" -----------------------";
136 if ( hitcounter != 1)
137 predTsos = thePropagator->propagate( currTsos, *(hit.
surface()) );
142 <<
"SOMETHING WRONG !" <<
"\n"
143 <<
"KFTrajectoryFitter: predicted tsos not valid!\n"
144 <<
"current TSOS: " << currTsos <<
"\n";
148 if( myTraj.foundHits() >= minHits_ ) {
149 LogDebug(
"TrackFitters") <<
" breaking trajectory" <<
"\n";
152 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
159 LogTrace(
"TrackFitters") <<
"THE HIT IS VALID: updating hit with predTsos";
162 if unlikely(!preciseHit->isValid()){
163 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS NOT VALID: using currTsos = predTsos" <<
"\n";
165 myTraj.push(TM(predTsos, *ihit,0,theGeometry->idToLayer((*ihit)->geographicalId()) ));
168 LogTrace(
"TrackFitters") <<
"THE Precise HIT IS VALID: updating currTsos" <<
"\n";
169 currTsos = updator()->
update(predTsos, *preciseHit);
171 bool badState = (!currTsos.
isValid())
180 <<
"updating with the hit failed. Not updating the trajectory with the hit";
182 else LogTrace(
"FailedUpdate")<<
"updated state is valid but pretty bad, skipping. currTsos "
183 <<currTsos<<
"\n predTsos "<<predTsos;
184 myTraj.push(TM(predTsos, *ihit,0,theGeometry->idToLayer((*ihit)->geographicalId()) ));
187 if( myTraj.foundHits() >= minHits_ ) {
188 LogDebug(
"TrackFitters") <<
" breaking trajectory" <<
"\n";
191 LogDebug(
"TrackFitters") <<
" killing trajectory" <<
"\n";
195 if (preciseHit->det()) myTraj.push(TM(predTsos, currTsos, preciseHit,
196 estimator()->estimate(predTsos, *preciseHit).
second,
197 theGeometry->idToLayer(preciseHit->geographicalId()) ));
198 else myTraj.push(TM(predTsos, currTsos, preciseHit,
199 estimator()->estimate(predTsos, *preciseHit).second));
204 LogDebug(
"TrackFitters") <<
"THE HIT IS NOT VALID: using currTsos" <<
"\n";
206 myTraj.push(TM(predTsos, *ihit,0,theGeometry->idToLayer((*ihit)->geographicalId()) ));
210 <<
"predTsos !" <<
"\n"
212 <<
"currTsos !" <<
"\n"
216 LogDebug(
"TrackFitters") <<
"Found 1 trajectory with " << myTraj.foundHits() <<
" valid hits\n";
PropagationDirection direction() const
bool empty() const
True if trajectory has no measurements.
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
const LocalTrajectoryParameters & localParameters() const
LocalPoint position() const
Local x and y position coordinates.
Geom::Phi< T > phi() const
ConstRecHitContainer recHits(bool splitting=false) const
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
virtual GlobalPoint globalPosition() const =0
void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
virtual RecHitPointer clone(const TrajectoryStateOnSurface &) const
Abs< T >::type abs(const T &t)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
TrajectoryMeasurement const & firstMeasurement() const
virtual LocalError localPositionError() const =0
virtual const Surface * surface() const
const RotationType & rotation() const
DetId geographicalId() const
Detector det() const
get the detector field from this detid
virtual LocalPoint localPosition() const =0
const PositionType & position() const