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 override
 
 CosmicMuonSmoother (const edm::ParameterSet &, const MuonServiceProxy *service)
 
const 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 void setHitCloner (TkCloner const *hc)
 
virtual TrajectoryContainer trajectories (const Trajectory &traj) const override
 
virtual TrajectoryContainer trajectories (const TrajectorySeed &seed, const ConstRecHitContainer &hits, const TrajectoryStateOnSurface &firstPredTsos) const
 refit trajectory More...
 
Trajectory trajectory (const Trajectory &) const override
 
const KFUpdatorupdator () const
 
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
 
const Chi2MeasurementEstimatortheEstimator
 
std::string thePropagatorAlongName
 
std::string thePropagatorOppositeName
 
const MuonServiceProxytheService
 
const KFUpdatortheUpdator
 
const 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
const Chi2MeasurementEstimator * theEstimator
const CosmicMuonUtilities * theUtilities
std::string thePropagatorAlongName
const KFUpdator * theUpdator
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 }
const Chi2MeasurementEstimator * theEstimator
const CosmicMuonUtilities * theUtilities
const KFUpdator * theUpdator

Member Function Documentation

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

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)
const Chi2MeasurementEstimator* CosmicMuonSmoother::estimator ( void  ) const
inline

Definition at line 66 of file CosmicMuonSmoother.h.

References theEstimator.

66 {return theEstimator;}
const 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::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:244
void sortHitsAlongMom(ConstRecHitContainer &hits, const TrajectoryStateOnSurface &) const
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:275
#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_, 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().

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

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

426  {
427  if ( t.empty() ) return TrajectoryStateOnSurface();
428 
430 
432 
433  bool beamhaloFlag = ( t.firstMeasurement().updatedState().globalMomentum().eta() > 4.0 || t.lastMeasurement().updatedState().globalMomentum().eta() > 4.0 );
434 
435  if ( !beamhaloFlag ) { //initialState is the top one
437  result = t.firstMeasurement().updatedState();
438  } else {
439  result = t.lastMeasurement().updatedState();
440  }
441  if (result.globalMomentum().y()> 1.0 ) //top tsos should pointing down
442  theUtilities->reverseDirection(result,&*theService->magneticField());
443  } else {
444  if ( t.firstMeasurement().updatedState().globalPosition().z() * t.lastMeasurement().updatedState().globalPosition().z() >0 ) { //same side
445  if ( fabs(t.firstMeasurement().updatedState().globalPosition().z()) > fabs(t.lastMeasurement().updatedState().globalPosition().z()) ) {
446  result = t.firstMeasurement().updatedState();
447  } else {
448  result = t.lastMeasurement().updatedState();
449  }
450  } else { //different sides
451 
453  result = t.firstMeasurement().updatedState();
454  } else {
455  result = t.lastMeasurement().updatedState();
456  }
457  }
458 
459  }
460 
461  return result;
462 
463 }
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:244
const MuonServiceProxy * theService
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
const CosmicMuonUtilities * theUtilities
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
T z() const
Definition: PV3DBase.h:64
tuple result
Definition: query.py:137
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
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
virtual void CosmicMuonSmoother::setHitCloner ( TkCloner const *  hc)
inlinevirtual

Implements TrajectorySmoother.

Definition at line 74 of file CosmicMuonSmoother.h.

74 {}
vector< Trajectory > CosmicMuonSmoother::smooth ( const std::vector< Trajectory > &  tc) const
private

Definition at line 251 of file CosmicMuonSmoother.cc.

References query::result.

Referenced by trajectories(), and trajectory().

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

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

Definition at line 465 of file CosmicMuonSmoother.cc.

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

Referenced by fit().

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

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
overridevirtual

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
const KFUpdator* CosmicMuonSmoother::updator ( ) const
inline

Definition at line 62 of file CosmicMuonSmoother.h.

References theUpdator.

62 {return theUpdator;}
const KFUpdator * theUpdator
const 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; }
const CosmicMuonUtilities * theUtilities

Member Data Documentation

std::string CosmicMuonSmoother::category_
private

Definition at line 93 of file CosmicMuonSmoother.h.

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

double CosmicMuonSmoother::theErrorRescaling
private

Definition at line 92 of file CosmicMuonSmoother.h.

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

const Chi2MeasurementEstimator* CosmicMuonSmoother::theEstimator
private

Definition at line 85 of file CosmicMuonSmoother.h.

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

std::string CosmicMuonSmoother::thePropagatorAlongName
private

Definition at line 90 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorAlong().

std::string CosmicMuonSmoother::thePropagatorOppositeName
private

Definition at line 91 of file CosmicMuonSmoother.h.

Referenced by CosmicMuonSmoother(), and propagatorOpposite().

const MuonServiceProxy* CosmicMuonSmoother::theService
private

Definition at line 88 of file CosmicMuonSmoother.h.

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

const KFUpdator* CosmicMuonSmoother::theUpdator
private

Definition at line 84 of file CosmicMuonSmoother.h.

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

const CosmicMuonUtilities* CosmicMuonSmoother::theUtilities
private