CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrajAnnealing.cc
Go to the documentation of this file.
5 
6 TrajAnnealing::TrajAnnealing( const Trajectory& traj, float ann ){
7  traj_ = traj;
8  annealing_ = ann;
9 
10  const Trajectory::DataContainer& measurements = traj_.measurements();
11  if( measurements.size() > 2 ){
12 
13  Trajectory::DataContainer::const_iterator ibegin,iend;
14  int increment(0);
15  if( traj.direction() == alongMomentum ){
16  ibegin = measurements.begin();
17  iend = measurements.end();
18  increment = 1;
19  } else {
20  ibegin = measurements.end();
21  iend = measurements.begin();
22  increment = -1;
23  }
24 
25  for( Trajectory::DataContainer::const_iterator imeas = ibegin; imeas != iend; imeas += increment ){
26  theHits_.push_back(imeas->recHit());
27  if (imeas->recHit()->isValid()){
28  SiTrackerMultiRecHit const & mHit = dynamic_cast<SiTrackerMultiRecHit const &>(*imeas->recHit());
29  std::vector<const TrackingRecHit*> components = mHit.recHits();
30  int iComp = 0;
31  for(std::vector<const TrackingRecHit*>::const_iterator iter = components.begin();
32  iter != components.end(); iter++, iComp++){
33  theWeights.push_back(mHit.weight(iComp));
34  }
35  }
36  }
37 
38  }
39 
40 }
41 
42 std::pair<float, std::vector<float> > TrajAnnealing::getAnnealingWeight( const TrackingRecHit& aRecHit ) const {
43 
44  if (!aRecHit.isValid()) {
45  std::vector<float> dumpyVec = {0.0};
46  return make_pair(0.0,dumpyVec);
47  }
48 
49  SiTrackerMultiRecHit const & mHit = dynamic_cast<SiTrackerMultiRecHit const &>(aRecHit);
50  return make_pair(mHit.getAnnealingFactor(), mHit.weights());
51 
52 }
53 
Trajectory traj_
Definition: TrajAnnealing.h:32
std::pair< float, std::vector< float > > getAnnealingWeight(const TrackingRecHit &aRecHit) const
virtual double getAnnealingFactor() const
float weight(unsigned int i) const
PropagationDirection const & direction() const
Definition: Trajectory.cc:118
std::vector< float > theWeights
Definition: TrajAnnealing.h:34
DataContainer const & measurements() const
Definition: Trajectory.h:203
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
std::vector< float > const & weights() const
TrackingRecHit::RecHitContainer theHits_
Definition: TrajAnnealing.h:35
bool isValid() const