CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TempTrajectory.cc
Go to the documentation of this file.
9 
10 
12  theChiSquared(0),
13  theNumberOfFoundHits(0),
14  theNumberOfLostHits(0),
15  theNumberOfCCCBadHits_(0),
16  theDirection(traj.direction()),
17  theValid(traj.isValid()),
18  theNHseed(traj.seedNHits()),
19  theNLoops(traj.nLoops()),
20  theDPhiCache(traj.dPhiCacheForLoopersReconstruction()),
21  theCCCThreshold_(traj.cccThreshold()),
22  stopReason_(traj.stopReason()) {
23 
24  Trajectory::DataContainer::const_iterator begin=traj.measurements().begin();
25  Trajectory::DataContainer::const_iterator end=traj.measurements().end();
26 
27  for(Trajectory::DataContainer::const_iterator it=begin; it!=end; ++it){
28  push(std::move(*it));
29  }
30 
31 }
32 
33 
35  if (!empty()) {
36  if (theData.back().recHit()->isValid()) theNumberOfFoundHits--;
37  else if(lost(* (theData.back().recHit()) )) theNumberOfLostHits--;
39  theData.pop_back();
40  }
41 }
42 
43 
44 
45 void TempTrajectory::pushAux(double chi2Increment) {
46  const TrajectoryMeasurement& tm = theData.back();
47  if ( tm.recHit()->isValid()) {
49  }
50  //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
51  else if (lost( *(tm.recHit()) ) ) theNumberOfLostHits++;
52  else if (badForCCC(tm)) theNumberOfCCCBadHits_++;
53 
54  theChiSquared += chi2Increment;
55 
56 }
57 
58 void TempTrajectory::push(const TempTrajectory& segment) {
59  assert (segment.theDirection == theDirection) ;
61 
62  const int N = segment.measurements().size();
63  TrajectoryMeasurement const * tmp[N];
64  int i=0;
65  //for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it)
66  for ( auto const & tm : segment.measurements())
67  tmp[i++] =&tm;
68  while(i!=0) theData.push_back(*tmp[--i]);
72  theChiSquared += segment.theChiSquared;
73 }
74 
76  assert (segment.theDirection == theDirection) ;
77 
78  if (theCCCThreshold_ != segment.theCCCThreshold_)
80  if (segment.theData.shared()) {
81  push(segment);
82  segment.theData.clear(); // obey the contract, and increase the chances it will be not shared one day
83  } else {
84  theData.join(segment.theData);
88  theChiSquared += segment.theChiSquared;
89  }
90 }
91 
92 
95 }
96 
97 void TempTrajectory::check() const {
98  if ( theData.size() == 0)
99  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
100 }
101 
103 {
104  if likely(hit.isValid()) return false;
105 
106  // // A DetLayer is always inactive in this logic.
107  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
108  // // is compatible with the predicted state, so we don't really expect
109  // // a hit in this case.
110 
111  if(hit.geographicalId().rawId() == 0) {return false;}
112  return hit.getType() == TrackingRecHit::missing;
113 }
114 
116  auto const * thit = dynamic_cast<const BaseTrackerRecHit*>( tm.recHit()->hit() );
117  if (!thit)
118  return false;
119  if (thit->isPixel())
120  return false;
121  if (!tm.updatedState().isValid())
122  return false;
123  return siStripClusterTools::chargePerCM(thit->rawId(),
124  thit->firstClusterRef().stripCluster(),
126 }
127 
128 void TempTrajectory::updateBadForCCC(float ccc_threshold) {
129  // If the supplied threshold is the same as the currently cached
130  // one, then return the current number of bad hits for CCC,
131  // otherwise do a new full rescan.
132  if (ccc_threshold == theCCCThreshold_)
133  return;
134 
135  theCCCThreshold_ = ccc_threshold;
137  for (auto const & h : theData) {
138  if (badForCCC(h))
140  }
141 }
142 
143 int TempTrajectory::numberOfCCCBadHits(float ccc_threshold) {
144  updateBadForCCC(ccc_threshold);
145  return theNumberOfCCCBadHits_;
146 }
147 
150  Trajectory traj(p);
151  traj.setNLoops(theNLoops);
153 
154  traj.reserve(theData.size());
156  int i=0;
157  for (DataContainer::const_iterator it = theData.rbegin(), ed = theData.rend(); it != ed; --it)
158  tmp[i++] = &(*it);
159  while(i!=0) traj.push(*tmp[--i]);
160  return traj;
161 }
162 
signed short theNumberOfFoundHits
const_iterator rend() const
Definition: bqueue.h:164
int i
Definition: DBlmapReader.cc:9
ConstRecHitPointer const & recHit() const
void join(TempTrajectory &segment)
bool empty() const
True if trajectory has no measurements.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const LocalTrajectoryParameters & localParameters() const
void setStopReason(StopReason s)
Definition: Trajectory.h:392
signed short theNumberOfCCCBadHits_
assert(m_qm.get())
const DataContainer & measurements() const
float chargePerCM(DetId detid, Iter a, Iter b)
void setNLoops(signed char value)
Definition: Trajectory.h:389
static bool lost(const TrackingRecHit &hit)
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:204
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
PropagationDirection direction() const
DataContainer theData
#define likely(x)
StopReason stopReason_
bool shared()
Definition: bqueue.h:176
Trajectory toTrajectory() const
Convert to a standard Trajectory.
signed short theNumberOfLostHits
void check() const
void updateBadForCCC(float ccc_threshold)
def move
Definition: eostools.py:510
void clear()
Definition: bqueue.h:201
#define end
Definition: vmac.h:37
const T & back() const
Definition: bqueue.h:161
const_iterator rbegin() const
Definition: bqueue.h:163
Type getType() const
#define N
Definition: blowfish.cc:9
int numberOfCCCBadHits(float ccc_threshold)
signed char theNLoops
bool isValid() const
bool badForCCC(const TrajectoryMeasurement &tm)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define begin
Definition: vmac.h:30
void pop_back()
Definition: bqueue.h:151
signed char theDirection
void join(bqueue< T > &other)
Definition: bqueue.h:186
TrajectoryStateOnSurface const & updatedState() const
size_type size() const
Definition: bqueue.h:167
DetId geographicalId() const
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:35
void push_back(const T &val)
Definition: bqueue.h:133
void pushAux(double chi2Increment)
void push(const TrajectoryMeasurement &tm)