test
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 
11 
12 #include <vector>
13 #include <algorithm>
14 #include <limits>
15 #include <boost/shared_ptr.hpp>
16 
41 {
42 public:
43 
44  typedef std::vector<TrajectoryMeasurement> DataContainer;
47 
54  theSeed(),
55  seedRef_(),
56  theChiSquared(0),
63  theValid(false),
64  theDPhiCache(0),
65  theCCCThreshold_(std::numeric_limits<float>::max()),
66  theNLoops(0),
68  {}
69 
70 
77  explicit Trajectory( const TrajectorySeed& seed) :
78  theSeed( new TrajectorySeed(seed) ),
79  seedRef_(),
80  theChiSquared(0),
87  theValid(true),
88  theDPhiCache(0),
89  theCCCThreshold_(std::numeric_limits<float>::max()),
90  theNLoops(0),
92  {}
93 
99  theSeed( new TrajectorySeed(seed) ),
100  seedRef_(),
101  theChiSquared(0),
102  theChiSquaredBad(0),
106  theDirection(dir),
108  theValid(true),
109  theDPhiCache(0),
110  theCCCThreshold_(std::numeric_limits<float>::max()),
111  theNLoops(0),
113  {}
114 
119  Trajectory( const boost::shared_ptr<const TrajectorySeed> & seed, PropagationDirection dir) :
120  theSeed( seed ),
121  seedRef_(),
122  theChiSquared(0),
123  theChiSquaredBad(0),
127  theDirection(dir),
129  theValid(true),
130  theDPhiCache(0),
131  theCCCThreshold_(std::numeric_limits<float>::max()),
132  theNLoops(0),
134  {}
135 
141  theSeed(),
142  seedRef_(),
143  theChiSquared(0),
144  theChiSquaredBad(0),
148  theDirection(dir),
150  theValid(true),
151  theDPhiCache(0),
152  theCCCThreshold_(std::numeric_limits<float>::max()),
153  theNLoops(0),
155  {}
156 
157 
158  Trajectory(Trajectory const & rh) = default;
159  Trajectory & operator=(Trajectory const & rh) = default;
160 
162  theSeed(std::move(rh.theSeed)),
163  seedRef_(std::move(rh.seedRef_)),
164  theData(std::move(rh.theData)),
172  theValid(rh.theValid),
175  theNLoops(rh.theNLoops),
177  {}
178 
180  using std::swap;
181  swap(theData,rh.theData);
182  theChiSquared=rh.theChiSquared;
183  theChiSquaredBad=rh.theChiSquaredBad;
184  theValid=rh.theValid;
185  theDPhiCache=rh.theDPhiCache;
186  theCCCThreshold_=rh.theCCCThreshold_;
187  theNLoops=rh.theNLoops;
188  theNumberOfFoundHits=rh.theNumberOfFoundHits;
189  theNumberOfLostHits=rh.theNumberOfLostHits;
190  theNumberOfCCCBadHits_=rh.theNumberOfCCCBadHits_;
191  theDirection=rh.theDirection;
192  theDirectionValidity=rh.theDirectionValidity;
193  stopReason_ = rh.stopReason_;
194  swap(theSeed,rh.theSeed);
195  swap(seedRef_,rh.seedRef_);
196 
197  return *this;
198 
199  }
200 
201 
204  void reserve (unsigned int n) { theData.reserve(n); }
205 
210  void push(const TrajectoryMeasurement& tm);
214  void push(const TrajectoryMeasurement & tm, double chi2Increment);
215 
216  void push(TrajectoryMeasurement&& tm);
217  void push(TrajectoryMeasurement&& tm, double chi2Increment);
218 
221  void pop();
222 
229  check();
230  if (theData.back().recHitR().hit()!=0) return theData.back();
231  else if (theData.size()>2) return *(theData.end()-2);
232  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
233  }
234 
242  check();
243  if (theData.front().recHitR().hit()!=0) return theData.front();
244  else if (theData.size()>2) return *(theData.begin()+1);
245  else throw cms::Exception("TrajectoryMeasurement::firstMeasurement - Too few measurements in trajectory");
246  }
247 
250  DataContainer const & measurements() const { return theData;}
252 
254  DataContainer const & data() const { return measurements();}
255 
260  hits.reserve(theData.size());
261  for (Trajectory::DataContainer::const_iterator itm
262  = theData.begin(); itm != theData.end(); itm++){
263  hits.push_back((*itm).recHit());
264  }
265  return hits;
266  }
267 
271  void validRecHits(ConstRecHitContainer & cont) const;
272 
279  int foundHits() const { return theNumberOfFoundHits;}
280 
286  int lostHits() const { return theNumberOfLostHits;}
287 
292  int cccBadHits() const { return theNumberOfCCCBadHits_;}
293 
294  //number of hits in seed
295  unsigned int seedNHits() const { return seed().nHits();}
296 
297 
299  bool empty() const { return theData.empty();}
300 
308 
312  int ndof(bool bon = true) const;
313 
314 
319  PropagationDirection const & direction() const;
320 
324  bool isValid() const { return theValid;}
325 
327  void invalidate() { theValid = false;}
328 
330  TrajectorySeed const & seed() const { return *theSeed;}
331 
332 
335  static bool inactive(//const Det& det
336  ){return false;}//FIXME
337 
341  static bool lost( const TrackingRecHit& hit);
342 
346  static bool isBad( const TrackingRecHit& hit);
347 
349  const DetLayer* lastLayer() const {
350  check();
351  if (theData.back().recHit()->hit()!=0) return theData.back().layer();
352  else if (theData.size()>2) return (theData.end()-2)->layer();
353  else throw cms::Exception("TrajectoryMeasurement::lastMeasurement - Too few measurements in trajectory");
354  }
355 
362 
364 
366 
368 
371  void reverse() ;
372 
373  const boost::shared_ptr<const TrajectorySeed> & sharedSeed() const { return theSeed; }
374  void setSharedSeed(const boost::shared_ptr<const TrajectorySeed> & seed) { theSeed=seed;}
375 
379 
380  float cccThreshold() const {return theCCCThreshold_;}
381 
385 
386  bool isLooper() const { return (theNLoops>0);}
387  signed char nLoops() const {return theNLoops;}
388 
389  void setNLoops(signed char value) { theNLoops=value;}
391 
394 
395  int numberOfCCCBadHits(float ccc_threshold);
396 
397 private:
398 
399  void pushAux(double chi2Increment);
400  bool badForCCC(const TrajectoryMeasurement &tm);
401  void updateBadForCCC(float ccc_threshold);
402 
403  boost::shared_ptr<const TrajectorySeed> theSeed;
405 
409 
410  signed short theNumberOfFoundHits;
411  signed short theNumberOfLostHits;
413 
416  bool theValid;
417 
420  signed char theNLoops;
422 
423  void check() const;
424 };
425 
426 #endif
float dPhiCacheForLoopersReconstruction() const
Definition: Trajectory.h:378
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:299
void swap(ora::Record &rh, ora::Record &lh)
Definition: Record.h:70
Trajectory(const TrajectorySeed &seed, PropagationDirection dir)
Definition: Trajectory.h:98
int foundHits() const
Definition: Trajectory.h:279
float theChiSquaredBad
Definition: Trajectory.h:408
signed short theNumberOfFoundHits
Definition: Trajectory.h:410
int lostHits() const
Definition: Trajectory.h:286
bool theDirectionValidity
Definition: Trajectory.h:415
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:330
signed short theNumberOfLostHits
Definition: Trajectory.h:411
float cccThreshold() const
Definition: Trajectory.h:380
void pushAux(double chi2Increment)
Definition: Trajectory.cc:55
Trajectory & operator=(Trajectory const &rh)=default
void setStopReason(StopReason s)
Definition: Trajectory.h:392
void setNLoops(signed char value)
Definition: Trajectory.h:389
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
Definition: Trajectory.h:327
ConstRecHitContainer recHits() const
Definition: Trajectory.h:258
DataContainer theData
Definition: Trajectory.h:406
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:162
void check() const
Definition: Trajectory.cc:130
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:204
const boost::shared_ptr< const TrajectorySeed > & sharedSeed() const
Definition: Trajectory.h:373
float theCCCThreshold_
Definition: Trajectory.h:419
signed char theNLoops
Definition: Trajectory.h:420
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:232
TrajectoryStateOnSurface geometricalInnermostState() const
Definition: Trajectory.cc:195
signed char nLoops() const
Definition: Trajectory.h:387
void incrementLoops()
Definition: Trajectory.h:390
float theDPhiCache
Definition: Trajectory.h:418
PropagationDirection const & direction() const
Definition: Trajectory.cc:125
DataContainer const & measurements() const
Definition: Trajectory.h:250
void updateBadForCCC(float ccc_threshold)
Definition: Trajectory.cc:175
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:44
bool isLooper() const
Definition: Trajectory.h:386
StopReason stopReason() const
Definition: Trajectory.h:393
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:228
void validRecHits(ConstRecHitContainer &cont) const
Definition: Trajectory.cc:117
def move
Definition: eostools.py:510
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:361
DataContainer & measurements()
Definition: Trajectory.h:251
Trajectory(const TrajectorySeed &seed)
Definition: Trajectory.h:77
Trajectory(PropagationDirection dir)
Definition: Trajectory.h:140
bool theValid
Definition: Trajectory.h:416
StopReason stopReason_
Definition: Trajectory.h:421
PropagationDirection theDirection
Definition: Trajectory.h:414
void setSharedSeed(const boost::shared_ptr< const TrajectorySeed > &seed)
Definition: Trajectory.h:374
std::vector< ConstRecHitPointer > ConstRecHitContainer
float theChiSquared
Definition: Trajectory.h:407
boost::shared_ptr< const TrajectorySeed > theSeed
Definition: Trajectory.h:403
int ndof(bool bon=true) const
Definition: Trajectory.cc:85
bool isValid() const
Definition: Trajectory.h:324
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:241
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:46
unsigned int seedNHits() const
Definition: Trajectory.h:295
void pop()
Definition: Trajectory.cc:16
static bool isBad(const TrackingRecHit &hit)
Definition: Trajectory.cc:151
Trajectory(const boost::shared_ptr< const TrajectorySeed > &seed, PropagationDirection dir)
Definition: Trajectory.h:119
static bool inactive()
Definition: Trajectory.h:335
void setSeedRef(const edm::RefToBase< TrajectorySeed > &seedRef)
Definition: Trajectory.h:363
float chiSquared() const
Definition: Trajectory.h:307
edm::RefToBase< TrajectorySeed > seedRef_
Definition: Trajectory.h:404
void setDPhiCacheForLoopersReconstruction(float dphi)
Definition: Trajectory.h:384
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
Definition: Trajectory.h:45
int numberOfCCCBadHits(float ccc_threshold)
Definition: Trajectory.cc:190
unsigned int nHits() const
DataContainer const & data() const
obsolete name, use measurements() instead.
Definition: Trajectory.h:254
Trajectory(Trajectory &&rh)
Definition: Trajectory.h:161
Trajectory & operator=(Trajectory &&rh)
Definition: Trajectory.h:179
int cccBadHits() const
Definition: Trajectory.h:292
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
Definition: Trajectory.h:349
void reverse()
Definition: Trajectory.cc:239
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
signed short theNumberOfCCCBadHits_
Definition: Trajectory.h:412
static bool lost(const TrackingRecHit &hit)
Definition: Trajectory.cc:135