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 #include <ext/slist>
6 
8  theSeed( traj.sharedSeed() ),
9  theChiSquared(0),
10  theNumberOfFoundHits(0), theNumberOfLostHits(0),
11  theDirection(traj.direction()), theDirectionValidity(true),
12  theValid(traj.isValid()),
13  theDPhiCache(traj.dPhiCacheForLoopersReconstruction()),
14  theNLoops(traj.nLoops()) {
15 
16  Trajectory::DataContainer::const_iterator begin=traj.measurements().begin();
17  Trajectory::DataContainer::const_iterator end=traj.measurements().end();
18 
19  for(Trajectory::DataContainer::const_iterator it=begin; it!=end; ++it){
20  push(*it);
21  }
22 
23 }
24 
26 
28  if (!empty()) {
29  if (theData.back().recHit()->isValid()) theNumberOfFoundHits--;
30  else if(lost(* (theData.back().recHit()) )) theNumberOfLostHits--;
31  theData.pop_back();
32  }
33 }
34 
36  push( tm, tm.estimate());
37 }
38 
39 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
41  push( std::forward<TrajectoryMeasurement>(tm), tm.estimate());
42 }
43 #endif
44 
45 void TempTrajectory::push( const TrajectoryMeasurement& tm, double chi2Increment){
46  pushAux(tm,chi2Increment);
47  theData.push_back(tm);
48 }
49 
50 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
51 void TempTrajectory::push(TrajectoryMeasurement&& tm, double chi2Increment){
52  pushAux(tm,chi2Increment);
53  theData.push_back(std::move(tm));
54 }
55 #endif
56 
57 void TempTrajectory::pushAux( const TrajectoryMeasurement& tm, double chi2Increment)
58 {
59  if ( tm.recHit()->isValid()) {
61  }
62  //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
63  else if (lost( *(tm.recHit()) ) ) theNumberOfLostHits++;
64 
65 
66  theChiSquared += chi2Increment;
67 
68  // in case of a Trajectory constructed without direction,
69  // determine direction from the radii of the first two measurements
70 
71  if ( !theDirectionValidity && theData.size() >= 2) {
76  theDirectionValidity = true;
77  }
78 }
79 
80 void TempTrajectory::push( const TempTrajectory& segment) {
81  assert (segment.direction() == theDirection) ;
82  __gnu_cxx::slist<const TrajectoryMeasurement*> list;
83  for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it) {
84  list.push_front(&(*it));
85  }
86  for(__gnu_cxx::slist<const TrajectoryMeasurement*>::const_iterator it = list.begin(), ed = list.end(); it != ed; ++it) {
87  push(**it);
88  }
89 }
90 
92  assert (segment.direction() == theDirection) ;
93  if (segment.theData.shared()) {
94  push(segment);
95  segment.theData.clear(); // obey the contract, and increase the chances it will be not shared one day
96  } else {
97  for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it) {
98  if ( it->recHit()->isValid()) theNumberOfFoundHits++;
99  else if (lost( *(it->recHit()) ) ) theNumberOfLostHits++;
100  theChiSquared += it->estimate();
101  }
102  theData.join(segment.theData);
103 
104  if ( !theDirectionValidity && theData.size() >= 2) {
109  theDirectionValidity = true;
110  }
111  }
112 }
113 
114 
115 /*
116 Trajectory::RecHitContainer Trajectory::recHits() const {
117  RecHitContainer hits;
118  hits.reserve(theData.size());
119 
120  for (Trajectory::DataContainer::const_iterator itm
121  = theData.begin(); itm != theData.end(); itm++) {
122  hits.push_back((*itm).recHit());
123  }
124  return hits;
125 }
126 
127 */
128 
131  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
132 }
133 
134 void TempTrajectory::check() const {
135  if ( theData.size() == 0)
136  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
137 }
138 
140 {
141  if ( hit.isValid()) return false;
142  else {
143  // // A DetLayer is always inactive in this logic.
144  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
145  // // is compatible with the predicted state, so we don't really expect
146  // // a hit in this case.
147 
148  if(hit.geographicalId().rawId() == 0) {return false;}
149  else{
150  return hit.getType() == TrackingRecHit::missing;
151  }
152  }
153 }
154 
157  traj.setNLoops(theNLoops);
158 
159  traj.reserve(theData.size());
160  static std::vector<const TrajectoryMeasurement*> work;
161  work.resize(theData.size(), 0);
162  std::vector<const TrajectoryMeasurement*>::iterator workend = work.end(), itwork = workend;
163  for (TempTrajectory::DataContainer::const_iterator it = theData.rbegin(), ed = theData.rend(); it != ed; --it) {
164  --itwork; *itwork = (&(*it));
165  }
166  for (; itwork != workend; ++itwork) {
167  traj.push(**itwork);
168  }
169  return traj;
170 }
171 
signed short theNumberOfFoundHits
const_iterator rend() const
Definition: bqueue.h:145
T perp() const
Definition: PV3DBase.h:71
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:321
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
PropagationDirection theDirection
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:159
static bool lost(const TransientTrackingRecHit &hit)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
PropagationDirection direction() const
DataContainer theData
DataContainer const & measurements() const
Definition: Trajectory.h:203
bool shared()
Definition: bqueue.h:154
Trajectory toTrajectory() const
Convert to a standard Trajectory.
signed short theNumberOfLostHits
void check() const
void clear()
Definition: bqueue.h:175
TrajectoryStateOnSurface updatedState() const
#define end
Definition: vmac.h:38
boost::shared_ptr< const TrajectorySeed > theSeed
Type getType() const
signed char theNLoops
iterator rbegin()
Definition: bqueue.h:143
bool isValid() const
#define begin
Definition: vmac.h:31
void pop_back()
Definition: bqueue.h:133
void join(bqueue< T > &other)
Definition: bqueue.h:161
~TempTrajectory()
destruct a TempTrajectory
size_type size() const
Definition: bqueue.h:146
DetId geographicalId() const
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:35
void pushAux(const TrajectoryMeasurement &tm, double chi2Increment)
void push_back(const T &val)
Definition: bqueue.h:122
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
void push(const TrajectoryMeasurement &tm)