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

virtual MuonCkfTrajectoryBuilderclone (const MeasurementTrackerEvent *data) const
 
 MuonCkfTrajectoryBuilder (const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Propagator *propagatorProximity, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter)
 
virtual ~MuonCkfTrajectoryBuilder ()
 
- Public Member Functions inherited from CkfTrajectoryBuilder
TempTrajectory buildTrajectories (const TrajectorySeed &, TrajectoryContainer &ret, const TrajectoryFilter *) const
 
 CkfTrajectoryBuilder (const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *recHitBuilder, const TrajectoryFilter *filter)
 
void rebuildTrajectories (TempTrajectory const &startingTraj, const TrajectorySeed &, TrajectoryContainer &result) const
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &seed) const
 trajectories building starting from a seed More...
 
virtual void trajectories (const TrajectorySeed &seed, TrajectoryContainer &ret) const
 trajectories building starting from a seed More...
 
 ~CkfTrajectoryBuilder ()
 
- Public Member Functions inherited from BaseCkfTrajectoryBuilder
 BaseCkfTrajectoryBuilder (const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const TrajectoryFilter *filter, const TrajectoryFilter *inOutFilter=0)
 
 BaseCkfTrajectoryBuilder (const BaseCkfTrajectoryBuilder &other)=default
 
virtual void setDebugger (CkfDebugger *dbg) const
 
virtual void setEvent (const edm::Event &event) const
 
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
 
- 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 updateTrajectory (TempTrajectory &traj, const 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
 
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
 
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

Chi2MeasurementEstimatorBasetheEtaPhiEstimator
 
const PropagatortheProximityPropagator
 
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 PropagatortheBackwardPropagator
 
const
Chi2MeasurementEstimatorBase
theEstimator
 
const PropagatortheForwardPropagator
 
const MeasurementTrackerEventtheMeasurementTracker
 
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 FreeTrajectoryState FTS
 
typedef std::pair< TSOS,
std::vector< const DetLayer * > > 
StateAndLayers
 
typedef TrajectoryMeasurement TM
 
typedef TrajectoryStateOnSurface TSOS
 

Detailed Description

Definition at line 6 of file MuonCkfTrajectoryBuilder.h.

Constructor & Destructor Documentation

MuonCkfTrajectoryBuilder::MuonCkfTrajectoryBuilder ( const edm::ParameterSet conf,
const TrajectoryStateUpdator updator,
const Propagator propagatorAlong,
const Propagator propagatorOpposite,
const Propagator propagatorProximity,
const Chi2MeasurementEstimatorBase estimator,
const TransientTrackingRecHitBuilder RecHitBuilder,
const MeasurementTracker measurementTracker,
const TrajectoryFilter filter 
)

Definition at line 17 of file MuonCkfTrajectoryBuilder.cc.

References dPhi(), edm::ParameterSet::getParameter(), BaseCkfTrajectoryBuilder::theEstimator, theEtaPhiEstimator, theRescaleErrorIfFail, and theUseSeedLayer.

Referenced by clone().

25  :
26  CkfTrajectoryBuilder(conf,updator,propagatorAlong,propagatorOpposite,estimator,RecHitBuilder,filter),
27  theProximityPropagator(propagatorProximity)
28 {
29  //and something specific to me ?
30  theUseSeedLayer = conf.getParameter<bool>("useSeedLayer");
31  theRescaleErrorIfFail = conf.getParameter<double>("rescaleErrorIfFail");
32  double dEta=conf.getParameter<double>("deltaEta");
33  double dPhi=conf.getParameter<double>("deltaPhi");
34  if (dEta>0 && dPhi>0)
37 
38 
39 }
const Propagator * theProximityPropagator
T getParameter(std::string const &) const
CkfTrajectoryBuilder(const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *recHitBuilder, const TrajectoryFilter *filter)
Chi2MeasurementEstimatorBase * theEtaPhiEstimator
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const Chi2MeasurementEstimatorBase * theEstimator
MuonCkfTrajectoryBuilder::~MuonCkfTrajectoryBuilder ( )
virtual

Definition at line 41 of file MuonCkfTrajectoryBuilder.cc.

References theEtaPhiEstimator.

42 {
44 }
Chi2MeasurementEstimatorBase * theEtaPhiEstimator

Member Function Documentation

MuonCkfTrajectoryBuilder * MuonCkfTrajectoryBuilder::clone ( const MeasurementTrackerEvent data) const
virtual

Reimplemented from CkfTrajectoryBuilder.

Definition at line 47 of file MuonCkfTrajectoryBuilder.cc.

References MuonCkfTrajectoryBuilder(), run_regression::ret, BaseCkfTrajectoryBuilder::setData(), and theEtaPhiEstimator.

47  {
49  ret->setData(data);
50  if (theEtaPhiEstimator) {
51  ret->theEtaPhiEstimator = new EtaPhiEstimator(dynamic_cast<const EtaPhiEstimator&>(*theEtaPhiEstimator));
52  }
53  return ret;
54 }
void setData(const MeasurementTrackerEvent *data)
Chi2MeasurementEstimatorBase * theEtaPhiEstimator
MuonCkfTrajectoryBuilder(const edm::ParameterSet &conf, const TrajectoryStateUpdator *updator, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const Propagator *propagatorProximity, const Chi2MeasurementEstimatorBase *estimator, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, const TrajectoryFilter *filter)
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 87 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().

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

Reimplemented from CkfTrajectoryBuilder.

Definition at line 142 of file MuonCkfTrajectoryBuilder.cc.

References alongMomentum, collectMeasurement(), PTrajectoryStateOnDet::detId(), GeometricSearchTracker::detLayer(), TempTrajectory::direction(), TempTrajectory::empty(), TrajectoryStateOnSurface::freeState(), g, MeasurementTrackerEvent::geometricSearchTracker(), MeasurementTrackerEvent::geomTracker(), i, TrackingGeometry::idToDet(), insideOut, ConfigFiles::l, TempTrajectory::lastLayer(), TempTrajectory::lastMeasurement(), LogDebug, Propagator::magneticField(), DetLayer::nextLayers(), outsideIn, TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::rescaleError(), query::result, reco::return(), python.multivaluedict::sort(), TrajectorySeed::startingState(), BaseCkfTrajectoryBuilder::theForwardPropagator, BaseCkfTrajectoryBuilder::theMeasurementTracker, theProximityPropagator, theRescaleErrorIfFail, theUseSeedLayer, trajectoryStateTransform::transientState(), and TrajectoryMeasurement::updatedState().

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

Member Data Documentation

Chi2MeasurementEstimatorBase* MuonCkfTrajectoryBuilder::theEtaPhiEstimator
protected
const Propagator* MuonCkfTrajectoryBuilder::theProximityPropagator
protected

Definition at line 31 of file MuonCkfTrajectoryBuilder.h.

Referenced by findCompatibleMeasurements().

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