CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Trajectory.h
Go to the documentation of this file.
1 #ifndef CommonDet_Trajectory_H
2 #define CommonDet_Trajectory_H
3 
10 
11 #include <vector>
12 #include <algorithm>
13 #include <boost/shared_ptr.hpp>
14 
39 {
40 public:
41 
42  typedef std::vector<TrajectoryMeasurement> DataContainer;
45 
46 
55  theSeed(), seedRef_()
56  {}
57 
58 
69  theSeed( new TrajectorySeed(seed) ), seedRef_()
70  {}
71 
80  theSeed( new TrajectorySeed(seed) ), seedRef_()
81  {}
82 
87  Trajectory( const boost::shared_ptr<const TrajectorySeed> & seed, PropagationDirection dir) :
91  theSeed( seed ), seedRef_()
92  {}
93 
94 
95 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
96  Trajectory(Trajectory && rh) :
97  theData(std::move(rh.theData)),
101  theSeed(std::move(rh.theSeed)), seedRef_(std::move(rh.seedRef_))
102  {}
103 
104  Trajectory & operator=(Trajectory && rh) {
105  using std::swap;
106  swap(theData,rh.theData);
107  theChiSquared=rh.theChiSquared;
108  theChiSquaredBad=rh.theChiSquaredBad;
109  theValid=rh.theValid;
110  theNumberOfFoundHits=rh.theNumberOfFoundHits;
111  theNumberOfLostHits=rh.theNumberOfLostHits;
112  theDirection=rh.theDirection;
113  theDirectionValidity=rh.theDirectionValidity;
114  swap(theSeed,rh.theSeed);
115  swap(seedRef_,rh.seedRef_);
116 
117  return *this;
118 
119  }
120 
121 #endif
122 
125  void reserve (unsigned int n) { theData.reserve(n); }
126 
131  void push( const TrajectoryMeasurement& tm);
132 
136  void push( const TrajectoryMeasurement& tm, double chi2Increment);
137 
140  void pop();
141 
148  check();
149  if (theData.back().recHit()->hit()!=0) return theData.back();
150  else if (theData.size()>2) return *(theData.end()-2);
151  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
152  }
153 
161  check();
162  if (theData.front().recHit()->hit()!=0) return theData.front();
163  else if (theData.size()>2) return *(theData.begin()+1);
164  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
165  }
166 
169  DataContainer const & measurements() const { return theData;}
171  DataContainer const & data() const { return measurements();}
172 
175  ConstRecHitContainer recHits(bool splitting=false) const;
176 
177  void recHitsV(ConstRecHitContainer & cont,bool splitting = false) const;
178 
182  void validRecHits(ConstRecHitContainer & cont) const;
183 
190  int foundHits() const { return theNumberOfFoundHits;}
191 
197  int lostHits() const { return theNumberOfLostHits;}
198 
200  bool empty() const { return theData.empty();}
201 
209 
213  int ndof(bool bon = true) const;
214 
215 
220  PropagationDirection const & direction() const;
221 
225  bool isValid() const { return theValid;}
226 
228  void invalidate() { theValid = false;}
229 
231  TrajectorySeed const & seed() const { return *theSeed;}
232 
233 
236  static bool inactive(//const Det& det
237  ){return false;}//FIXME
238 
242  static bool lost( const TransientTrackingRecHit& hit);
243 
247  static bool isBad( const TransientTrackingRecHit& hit);
248 
250  const DetLayer* lastLayer() const {
251  check();
252  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
253  else if (theData.size()>2) return (theData.end()-2)->layer();
254  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
255  }
256 
263 
265 
267 
269 
272  void reverse() ;
273 
274  const boost::shared_ptr<const TrajectorySeed> & sharedSeed() const { return theSeed; }
275 private:
276 
277 
281  bool theValid;
282 
285 
288 
289  boost::shared_ptr<const TrajectorySeed> theSeed;
291 
292  void check() const;
293 };
294 
295 #endif
nocap nocap const skelname & operator=(const skelname &)
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:200
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:74
Trajectory(const TrajectorySeed &seed, PropagationDirection dir)
Definition: Trajectory.h:76
int theNumberOfLostHits
Definition: Trajectory.h:284
int foundHits() const
Definition: Trajectory.h:190
int lostHits() const
Definition: Trajectory.h:197
bool theDirectionValidity
Definition: Trajectory.h:287
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:205
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:231
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
Definition: Trajectory.h:228
double theChiSquaredBad
Definition: Trajectory.h:280
DataContainer theData
Definition: Trajectory.h:278
void check() const
Definition: Trajectory.cc:200
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:125
const boost::shared_ptr< const TrajectorySeed > & sharedSeed() const
Definition: Trajectory.h:274
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:269
TrajectoryStateOnSurface geometricalInnermostState() const
Definition: Trajectory.cc:232
void recHitsV(ConstRecHitContainer &cont, bool splitting=false) const
Definition: Trajectory.cc:107
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:43
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
DataContainer const & measurements() const
Definition: Trajectory.h:169
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:147
void validRecHits(ConstRecHitContainer &cont) const
Definition: Trajectory.cc:187
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:262
Trajectory(const TrajectorySeed &seed)
Definition: Trajectory.h:65
bool theValid
Definition: Trajectory.h:281
double theChiSquared
Definition: Trajectory.h:279
PropagationDirection theDirection
Definition: Trajectory.h:286
std::vector< ConstRecHitPointer > ConstRecHitContainer
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:289
int ndof(bool bon=true) const
Definition: Trajectory.cc:74
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:221
bool isValid() const
Definition: Trajectory.h:225
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:160
void pop()
Definition: Trajectory.cc:17
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
Trajectory(const boost::shared_ptr< const TrajectorySeed > &seed, PropagationDirection dir)
Definition: Trajectory.h:87
int cont
static bool inactive()
Definition: Trajectory.h:236
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:264
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:290
DataContainer const & data() const
obsolete name, use measurements() instead.
Definition: Trajectory.h:171
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:250
void reverse()
Definition: Trajectory.cc:276
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
dbl *** dir
Definition: mlp_gen.cc:35
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:35
int theNumberOfFoundHits
Definition: Trajectory.h:283
double chiSquared() const
Definition: Trajectory.h:208