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 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 50 of file CosmicMuonSmoother.h.

References CosmicMuonSmoother().

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

Definition at line 68 of file CosmicMuonSmoother.h.

References theEstimator.

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

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

96  {
97 
98  if ( t.empty() ) return vector<Trajectory>();
99 
100  LogTrace(category_)<< "fit begin (trajectory) ";
101 
102  TrajectoryStateOnSurface firstTsos = initialState(t);
103  if ( !firstTsos.isValid() ) {
104  LogTrace(category_)<< "Error: firstTsos invalid. ";
105  return vector<Trajectory>();
106  }
107 
108  LogTrace(category_)<< "firstTsos: "<<firstTsos;
109 
110  ConstRecHitContainer hits = t.recHits();
111  LogTrace(category_)<< "hits: "<<hits.size();
112  LogTrace(category_)<<"hit front" <<hits.front()->globalPosition()<< " hit back"
113  <<hits.back()->globalPosition();
114 
115  sortHitsAlongMom(hits, firstTsos);
116 
117  LogTrace(category_)<<"after sorting hit front" <<hits.front()->globalPosition()<< " hit back"
118  <<hits.back()->globalPosition();
119 
120  return fit(t.seed(), hits, firstTsos);
121 
122 }
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 128 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.

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

423  {
424  if ( t.empty() ) return TrajectoryStateOnSurface();
425 
427 
429 
430  bool beamhaloFlag = ( t.firstMeasurement().updatedState().globalMomentum().eta() > 4.0 || t.lastMeasurement().updatedState().globalMomentum().eta() > 4.0 );
431 
432  if ( !beamhaloFlag ) { //initialState is the top one
434  result = t.firstMeasurement().updatedState();
435  } else {
436  result = t.lastMeasurement().updatedState();
437  }
438  if (result.globalMomentum().y()> 1.0 ) //top tsos should pointing down
439  theUtilities->reverseDirection(result,&*theService->magneticField());
440  } else {
441  if ( t.firstMeasurement().updatedState().globalPosition().z() * t.lastMeasurement().updatedState().globalPosition().z() >0 ) { //same side
442  if ( fabs(t.firstMeasurement().updatedState().globalPosition().z()) > fabs(t.lastMeasurement().updatedState().globalPosition().z()) ) {
443  result = t.firstMeasurement().updatedState();
444  } else {
445  result = t.lastMeasurement().updatedState();
446  }
447  } else { //different sides
448 
450  result = t.firstMeasurement().updatedState();
451  } else {
452  result = t.lastMeasurement().updatedState();
453  }
454  }
455 
456  }
457 
458  return result;
459 
460 }
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 60 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 62 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 248 of file CosmicMuonSmoother.cc.

References query::result.

Referenced by trajectories(), and trajectory().

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

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

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

Referenced by fit().

462  {
463 
464  if (hits.size() < 2) return;
465  float dis1 = (hits.front()->globalPosition() - tsos.globalPosition()).mag();
466  float dis2 = (hits.back()->globalPosition() - tsos.globalPosition()).mag();
467 
468  if ( dis1 > dis2 )
469  std::reverse(hits.begin(),hits.end());
470 
471  return;
472 }
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 46 of file CosmicMuonSmoother.h.

References TrajectorySmoother::trajectories().

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

46  {
48  }
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 71 of file CosmicMuonSmoother.cc.

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

73  {
74 
75  if ( hits.empty() ||!firstPredTsos.isValid() ) return vector<Trajectory>();
76 
77  LogTrace(category_)<< "trajectory begin (seed hits tsos)";
78 
79  TrajectoryStateOnSurface firstTsos = firstPredTsos;
81 
82  LogTrace(category_)<< "first TSOS: "<<firstTsos;
83 
84  vector<Trajectory> fitted = fit(seed, hits, firstTsos);
85  LogTrace(category_)<< "fitted: "<<fitted.size();
86  vector<Trajectory> smoothed = smooth(fitted);
87  LogTrace(category_)<< "smoothed: "<<smoothed.size();
88 
89  return smoothed;
90 
91 }
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 61 of file CosmicMuonSmoother.cc.

References fit(), and smooth().

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

Definition at line 64 of file CosmicMuonSmoother.h.

References theUpdator.

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

Definition at line 66 of file CosmicMuonSmoother.h.

References theUtilities.

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

66 {return theUtilities; }
CosmicMuonUtilities * theUtilities

Member Data Documentation

std::string CosmicMuonSmoother::category_
private

Definition at line 92 of file CosmicMuonSmoother.h.

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

double CosmicMuonSmoother::theErrorRescaling
private

Definition at line 91 of file CosmicMuonSmoother.h.

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

Chi2MeasurementEstimator* CosmicMuonSmoother::theEstimator
private

Definition at line 84 of file CosmicMuonSmoother.h.

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

std::string CosmicMuonSmoother::thePropagatorAlongName
private

Definition at line 89 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorAlong().

std::string CosmicMuonSmoother::thePropagatorOppositeName
private

Definition at line 90 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorOpposite().

const MuonServiceProxy* CosmicMuonSmoother::theService
private

Definition at line 87 of file CosmicMuonSmoother.h.

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

KFUpdator* CosmicMuonSmoother::theUpdator
private

Definition at line 83 of file CosmicMuonSmoother.h.

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

CosmicMuonUtilities* CosmicMuonSmoother::theUtilities
private