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
 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)
 
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 TempTrajectory &traj, std::vector< TrajectoryMeasurement > &result) const
 
- Protected Member Functions inherited from CkfTrajectoryBuilder
void limitedCandidates (TempTrajectory &startingTraj, TrajectoryContainer &result) const
 
void limitedCandidates (TempTrajectoryContainer &candidates, TrajectoryContainer &result) const
 
void updateTrajectory (TempTrajectory &traj, const TM &tm) const
 
- Protected Member Functions inherited from BaseCkfTrajectoryBuilder
void addToResult (TempTrajectory &traj, TrajectoryContainer &result, bool inOut=false) const
 
void addToResult (TempTrajectory &traj, TempTrajectoryContainer &result, bool inOut=false) const
 
virtual bool analyzeMeasurementsDebugger (Trajectory &traj, std::vector< TrajectoryMeasurement > meas, const MeasurementTracker *theMeasurementTracker, const Propagator *theForwardPropagator, const Chi2MeasurementEstimatorBase *theEstimator, const TransientTrackingRecHitBuilder *theTTRHBuilder) const
 
virtual bool analyzeMeasurementsDebugger (TempTrajectory &traj, 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 TempTrajectory &traj) 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 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, errorMatrix2Lands_multiChannel::id, TrackingGeometry::idToDet(), insideOut, prof2calltree::l, TempTrajectory::lastLayer(), TempTrajectory::lastMeasurement(), LogDebug, Propagator::magneticField(), DetLayer::nextLayers(), outsideIn, TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::rescaleError(), query::result, hitfit::return, TempTrajectory::seed(), python.multivaluedict::sort(), TrajectorySeed::startingState(), BaseCkfTrajectoryBuilder::theForwardPropagator, BaseCkfTrajectoryBuilder::theMeasurementTracker, theProximityPropagator, theRescaleErrorIfFail, theUseSeedLayer, trajectoryStateTransform::transientState(), and TrajectoryMeasurement::updatedState().

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