CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
MuonCkfTrajectoryBuilder Class Reference

#include <MuonCkfTrajectoryBuilder.h>

Inheritance diagram for MuonCkfTrajectoryBuilder:
CkfTrajectoryBuilder BaseCkfTrajectoryBuilder TrajectoryBuilder

Public Member Functions

 MuonCkfTrajectoryBuilder (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
 ~MuonCkfTrajectoryBuilder () override
 
- Public Member Functions inherited from CkfTrajectoryBuilder
TempTrajectory buildTrajectories (const TrajectorySeed &, TrajectoryContainer &ret, unsigned int &nCandPerSeed, const TrajectoryFilter *) const override
 
 CkfTrajectoryBuilder (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
 CkfTrajectoryBuilder (const edm::ParameterSet &conf, std::unique_ptr< TrajectoryFilter > filter)
 
void rebuildTrajectories (TempTrajectory const &startingTraj, const TrajectorySeed &, TrajectoryContainer &result) const override
 
TrajectoryContainer trajectories (const TrajectorySeed &seed) const override
 trajectories building starting from a seed More...
 
void trajectories (const TrajectorySeed &seed, TrajectoryContainer &ret) const override
 trajectories building starting from a seed More...
 
 ~CkfTrajectoryBuilder () override
 
- Public Member Functions inherited from BaseCkfTrajectoryBuilder
 BaseCkfTrajectoryBuilder (const edm::ParameterSet &conf, std::unique_ptr< TrajectoryFilter > filter, std::unique_ptr< TrajectoryFilter > inOutFilter=0)
 
 BaseCkfTrajectoryBuilder (const BaseCkfTrajectoryBuilder &)=delete
 
const TransientTrackingRecHitBuilderhitBuilder () const
 
BaseCkfTrajectoryBuilderoperator= (const BaseCkfTrajectoryBuilder &)=delete
 
virtual void setDebugger (CkfDebugger *dbg) const
 
void setEvent (const edm::Event &event) const override
 
void setEvent (const edm::Event &iEvent, const edm::EventSetup &iSetup, const MeasurementTrackerEvent *data)
 
void setNavigationSchool (NavigationSchool const *nv)
 
void unset () const override
 
 ~BaseCkfTrajectoryBuilder () override
 
- Public Member Functions inherited from TrajectoryBuilder
virtual void rebuildSeedingRegion (const TrajectorySeed &, TrajectoryContainer &result) const
 
virtual ~TrajectoryBuilder ()
 

Protected Member Functions

void collectMeasurement (const DetLayer *layer, const std::vector< const DetLayer * > &nl, const TrajectoryStateOnSurface &currentState, std::vector< TM > &result, int &invalidHits, const Propagator *) const
 
void findCompatibleMeasurements (const TrajectorySeed &seed, const TempTrajectory &traj, std::vector< TrajectoryMeasurement > &result) const override
 
void setEvent_ (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
- Protected Member Functions inherited from CkfTrajectoryBuilder
unsigned int limitedCandidates (const TrajectorySeed &seed, TempTrajectory &startingTraj, TrajectoryContainer &result) const
 
unsigned int limitedCandidates (const std::shared_ptr< const TrajectorySeed > &sharedSeed, TempTrajectoryContainer &candidates, TrajectoryContainer &result) const
 
void setEvent_ (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void updateTrajectory (TempTrajectory &traj, TM &&tm) const
 
- Protected Member Functions inherited from BaseCkfTrajectoryBuilder
void addToResult (std::shared_ptr< const TrajectorySeed > const &seed, TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
 
void addToResult (TempTrajectory const &traj, TempTrajectoryContainer &result, bool inOut=false) const
 
virtual bool analyzeMeasurementsDebugger (Trajectory &traj, const std::vector< TrajectoryMeasurement > &meas, const MeasurementTrackerEvent *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
 
virtual bool analyzeMeasurementsDebugger (TempTrajectory &traj, const std::vector< TrajectoryMeasurement > &meas, const MeasurementTrackerEvent *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
 
const PropagatorbackwardPropagator (const TrajectorySeed &seed) const
 
TempTrajectory createStartingTrajectory (const TrajectorySeed &seed) const
 
virtual void fillSeedHistoDebugger (std::vector< TrajectoryMeasurement >::iterator begin, std::vector< TrajectoryMeasurement >::iterator end) const
 
StateAndLayers findStateAndLayers (const TrajectorySeed &seed, const TempTrajectory &traj) const
 
const PropagatorforwardPropagator (const TrajectorySeed &seed) const
 
void moveToResult (TempTrajectory &&traj, TempTrajectoryContainer &result, bool inOut=false) const
 
bool qualityFilter (const TempTrajectory &traj, bool inOut=false) const
 
void setData (const MeasurementTrackerEvent *data)
 
bool toBeContinued (TempTrajectory &traj, bool inOut=false) const
 

Protected Attributes

const double theDeltaEta
 
const double theDeltaPhi
 
edm::ESWatcher< BaseCkfTrajectoryBuilder::Chi2MeasurementEstimatorRecordtheEstimatorWatcher
 
std::unique_ptr< Chi2MeasurementEstimatorBasetheEtaPhiEstimator
 
const PropagatortheProximityPropagator
 
const std::string theProximityPropagatorName
 
double theRescaleErrorIfFail
 
bool theUseSeedLayer
 
- Protected Attributes inherited from CkfTrajectoryBuilder
bool theAlwaysUseInvalidHits
 
bool theIntermediateCleaning
 
float theLostHitPenalty
 
int theMaxCand
 set Event for the internal MeasurementTracker data member More...
 
- Protected Attributes inherited from BaseCkfTrajectoryBuilder
const Chi2MeasurementEstimatorBasetheEstimator = 0
 
const MeasurementTrackerEventtheMeasurementTracker = 0
 
const NavigationSchooltheNavigationSchool = 0
 
const PropagatorthePropagatorAlong = 0
 
const PropagatorthePropagatorOpposite = 0
 
const TransientTrackingRecHitBuildertheTTRHBuilder = 0
 
const TrajectoryStateUpdatortheUpdator = 0
 

Additional Inherited Members

- Public Types inherited from CkfTrajectoryBuilder
typedef std::vector< TempTrajectoryTempTrajectoryContainer
 
typedef std::vector< TrajectoryTrajectoryContainer
 
- Public Types inherited from BaseCkfTrajectoryBuilder
typedef std::vector< TempTrajectoryTempTrajectoryContainer
 
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef TrajectoryContainer::iterator TrajectoryIterator
 
- Public Types inherited from TrajectoryBuilder
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef TrajectoryContainer::iterator TrajectoryIterator
 
- Protected Types inherited from BaseCkfTrajectoryBuilder
typedef TrackingComponentsRecord Chi2MeasurementEstimatorRecord
 
typedef FreeTrajectoryState FTS
 
typedef std::pair< TSOS, std::vector< const DetLayer * > > StateAndLayers
 
typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 
- Static Protected Member Functions inherited from BaseCkfTrajectoryBuilder
static std::unique_ptr< TrajectoryFiltercreateTrajectoryFilter (const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
 

Detailed Description

Definition at line 7 of file MuonCkfTrajectoryBuilder.h.

Constructor & Destructor Documentation

MuonCkfTrajectoryBuilder::MuonCkfTrajectoryBuilder ( const edm::ParameterSet conf,
edm::ConsumesCollector iC 
)

Definition at line 18 of file MuonCkfTrajectoryBuilder.cc.

References edm::ParameterSet::getParameter(), theRescaleErrorIfFail, and theUseSeedLayer.

19  : CkfTrajectoryBuilder(conf, iC),
20  theDeltaEta(conf.getParameter<double>("deltaEta")),
21  theDeltaPhi(conf.getParameter<double>("deltaPhi")),
22  theProximityPropagatorName(conf.getParameter<std::string>("propagatorProximity")),
23  theProximityPropagator(nullptr),
24  theEtaPhiEstimator(nullptr) {
25  //and something specific to me ?
26  theUseSeedLayer = conf.getParameter<bool>("useSeedLayer");
27  theRescaleErrorIfFail = conf.getParameter<double>("rescaleErrorIfFail");
28 }
const Propagator * theProximityPropagator
T getParameter(std::string const &) const
CkfTrajectoryBuilder(const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
const std::string theProximityPropagatorName
std::unique_ptr< Chi2MeasurementEstimatorBase > theEtaPhiEstimator
MuonCkfTrajectoryBuilder::~MuonCkfTrajectoryBuilder ( )
override

Definition at line 30 of file MuonCkfTrajectoryBuilder.cc.

30 {}

Member Function Documentation

void MuonCkfTrajectoryBuilder::collectMeasurement ( const DetLayer layer,
const std::vector< const DetLayer * > &  nl,
const TrajectoryStateOnSurface currentState,
std::vector< TM > &  result,
int &  invalidHits,
const Propagator prop 
) const
protected

Definition at line 74 of file MuonCkfTrajectoryBuilder.cc.

References PrintoutHelper::dumpMeasurements(), TransverseImpactPointExtrapolator::extrapolate(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogDebug, MeasurementTrackerEvent::measurementTracker(), BaseCkfTrajectoryBuilder::theEstimator, theEtaPhiEstimator, BaseCkfTrajectoryBuilder::theMeasurementTracker, and createJobs::tmp.

Referenced by findCompatibleMeasurements().

79  {
80  for (std::vector<const DetLayer*>::const_iterator il = nl.begin(); il != nl.end(); il++) {
81  TSOS stateToUse = currentState;
82 
83  if (layer == (*il)) {
84  LogDebug("CkfPattern") << " self propagating in findCompatibleMeasurements.\n from: \n" << stateToUse;
85  //self navigation case
86  // go to a middle point first
88  GlobalPoint center(0, 0, 0);
89  stateToUse = middle.extrapolate(stateToUse, center, *prop);
90 
91  if (!stateToUse.isValid())
92  continue;
93  LogDebug("CkfPattern") << "to: " << stateToUse;
94  }
95 
97  std::vector<TM> tmp = layerMeasurements.measurements((**il), stateToUse, *prop, *theEstimator);
98 
99  if (tmp.size() == 1 && theEtaPhiEstimator) {
100  LogDebug("CkfPattern") << "only an invalid hit is found. trying differently";
101  tmp = layerMeasurements.measurements((**il), stateToUse, *prop, *theEtaPhiEstimator);
102  }
103  LogDebug("CkfPattern") << tmp.size() << " measurements returned by LayerMeasurements";
104 
105  if (!tmp.empty()) {
106  // FIXME durty-durty-durty cleaning: never do that please !
107  /* for (vector<TM>::iterator it = tmp.begin(); it!=tmp.end(); ++it)
108  {if (it->recHit()->det()==0) it=tmp.erase(it)--;}*/
109 
110  if (result.empty())
111  result = tmp;
112  else {
113  // keep one dummy TM at the end, skip the others
114  result.insert(result.end() - invalidHits, tmp.begin(), tmp.end());
115  }
116  invalidHits++;
117  }
118  }
119 
120  LogDebug("CkfPattern") << "starting from:\n"
121  << "x: " << currentState.globalPosition() << "\n"
122  << "p: " << currentState.globalMomentum() << "\n"
124 }
#define LogDebug(id)
GlobalPoint globalPosition() const
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
const MeasurementTracker & measurementTracker() const
const MeasurementTrackerEvent * theMeasurementTracker
std::unique_ptr< Chi2MeasurementEstimatorBase > theEtaPhiEstimator
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
GlobalVector globalMomentum() const
tmp
align.sh
Definition: createJobs.py:716
const Chi2MeasurementEstimatorBase * theEstimator
void MuonCkfTrajectoryBuilder::findCompatibleMeasurements ( const TrajectorySeed seed,
const TempTrajectory traj,
std::vector< TrajectoryMeasurement > &  result 
) const
overrideprotectedvirtual

Reimplemented from CkfTrajectoryBuilder.

Definition at line 126 of file MuonCkfTrajectoryBuilder.cc.

References alongMomentum, collectMeasurement(), PTrajectoryStateOnDet::detId(), GeometricSearchTracker::detLayer(), TempTrajectory::direction(), TempTrajectory::empty(), BaseCkfTrajectoryBuilder::forwardPropagator(), TrajectoryStateOnSurface::freeState(), g, MeasurementTrackerEvent::geometricSearchTracker(), MeasurementTrackerEvent::geomTracker(), mps_fire::i, triggerObjects_cff::id, TrackingGeometry::idToDet(), insideOut, createfilelist::int, cmsLHEtoEOSManager::l, TempTrajectory::lastLayer(), TempTrajectory::lastMeasurement(), LogDebug, HLT_2018_cff::magneticField, NavigationSchool::nextLayers(), outsideIn, TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::rescaleError(), mps_fire::result, TrajectorySeed::startingState(), BaseCkfTrajectoryBuilder::theMeasurementTracker, BaseCkfTrajectoryBuilder::theNavigationSchool, theProximityPropagator, theRescaleErrorIfFail, theUseSeedLayer, trajectoryStateTransform::transientState(), and TrajectoryMeasurement::updatedState().

128  {
129  int invalidHits = 0;
130 
131  std::vector<const DetLayer*> nl;
132 
133  if (traj.empty()) {
134  LogDebug("CkfPattern") << "using JR patch for no measurement case";
135  //what if there are no measurement on the Trajectory
136 
137  //set the currentState to be the one from the trajectory seed starting point
138  PTrajectoryStateOnDet ptod = seed.startingState();
139  DetId id(ptod.detId());
141  const Surface* surface = &g->surface();
142 
143  TrajectoryStateOnSurface currentState(
145 
146  //set the next layers to be that one the state is on
148 
149  if (theUseSeedLayer) {
150  {
151  //get the measurements on the layer first
152  LogDebug("CkfPattern") << "using the layer of the seed first.";
153  nl.push_back(l);
154  collectMeasurement(l, nl, currentState, result, invalidHits, theProximityPropagator);
155  }
156 
157  //if fails: try to rescale locally the state to find measurements
158  if ((unsigned int)invalidHits == result.size() && theRescaleErrorIfFail != 1.0 && !result.empty()) {
159  result.clear();
160  LogDebug("CkfPattern") << "using a rescale by " << theRescaleErrorIfFail << " to find measurements.";
161  TrajectoryStateOnSurface rescaledCurrentState = currentState;
162  rescaledCurrentState.rescaleError(theRescaleErrorIfFail);
163  invalidHits = 0;
164  collectMeasurement(l, nl, rescaledCurrentState, result, invalidHits, theProximityPropagator);
165  }
166  }
167 
168  //if fails: go to next layers
169  if (result.empty() || (unsigned int)invalidHits == result.size()) {
170  result.clear();
171  LogDebug("CkfPattern") << "Need to go to next layer to get measurements";
172  //the following will "JUMP" the first layer measurements
173  nl = theNavigationSchool->nextLayers(*l, *currentState.freeState(), traj.direction());
174  if (nl.empty()) {
175  LogDebug("CkfPattern") << " there was no next layer with wellInside. Use the next with no check.";
176  //means you did not get any compatible layer on the next 1/2 tracker layer.
177  // use the next layers with no checking
179  }
180  invalidHits = 0;
181  collectMeasurement(l, nl, currentState, result, invalidHits, forwardPropagator(seed));
182  }
183 
184  //if fails: this is on the next layers already, try rescaling locally the state
185  if (!result.empty() && (unsigned int)invalidHits == result.size() && theRescaleErrorIfFail != 1.0) {
186  result.clear();
187  LogDebug("CkfPattern") << "using a rescale by " << theRescaleErrorIfFail
188  << " to find measurements on next layers.";
189  TrajectoryStateOnSurface rescaledCurrentState = currentState;
190  rescaledCurrentState.rescaleError(theRescaleErrorIfFail);
191  invalidHits = 0;
192  collectMeasurement(l, nl, rescaledCurrentState, result, invalidHits, forwardPropagator(seed));
193  }
194 
195  } else //regular case
196  {
197  TSOS currentState(traj.lastMeasurement().updatedState());
198 
199  nl = theNavigationSchool->nextLayers(*traj.lastLayer(), *currentState.freeState(), traj.direction());
200  if (nl.empty()) {
201  LogDebug("CkfPattern") << " no next layers... going " << traj.direction() << "\n from: \n"
202  << currentState
203  << "\n from detId: " << traj.lastMeasurement().recHit()->geographicalId().rawId();
204  return;
205  }
206 
207  collectMeasurement(traj.lastLayer(), nl, currentState, result, invalidHits, forwardPropagator(seed));
208  }
209 
210  // sort the final result, keep dummy measurements at the end
211  if (result.size() > 1) {
212  sort(result.begin(), result.end() - invalidHits, TrajMeasLessEstim());
213  }
214 
215 #ifdef DEBUG_INVALID
216  bool afterInvalid = false;
217  for (std::vector<TM>::const_iterator i = result.begin(); i != result.end(); i++) {
218  if (!i->recHit().isValid())
219  afterInvalid = true;
220  if (afterInvalid && i->recHit().isValid()) {
221  edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: valid hit after invalid!";
222  }
223  }
224 #endif
225 
226  //analyseMeasurements( result, traj);
227 }
#define LogDebug(id)
const Propagator * theProximityPropagator
const TrackingGeometry * geomTracker() const
ConstRecHitPointer const & recHit() const
bool empty() const
True if trajectory has no measurements.
const Propagator * forwardPropagator(const TrajectorySeed &seed) const
virtual const GeomDet * idToDet(DetId) const =0
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
const TrajectoryMeasurement & lastMeasurement() const
PropagationDirection direction() const
const DetLayer * detLayer(const DetId &id) const
obsolete method. Use idToLayer() instead.
unsigned int detId() const
const MeasurementTrackerEvent * theMeasurementTracker
Definition: DetId.h:17
void collectMeasurement(const DetLayer *layer, const std::vector< const DetLayer * > &nl, const TrajectoryStateOnSurface &currentState, std::vector< TM > &result, int &invalidHits, const Propagator *) const
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
const NavigationSchool * theNavigationSchool
TrajectoryStateOnSurface const & updatedState() const
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
const GeometricSearchTracker * geometricSearchTracker() const
void MuonCkfTrajectoryBuilder::setEvent_ ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements BaseCkfTrajectoryBuilder.

Definition at line 32 of file MuonCkfTrajectoryBuilder.cc.

References edm::ESWatcher< T >::check(), edm::EventSetup::get(), edm::ESHandle< T >::product(), CkfTrajectoryBuilder::setEvent_(), theDeltaEta, theDeltaPhi, BaseCkfTrajectoryBuilder::theEstimator, theEstimatorWatcher, theEtaPhiEstimator, theProximityPropagator, and theProximityPropagatorName.

32  {
33  CkfTrajectoryBuilder::setEvent_(iEvent, iSetup);
34 
35  edm::ESHandle<Propagator> propagatorProximityHandle;
36  iSetup.get<TrackingComponentsRecord>().get(theProximityPropagatorName, propagatorProximityHandle);
37  theProximityPropagator = propagatorProximityHandle.product();
38 
39  // theEstimator is set for this event in the base class
40  if (theEstimatorWatcher.check(iSetup) && theDeltaEta > 0 && theDeltaPhi > 0)
41  theEtaPhiEstimator = std::make_unique<EtaPhiEstimator>(theDeltaEta, theDeltaPhi, theEstimator);
42 }
const Propagator * theProximityPropagator
const std::string theProximityPropagatorName
std::unique_ptr< Chi2MeasurementEstimatorBase > theEtaPhiEstimator
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESWatcher< BaseCkfTrajectoryBuilder::Chi2MeasurementEstimatorRecord > theEstimatorWatcher
T get() const
Definition: EventSetup.h:73
void setEvent_(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
T const * product() const
Definition: ESHandle.h:86
const Chi2MeasurementEstimatorBase * theEstimator

Member Data Documentation

const double MuonCkfTrajectoryBuilder::theDeltaEta
protected

Definition at line 29 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

const double MuonCkfTrajectoryBuilder::theDeltaPhi
protected

Definition at line 30 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

edm::ESWatcher<BaseCkfTrajectoryBuilder::Chi2MeasurementEstimatorRecord> MuonCkfTrajectoryBuilder::theEstimatorWatcher
protected

Definition at line 33 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

std::unique_ptr<Chi2MeasurementEstimatorBase> MuonCkfTrajectoryBuilder::theEtaPhiEstimator
protected

Definition at line 34 of file MuonCkfTrajectoryBuilder.h.

Referenced by collectMeasurement(), and setEvent_().

const Propagator* MuonCkfTrajectoryBuilder::theProximityPropagator
protected

Definition at line 32 of file MuonCkfTrajectoryBuilder.h.

Referenced by findCompatibleMeasurements(), and setEvent_().

const std::string MuonCkfTrajectoryBuilder::theProximityPropagatorName
protected

Definition at line 31 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

double MuonCkfTrajectoryBuilder::theRescaleErrorIfFail
protected
bool MuonCkfTrajectoryBuilder::theUseSeedLayer
protected