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 
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 
96 
97 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
98  Trajectory(Trajectory const & rh) :
100  theData(rh.theData),
105  {}
106 
107 
108  Trajectory(Trajectory && rh) :
109  theSeed(std::move(rh.theSeed)), seedRef_(std::move(rh.seedRef_)),
110  theData(std::move(rh.theData)),
115  {}
116 
117  Trajectory & operator=(Trajectory && rh) {
118  using std::swap;
119  swap(theData,rh.theData);
120  theChiSquared=rh.theChiSquared;
121  theChiSquaredBad=rh.theChiSquaredBad;
122  theValid=rh.theValid;
123  theDPhiCache=rh.theDPhiCache;
124  theNLoops=rh.theNLoops;
125  theNumberOfFoundHits=rh.theNumberOfFoundHits;
126  theNumberOfLostHits=rh.theNumberOfLostHits;
127  theDirection=rh.theDirection;
128  theDirectionValidity=rh.theDirectionValidity;
129  swap(theSeed,rh.theSeed);
130  swap(seedRef_,rh.seedRef_);
131 
132  return *this;
133 
134  }
135 
136  Trajectory & operator=(Trajectory const & rh) {
137  theData = rh.theData;
140  theValid=rh.theValid;
142  theNLoops=rh.theNLoops;
147  theSeed = rh.theSeed;
148  seedRef_ = rh.seedRef_;
149 
150  return *this;
151 
152  }
153 
154 
155 #endif
156 
159  void reserve (unsigned int n) { theData.reserve(n); }
160 
165  void push( const TrajectoryMeasurement& tm);
166 
170  void push( const TrajectoryMeasurement& tm, double chi2Increment);
171 
174  void pop();
175 
182  check();
183  if (theData.back().recHit()->hit()!=0) return theData.back();
184  else if (theData.size()>2) return *(theData.end()-2);
185  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
186  }
187 
195  check();
196  if (theData.front().recHit()->hit()!=0) return theData.front();
197  else if (theData.size()>2) return *(theData.begin()+1);
198  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
199  }
200 
203  DataContainer const & measurements() const { return theData;}
205  DataContainer const & data() const { return measurements();}
206 
209  ConstRecHitContainer recHits(bool splitting=false) const;
210 
211  void recHitsV(ConstRecHitContainer & cont,bool splitting = false) const;
212 
216  void validRecHits(ConstRecHitContainer & cont) const;
217 
224  int foundHits() const { return theNumberOfFoundHits;}
225 
231  int lostHits() const { return theNumberOfLostHits;}
232 
234  bool empty() const { return theData.empty();}
235 
243 
247  int ndof(bool bon = true) const;
248 
249 
254  PropagationDirection const & direction() const;
255 
259  bool isValid() const { return theValid;}
260 
262  void invalidate() { theValid = false;}
263 
265  TrajectorySeed const & seed() const { return *theSeed;}
266 
267 
270  static bool inactive(//const Det& det
271  ){return false;}//FIXME
272 
276  static bool lost( const TransientTrackingRecHit& hit);
277 
281  static bool isBad( const TransientTrackingRecHit& hit);
282 
284  const DetLayer* lastLayer() const {
285  check();
286  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
287  else if (theData.size()>2) return (theData.end()-2)->layer();
288  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
289  }
290 
297 
299 
301 
303 
306  void reverse() ;
307 
308  const boost::shared_ptr<const TrajectorySeed> & sharedSeed() const { return theSeed; }
309 
313 
317 
318  bool isLooper() const { return (theNLoops>0);}
319  signed char nLoops() const {return theNLoops;}
320 
321  void setNLoops(signed char value) { theNLoops=value;}
323 
324 private:
325 
326  boost::shared_ptr<const TrajectorySeed> theSeed;
328 
332 
333  signed short theNumberOfFoundHits;
334  signed short theNumberOfLostHits;
335 
338  bool theValid;
339 
341  signed char theNLoops;
342 
343  void check() const;
344 };
345 
346 #endif
float dPhiCacheForLoopersReconstruction() const
Definition: Trajectory.h:312
nocap nocap const skelname & operator=(const skelname &)
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:234
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:224
float theChiSquaredBad
Definition: Trajectory.h:331
signed short theNumberOfFoundHits
Definition: Trajectory.h:333
int lostHits() const
Definition: Trajectory.h:231
bool theDirectionValidity
Definition: Trajectory.h:337
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:265
signed short theNumberOfLostHits
Definition: Trajectory.h:334
void setNLoops(signed char value)
Definition: Trajectory.h:321
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
Definition: Trajectory.h:262
DataContainer theData
Definition: Trajectory.h:329
void check() const
Definition: Trajectory.cc:200
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:159
const boost::shared_ptr< const TrajectorySeed > & sharedSeed() const
Definition: Trajectory.h:308
signed char theNLoops
Definition: Trajectory.h:341
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
signed char nLoops() const
Definition: Trajectory.h:319
void incrementLoops()
Definition: Trajectory.h:322
TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:43
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
float theDPhiCache
Definition: Trajectory.h:340
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
DataContainer const & measurements() const
Definition: Trajectory.h:203
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
bool isLooper() const
Definition: Trajectory.h:318
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
void validRecHits(ConstRecHitContainer &cont) const
Definition: Trajectory.cc:187
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:296
Trajectory(const TrajectorySeed &seed)
Definition: Trajectory.h:66
bool theValid
Definition: Trajectory.h:338
PropagationDirection theDirection
Definition: Trajectory.h:336
float theChiSquared
Definition: Trajectory.h:330
std::vector< ConstRecHitPointer > ConstRecHitContainer
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:326
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:259
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
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:270
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:298
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:327
void setDPhiCacheForLoopersReconstruction(float dphi)
Definition: Trajectory.h:316
DataContainer const & data() const
obsolete name, use measurements() instead.
Definition: Trajectory.h:205
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:284
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
double chiSquared() const
Definition: Trajectory.h:242