CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
TransientInitialStateEstimator Class Reference

#include <TransientInitialStateEstimator.h>

Public Types

typedef TrajectoryStateOnSurface TSOS
 

Public Member Functions

std::pair
< TrajectoryStateOnSurface,
const GeomDet * > 
innerState (const Trajectory &traj, bool doBackFit=true) const
 
void setEventSetup (const edm::EventSetup &es)
 Call this at each event until this object will come from the EventSetup as it should. More...
 
 TransientInitialStateEstimator (const edm::EventSetup &es, const edm::ParameterSet &conf)
 

Private Attributes

int theNumberMeasurementsForFit
 
edm::ESHandle< PropagatorthePropagatorAlong
 
std::string thePropagatorAlongName
 
edm::ESHandle< PropagatorthePropagatorOpposite
 
std::string thePropagatorOppositeName
 

Detailed Description

Computes the trajectory state to be used as a starting state for the track fit from the vector of hits. The parameters of this state are close to the final fit parameters. The error matrix is enlarged in order not to bias the track fit.

Definition at line 20 of file TransientInitialStateEstimator.h.

Member Typedef Documentation

Definition at line 23 of file TransientInitialStateEstimator.h.

Constructor & Destructor Documentation

TransientInitialStateEstimator::TransientInitialStateEstimator ( const edm::EventSetup es,
const edm::ParameterSet conf 
)

Definition at line 21 of file TransientInitialStateEstimator.cc.

References edm::EventSetup::get(), and edm::ParameterSet::getParameter().

23 {
24  thePropagatorAlongName = conf.getParameter<std::string>("propagatorAlongTISE");
25  thePropagatorOppositeName = conf.getParameter<std::string>("propagatorOppositeTISE");
26  theNumberMeasurementsForFit = conf.getParameter<int32_t>("numberMeasurementsForFit");
27 
28 
29  // let's avoid breaking compatibility now
31  es.get<TrackingComponentsRecord>().get(thePropagatorOppositeName,thePropagatorOpposite);
32 }
edm::ESHandle< Propagator > thePropagatorOpposite
T getParameter(std::string const &) const
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< Propagator > thePropagatorAlong

Member Function Documentation

std::pair< TrajectoryStateOnSurface, const GeomDet * > TransientInitialStateEstimator::innerState ( const Trajectory traj,
bool  doBackFit = true 
) const

Definition at line 40 of file TransientInitialStateEstimator.cc.

References alongMomentum, Trajectory::direction(), Trajectory::firstMeasurement(), TrajectoryMeasurement::forwardPredictedState(), i, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localParameters(), LogDebug, TrajectoryStateOnSurface::magneticField(), Trajectory::measurements(), oppositeToMomentum, TrajectoryMeasurement::recHit(), TrajectoryStateOnSurface::rescaleError(), TrajectoryStateOnSurface::surface(), and TrajectoryMeasurement::updatedState().

Referenced by cms::CkfTrackCandidateMakerBase::produceBase(), InOutConversionTrackFinder::tracks(), and OutInConversionTrackFinder::tracks().

41 {
42  if (!doBackFit && traj.firstMeasurement().forwardPredictedState().isValid()){
43  LogDebug("TransientInitialStateEstimator")
44  <<"a backward fit will not be done. assuming that the state on first measurement is OK";
45  TSOS firstStateFromForward = traj.firstMeasurement().forwardPredictedState();
46  firstStateFromForward.rescaleError(100.);
47  return std::pair<TrajectoryStateOnSurface, const GeomDet*>( firstStateFromForward,
48  traj.firstMeasurement().recHit()->det());
49  }
50  if (!doBackFit){
51  LogDebug("TransientInitialStateEstimator")
52  <<"told to not do a back fit, but the forward state of the first measurement is not valid. doing a back fit.";
53  }
54 
55  int nMeas = traj.measurements().size();
56  int lastFitted = theNumberMeasurementsForFit >=0 ? theNumberMeasurementsForFit : nMeas;
57  if (nMeas-1 < lastFitted) lastFitted = nMeas-1;
58 
59  std::vector<TrajectoryMeasurement> measvec = traj.measurements();
61 
62  bool foundLast = false;
63  int actualLast = -99;
64 
65  for (int i=lastFitted; i >= 0; i--) {
66  if(measvec[i].recHit()->det()){
67  if(!foundLast){
68  actualLast = i;
69  foundLast = true;
70  }
71  firstHits.push_back( measvec[i].recHit());
72  }
73  }
74  TSOS startingState = measvec[actualLast].updatedState();
75  startingState.rescaleError(100.);
76 
77  // avoid cloning...
78  KFUpdator const aKFUpdator;
79  Chi2MeasurementEstimator const aChi2MeasurementEstimator( 100., 3);
81  &aKFUpdator,
82  &aChi2MeasurementEstimator,
83  firstHits.size());
84 
86 
87  // only direction matters in this contest
90  backFitDirection);
91 
92  vector<Trajectory> fitres = backFitter.fit( fakeSeed, firstHits, startingState);
93 
94  LogDebug("TransientInitialStateEstimator")
95  <<"using a backward fit of :"<<firstHits.size()<<" hits, starting from:\n"<<startingState
96  <<" to get the estimate of the initial state of the track.";
97 
98  if (fitres.size() != 1) {
99  LogDebug("TransientInitialStateEstimator")
100  << "FitTester: first hits fit failed!";
101  return std::pair<TrajectoryStateOnSurface, const GeomDet*>();
102  }
103 
104  TrajectoryMeasurement firstMeas = fitres[0].lastMeasurement();
105  TSOS firstState(firstMeas.updatedState().localParameters(),
106  firstMeas.updatedState().localError(),
107  firstMeas.updatedState().surface(),
108  thePropagatorAlong->magneticField());
109  // I couldn't do:
110  //TSOS firstState = firstMeas.updatedState();
111  // why????
112 
113 
114  firstState.rescaleError(100.);
115 
116  LogDebug("TransientInitialStateEstimator")
117  <<"the initial state is found to be:\n:"<<firstState
118  <<"\n it's field pointer is: "<<firstState.magneticField()
119  <<"\n the pointer from the state of the back fit was: "<<firstMeas.updatedState().magneticField();
120 
121 
122  return std::pair<TrajectoryStateOnSurface, const GeomDet*>( firstState,
123  firstMeas.recHit()->det());
124 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const LocalTrajectoryParameters & localParameters() const
TrajectoryStateOnSurface forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
ConstRecHitPointer recHit() const
PropagationDirection
const MagneticField * magneticField() const
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
DataContainer const & measurements() const
Definition: Trajectory.h:203
TrajectoryStateOnSurface updatedState() const
const LocalTrajectoryError & localError() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
T const * product() const
Definition: ESHandle.h:62
const Surface & surface() const
edm::ESHandle< Propagator > thePropagatorAlong
void TransientInitialStateEstimator::setEventSetup ( const edm::EventSetup es)

Member Data Documentation

int TransientInitialStateEstimator::theNumberMeasurementsForFit
private

Definition at line 38 of file TransientInitialStateEstimator.h.

edm::ESHandle<Propagator> TransientInitialStateEstimator::thePropagatorAlong
private

Definition at line 36 of file TransientInitialStateEstimator.h.

std::string TransientInitialStateEstimator::thePropagatorAlongName
private

Definition at line 34 of file TransientInitialStateEstimator.h.

edm::ESHandle<Propagator> TransientInitialStateEstimator::thePropagatorOpposite
private

Definition at line 37 of file TransientInitialStateEstimator.h.

std::string TransientInitialStateEstimator::thePropagatorOppositeName
private

Definition at line 35 of file TransientInitialStateEstimator.h.