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 
53  theSeed(), seedRef_(),
57  {}
58 
59 
66  explicit Trajectory( const TrajectorySeed& seed) :
67  theSeed( new TrajectorySeed(seed) ), seedRef_(),
71  {}
72 
78  theSeed( new TrajectorySeed(seed) ), seedRef_(),
82 
83  {}
84 
89  Trajectory( const boost::shared_ptr<const TrajectorySeed> & seed, PropagationDirection dir) :
90  theSeed( seed ), seedRef_(),
94  {}
95 
101  theSeed(), seedRef_(),
105 
106  {}
107 
108 
109 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
110  Trajectory(Trajectory const & rh) :
111  theSeed(rh.theSeed), seedRef_(rh.seedRef_),
112  theData(rh.theData),
117  {}
118 
119 
120  Trajectory(Trajectory && rh) :
121  theSeed(std::move(rh.theSeed)), seedRef_(std::move(rh.seedRef_)),
122  theData(std::move(rh.theData)),
127  {}
128 
129  Trajectory & operator=(Trajectory && rh) {
130  using std::swap;
131  swap(theData,rh.theData);
132  theChiSquared=rh.theChiSquared;
133  theChiSquaredBad=rh.theChiSquaredBad;
134  theValid=rh.theValid;
135  theDPhiCache=rh.theDPhiCache;
136  theNLoops=rh.theNLoops;
137  theNumberOfFoundHits=rh.theNumberOfFoundHits;
138  theNumberOfLostHits=rh.theNumberOfLostHits;
139  theDirection=rh.theDirection;
140  theDirectionValidity=rh.theDirectionValidity;
141  swap(theSeed,rh.theSeed);
142  swap(seedRef_,rh.seedRef_);
143 
144  return *this;
145 
146  }
147 
148  Trajectory & operator=(Trajectory const & rh) {
149  theData = rh.theData;
152  theValid=rh.theValid;
154  theNLoops=rh.theNLoops;
159  theSeed = rh.theSeed;
160  seedRef_ = rh.seedRef_;
161 
162  return *this;
163 
164  }
165 
166 
167 #endif
168 
171  void reserve (unsigned int n) { theData.reserve(n); }
172 
177  void push( const TrajectoryMeasurement& tm);
178 
182  void push( const TrajectoryMeasurement& tm, double chi2Increment);
183 
186  void pop();
187 
194  check();
195  if (theData.back().recHitR().hit()!=0) return theData.back();
196  else if (theData.size()>2) return *(theData.end()-2);
197  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
198  }
199 
207  check();
208  if (theData.front().recHitR().hit()!=0) return theData.front();
209  else if (theData.size()>2) return *(theData.begin()+1);
210  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
211  }
212 
215  DataContainer const & measurements() const { return theData;}
217  DataContainer const & data() const { return measurements();}
218 
221  ConstRecHitContainer recHits(bool splitting=false) const;
222 
223  void recHitsV(ConstRecHitContainer & cont,bool splitting = false) const;
224 
228  void validRecHits(ConstRecHitContainer & cont) const;
229 
236  int foundHits() const { return theNumberOfFoundHits;}
237 
243  int lostHits() const { return theNumberOfLostHits;}
244 
246  bool empty() const { return theData.empty();}
247 
255 
259  int ndof(bool bon = true) const;
260 
261 
266  PropagationDirection const & direction() const;
267 
271  bool isValid() const { return theValid;}
272 
274  void invalidate() { theValid = false;}
275 
277  TrajectorySeed const & seed() const { return *theSeed;}
278 
279 
282  static bool inactive(//const Det& det
283  ){return false;}//FIXME
284 
288  static bool lost( const TransientTrackingRecHit& hit);
289 
293  static bool isBad( const TransientTrackingRecHit& hit);
294 
296  const DetLayer* lastLayer() const {
297  check();
298  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
299  else if (theData.size()>2) return (theData.end()-2)->layer();
300  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
301  }
302 
309 
311 
313 
315 
318  void reverse() ;
319 
320  const boost::shared_ptr<const TrajectorySeed> & sharedSeed() const { return theSeed; }
321  void setSharedSeed(const boost::shared_ptr<const TrajectorySeed> & seed) { theSeed=seed;}
322 
326 
330 
331  bool isLooper() const { return (theNLoops>0);}
332  signed char nLoops() const {return theNLoops;}
333 
334  void setNLoops(signed char value) { theNLoops=value;}
336 
337 private:
338 
339  boost::shared_ptr<const TrajectorySeed> theSeed;
341 
345 
346  signed short theNumberOfFoundHits;
347  signed short theNumberOfLostHits;
348 
351  bool theValid;
352 
354  signed char theNLoops;
355 
356  void check() const;
357 };
358 
359 #endif
float dPhiCacheForLoopersReconstruction() const
Definition: Trajectory.h:325
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:246
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
Trajectory(const TrajectorySeed &seed, PropagationDirection dir)
Definition: Trajectory.h:77
int foundHits() const
Definition: Trajectory.h:236
float theChiSquaredBad
Definition: Trajectory.h:344
signed short theNumberOfFoundHits
Definition: Trajectory.h:346
int lostHits() const
Definition: Trajectory.h:243
bool theDirectionValidity
Definition: Trajectory.h:350
static bool lost(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:206
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:277
signed short theNumberOfLostHits
Definition: Trajectory.h:347
void setNLoops(signed char value)
Definition: Trajectory.h:334
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
Definition: Trajectory.h:274
DataContainer theData
Definition: Trajectory.h:342
void check() const
Definition: Trajectory.cc:201
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:171
const boost::shared_ptr< const TrajectorySeed > & sharedSeed() const
Definition: Trajectory.h:320
signed char theNLoops
Definition: Trajectory.h:354
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:270
TrajectoryStateOnSurface geometricalInnermostState() const
Definition: Trajectory.cc:233
void recHitsV(ConstRecHitContainer &cont, bool splitting=false) const
Definition: Trajectory.cc:107
signed char nLoops() const
Definition: Trajectory.h:332
void incrementLoops()
Definition: Trajectory.h:335
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:43
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
float theDPhiCache
Definition: Trajectory.h:353
PropagationDirection const & direction() const
Definition: Trajectory.cc:196
DataContainer const & measurements() const
Definition: Trajectory.h:215
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
bool isLooper() const
Definition: Trajectory.h:331
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:193
void validRecHits(ConstRecHitContainer &cont) const
Definition: Trajectory.cc:188
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:308
Trajectory(const TrajectorySeed &seed)
Definition: Trajectory.h:66
Trajectory(PropagationDirection dir)
Definition: Trajectory.h:100
bool theValid
Definition: Trajectory.h:351
PropagationDirection theDirection
Definition: Trajectory.h:349
void setSharedSeed(const boost::shared_ptr< const TrajectorySeed > &seed)
Definition: Trajectory.h:321
float theChiSquared
Definition: Trajectory.h:343
std::vector< ConstRecHitPointer > ConstRecHitContainer
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:339
int ndof(bool bon=true) const
Definition: Trajectory.cc:74
static bool isBad(const TransientTrackingRecHit &hit)
Definition: Trajectory.cc:222
bool isValid() const
Definition: Trajectory.h:271
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:206
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:89
int cont
static bool inactive()
Definition: Trajectory.h:282
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:310
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:340
void setDPhiCacheForLoopersReconstruction(float dphi)
Definition: Trajectory.h:329
DataContainer const & data() const
obsolete name, use measurements() instead.
Definition: Trajectory.h:217
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:296
void reverse()
Definition: Trajectory.cc:277
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
dbl *** dir
Definition: mlp_gen.cc:35
volatile std::atomic< bool > shutdown_flag false
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:35
double chiSquared() const
Definition: Trajectory.h:254