CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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)),
72  theValid(rh.theValid),
73  theNHseed(rh.theNHseed),
74  theNLoops(rh.theNLoops),
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
const TrajectoryMeasurement & firstMeasurement() const
signed short theNumberOfFoundHits
void join(TempTrajectory &segment)
bool empty() const
True if trajectory has no measurements.
ConstRecHitContainer RecHitContainer
void push(TrajectoryMeasurement &&tm)
TrackingRecHit::ConstRecHitContainer ConstRecHitContainer
bool empty() const
Definition: bqueue.h:202
signed short theNumberOfCCCBadHits_
const DataContainer & measurements() const
void setNLoops(signed char value)
int foundHits() const
static bool lost(const TrackingRecHit &hit)
PropagationDirection
void emplace_back(Args &&...args)
Definition: bqueue.h:177
TempTrajectory(TempTrajectory &&rh) noexcept
int cccBadHits() const
StopReason stopReason() const
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
int foundPixelHits() const
const T & front() const
Definition: bqueue.h:193
const TrajectoryMeasurement & lastMeasurement() const
PropagationDirection direction() const
void setDPhiCacheForLoopersReconstruction(float dphi)
DataContainer theData
StopReason stopReason_
bool isLooper() const
Trajectory toTrajectory() const
Convert to a standard Trajectory.
float dPhiCacheForLoopersReconstruction() const
signed short theNumberOfLostHits
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void check() const
static bool inactive()
void updateBadForCCC(float ccc_threshold)
def move
Definition: eostools.py:511
unsigned int seedNHits() const
TempTrajectory & operator=(TempTrajectory const &rh)=default
#define dso_internal
Definition: Visibility.h:13
const DetLayer * layer() const
TempTrajectory & operator=(TempTrajectory &&rh) noexcept
void push(TrajectoryMeasurement &&tm, double chi2Increment)
const T & back() const
Definition: bqueue.h:195
std::vector< ConstRecHitPointer > ConstRecHitContainer
bool isValid() const
int trailingFoundHits() const
void push(const TrajectoryMeasurement &tm, double chi2Increment)
int numberOfCCCBadHits(float ccc_threshold)
signed char theNLoops
float chiSquared() const
Value of the raw Chi2 of the trajectory, not normalised to the N.D.F.
signed short theNumberOfFoundPixelHits
bool badForCCC(const TrajectoryMeasurement &tm)
void emplace(Args &&...args)
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
void emplace(double chi2Increment, Args &&...args)
const DetLayer * lastLayer() const
Redundant method, returns the layer of lastMeasurement() .
void push_back(const T &val)
Definition: bqueue.h:160
void pushAux(double chi2Increment)
int lostHits() const
void push(const TrajectoryMeasurement &tm)
TempTrajectory(PropagationDirection dir, unsigned char nhseed)