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;
43 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
46 #else
49 #endif
50 
57  theSeed(), seedRef_(),
61  {}
62 
63 
70  explicit Trajectory( const TrajectorySeed& seed) :
71  theSeed( new TrajectorySeed(seed) ), seedRef_(),
75  {}
76 
82  theSeed( new TrajectorySeed(seed) ), seedRef_(),
86 
87  {}
88 
93  Trajectory( const boost::shared_ptr<const TrajectorySeed> & seed, PropagationDirection dir) :
94  theSeed( seed ), seedRef_(),
98  {}
99 
105  theSeed(), seedRef_(),
109 
110  {}
111 
112 
113 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
114 
115  Trajectory(Trajectory const & rh) = default;
116  Trajectory & operator=(Trajectory const & rh) = default;
117 
118  Trajectory(Trajectory && rh) :
119  theSeed(std::move(rh.theSeed)), seedRef_(std::move(rh.seedRef_)),
120  theData(std::move(rh.theData)),
125  {}
126 
127  Trajectory & operator=(Trajectory && rh) {
128  using std::swap;
129  swap(theData,rh.theData);
130  theChiSquared=rh.theChiSquared;
131  theChiSquaredBad=rh.theChiSquaredBad;
132  theValid=rh.theValid;
133  theDPhiCache=rh.theDPhiCache;
134  theNLoops=rh.theNLoops;
135  theNumberOfFoundHits=rh.theNumberOfFoundHits;
136  theNumberOfLostHits=rh.theNumberOfLostHits;
137  theDirection=rh.theDirection;
138  theDirectionValidity=rh.theDirectionValidity;
139  swap(theSeed,rh.theSeed);
140  swap(seedRef_,rh.seedRef_);
141 
142  return *this;
143 
144  }
145 
146 #else
147 // private:
148 // Trajectory(Trajectory const & rh){}
149 // Trajectory & operator=(Trajectory const & rh){ return *this;}
150 // public:
151 #endif
152 
155  void reserve (unsigned int n) { theData.reserve(n); }
156 
161  void push(const TrajectoryMeasurement& tm);
165  void push(const TrajectoryMeasurement & tm, double chi2Increment);
166 
167 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
168  void push(TrajectoryMeasurement&& tm);
169  void push(TrajectoryMeasurement&& tm, double chi2Increment);
170 #endif
171 
174  void pop();
175 
182  check();
183  if (theData.back().recHitR().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().recHitR().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 
207  DataContainer const & data() const { return measurements();}
208 
211 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
212  ConstRecHitContainer recHits() const {
214  hits.reserve(theData.size());
215  for (Trajectory::DataContainer::const_iterator itm
216  = theData.begin(); itm != theData.end(); itm++){
217  hits.push_back((*itm).recHit());
218  }
219  return hits;
220  }
221 
225  void validRecHits(ConstRecHitContainer & cont) const;
226 #endif
227 
234  int foundHits() const { return theNumberOfFoundHits;}
235 
241  int lostHits() const { return theNumberOfLostHits;}
242 
244  bool empty() const { return theData.empty();}
245 
253 
257  int ndof(bool bon = true) const;
258 
259 
264  PropagationDirection const & direction() const;
265 
269  bool isValid() const { return theValid;}
270 
272  void invalidate() { theValid = false;}
273 
275  TrajectorySeed const & seed() const { return *theSeed;}
276 
277 
280  static bool inactive(//const Det& det
281  ){return false;}//FIXME
282 
286  static bool lost( const TrackingRecHit& hit);
287 
291  static bool isBad( const TrackingRecHit& hit);
292 
294  const DetLayer* lastLayer() const {
295  check();
296  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
297  else if (theData.size()>2) return (theData.end()-2)->layer();
298  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
299  }
300 
307 
309 
311 
313 
316  void reverse() ;
317 
318  const boost::shared_ptr<const TrajectorySeed> & sharedSeed() const { return theSeed; }
319  void setSharedSeed(const boost::shared_ptr<const TrajectorySeed> & seed) { theSeed=seed;}
320 
324 
328 
329  bool isLooper() const { return (theNLoops>0);}
330  signed char nLoops() const {return theNLoops;}
331 
332  void setNLoops(signed char value) { theNLoops=value;}
334 
335 private:
336 
337  void pushAux(double chi2Increment);
338 
339 
340  boost::shared_ptr<const TrajectorySeed> theSeed;
342 
346 
347  signed short theNumberOfFoundHits;
348  signed short theNumberOfLostHits;
349 
352  bool theValid;
353 
355  signed char theNLoops;
356 
357  void check() const;
358 };
359 
360 #endif
float dPhiCacheForLoopersReconstruction() const
Definition: Trajectory.h:323
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:244
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
Trajectory(const TrajectorySeed &seed, PropagationDirection dir)
Definition: Trajectory.h:81
int foundHits() const
Definition: Trajectory.h:234
float theChiSquaredBad
Definition: Trajectory.h:345
signed short theNumberOfFoundHits
Definition: Trajectory.h:347
int lostHits() const
Definition: Trajectory.h:241
bool theDirectionValidity
Definition: Trajectory.h:351
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:275
signed short theNumberOfLostHits
Definition: Trajectory.h:348
void pushAux(double chi2Increment)
Definition: Trajectory.cc:50
void setNLoops(signed char value)
Definition: Trajectory.h:332
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
Definition: Trajectory.h:272
DataContainer theData
Definition: Trajectory.h:343
void check() const
Definition: Trajectory.cc:123
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:155
const boost::shared_ptr< const TrajectorySeed > & sharedSeed() const
Definition: Trajectory.h:318
signed char theNLoops
Definition: Trajectory.h:355
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:192
TrajectoryStateOnSurface geometricalInnermostState() const
Definition: Trajectory.cc:155
signed char nLoops() const
Definition: Trajectory.h:330
void incrementLoops()
Definition: Trajectory.h:333
float theDPhiCache
Definition: Trajectory.h:354
PropagationDirection const & direction() const
Definition: Trajectory.cc:118
DataContainer const & measurements() const
Definition: Trajectory.h:203
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
bool isLooper() const
Definition: Trajectory.h:329
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
def move
Definition: eostools.py:508
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:306
DataContainer & measurements()
Definition: Trajectory.h:204
Trajectory(const TrajectorySeed &seed)
Definition: Trajectory.h:70
Trajectory(PropagationDirection dir)
Definition: Trajectory.h:104
bool theValid
Definition: Trajectory.h:352
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:47
PropagationDirection theDirection
Definition: Trajectory.h:350
void setSharedSeed(const boost::shared_ptr< const TrajectorySeed > &seed)
Definition: Trajectory.h:319
std::vector< ConstRecHitPointer > ConstRecHitContainer
float theChiSquared
Definition: Trajectory.h:344
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:340
int ndof(bool bon=true) const
Definition: Trajectory.cc:78
bool isValid() const
Definition: Trajectory.h:269
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
void pop()
Definition: Trajectory.cc:12
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:48
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:144
Trajectory(const boost::shared_ptr< const TrajectorySeed > &seed, PropagationDirection dir)
Definition: Trajectory.h:93
static bool inactive()
Definition: Trajectory.h:280
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:308
float chiSquared() const
Definition: Trajectory.h:252
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:341
void setDPhiCacheForLoopersReconstruction(float dphi)
Definition: Trajectory.h:327
DataContainer const & data() const
obsolete name, use measurements() instead.
Definition: Trajectory.h:207
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:294
void reverse()
Definition: Trajectory.cc:199
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:30
static bool lost(const TrackingRecHit &hit)
Definition: Trajectory.cc:128