CMS 3D CMS Logo

TempTrajectory.cc
Go to the documentation of this file.
11 
12 namespace {
13  template <typename DataContainer>
14  unsigned short countTrailingValidHits(DataContainer const& meas) {
15  unsigned short n = 0;
16  for (auto it = meas.rbegin(); it != meas.rend(); --it) { // it is not consistent with std...
17  if (TempTrajectory::lost(*(*it).recHit()))
18  break;
19  if ((*it).recHit()->isValid())
20  ++n;
21  }
22  return n;
23  }
24 } // namespace
25 
27  : theChiSquared(0),
28  theNumberOfFoundHits(0),
29  theNumberOfFoundPixelHits(0),
30  theNumberOfLostHits(0),
31  theNumberOfCCCBadHits_(0),
32  theDirection(traj.direction()),
33  theValid(traj.isValid()),
34  theNHseed(traj.seedNHits()),
35  theNLoops(traj.nLoops()),
36  theDPhiCache(traj.dPhiCacheForLoopersReconstruction()),
37  theCCCThreshold_(traj.cccThreshold()),
38  stopReason_(traj.stopReason()) {
39  for (auto& it : traj.measurements()) {
40  push(std::move(it));
41  }
42 }
43 
45  if (!empty()) {
46  if (theData.back().recHit()->isValid()) {
48  if (badForCCC(theData.back()))
52  } else if (lost(*(theData.back().recHit()))) {
54  }
55  theData.pop_back();
56  theNumberOfTrailingFoundHits = countTrailingValidHits(theData);
57  }
58 }
59 
60 void TempTrajectory::pushAux(double chi2Increment) {
61  const TrajectoryMeasurement& tm = theData.back();
62  if (tm.recHit()->isValid()) {
65  if (badForCCC(tm))
67  if (Trajectory::pixel(*(tm.recHit())))
69  }
70  //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
71  else if (lost(*(tm.recHit()))) {
74  }
75 
76  theChiSquared += chi2Increment;
77 }
78 
79 void TempTrajectory::push(const TempTrajectory& segment) {
80  assert(segment.theDirection == theDirection);
82 
83  const int N = segment.measurements().size();
84  TrajectoryMeasurement const* tmp[N];
85  int i = 0;
86  //for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it)
87  for (auto const& tm : segment.measurements())
88  tmp[i++] = &tm;
89  while (i != 0)
90  theData.push_back(*tmp[--i]);
95  theNumberOfTrailingFoundHits = countTrailingValidHits(theData);
96  theChiSquared += segment.theChiSquared;
97 }
98 
100  assert(segment.theDirection == theDirection);
101 
102  if (theCCCThreshold_ != segment.theCCCThreshold_)
104  if (segment.theData.shared()) {
105  push(segment);
106  segment.theData.clear(); // obey the contract, and increase the chances it will be not shared one day
107  } else {
108  theData.join(segment.theData);
113  theNumberOfTrailingFoundHits = countTrailingValidHits(theData);
114  theChiSquared += segment.theChiSquared;
115  }
116 }
117 
119 
120 void TempTrajectory::check() const {
121  if (theData.size() == 0)
122  throw cms::Exception("TrackingTools/PatternTools",
123  "Trajectory::check() - information requested from empty Trajectory");
124 }
125 
127  if LIKELY (hit.isValid())
128  return false;
129 
130  // // A DetLayer is always inactive in this logic.
131  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
132  // // is compatible with the predicted state, so we don't really expect
133  // // a hit in this case.
134 
135  if (hit.geographicalId().rawId() == 0) {
136  return false;
137  }
138  return hit.getType() == TrackingRecHit::missing;
139 }
140 
142  if (!trackerHitRTTI::isFromDet(*tm.recHit()))
143  return false;
144  auto const* thit = static_cast<const BaseTrackerRecHit*>(tm.recHit()->hit());
145  if (!thit)
146  return false;
147  if (thit->isPixel() || thit->isPhase2())
148  return false;
149  if (!tm.updatedState().isValid())
150  return false;
151  return siStripClusterTools::chargePerCM(thit->rawId(),
152  thit->firstClusterRef().stripCluster(),
154 }
155 
156 void TempTrajectory::updateBadForCCC(float ccc_threshold) {
157  // If the supplied threshold is the same as the currently cached
158  // one, then return the current number of bad hits for CCC,
159  // otherwise do a new full rescan.
160  if (ccc_threshold == theCCCThreshold_)
161  return;
162 
163  theCCCThreshold_ = ccc_threshold;
165  for (auto const& h : theData) {
166  if (badForCCC(h))
168  }
169 }
170 
171 int TempTrajectory::numberOfCCCBadHits(float ccc_threshold) {
172  updateBadForCCC(ccc_threshold);
173  return theNumberOfCCCBadHits_;
174 }
175 
178  Trajectory traj(p);
179  traj.setNLoops(theNLoops);
182 
183  traj.reserve(theData.size());
185  int i = 0;
186  for (DataContainer::const_iterator it = theData.rbegin(), ed = theData.rend(); it != ed; --it)
187  tmp[i++] = &(*it);
188  while (i != 0)
189  traj.push(*tmp[--i]);
190  return traj;
191 }
signed short theNumberOfFoundHits
PropagationDirection direction() const
const_iterator rbegin() const
Definition: bqueue.h:197
void join(TempTrajectory &segment)
const T & back() const
Definition: bqueue.h:195
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
bool isFromDet(TrackingRecHit const &hit)
void setStopReason(StopReason s)
Definition: Trajectory.h:334
signed short theNumberOfCCCBadHits_
float chargePerCM(DetId detid, Iter a, Iter b)
void setNLoops(signed char value)
Definition: Trajectory.h:331
#define LIKELY(x)
Definition: Likely.h:20
const LocalTrajectoryParameters & localParameters() const
static bool lost(const TrackingRecHit &hit)
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:126
const DataContainer & measurements() const
assert(be >=bs)
DataContainer theData
StopReason stopReason_
bool shared()
Definition: bqueue.h:211
signed short theNumberOfLostHits
void updateBadForCCC(float ccc_threshold)
void clear()
Definition: bqueue.h:235
static bool pixel(const TrackingRecHit &hit)
Definition: Trajectory.cc:175
void check() const
#define N
Definition: blowfish.cc:9
Trajectory toTrajectory() const
Convert to a standard Trajectory.
size_type size() const
Definition: bqueue.h:201
int numberOfCCCBadHits(float ccc_threshold)
signed char theNLoops
signed short theNumberOfFoundPixelHits
bool badForCCC(const TrajectoryMeasurement &tm)
TrajectoryStateOnSurface const & updatedState() const
int numberOfCCCBadHits(float ccc_threshold)
Definition: Trajectory.cc:212
void pop_back()
Definition: bqueue.h:184
signed short theNumberOfTrailingFoundHits
signed char theDirection
const_iterator rend() const
Definition: bqueue.h:198
void join(bqueue< T > &other)
Definition: bqueue.h:220
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
tmp
align.sh
Definition: createJobs.py:716
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:50
def move(src, dest)
Definition: eostools.py:511
void push_back(const T &val)
Definition: bqueue.h:160
ConstRecHitPointer const & recHit() const
void pushAux(double chi2Increment)
bool empty() const
True if trajectory has no measurements.
void push(const TrajectoryMeasurement &tm)