test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual ~MuonCkfTrajectoryBuilder ()
 
- Public Member Functions inherited from CkfTrajectoryBuilder
TempTrajectory buildTrajectories (const TrajectorySeed &, TrajectoryContainer &ret, const TrajectoryFilter *) const override
 
 CkfTrajectoryBuilder (const edm::ParameterSet &conf, edm::ConsumesCollector &iC)
 
 CkfTrajectoryBuilder (const edm::ParameterSet &conf, TrajectoryFilter *filter)
 
void rebuildTrajectories (TempTrajectory const &startingTraj, const TrajectorySeed &, TrajectoryContainer &result) const override
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &seed) const override
 trajectories building starting from a seed More...
 
virtual void trajectories (const TrajectorySeed &seed, TrajectoryContainer &ret) const override
 trajectories building starting from a seed More...
 
 ~CkfTrajectoryBuilder ()
 
- Public Member Functions inherited from BaseCkfTrajectoryBuilder
 BaseCkfTrajectoryBuilder (const edm::ParameterSet &conf, TrajectoryFilter *filter, TrajectoryFilter *inOutFilter=0)
 
 BaseCkfTrajectoryBuilder (const BaseCkfTrajectoryBuilder &)=delete
 
const
TransientTrackingRecHitBuilder
hitBuilder () const
 
BaseCkfTrajectoryBuilderoperator= (const BaseCkfTrajectoryBuilder &)=delete
 
virtual void setDebugger (CkfDebugger *dbg) const
 
virtual void setEvent (const edm::Event &event) const
 
void setEvent (const edm::Event &iEvent, const edm::EventSetup &iSetup, const MeasurementTrackerEvent *data)
 
void setNavigationSchool (NavigationSchool const *nv)
 
virtual void unset () const
 
virtual ~BaseCkfTrajectoryBuilder ()
 
- 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
 
virtual 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
void limitedCandidates (const TrajectorySeed &seed, TempTrajectory &startingTraj, TrajectoryContainer &result) const
 
void limitedCandidates (const boost::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 (boost::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
 
StateAndLayers findStateAndLayers (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::Chi2MeasurementEstimatorRecord
theEstimatorWatcher
 
std::unique_ptr
< Chi2MeasurementEstimatorBase
theEtaPhiEstimator
 
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
Chi2MeasurementEstimatorBase
theEstimator
 
const MeasurementTrackerEventtheMeasurementTracker
 
const NavigationSchooltheNavigationSchool = 0
 
const PropagatorthePropagatorAlong
 
const PropagatorthePropagatorOpposite
 
const
TransientTrackingRecHitBuilder
theTTRHBuilder
 
const TrajectoryStateUpdatortheUpdator
 

Additional Inherited Members

- Public Types inherited from CkfTrajectoryBuilder
typedef std::vector
< TempTrajectory
TempTrajectoryContainer
 
typedef std::vector< TrajectoryTrajectoryContainer
 
- Public Types inherited from BaseCkfTrajectoryBuilder
typedef std::vector
< TempTrajectory
TempTrajectoryContainer
 
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 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.

18  :
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 {
26  //and something specific to me ?
27  theUseSeedLayer = conf.getParameter<bool>("useSeedLayer");
28  theRescaleErrorIfFail = conf.getParameter<double>("rescaleErrorIfFail");
29 }
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 ( )
virtual

Definition at line 31 of file MuonCkfTrajectoryBuilder.cc.

32 {
33 }

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 78 of file MuonCkfTrajectoryBuilder.cc.

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

Referenced by findCompatibleMeasurements().

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

Reimplemented from CkfTrajectoryBuilder.

Definition at line 133 of file MuonCkfTrajectoryBuilder.cc.

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

136 {
137  int invalidHits = 0;
138 
139 
140  std::vector<const DetLayer*> nl;
141 
142  if (traj.empty())
143  {
144  LogDebug("CkfPattern")<<"using JR patch for no measurement case";
145  //what if there are no measurement on the Trajectory
146 
147  //set the currentState to be the one from the trajectory seed starting point
149  DetId id(ptod.detId());
151  const Surface * surface=&g->surface();
152 
154 
155  //set the next layers to be that one the state is on
157 
158  if (theUseSeedLayer){
159  {
160  //get the measurements on the layer first
161  LogDebug("CkfPattern")<<"using the layer of the seed first.";
162  nl.push_back(l);
163  collectMeasurement(l,nl,currentState,result,invalidHits,theProximityPropagator);
164  }
165 
166  //if fails: try to rescale locally the state to find measurements
167  if ((unsigned int)invalidHits==result.size() && theRescaleErrorIfFail!=1.0 && result.size()!=0)
168  {
169  result.clear();
170  LogDebug("CkfPattern")<<"using a rescale by "<< theRescaleErrorIfFail <<" to find measurements.";
171  TrajectoryStateOnSurface rescaledCurrentState = currentState;
172  rescaledCurrentState.rescaleError(theRescaleErrorIfFail);
173  invalidHits=0;
174  collectMeasurement(l,nl,rescaledCurrentState,result,invalidHits,theProximityPropagator);
175  }
176  }
177 
178  //if fails: go to next layers
179  if (result.size()==0 || (unsigned int)invalidHits==result.size())
180  {
181  result.clear();
182  LogDebug("CkfPattern")<<"Need to go to next layer to get measurements";
183  //the following will "JUMP" the first layer measurements
184  nl = theNavigationSchool->nextLayers(*l, *currentState.freeState(), traj.direction());
185  if (nl.size()==0){
186  LogDebug("CkfPattern")<<" there was no next layer with wellInside. Use the next with no check.";
187  //means you did not get any compatible layer on the next 1/2 tracker layer.
188  // use the next layers with no checking
190  }
191  invalidHits=0;
192  collectMeasurement(l,nl,currentState,result,invalidHits,forwardPropagator(seed));
193  }
194 
195  //if fails: this is on the next layers already, try rescaling locally the state
196  if (result.size()!=0 && (unsigned int)invalidHits==result.size() && theRescaleErrorIfFail!=1.0)
197  {
198  result.clear();
199  LogDebug("CkfPattern")<<"using a rescale by "<< theRescaleErrorIfFail <<" to find measurements on next layers.";
200  TrajectoryStateOnSurface rescaledCurrentState = currentState;
201  rescaledCurrentState.rescaleError(theRescaleErrorIfFail);
202  invalidHits=0;
203  collectMeasurement(l,nl,rescaledCurrentState, result,invalidHits,forwardPropagator(seed));
204  }
205 
206  }
207  else //regular case
208  {
209 
210  TSOS currentState( traj.lastMeasurement().updatedState());
211 
212  nl = theNavigationSchool->nextLayers(*traj.lastLayer(), *currentState.freeState(), traj.direction());
213  if (nl.empty()){LogDebug("CkfPattern")<<" no next layers... going "<<traj.direction()<<"\n from: \n"<<currentState<<"\n from detId: "<<traj.lastMeasurement().recHit()->geographicalId().rawId(); return ;}
214 
215  collectMeasurement(traj.lastLayer(),nl,currentState,result,invalidHits,forwardPropagator(seed));
216  }
217 
218 
219  // sort the final result, keep dummy measurements at the end
220  if ( result.size() > 1) {
221  sort( result.begin(), result.end()-invalidHits, TrajMeasLessEstim());
222  }
223 
224 #ifdef DEBUG_INVALID
225  bool afterInvalid = false;
226  for (std::vector<TM>::const_iterator i=result.begin();
227  i!=result.end(); i++) {
228  if ( ! i->recHit().isValid()) afterInvalid = true;
229  if (afterInvalid && i->recHit().isValid()) {
230  edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: valid hit after invalid!" ;
231  }
232  }
233 #endif
234 
235  //analyseMeasurements( result, traj);
236 
237 }
#define LogDebug(id)
const Propagator * theProximityPropagator
int i
Definition: DBlmapReader.cc:9
const TrackingGeometry * geomTracker() const
ConstRecHitPointer const & recHit() const
bool empty() const
True if trajectory has no measurements.
const Propagator * forwardPropagator(const TrajectorySeed &seed) const
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
tuple result
Definition: mps_fire.py:84
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:18
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)
virtual const GeomDet * idToDet(DetId) const =0
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
NavigationDirection.
return(e1-e2)*(e1-e2)+dp *dp
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 35 of file MuonCkfTrajectoryBuilder.cc.

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

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

Member Data Documentation

const double MuonCkfTrajectoryBuilder::theDeltaEta
protected

Definition at line 22 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

const double MuonCkfTrajectoryBuilder::theDeltaPhi
protected

Definition at line 23 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

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

Definition at line 26 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

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

Definition at line 27 of file MuonCkfTrajectoryBuilder.h.

Referenced by collectMeasurement(), and setEvent_().

const Propagator* MuonCkfTrajectoryBuilder::theProximityPropagator
protected

Definition at line 25 of file MuonCkfTrajectoryBuilder.h.

Referenced by findCompatibleMeasurements(), and setEvent_().

const std::string MuonCkfTrajectoryBuilder::theProximityPropagatorName
protected

Definition at line 24 of file MuonCkfTrajectoryBuilder.h.

Referenced by setEvent_().

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