CMS 3D CMS Logo

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