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 TrajectoryContainer trajectories (const Trajectory &traj) const
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &seed, const ConstRecHitContainer &hits, const TrajectoryStateOnSurface &firstPredTsos) const
 refit trajectory More...
 
Trajectory trajectory (const Trajectory &) const
 
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 35 of file CosmicMuonSmoother.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file CosmicMuonSmoother.cc.

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

Referenced by clone().

32  : theService(service) {
33 
34  theUpdator = new KFUpdator;
37  thePropagatorAlongName = par.getParameter<string>("PropagatorAlong");
38  thePropagatorOppositeName = par.getParameter<string>("PropagatorOpposite");
39  theErrorRescaling = par.getParameter<double>("RescalingFactor");
40 
41  category_ = "Muon|RecoMuon|CosmicMuon|CosmicMuonSmoother";
42 }
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 47 of file CosmicMuonSmoother.cc.

References theEstimator, theUpdator, and theUtilities.

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

Member Function Documentation

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

Implements TrajectorySmoother.

Definition at line 48 of file CosmicMuonSmoother.h.

References CosmicMuonSmoother().

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

Definition at line 66 of file CosmicMuonSmoother.h.

References theEstimator.

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

Definition at line 94 of file CosmicMuonSmoother.cc.

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

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

94  {
95 
96  if ( t.empty() ) return vector<Trajectory>();
97 
98  LogTrace(category_)<< "fit begin (trajectory) ";
99 
100  TrajectoryStateOnSurface firstTsos = initialState(t);
101  if ( !firstTsos.isValid() ) {
102  LogTrace(category_)<< "Error: firstTsos invalid. ";
103  return vector<Trajectory>();
104  }
105 
106  LogTrace(category_)<< "firstTsos: "<<firstTsos;
107 
108  ConstRecHitContainer hits = t.recHits();
109  LogTrace(category_)<< "hits: "<<hits.size();
110  LogTrace(category_)<<"hit front" <<hits.front()->globalPosition()<< " hit back"
111  <<hits.back()->globalPosition();
112 
113  sortHitsAlongMom(hits, firstTsos);
114 
115  LogTrace(category_)<<"after sorting hit front" <<hits.front()->globalPosition()<< " hit back"
116  <<hits.back()->globalPosition();
117 
118  return fit(t.seed(), hits, firstTsos);
119 
120 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:246
void sortHitsAlongMom(ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:277
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 126 of file CosmicMuonSmoother.cc.

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

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

Definition at line 421 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().

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

Definition at line 58 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 60 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 246 of file CosmicMuonSmoother.cc.

References query::result.

Referenced by trajectories(), and trajectory().

246  {
247 
248  vector<Trajectory> result;
249 
250  for ( vector<Trajectory>::const_iterator it = tc.begin(); it != tc.end(); ++it ) {
251  vector<Trajectory> smoothed = smooth(*it);
252  result.insert(result.end(), smoothed.begin(), smoothed.end());
253  }
254 
255  return result;
256 
257 }
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 263 of file CosmicMuonSmoother.cc.

References category_, heavyFlavorValidationHarvestingSequence_cff::combiner, Trajectory::empty(), 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, and theUtilities.

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

Definition at line 460 of file CosmicMuonSmoother.cc.

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

Referenced by fit().

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

Reimplemented from TrajectorySmoother.

Definition at line 44 of file CosmicMuonSmoother.h.

References TrajectorySmoother::trajectories().

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

44  {
46  }
virtual TrajectoryContainer trajectories(const Trajectory &traj) const
std::vector< Trajectory > CosmicMuonSmoother::trajectories ( const TrajectorySeed seed,
const ConstRecHitContainer hits,
const TrajectoryStateOnSurface firstPredTsos 
) const
virtual

refit trajectory

Definition at line 69 of file CosmicMuonSmoother.cc.

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

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

Implements TrajectorySmoother.

Definition at line 59 of file CosmicMuonSmoother.cc.

References fit(), and smooth().

59  {
60  std::vector<Trajectory> && fitted = fit(t);
61  if (fitted.empty()) return Trajectory();
62  std::vector<Trajectory> && smoothed = smooth(fitted);
63  return smoothed.empty() ? Trajectory() : smoothed.front();
64 }
std::vector< Trajectory > smooth(const std::vector< Trajectory > &) const
std::vector< Trajectory > fit(const Trajectory &) const
KFUpdator* CosmicMuonSmoother::updator ( ) const
inline

Definition at line 62 of file CosmicMuonSmoother.h.

References theUpdator.

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

Definition at line 64 of file CosmicMuonSmoother.h.

References theUtilities.

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

64 {return theUtilities; }
CosmicMuonUtilities * theUtilities

Member Data Documentation

std::string CosmicMuonSmoother::category_
private

Definition at line 90 of file CosmicMuonSmoother.h.

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

double CosmicMuonSmoother::theErrorRescaling
private

Definition at line 89 of file CosmicMuonSmoother.h.

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

Chi2MeasurementEstimator* CosmicMuonSmoother::theEstimator
private

Definition at line 82 of file CosmicMuonSmoother.h.

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

std::string CosmicMuonSmoother::thePropagatorAlongName
private

Definition at line 87 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorAlong().

std::string CosmicMuonSmoother::thePropagatorOppositeName
private

Definition at line 88 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorOpposite().

const MuonServiceProxy* CosmicMuonSmoother::theService
private

Definition at line 85 of file CosmicMuonSmoother.h.

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

KFUpdator* CosmicMuonSmoother::theUpdator
private

Definition at line 81 of file CosmicMuonSmoother.h.

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

CosmicMuonUtilities* CosmicMuonSmoother::theUtilities
private