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.
4 
5 
7  theChiSquared(0),
8  theNumberOfFoundHits(0), theNumberOfLostHits(0),
9  theDirection(traj.direction()), theDirectionValidity(true),
10  theValid(traj.isValid()),
11  theNLoops(traj.nLoops()),
12  theDPhiCache(traj.dPhiCacheForLoopersReconstruction()) {
13 
14  Trajectory::DataContainer::const_iterator begin=traj.measurements().begin();
15  Trajectory::DataContainer::const_iterator end=traj.measurements().end();
16 
17  for(Trajectory::DataContainer::const_iterator it=begin; it!=end; ++it){
18  push(*it);
19  }
20 
21 }
22 
23 
25  if (!empty()) {
26  if (theData.back().recHit()->isValid()) theNumberOfFoundHits--;
27  else if(lost(* (theData.back().recHit()) )) theNumberOfLostHits--;
28  theData.pop_back();
29  }
30 }
31 
32 
33 
34 void TempTrajectory::pushAux(double chi2Increment) {
35  const TrajectoryMeasurement& tm = theData.back();
36  if ( tm.recHit()->isValid()) {
38  }
39  //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
40  else if (lost( *(tm.recHit()) ) ) theNumberOfLostHits++;
41 
42 
43  theChiSquared += chi2Increment;
44 
45  // in case of a Trajectory constructed without direction,
46  // determine direction from the radii of the first two measurements
47 
48  if ( !theDirectionValidity && theData.size() >= 2) {
53  theDirectionValidity = true;
54  }
55 }
56 
57 void TempTrajectory::push(const TempTrajectory& segment) {
58  assert (segment.theDirection == theDirection) ;
59  assert(theDirectionValidity); // given the above...
60 
61  const int N = segment.measurements().size();
62  TrajectoryMeasurement const * tmp[N];
63  int i=0;
64  //for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it)
65  for ( auto const & tm : segment.measurements())
66  tmp[i++] =&tm;
67  while(i!=0) theData.push_back(*tmp[--i]);
70  theChiSquared += segment.theChiSquared;
71 }
72 
74  assert (segment.theDirection == theDirection) ;
75  assert(theDirectionValidity);
76 
77  if (segment.theData.shared()) {
78  push(segment);
79  segment.theData.clear(); // obey the contract, and increase the chances it will be not shared one day
80  } else {
81  theData.join(segment.theData);
84  theChiSquared += segment.theChiSquared;
85  }
86 }
87 
88 
89 /*
90 Trajectory::RecHitContainer Trajectory::recHits() const {
91  RecHitContainer hits;
92  hits.reserve(theData.size());
93 
94  for (Trajectory::DataContainer::const_iterator itm
95  = theData.begin(); itm != theData.end(); itm++) {
96  hits.push_back((*itm).recHit());
97  }
98  return hits;
99 }
100 
101 */
102 
105  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
106 }
107 
108 void TempTrajectory::check() const {
109  if ( theData.size() == 0)
110  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
111 }
112 
114 {
115  if likely(hit.isValid()) return false;
116 
117  // // A DetLayer is always inactive in this logic.
118  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
119  // // is compatible with the predicted state, so we don't really expect
120  // // a hit in this case.
121 
122  if(hit.geographicalId().rawId() == 0) {return false;}
123  return hit.getType() == TrackingRecHit::missing;
124 }
125 
127  assert(theDirectionValidity);
129  Trajectory traj(p);
130  traj.setNLoops(theNLoops);
131 
132  traj.reserve(theData.size());
134  int i=0;
135  for (DataContainer::const_iterator it = theData.rbegin(), ed = theData.rend(); it != ed; --it)
136  tmp[i++] = &(*it);
137  while(i!=0) traj.push(*tmp[--i]);
138  return traj;
139 }
140 
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.
const DataContainer & measurements() const
void setNLoops(signed char value)
Definition: Trajectory.h:334
GlobalPoint globalPosition() const
T perp2() const
Definition: PV3DBase.h:71
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:171
const T & front() const
Definition: bqueue.h:159
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
PropagationDirection direction() const
DataContainer theData
DataContainer const & measurements() const
Definition: Trajectory.h:215
bool shared()
Definition: bqueue.h:176
Trajectory toTrajectory() const
Convert to a standard Trajectory.
signed short theNumberOfLostHits
const_iterator begin() const
Definition: bqueue.h:165
void check() const
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
static bool lost(const TransientTrackingRecHit &hit) dso_internal
#define N
Definition: blowfish.cc:9
signed char theNLoops
bool isValid() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define likely(x)
Definition: Likely.h:20
#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
const_iterator end() const
Definition: bqueue.h:166
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)