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, 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 MeasurementTracker *measurementTracker, 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 MeasurementTracker *measurementTracker, const TrajectoryFilter *filter, const TrajectoryFilter *inOutFilter=0)
 
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 MeasurementTracker *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
 
virtual bool analyzeMeasurementsDebugger (TempTrajectory &traj, const std::vector< TrajectoryMeasurement > &meas, const MeasurementTracker *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
 
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 LayerMeasurementstheLayerMeasurements
 
const MeasurementTrackertheMeasurementTracker
 
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 16 of file MuonCkfTrajectoryBuilder.cc.

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

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

Definition at line 40 of file MuonCkfTrajectoryBuilder.cc.

References theEtaPhiEstimator.

41 {
43 }
Chi2MeasurementEstimatorBase * theEtaPhiEstimator

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

References PrintoutHelper::dumpMeasurements(), TransverseImpactPointExtrapolator::extrapolate(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogDebug, LayerMeasurements::measurements(), BaseCkfTrajectoryBuilder::theEstimator, theEtaPhiEstimator, BaseCkfTrajectoryBuilder::theLayerMeasurements, and tmp.

Referenced by findCompatibleMeasurements().

79  {
80  for (std::vector<const DetLayer*>::const_iterator il = nl.begin();
81  il != nl.end(); il++) {
82 
83  TSOS stateToUse = currentState;
84 
85  if (layer == (*il)){
86  LogDebug("CkfPattern")<<" self propagating in findCompatibleMeasurements.\n from: \n"<<stateToUse;
87  //self navigation case
88  // go to a middle point first
90  GlobalPoint center(0,0,0);
91  stateToUse = middle.extrapolate(stateToUse, center, *prop);
92 
93  if (!stateToUse.isValid()) continue;
94  LogDebug("CkfPattern")<<"to: "<<stateToUse;
95  }
96 
97  std::vector<TM> tmp =
98  theLayerMeasurements->measurements((**il),stateToUse, *prop, *theEstimator);
99 
100  if (tmp.size()==1 && theEtaPhiEstimator){
101  LogDebug("CkfPattern")<<"only an invalid hit is found. trying differently";
102  tmp = theLayerMeasurements->measurements((**il),stateToUse, *prop, *theEtaPhiEstimator);
103  }
104  LogDebug("CkfPattern")<<tmp.size()<<" measurements returned by LayerMeasurements";
105 
106  if ( !tmp.empty()) {
107  // FIXME durty-durty-durty cleaning: never do that please !
108  /* for (vector<TM>::iterator it = tmp.begin(); it!=tmp.end(); ++it)
109  {if (it->recHit()->det()==0) it=tmp.erase(it)--;}*/
110 
111  if ( result.empty()) 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)
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
GlobalPoint globalPosition() const
Chi2MeasurementEstimatorBase * theEtaPhiEstimator
static std::string dumpMeasurements(const std::vector< TrajectoryMeasurement > &v)
const LayerMeasurements * theLayerMeasurements
tuple result
Definition: query.py:137
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 129 of file MuonCkfTrajectoryBuilder.cc.

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

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

Referenced by findCompatibleMeasurements().

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