CMS 3D CMS Logo

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

#include <CosmicMuonSmoother.h>

Inheritance diagram for CosmicMuonSmoother:
TrajectorySmoother

Public Member Functions

virtual CosmicMuonSmootherclone () const
 
 CosmicMuonSmoother (const edm::ParameterSet &, const MuonServiceProxy *service)
 
Chi2MeasurementEstimatorestimator () const
 
std::vector< Trajectoryfit (const Trajectory &) const
 
std::vector< Trajectoryfit (const TrajectorySeed &seed, const ConstRecHitContainer &hits, const TrajectoryStateOnSurface &firstPredTsos) const
 
const PropagatorpropagatorAlong () const
 
const PropagatorpropagatorOpposite () const
 
virtual std::vector< Trajectorytrajectories (const Trajectory &) const
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &seed, const ConstRecHitContainer &hits, const TrajectoryStateOnSurface &firstPredTsos) const
 refit trajectory More...
 
KFUpdatorupdator () const
 
CosmicMuonUtilitiesutilities () const
 
virtual ~CosmicMuonSmoother ()
 
- Public Member Functions inherited from TrajectorySmoother
virtual ~TrajectorySmoother ()
 

Private Member Functions

TrajectoryStateOnSurface initialState (const Trajectory &) const
 
std::vector< Trajectorysmooth (const std::vector< Trajectory > &) const
 
std::vector< Trajectorysmooth (const Trajectory &) const
 
void sortHitsAlongMom (ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
 

Private Attributes

std::string category_
 
double theErrorRescaling
 
Chi2MeasurementEstimatortheEstimator
 
std::string thePropagatorAlongName
 
std::string thePropagatorOppositeName
 
const MuonServiceProxytheService
 
KFUpdatortheUpdator
 
CosmicMuonUtilitiestheUtilities
 

Additional Inherited Members

- Public Types inherited from TrajectorySmoother
typedef std::vector< TrajectoryTrajectoryContainer
 
typedef
TrajectoryContainer::iterator 
TrajectoryIterator
 

Detailed Description

Definition at line 37 of file CosmicMuonSmoother.h.

Constructor & Destructor Documentation

CosmicMuonSmoother::CosmicMuonSmoother ( const edm::ParameterSet par,
const MuonServiceProxy service 
)

Definition at line 34 of file CosmicMuonSmoother.cc.

References category_, Chi2MeasurementEstimatorESProducer_cfi::Chi2MeasurementEstimator, edm::ParameterSet::getParameter(), theErrorRescaling, theEstimator, thePropagatorAlongName, thePropagatorOppositeName, theUpdator, and theUtilities.

Referenced by clone().

34  : theService(service) {
35 
36  theUpdator = new KFUpdator;
39  thePropagatorAlongName = par.getParameter<string>("PropagatorAlong");
40  thePropagatorOppositeName = par.getParameter<string>("PropagatorOpposite");
41  theErrorRescaling = par.getParameter<double>("RescalingFactor");
42 
43  category_ = "Muon|RecoMuon|CosmicMuon|CosmicMuonSmoother";
44 }
T getParameter(std::string const &) const
const MuonServiceProxy * theService
std::string thePropagatorAlongName
CosmicMuonUtilities * theUtilities
Chi2MeasurementEstimator * theEstimator
std::string thePropagatorOppositeName
CosmicMuonSmoother::~CosmicMuonSmoother ( )
virtual

Definition at line 49 of file CosmicMuonSmoother.cc.

References theEstimator, theUpdator, and theUtilities.

49  {
50 
51  if ( theUpdator ) delete theUpdator;
52  if ( theUtilities ) delete theUtilities;
53  if ( theEstimator ) delete theEstimator;
54 
55 }
CosmicMuonUtilities * theUtilities
Chi2MeasurementEstimator * theEstimator

Member Function Documentation

virtual CosmicMuonSmoother* CosmicMuonSmoother::clone ( void  ) const
inlinevirtual

Implements TrajectorySmoother.

Definition at line 46 of file CosmicMuonSmoother.h.

References CosmicMuonSmoother().

46  {
47  return new CosmicMuonSmoother(*this);
48  }
CosmicMuonSmoother(const edm::ParameterSet &, const MuonServiceProxy *service)
Chi2MeasurementEstimator* CosmicMuonSmoother::estimator ( void  ) const
inline

Definition at line 64 of file CosmicMuonSmoother.h.

References theEstimator.

64 {return theEstimator;}
Chi2MeasurementEstimator * theEstimator
vector< Trajectory > CosmicMuonSmoother::fit ( const Trajectory t) const

Definition at line 95 of file CosmicMuonSmoother.cc.

References category_, Trajectory::empty(), initialState(), TrajectoryStateOnSurface::isValid(), LogTrace, Trajectory::recHits(), Trajectory::seed(), and sortHitsAlongMom().

Referenced by CosmicMuonTrajectoryBuilder::flipTrajectory(), trajectories(), and GlobalCosmicMuonTrajectoryBuilder::trajectories().

95  {
96 
97  if ( t.empty() ) return vector<Trajectory>();
98 
99  LogTrace(category_)<< "fit begin (trajectory) ";
100 
101  TrajectoryStateOnSurface firstTsos = initialState(t);
102  if ( !firstTsos.isValid() ) {
103  LogTrace(category_)<< "Error: firstTsos invalid. ";
104  return vector<Trajectory>();
105  }
106 
107  LogTrace(category_)<< "firstTsos: "<<firstTsos;
108 
109  ConstRecHitContainer hits = t.recHits();
110  LogTrace(category_)<< "hits: "<<hits.size();
111  LogTrace(category_)<<"hit front" <<hits.front()->globalPosition()<< " hit back"
112  <<hits.back()->globalPosition();
113 
114  sortHitsAlongMom(hits, firstTsos);
115 
116  LogTrace(category_)<<"after sorting hit front" <<hits.front()->globalPosition()<< " hit back"
117  <<hits.back()->globalPosition();
118 
119  return fit(t.seed(), hits, firstTsos);
120 
121 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:200
void sortHitsAlongMom(ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:231
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
#define LogTrace(id)
TrajectoryStateOnSurface initialState(const Trajectory &) const
std::vector< Trajectory > fit(const Trajectory &) const
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
vector< Trajectory > CosmicMuonSmoother::fit ( const TrajectorySeed seed,
const ConstRecHitContainer hits,
const TrajectoryStateOnSurface firstPredTsos 
) const

Definition at line 127 of file CosmicMuonSmoother.cc.

References alongMomentum, category_, Chi2MeasurementEstimator::estimate(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogTrace, Trajectory::measurements(), Propagator::propagate(), propagatorAlong(), Trajectory::push(), edm::second(), CosmicMuonUtilities::stepPropagate(), TrajectoryStateOnSurface::surface(), theEstimator, theService, theUpdator, theUtilities, and KFUpdator::update().

129  {
130 
131  LogTrace(category_)<< "fit begin (seed, hit, tsos).";
132 
133  if ( hits.empty() ) {
134  LogTrace(category_)<< "Error: empty hits container.";
135  return vector<Trajectory>();
136  }
137 
138  Trajectory myTraj(seed, alongMomentum);
139 
140  TrajectoryStateOnSurface predTsos(firstPredTsos);
141  LogTrace(category_)<< "first pred TSOS: "<<predTsos;
142 
143  if ( !predTsos.isValid() ) {
144  LogTrace(category_)<< "Error: firstTsos invalid.";
145  return vector<Trajectory>();
146  }
147  TrajectoryStateOnSurface currTsos;
148 
149  if ( hits.front()->isValid() ) {
150 
151  TransientTrackingRecHit::RecHitPointer preciseHit = hits.front()->clone(predTsos);
152  LogTrace(category_)<<"first hit is at det "<< hits.front()->det()->surface().position();
153 
154  currTsos = theUpdator->update(predTsos, *preciseHit);
155  if (!currTsos.isValid()){
157  <<"an updated state is not valid. killing the trajectory.";
158  return vector<Trajectory>();
159  }
160  myTraj.push(TrajectoryMeasurement(predTsos, currTsos, hits.front(),
161  theEstimator->estimate(predTsos, *hits.front()).second));
162  if ( currTsos.isValid() ) LogTrace(category_)<< "first curr TSOS: "<<currTsos;
163 
164  } else {
165 
166  currTsos = predTsos;
167  myTraj.push(TrajectoryMeasurement(predTsos, hits.front()));
168  }
169  //const TransientTrackingRecHit& firsthit = *hits.front();
170 
171  for ( ConstRecHitContainer::const_iterator ihit = hits.begin() + 1;
172  ihit != hits.end(); ++ihit ) {
173 
174  if ( !(**ihit).isValid() ) {
175  LogTrace(category_)<< "Error: invalid hit.";
176  continue;
177  }
178  if (currTsos.isValid()) {
179  LogTrace(category_)<<"current pos "<<currTsos.globalPosition()
180  <<"mom "<<currTsos.globalMomentum();
181  } else {
182  LogTrace(category_)<<"current state invalid";
183  }
184 
185  predTsos = propagatorAlong()->propagate(currTsos, (**ihit).det()->surface());
186  LogTrace(category_)<<"predicted state propagate directly "<<predTsos.isValid();
187 
188  if ( !predTsos.isValid() ) {
189  LogTrace(category_)<<"step-propagating from "<<currTsos.globalPosition() <<" to position: "<<(*ihit)->globalPosition();
190  predTsos = theUtilities->stepPropagate(currTsos, (*ihit), *propagatorAlong());
191  }
192  if ( !predTsos.isValid() && (fabs(theService->magneticField()->inTesla(GlobalPoint(0,0,0)).z()) < 0.01) && (theService->propagator("StraightLinePropagator").isValid() ) ) {
193  LogTrace(category_)<<"straight-line propagating from "<<currTsos.globalPosition() <<" to position: "<<(*ihit)->globalPosition();
194  predTsos = theService->propagator("StraightLinePropagator")->propagate(currTsos, (**ihit).det()->surface());
195  }
196  if (predTsos.isValid()) {
197  LogTrace(category_)<<"predicted pos "<<predTsos.globalPosition()
198  <<"mom "<<predTsos.globalMomentum();
199  } else {
200  LogTrace(category_)<<"predicted state invalid";
201  }
202  if ( !predTsos.isValid() ) {
203  LogTrace(category_)<< "Error: predTsos is still invalid forward fit.";
204 // return vector<Trajectory>();
205  continue;
206  } else if ( (**ihit).isValid() ) {
207  // update
208  TransientTrackingRecHit::RecHitPointer preciseHit = (**ihit).clone(predTsos);
209 
210  if ( !preciseHit->isValid() ) {
211  currTsos = predTsos;
212  myTraj.push(TrajectoryMeasurement(predTsos, *ihit));
213  } else {
214  currTsos = theUpdator->update(predTsos, *preciseHit);
215  if (!currTsos.isValid()){
217  <<"an updated state is not valid. killing the trajectory.";
218  return vector<Trajectory>();
219  }
220  myTraj.push(TrajectoryMeasurement(predTsos, currTsos, preciseHit,
221  theEstimator->estimate(predTsos, *preciseHit).second));
222  }
223  } else {
224  currTsos = predTsos;
225  myTraj.push(TrajectoryMeasurement(predTsos, *ihit));
226  }
227 
228  }
229 
230  std::vector<TrajectoryMeasurement> mytms = myTraj.measurements();
231  LogTrace(category_)<<"fit result "<<mytms.size();
232  for (std::vector<TrajectoryMeasurement>::const_iterator itm = mytms.begin();
233  itm != mytms.end(); ++itm ) {
234  LogTrace(category_)<<"updated pos "<<itm->updatedState().globalPosition()
235  <<"mom "<<itm->updatedState().globalMomentum();
236  }
237 
238 
239  return vector<Trajectory>(1, myTraj);
240 
241 }
const MuonServiceProxy * theService
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint globalPosition() const
const Propagator * propagatorAlong() const
U second(std::pair< T, U > const &p)
TrajectoryStateOnSurface stepPropagate(const TrajectoryStateOnSurface &, const ConstRecHitPointer &, const Propagator &) const
#define LogTrace(id)
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
CosmicMuonUtilities * theUtilities
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
Chi2MeasurementEstimator * theEstimator
GlobalVector globalMomentum() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
const Surface & surface() const
TrajectoryStateOnSurface CosmicMuonSmoother::initialState ( const Trajectory t) const
private

Definition at line 422 of file CosmicMuonSmoother.cc.

References Trajectory::empty(), PV3DBase< T, PVType, FrameType >::eta(), Trajectory::firstMeasurement(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), Trajectory::lastMeasurement(), query::result, CosmicMuonUtilities::reverseDirection(), theService, theUtilities, TrajectoryMeasurement::updatedState(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by fit().

422  {
423  if ( t.empty() ) return TrajectoryStateOnSurface();
424 
426 
428 
429  bool beamhaloFlag = ( t.firstMeasurement().updatedState().globalMomentum().eta() > 4.0 || t.lastMeasurement().updatedState().globalMomentum().eta() > 4.0 );
430 
431  if ( !beamhaloFlag ) { //initialState is the top one
433  result = t.firstMeasurement().updatedState();
434  } else {
435  result = t.lastMeasurement().updatedState();
436  }
437  if (result.globalMomentum().y()> 1.0 ) //top tsos should pointing down
438  theUtilities->reverseDirection(result,&*theService->magneticField());
439  } else {
440  if ( t.firstMeasurement().updatedState().globalPosition().z() * t.lastMeasurement().updatedState().globalPosition().z() >0 ) { //same side
441  if ( fabs(t.firstMeasurement().updatedState().globalPosition().z()) > fabs(t.lastMeasurement().updatedState().globalPosition().z()) ) {
442  result = t.firstMeasurement().updatedState();
443  } else {
444  result = t.lastMeasurement().updatedState();
445  }
446  } else { //different sides
447 
449  result = t.firstMeasurement().updatedState();
450  } else {
451  result = t.lastMeasurement().updatedState();
452  }
453  }
454 
455  }
456 
457  return result;
458 
459 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:200
const MuonServiceProxy * theService
T y() const
Definition: PV3DBase.h:57
GlobalPoint globalPosition() const
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:147
T z() const
Definition: PV3DBase.h:58
tuple result
Definition: query.py:137
TrajectoryStateOnSurface updatedState() const
CosmicMuonUtilities * theUtilities
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:160
T eta() const
Definition: PV3DBase.h:70
GlobalVector globalMomentum() const
void reverseDirection(TrajectoryStateOnSurface &, const MagneticField *) const
const Propagator* CosmicMuonSmoother::propagatorAlong ( ) const
inline

Definition at line 56 of file CosmicMuonSmoother.h.

References MuonServiceProxy::propagator(), thePropagatorAlongName, and theService.

Referenced by fit().

const MuonServiceProxy * theService
std::string thePropagatorAlongName
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
const Propagator* CosmicMuonSmoother::propagatorOpposite ( ) const
inline

Definition at line 58 of file CosmicMuonSmoother.h.

References MuonServiceProxy::propagator(), thePropagatorOppositeName, and theService.

Referenced by smooth().

const MuonServiceProxy * theService
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator
std::string thePropagatorOppositeName
vector< Trajectory > CosmicMuonSmoother::smooth ( const std::vector< Trajectory > &  tc) const
private

Definition at line 247 of file CosmicMuonSmoother.cc.

References query::result.

Referenced by trajectories().

247  {
248 
249  vector<Trajectory> result;
250 
251  for ( vector<Trajectory>::const_iterator it = tc.begin(); it != tc.end(); ++it ) {
252  vector<Trajectory> smoothed = smooth(*it);
253  result.insert(result.end(), smoothed.begin(), smoothed.end());
254  }
255 
256  return result;
257 
258 }
std::vector< Trajectory > smooth(const std::vector< Trajectory > &) const
tuple result
Definition: query.py:137
vector< Trajectory > CosmicMuonSmoother::smooth ( const Trajectory t) const
private

Definition at line 264 of file CosmicMuonSmoother.cc.

References category_, heavyFlavorValidationHarvestingSequence_cff::combiner, Trajectory::empty(), Chi2MeasurementEstimator::estimate(), TrajectoryMeasurement::estimate(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogTrace, Trajectory::measurements(), oppositeToMomentum, Propagator::propagate(), propagatorOpposite(), TrajectoryStateOnSurface::rescaleError(), Trajectory::seed(), CosmicMuonUtilities::stepPropagate(), TrajectoryStateOnSurface::surface(), theErrorRescaling, theEstimator, theUpdator, theUtilities, and KFUpdator::update().

264  {
265 
266  if ( t.empty() ) {
267  LogTrace(category_)<< "Error: smooth: empty trajectory.";
268  return vector<Trajectory>();
269  }
270 
271  Trajectory myTraj(t.seed(), oppositeToMomentum);
272 
273  vector<TrajectoryMeasurement> avtm = t.measurements();
274 
275  if ( avtm.size() < 2 ) {
276  LogTrace(category_)<< "Error: smooth: too little TM. ";
277  return vector<Trajectory>();
278  }
279 
280  TrajectoryStateOnSurface predTsos = avtm.back().forwardPredictedState();
282 
283  if ( !predTsos.isValid() ) {
284  LogTrace(category_)<< "Error: smooth: first TSOS from back invalid. ";
285  return vector<Trajectory>();
286  }
287 
288  TrajectoryStateOnSurface currTsos;
289 
290  // first smoothed TrajectoryMeasurement is last fitted
291  if ( avtm.back().recHit()->isValid() ) {
292  currTsos = theUpdator->update(predTsos, (*avtm.back().recHit()));
293  if (!currTsos.isValid()){
295  <<"an updated state is not valid. killing the trajectory.";
296  return vector<Trajectory>();
297  }
298  myTraj.push(TrajectoryMeasurement(avtm.back().forwardPredictedState(),
299  predTsos,
300  avtm.back().updatedState(),
301  avtm.back().recHit(),
302  avtm.back().estimate()//,
303  /*avtm.back().layer()*/),
304  avtm.back().estimate());
305 
306  } else {
307  currTsos = predTsos;
308  myTraj.push(TrajectoryMeasurement(avtm.back().forwardPredictedState(),
309  avtm.back().recHit()//,
310  /*avtm.back().layer()*/));
311 
312  }
313 
315 
316 
317  for ( vector<TrajectoryMeasurement>::reverse_iterator itm = avtm.rbegin() + 1;
318  itm != avtm.rend() - 1; ++itm ) {
319 
320  if (currTsos.isValid()) {
321  LogTrace(category_)<<"current pos "<<currTsos.globalPosition()
322  <<"mom "<<currTsos.globalMomentum();
323  } else {
324  LogTrace(category_)<<"current state invalid";
325  }
326 
327  predTsos = propagatorOpposite()->propagate(currTsos,(*itm).recHit()->det()->surface());
328 
329  if ( !predTsos.isValid() ) {
330  LogTrace(category_)<<"step-propagating from "<<currTsos.globalPosition() <<" to position: "<<(*itm).recHit()->globalPosition();
331  predTsos = theUtilities->stepPropagate(currTsos, (*itm).recHit(), *propagatorOpposite());
332  }
333  if (predTsos.isValid()) {
334  LogTrace(category_)<<"predicted pos "<<predTsos.globalPosition()
335  <<"mom "<<predTsos.globalMomentum();
336  } else {
337  LogTrace(category_)<<"predicted state invalid";
338  }
339 
340  if ( !predTsos.isValid() ) {
341  LogTrace(category_)<< "Error: predTsos is still invalid backward smooth.";
342  return vector<Trajectory>();
343  // continue;
344  } else if ( (*itm).recHit()->isValid() ) {
345  //update
346  currTsos = theUpdator->update(predTsos, (*(*itm).recHit()));
347  if (!currTsos.isValid()){
349  <<"an updated state is not valid. killing the trajectory.";
350  return vector<Trajectory>();
351  }
352  TrajectoryStateOnSurface combTsos = combiner(predTsos, (*itm).forwardPredictedState());
353  if ( !combTsos.isValid() ) {
354  LogTrace(category_)<< "Error: smooth: combining pred TSOS failed. ";
355  return vector<Trajectory>();
356  }
357 
358  TrajectoryStateOnSurface smooTsos = combiner((*itm).updatedState(), predTsos);
359 
360  if ( !smooTsos.isValid() ) {
361  LogTrace(category_)<< "Error: smooth: combining smooth TSOS failed. ";
362  return vector<Trajectory>();
363  }
364 
365  myTraj.push(TrajectoryMeasurement((*itm).forwardPredictedState(),
366  predTsos,
367  smooTsos,
368  (*itm).recHit(),
369  theEstimator->estimate(combTsos, (*(*itm).recHit())).second//,
370  /*(*itm).layer()*/),
371  (*itm).estimate());
372  } else {
373  currTsos = predTsos;
374  TrajectoryStateOnSurface combTsos = combiner(predTsos, (*itm).forwardPredictedState());
375 
376  if ( !combTsos.isValid() ) {
377  LogTrace(category_)<< "Error: smooth: combining TSOS failed. ";
378  return vector<Trajectory>();
379  }
380 
381  myTraj.push(TrajectoryMeasurement((*itm).forwardPredictedState(),
382  predTsos,
383  combTsos,
384  (*itm).recHit()//,
385  /*(*itm).layer()*/));
386  }
387  }
388 
389  // last smoothed TrajectoryMeasurement is last filtered
390  predTsos = propagatorOpposite()->propagate(currTsos, avtm.front().recHit()->det()->surface());
391 
392  if ( !predTsos.isValid() ){
393  LogTrace(category_)<< "Error: last predict TSOS failed, use original one. ";
394  // return vector<Trajectory>();
395  myTraj.push(TrajectoryMeasurement(avtm.front().forwardPredictedState(),
396  avtm.front().recHit()));
397  } else {
398  if ( avtm.front().recHit()->isValid() ) {
399  //update
400  currTsos = theUpdator->update(predTsos, (*avtm.front().recHit()));
401  if (currTsos.isValid())
402  myTraj.push(TrajectoryMeasurement(avtm.front().forwardPredictedState(),
403  predTsos,
404  currTsos,
405  avtm.front().recHit(),
406  theEstimator->estimate(predTsos, (*avtm.front().recHit())).second//,
407  /*avtm.front().layer()*/),
408  avtm.front().estimate());
409  }
410  }
411  LogTrace(category_)<< "myTraj foundHits. "<<myTraj.foundHits();
412 
413  if (myTraj.foundHits() >= 3)
414  return vector<Trajectory>(1, myTraj);
415  else {
416  LogTrace(category_)<< "Error: smooth: No enough hits in trajctory. ";
417  return vector<Trajectory>();
418  }
419 
420 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:200
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:231
GlobalPoint globalPosition() const
const Propagator * propagatorOpposite() const
DataContainer const & measurements() const
Definition: Trajectory.h:169
TrajectoryStateOnSurface stepPropagate(const TrajectoryStateOnSurface &, const ConstRecHitPointer &, const Propagator &) const
#define LogTrace(id)
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
CosmicMuonUtilities * theUtilities
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:9
Chi2MeasurementEstimator * theEstimator
GlobalVector globalMomentum() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
const Surface & surface() const
void CosmicMuonSmoother::sortHitsAlongMom ( ConstRecHitContainer hits,
const TrajectoryStateOnSurface tsos 
) const
private

Definition at line 461 of file CosmicMuonSmoother.cc.

References TrajectoryStateOnSurface::globalPosition(), and mag().

Referenced by fit().

461  {
462 
463  if (hits.size() < 2) return;
464  float dis1 = (hits.front()->globalPosition() - tsos.globalPosition()).mag();
465  float dis2 = (hits.back()->globalPosition() - tsos.globalPosition()).mag();
466 
467  if ( dis1 > dis2 )
468  std::reverse(hits.begin(),hits.end());
469 
470  return;
471 }
GlobalPoint globalPosition() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
vector< Trajectory > CosmicMuonSmoother::trajectories ( const Trajectory t) const
virtual

Implements TrajectorySmoother.

Definition at line 61 of file CosmicMuonSmoother.cc.

References fit(), and smooth().

Referenced by CosmicMuonTrajectoryBuilder::estimateDirection(), CosmicMuonTrajectoryBuilder::trajectories(), and GlobalCosmicMuonTrajectoryBuilder::trajectories().

61  {
62  vector<Trajectory> fitted = fit(t);
63  return smooth(fitted);
64 
65 }
std::vector< Trajectory > smooth(const std::vector< Trajectory > &) const
std::vector< Trajectory > fit(const Trajectory &) const
vector< Trajectory > CosmicMuonSmoother::trajectories ( const TrajectorySeed seed,
const ConstRecHitContainer hits,
const TrajectoryStateOnSurface firstPredTsos 
) const
virtual

refit trajectory

Definition at line 70 of file CosmicMuonSmoother.cc.

References category_, fit(), TrajectoryStateOnSurface::isValid(), LogTrace, TrajectoryStateOnSurface::rescaleError(), smooth(), and theErrorRescaling.

72  {
73 
74  if ( hits.empty() ||!firstPredTsos.isValid() ) return vector<Trajectory>();
75 
76  LogTrace(category_)<< "trajectory begin (seed hits tsos)";
77 
78  TrajectoryStateOnSurface firstTsos = firstPredTsos;
80 
81  LogTrace(category_)<< "first TSOS: "<<firstTsos;
82 
83  vector<Trajectory> fitted = fit(seed, hits, firstTsos);
84  LogTrace(category_)<< "fitted: "<<fitted.size();
85  vector<Trajectory> smoothed = smooth(fitted);
86  LogTrace(category_)<< "smoothed: "<<smoothed.size();
87 
88  return smoothed;
89 
90 }
std::vector< Trajectory > smooth(const std::vector< Trajectory > &) const
#define LogTrace(id)
std::vector< Trajectory > fit(const Trajectory &) const
KFUpdator* CosmicMuonSmoother::updator ( ) const
inline

Definition at line 60 of file CosmicMuonSmoother.h.

References theUpdator.

60 {return theUpdator;}
CosmicMuonUtilities* CosmicMuonSmoother::utilities ( ) const
inline

Definition at line 62 of file CosmicMuonSmoother.h.

References theUtilities.

Referenced by CosmicMuonTrajectoryBuilder::utilities(), and GlobalCosmicMuonTrajectoryBuilder::utilities().

62 {return theUtilities; }
CosmicMuonUtilities * theUtilities

Member Data Documentation

std::string CosmicMuonSmoother::category_
private

Definition at line 88 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), fit(), smooth(), and trajectories().

double CosmicMuonSmoother::theErrorRescaling
private

Definition at line 87 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), smooth(), and trajectories().

Chi2MeasurementEstimator* CosmicMuonSmoother::theEstimator
private

Definition at line 80 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), estimator(), fit(), smooth(), and ~CosmicMuonSmoother().

std::string CosmicMuonSmoother::thePropagatorAlongName
private

Definition at line 85 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorAlong().

std::string CosmicMuonSmoother::thePropagatorOppositeName
private

Definition at line 86 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorOpposite().

const MuonServiceProxy* CosmicMuonSmoother::theService
private

Definition at line 83 of file CosmicMuonSmoother.h.

Referenced by fit(), initialState(), propagatorAlong(), and propagatorOpposite().

KFUpdator* CosmicMuonSmoother::theUpdator
private

Definition at line 79 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), fit(), smooth(), updator(), and ~CosmicMuonSmoother().

CosmicMuonUtilities* CosmicMuonSmoother::theUtilities
private