44 theRoadEstimator(0),theHitEstimator(0),theUpdator(0),theSmoother(0)
51 theCategory =
"Muon|RecoMuon|MuonRoadTrajectoryBuilder";
59 double chi2R=iConfig.
getParameter<
double>(
"maxChi2Road");
113 if (s1>s2)
return true;
115 if (s1==s2)
return (traj1.
chi2<traj2.
chi2);
116 else return false; }}
132 std::vector<Trajectory>
result;
164 LogDebug(
theCategory) <<
"(detId.rawId()) "<<(detId.rawId())<<
"(detId.subdetId()) "<<(detId.subdetId())
184 initial.
traj=basicTrajectory;
191 std::vector<ForwardDetLayer*> tidlc[2];
194 std::vector<ForwardDetLayer*> teclc[2];
197 const int Ntib=tiblc.size();
198 const int Ntob=toblc.size();
199 const int Ntid=tidlc[0].size();
202 const int Ntec=teclc[0].size();
204 LogDebug(
theCategory)<<
"(Ntib) "<<(Ntib)<<
"(Ntob) "<<(Ntob)<<
"(Ntid) "<<(Ntid)<<
"(Ntec) "<<(Ntec);
214 PART whichpart = fault;
215 switch(detId.subdetId()){
216 case 1: {whichpart=PXB;
break;}
217 case 2: {whichpart=PXF;
break;}
219 case 3: {whichpart=
TIB;
break;}
220 case 4: {whichpart=
TID;
break;}
221 case 5: {whichpart=
TOB;
break;}
222 case 6: {whichpart=
TEC;
break;}}
225 bool firstRound =
true;
242 if (indexinpart==Ntib){whichpart =
TOB; indexinpart=-1;
break; }
253 if (fabs(z) > fabs(tidlc[(z>0)][0]->surface().
position().
z()))
255 LogDebug(
theCategory)<<
"|z| ("<<z<<
") bigger than the TID min z("<<tidlc[(z>0)][0]->surface().position().z()<<
"): go to TID";
256 whichpart =
TID; indexinpart=-1;
break;}
257 else { Nhits+=
GatherHits(TSOS,tiblc[indexinpart],Trajectories);}
262 if (indexinpart==Ntid){ whichpart =
TEC; indexinpart=-1;
break;}
274 sdbounds =
dynamic_cast<const SimpleDiskBounds *
>(&tidlc[(z>0)][indexinpart]->surface().bounds());
278 if (r < sdbounds->innerRadius())
285 whichpart =
TOB; indexinpart=-1;
break;}
288 Nhits+=
GatherHits(TSOS,tidlc[(z>0)][indexinpart],Trajectories);}
293 if (indexinpart==Ntob){ inapart=
false;
break;}
304 if (fabs(z) > fabs(teclc[(z>0)][0]->surface().
position().
z()))
306 LogDebug(
theCategory)<<
"|z| ("<<z<<
") bigger than the TOB layer max z ("<< teclc[(z>0)][0]->surface().position().z()<<
"): go to TEC";
307 whichpart =
TEC; indexinpart=-1;
break;}
308 else {Nhits+=
GatherHits(TSOS,toblc[indexinpart],Trajectories);}
313 if (indexinpart==Ntec){inapart=
false;
break;}
325 sdbounds =
dynamic_cast<const SimpleDiskBounds *
>(&teclc[(z>0)][indexinpart]->surface().bounds());
329 if (r < sdbounds->innerRadius())
336 inapart=
false;
break;}
337 else {Nhits+=
GatherHits(TSOS,teclc[(z>0)][indexinpart],Trajectories);}
353 <<Nhits<<
" hits in the road for this seed \n"
354 << Trajectories.
head().size()<<
" possible trajectory(ies)";
365 for (TrajectoryCollection::iterator tit = Trajectories.
head().begin(); tit!=Trajectories.
head().end();tit++)
399 Trajectory::DataContainer::iterator mit = meas.begin();
400 while (mit!=meas.end()){
403 LogDebug(
theCategory)<<
"(mit->recHit()->det()->geographicalId().rawId()) "<<(mit->recHit()->det()->geographicalId().rawId())
404 <<
"(detLayer) "<<(detLayer)<<
"(lastDetLayer) "<<(lastDetLayer);
406 if (detLayer==lastDetLayer)
411 lastDetLayer=detLayer;
414 for (Trajectory::DataContainer::iterator mit=meas.begin();mit!=meas.end();++mit)
415 {newTraj.
push(*mit);}
433 for (Trajectory::DataContainer::iterator mit=meas.begin();mit!=meas.end();++mit)
434 {newTraj.
push(*mit);}
455 else{
return (ret.front());}
462 bool atleastoneadded=
false;
469 for (std::vector< DetLayer::DetWithState > ::iterator dws = compatible.begin();dws != compatible.end();dws++)
471 const DetId presentdetid = dws->first->geographicalId();
472 restep = dws->second;
475 LogDebug(
theCategory)<<((dws->first->components ().size()!=0) ?
"double sided layer":
"single sided layer")
476 <<
"(presentdetid.rawId()) "<<(presentdetid.
rawId());
480 int additionalHits =0;
486 <<
" compatible hits ("<<thoseHits.size()<<
")on module "<<presentdetid.
rawId()
487 <<
", skip it";
continue; }
490 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator iTThit = thoseHits.begin();iTThit != thoseHits.end(); iTThit++)
497 const BoundPlane & surface = (*iTThit)->det()->surface();
503 <<
"road step parameters at module: \n"<<restep
504 <<
"(est_road.first) "<<(est_road.first)<<
"(est_road.second) "<<(est_road.second);
511 atleastoneadded=
true;
514 <<
"loop over previous trajectories\n"
515 <<
"(Trajectories.tail().size()) "<<(Trajectories.
tail().size())<<
"(Trajectories.head().size()) "<<(Trajectories.
head().size());
519 for ( TrajectoryCollection::iterator traj =Trajectories.
head().begin();traj != Trajectories.
head().end(); traj++)
530 <<
"predicted state is not valid at trajectory update, rechit surface cannot be reached by the previous updated state.";
continue;}
547 Trajectories.
tail().push_back(*traj);
552 combined.
chi2 += est_road.second;
560 combined.
TSOS = updatedState;
562 combined.
traj.
push(trajMeasurement,est.second);
565 <<
"muon measurement on previous module: \n"<<traj->TSOS
566 <<
"muon measurement before update: \n"<<predictedState
567 <<
"muon measurement after update: \n"<<updatedState;
572 LogDebug(
theCategory)<<
"hit failed chi2 test for trajectories update\n"<<
"(traj->duplicate) "<<(traj->duplicate);
574 if (!traj->duplicate){
575 Trajectories.
tail().push_back(*traj);
580 traj->duplicate =
true;
590 if (!Trajectories.
tail().empty())
603 Trajectories.
tail().push_front(*Trajectories.
head().begin());
605 pushed.
missed+=additionalHits;
612 Trajectories.
head().clear();
633 {Trajectories.
tail().push_front(*Trajectories.
head().begin());}
637 Trajectories.
head().clear();
650 Trajectories.
head().pop_front(); }
656 if (Trajectories.
head().size()>=2)
679 unsigned int prevSize=collection.size();
682 <<
" too many possible trajectories ("<<prevSize
693 TrajectoryCollection::iterator traj1 = collection.begin();
694 while(traj1 != collection.end())
699 TrajectoryCollection::iterator traj2 = traj1;
701 bool traj1_removed=
false;
702 while( traj2 != collection.end())
704 if (traj2 == traj1 )
continue;
707 std::list <TrajectoryMeasurement >::reverse_iterator h1 = traj1->measurements.rbegin();
708 std::list <TrajectoryMeasurement >::reverse_iterator h2 = traj2->measurements.rbegin();
710 bool break_different =
false;
711 while (h1 != traj1->measurements.rend() && h2!=traj2->measurements.rend())
716 LogDebug(
theCategory)<<
"(hit1->geographicalId().rawId()) "<<(hit1->geographicalId().rawId())<<
"(hit1->globalPosition()) "<<(hit1->globalPosition())
717 <<
"(hit2->geographicalId().rawId()) "<<(hit2->geographicalId().rawId())<<
"(hit2->globalPosition()) "<<(hit2->globalPosition());
719 if (hit1 == hit2){ h1++;h2++;
continue;}
720 else{break_different =
true;
726 if (!break_different)
734 if (h1 != traj1->measurements.rend())
738 traj2=collection.erase(traj2);
744 traj1=collection.erase(traj1);
std::vector< Trajectory > Trajectories
T getParameter(std::string const &) const
~MuonRoadTrajectoryBuilder()
bool trajectorymeasurementInverseOrder(const TrajectoryMeasurement &meas_1, const TrajectoryMeasurement &meas_2)
virtual void update(const edm::Event &) const =0
std::vector< unsigned int > theMaxTrajectoriesThreshold
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
bool theCarriedIPatfirstlayerModule
std::string theCategory
Info/Debug category "Muon|RecoMuon|MuonRoadTrajectoryBuilder".
unsigned int theNumberOfHitPerModuleDefault
virtual TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const =0
for the trajectory collection
MuonRoadTrajectoryBuilder(const edm::ParameterSet &par, const MeasurementTracker *mt, const MagneticField *f, const Propagator *p)
constructor from PSet and things from record
bool theDynamicMaxNumberOfHitPerModule
std::vector< Trajectory > trajectories(const TrajectorySeed &seed) const
bool theCarriedIPatfirstlayer
bool trajectoryOrder(const MuonRoadTrajectoryBuilder::trajectory &traj1, const MuonRoadTrajectoryBuilder::trajectory &traj2)
GlobalPoint globalPosition() const
void makeTrajectories(const TrajectorySeed &seed, std::vector< Trajectory > &result, int version=0) const
KFTrajectorySmoother * theSmoother
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Trajectory smooth(Trajectory &) const
std::vector< ForwardDetLayer * > const & posTecLayers() const
std::vector< unsigned int > theNumberOfHitPerModuleThreshold
Chi2MeasurementEstimator * theHitEstimator
bool theBranchonfirstlayer
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
bool checkStep(TrajectoryCollection &collection) const
void makeTrajectories_0(const TrajectorySeed &seed, std::vector< Trajectory > &result) const
PropagationDirection const & direction() const
uint32_t rawId() const
get the raw id
virtual std::vector< Trajectory > trajectories(const Trajectory &aTraj) const
std::vector< ForwardDetLayer * > const & negTecLayers() const
virtual RecHitContainer recHits(const TrajectoryStateOnSurface &) const =0
DataContainer const & measurements() const
void setEvent(const edm::Event &) const
std::vector< Trajectory > TrajectoryContainer
std::vector< TrajectoryMeasurement > DataContainer
void cleanTrajectory(Trajectory &traj) const
FreeTrajectoryState * freeState(bool withErrors=true) const
unsigned int theNumberOfHitPerModule
unsigned int theMaxTrajectories
TrajectoryStateUpdator * theUpdator
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
const TrackingGeometry * geomTracker() const
unsigned int detId() const
void makeTrajectories_1(const TrajectorySeed &seed, std::vector< Trajectory > &result) const
TrajectoryStateOnSurface predictedState() const
float outerRadius() const
tuple Chi2MeasurementEstimator
const MeasurementTracker * theMeasurementTracker
void sortTrajectoryMeasurements(Trajectory &traj)
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
std::list< TrajectoryMeasurement > measurements
std::vector< ConstRecHitPointer > ConstRecHitContainer
Vector3DBase unit() const
std::pair< bool, double > HitReturnType
TrajectoryStateOnSurface TSOS
PTrajectoryStateOnDet const & startingState() const
virtual const GeomDet * idToDet(DetId) const =0
std::list< trajectory > TrajectoryCollection
Chi2MeasurementEstimator * theRoadEstimator
unsigned int theMinNumberOfHitOnCandidate
const MagneticField * theField
std::vector< BarrelDetLayer * > const & tibLayers() const
const Propagator * thePropagator
GlobalVector globalMomentum() const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
std::vector< ForwardDetLayer * > const & posTidLayers() const
bool trajectorymeasurementOrder(const TrajectoryMeasurement &meas_1, const TrajectoryMeasurement &meas_2)
static int position[264][3]
virtual const MeasurementDet * idToDet(const DetId &id) const =0
MeasurementDetSystem interface.
tuple KFTrajectorySmoother
std::vector< ForwardDetLayer * > const & negTidLayers() const
float innerRadius() const
Extension of the Bounds interface.
const GeometricSearchTracker * geometricSearchTracker() const
void push(const TrajectoryMeasurement &tm)
void checkDuplicate(TrajectoryCollection &collection) const
TrajectoryStateOnSurface TSOS
GlobalVector globalDirection() const
std::vector< BarrelDetLayer * > const & tobLayers() const
int GatherHits(const TrajectoryStateOnSurface &step, const DetLayer *thislayer, TrajectoryCollectionFPair &Trajectories) const