CMS 3D CMS Logo

TempTrajectory.h
Go to the documentation of this file.
1 #ifndef CkfPattern_TempTrajectory_H
2 #define CkfPattern_TempTrajectory_H
3 
10 
11 #include <vector>
12 #include <algorithm>
13 #include <limits>
15 
17 
41 public:
45 
52 
57  TempTrajectory(PropagationDirection dir, unsigned char nhseed)
58  : theDirection(dir), theValid(true), theNHseed(nhseed) {}
59 
60  TempTrajectory(TempTrajectory const& rh) = default;
61  TempTrajectory& operator=(TempTrajectory const& rh) = default;
62 
64  : theData(std::move(rh.theData)),
65  theChiSquared(rh.theChiSquared),
66  theNumberOfFoundHits(rh.theNumberOfFoundHits),
67  theNumberOfFoundPixelHits(rh.theNumberOfFoundPixelHits),
68  theNumberOfLostHits(rh.theNumberOfLostHits),
69  theNumberOfTrailingFoundHits(rh.theNumberOfTrailingFoundHits),
70  theNumberOfCCCBadHits_(rh.theNumberOfCCCBadHits_),
71  theDirection(rh.theDirection),
72  theValid(rh.theValid),
73  theNHseed(rh.theNHseed),
74  theNLoops(rh.theNLoops),
75  theDPhiCache(rh.theDPhiCache),
76  theCCCThreshold_(rh.theCCCThreshold_),
77  stopReason_(rh.stopReason_) {}
78 
80  using std::swap;
81  swap(theData, rh.theData);
82  theChiSquared = rh.theChiSquared;
83  theNumberOfFoundHits = rh.theNumberOfFoundHits;
84  theNumberOfFoundPixelHits = rh.theNumberOfFoundPixelHits;
85  theNumberOfLostHits = rh.theNumberOfLostHits;
86  theNumberOfTrailingFoundHits = rh.theNumberOfTrailingFoundHits;
87  theNumberOfCCCBadHits_ = rh.theNumberOfCCCBadHits_;
88  theDirection = rh.theDirection;
89  theValid = rh.theValid;
90  theNHseed = rh.theNHseed;
91  theNLoops = rh.theNLoops;
92  theDPhiCache = rh.theDPhiCache;
93  theCCCThreshold_ = rh.theCCCThreshold_;
94  stopReason_ = rh.stopReason_;
95  return *this;
96  }
97 
99  explicit TempTrajectory(Trajectory&& traj);
100 
103 
108  void push(const TrajectoryMeasurement& tm) { push(tm, tm.estimate()); }
109 
110  void push(TrajectoryMeasurement&& tm) { push(std::forward<TrajectoryMeasurement>(tm), tm.estimate()); }
111 
112  template <typename... Args>
113  void emplace(Args&&... args) {
114  theData.emplace_back(std::forward<Args>(args)...);
116  }
117 
123  void push(TempTrajectory const& segment);
124 
129  void join(TempTrajectory& segment);
130 
134  void push(const TrajectoryMeasurement& tm, double chi2Increment) {
135  theData.push_back(tm);
136  pushAux(chi2Increment);
137  }
138 
139  void push(TrajectoryMeasurement&& tm, double chi2Increment) {
141  pushAux(chi2Increment);
142  }
143 
144  template <typename... Args>
145  void emplace(double chi2Increment, Args&&... args) { // works only because the first Arg is never a double!
146  theData.emplace_back(std::forward<Args>(args)...);
147  pushAux(chi2Increment);
148  }
149 
152  void pop();
153 
160  check();
161  return theData.back();
162  }
163 
171  check();
172  return theData.front();
173  }
174 
177  const DataContainer& measurements() const { return theData; }
178 
184  int foundHits() const { return theNumberOfFoundHits; }
185 
189 
194  int lostHits() const { return theNumberOfLostHits; }
195 
199 
204  int cccBadHits() const { return theNumberOfCCCBadHits_; }
205 
206  //number of hits in seed
207  unsigned int seedNHits() const { return theNHseed; }
208 
210  bool empty() const { return theData.empty(); }
211 
213  float chiSquared() const { return theChiSquared; }
214 
220 
224  bool isValid() const { return theValid; }
225 
227  void invalidate() { theValid = false; }
228 
231  static bool inactive( //const Det& det
232  ) {
233  return false;
234  } //FIXME
235 
237  const DetLayer* lastLayer() const {
238  check();
239  return theData.back().layer();
240  }
241 
243  Trajectory toTrajectory() const;
244 
246  void popInvalidTail();
247 
251 
255 
256  bool isLooper() const { return (theNLoops > 0); }
257  signed char nLoops() const { return theNLoops; }
258 
259  void setNLoops(signed char value) { theNLoops = value; }
260  void incrementLoops() { theNLoops++; }
261 
262  StopReason stopReason() const { return stopReason_; }
264 
265  int numberOfCCCBadHits(float ccc_threshold);
266 
267  static bool lost(const TrackingRecHit& hit) dso_internal;
268 
269 private:
274  void updateBadForCCC(float ccc_threshold) dso_internal;
275 
276  void pushAux(double chi2Increment);
277 
278 private:
280 
281  float theChiSquared = 0;
282 
283  signed short theNumberOfFoundHits = 0;
284  signed short theNumberOfFoundPixelHits = 0;
285  signed short theNumberOfLostHits = 0;
287  signed short theNumberOfCCCBadHits_ = 0;
288 
289  // PropagationDirection
290  signed char theDirection = anyDirection;
291  bool theValid = false;
292 
293  unsigned char theNHseed = 0;
294 
295  signed char theNLoops = 0;
296  float theDPhiCache = 0;
299 
300  void check() const;
301 };
302 
303 #endif
signed short theNumberOfFoundHits
void emplace(Args &&... args)
PropagationDirection direction() const
int cccBadHits() const
void join(TempTrajectory &segment)
ConstRecHitContainer RecHitContainer
const T & back() const
Definition: bqueue.h:196
void push(TrajectoryMeasurement &&tm)
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
signed short theNumberOfCCCBadHits_
const T & front() const
Definition: bqueue.h:194
void setNLoops(signed char value)
int trailingFoundHits() const
static bool lost(const TrackingRecHit &hit)
PropagationDirection
unsigned int seedNHits() const
void emplace_back(Args &&...args)
Definition: bqueue.h:178
TempTrajectory(TempTrajectory &&rh) noexcept
const DataContainer & measurements() const
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
void setDPhiCacheForLoopersReconstruction(float dphi)
DataContainer theData
StopReason stopReason_
signed short theNumberOfLostHits
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
bool isLooper() const
bool isValid() const
static bool inactive()
void updateBadForCCC(float ccc_threshold)
const TrajectoryMeasurement & lastMeasurement() const
void emplace(double chi2Increment, Args &&... args)
TempTrajectory & operator=(TempTrajectory const &rh)=default
const TrajectoryMeasurement & firstMeasurement() const
#define dso_internal
Definition: Visibility.h:13
TempTrajectory & operator=(TempTrajectory &&rh) noexcept
int foundHits() const
Definition: value.py:1
void push(TrajectoryMeasurement &&tm, double chi2Increment)
float chiSquared() const
Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.
int lostHits() const
void check() const
StopReason stopReason() const
std::vector< ConstRecHitPointer > ConstRecHitContainer
Trajectory toTrajectory() const
Convert to a standard Trajectory.
void push(const TrajectoryMeasurement &tm, double chi2Increment)
int numberOfCCCBadHits(float ccc_threshold)
signed char theNLoops
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
float dPhiCacheForLoopersReconstruction() const
bool empty() const
Definition: bqueue.h:203
signed short theNumberOfFoundPixelHits
bool badForCCC(const TrajectoryMeasurement &tm)
void popInvalidTail()
Pops out all the invalid hits on the tail.
cmsutils::bqueue< TrajectoryMeasurement > DataContainer
signed short theNumberOfTrailingFoundHits
unsigned char theNHseed
void setStopReason(StopReason s)
signed char theDirection
~TempTrajectory()
destruct a TempTrajectory
signed char nLoops() const
int foundPixelHits() const
const DetLayer * layer() const
def move(src, dest)
Definition: eostools.py:511
void push_back(const T &val)
Definition: bqueue.h:161
void pushAux(double chi2Increment)
bool empty() const
True if trajectory has no measurements.
void push(const TrajectoryMeasurement &tm)
TempTrajectory(PropagationDirection dir, unsigned char nhseed)