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
128  LIKELY(hit.isValid()) 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 }
Likely.h
TrajectoryStateOnSurface.h
mps_fire.i
i
Definition: mps_fire.py:428
TempTrajectory::direction
PropagationDirection direction() const
Definition: TempTrajectory.cc:118
PixelSubdetector.h
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TempTrajectory::theCCCThreshold_
float theCCCThreshold_
Definition: TempTrajectory.h:297
TempTrajectory::push
void push(const TrajectoryMeasurement &tm)
Definition: TempTrajectory.h:108
TempTrajectory::join
void join(TempTrajectory &segment)
Definition: TempTrajectory.cc:99
TempTrajectory
Definition: TempTrajectory.h:40
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
siStripClusterTools::chargePerCM
float chargePerCM(DetId detid, Iter a, Iter b)
Definition: SiStripClusterTools.h:29
cms::cuda::assert
assert(be >=bs)
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
Trajectory::reserve
void reserve(unsigned int n)
Definition: Trajectory.h:126
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
TempTrajectory::TempTrajectory
TempTrajectory()
Definition: TempTrajectory.h:51
TempTrajectory::theChiSquared
float theChiSquared
Definition: TempTrajectory.h:281
Trajectory::setStopReason
void setStopReason(StopReason s)
Definition: Trajectory.h:334
cmsutils::bqueue::clear
void clear()
Definition: bqueue.h:235
TempTrajectory::theNumberOfCCCBadHits_
signed short theNumberOfCCCBadHits_
Definition: TempTrajectory.h:287
cmsutils::bqueue::back
const T & back() const
Definition: bqueue.h:195
TempTrajectory::theData
DataContainer theData
Definition: TempTrajectory.h:279
cmsutils::bqueue::size
size_type size() const
Definition: bqueue.h:201
TempTrajectory::lost
static bool lost(const TrackingRecHit &hit)
Definition: TempTrajectory.cc:126
TempTrajectory::measurements
const DataContainer & measurements() const
Definition: TempTrajectory.h:177
N
#define N
Definition: blowfish.cc:9
TempTrajectory::theNumberOfLostHits
signed short theNumberOfLostHits
Definition: TempTrajectory.h:285
h
TempTrajectory::updateBadForCCC
void updateBadForCCC(float ccc_threshold)
Definition: TempTrajectory.cc:156
cmsutils::bqueue::rbegin
const_iterator rbegin() const
Definition: bqueue.h:197
SiStripClusterTools.h
cmsutils::bqueue::shared
bool shared()
Definition: bqueue.h:211
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
TempTrajectory::stopReason_
StopReason stopReason_
Definition: TempTrajectory.h:298
cmsutils::bqueue::join
void join(bqueue< T > &other)
Definition: bqueue.h:220
SiStripCluster.h
cmsutils::_bqueue_itr
Definition: bqueue.h:39
TempTrajectory::toTrajectory
Trajectory toTrajectory() const
Convert to a standard Trajectory.
Definition: TempTrajectory.cc:176
TrackingRecHit::missing
Definition: TrackingRecHit.h:47
cmsutils::bqueue::push_back
void push_back(const T &val)
Definition: bqueue.h:160
TempTrajectory::theNLoops
signed char theNLoops
Definition: TempTrajectory.h:295
TempTrajectory::check
void check() const
Definition: TempTrajectory.cc:120
trackerHitRTTI::isFromDet
bool isFromDet(TrackingRecHit const &hit)
Definition: trackerHitRTTI.h:36
cmsutils::bqueue::pop_back
void pop_back()
Definition: bqueue.h:184
Trajectory::push
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:50
OmniClusterRef.h
TempTrajectory::theNumberOfTrailingFoundHits
signed short theNumberOfTrailingFoundHits
Definition: TempTrajectory.h:286
TrackingRecHit
Definition: TrackingRecHit.h:21
BaseTrackerRecHit.h
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
GeomDet.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
TempTrajectory::badForCCC
bool badForCCC(const TrajectoryMeasurement &tm)
Definition: TempTrajectory.cc:141
Trajectory
Definition: Trajectory.h:38
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
cmsutils::bqueue::rend
const_iterator rend() const
Definition: bqueue.h:198
Trajectory::numberOfCCCBadHits
int numberOfCCCBadHits(float ccc_threshold)
Definition: Trajectory.cc:212
TempTrajectory::numberOfCCCBadHits
int numberOfCCCBadHits(float ccc_threshold)
Definition: TempTrajectory.cc:171
Exception.h
TempTrajectory::theDirection
signed char theDirection
Definition: TempTrajectory.h:290
Trajectory::setNLoops
void setNLoops(signed char value)
Definition: Trajectory.h:331
TempTrajectory::theNumberOfFoundPixelHits
signed short theNumberOfFoundPixelHits
Definition: TempTrajectory.h:284
cms::Exception
Definition: Exception.h:70
TempTrajectory::theNumberOfFoundHits
signed short theNumberOfFoundHits
Definition: TempTrajectory.h:283
Trajectory::pixel
static bool pixel(const TrackingRecHit &hit)
Definition: Trajectory.cc:175
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
TempTrajectory.h
TempTrajectory::pop
void pop()
Definition: TempTrajectory.cc:44
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
TempTrajectory::pushAux
void pushAux(double chi2Increment)
Definition: TempTrajectory.cc:60
TempTrajectory::empty
bool empty() const
True if trajectory has no measurements.
Definition: TempTrajectory.h:210