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  theChiSquared(0), theValid(traj.isValid()),
9  theNumberOfFoundHits(0), theNumberOfLostHits(0),
10  theDirection(traj.direction()), theDirectionValidity(true),
11  theSeed( traj.sharedSeed() ){
12 
13  Trajectory::DataContainer::const_iterator begin=traj.measurements().begin();
14  Trajectory::DataContainer::const_iterator end=traj.measurements().end();
15 
16  for(Trajectory::DataContainer::const_iterator it=begin; it!=end; ++it){
17  push(*it);
18  }
19 
20 
21 }
22 
24 }
25 
27  if (!empty()) {
28  if (theData.back().recHit()->isValid()) theNumberOfFoundHits--;
29  else if(lost(* (theData.back().recHit()) )) theNumberOfLostHits--;
30  theData.pop_back();
31  }
32 }
33 
35  push( tm, tm.estimate());
36 }
37 
38 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
40  push( std::forward<TrajectoryMeasurement>(tm), tm.estimate());
41 }
42 #endif
43 
44 void TempTrajectory::push( const TrajectoryMeasurement& tm, double chi2Increment){
45  pushAux(tm,chi2Increment);
46  theData.push_back(tm);
47 }
48 
49 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
50 void TempTrajectory::push(TrajectoryMeasurement&& tm, double chi2Increment){
51  pushAux(tm,chi2Increment);
52  theData.push_back(std::move(tm));
53 }
54 #endif
55 
56 void TempTrajectory::pushAux( const TrajectoryMeasurement& tm, double chi2Increment)
57 {
58  if ( tm.recHit()->isValid()) {
60  }
61  //else if (lost( tm.recHit()) && !inactive(tm.recHit().det())) theNumberOfLostHits++;
62  else if (lost( *(tm.recHit()) ) ) theNumberOfLostHits++;
63 
64 
65  theChiSquared += chi2Increment;
66 
67  // in case of a Trajectory constructed without direction,
68  // determine direction from the radii of the first two measurements
69 
70  if ( !theDirectionValidity && theData.size() >= 2) {
75  theDirectionValidity = true;
76  }
77 }
78 
79 void TempTrajectory::push( const TempTrajectory& segment) {
80  assert (segment.direction() == theDirection) ;
81  __gnu_cxx::slist<const TrajectoryMeasurement*> list;
82  for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it) {
83  list.push_front(&(*it));
84  }
85  for(__gnu_cxx::slist<const TrajectoryMeasurement*>::const_iterator it = list.begin(), ed = list.end(); it != ed; ++it) {
86  push(**it);
87  }
88 }
89 
91  assert (segment.direction() == theDirection) ;
92  if (segment.theData.shared()) {
93  push(segment);
94  segment.theData.clear(); // obey the contract, and increase the chances it will be not shared one day
95  } else {
96  for (DataContainer::const_iterator it = segment.measurements().rbegin(), ed = segment.measurements().rend(); it != ed; --it) {
97  if ( it->recHit()->isValid()) theNumberOfFoundHits++;
98  else if (lost( *(it->recHit()) ) ) theNumberOfLostHits++;
99  theChiSquared += it->estimate();
100  }
101  theData.join(segment.theData);
102 
103  if ( !theDirectionValidity && theData.size() >= 2) {
108  theDirectionValidity = true;
109  }
110  }
111 }
112 
113 
114 /*
115 Trajectory::RecHitContainer Trajectory::recHits() const {
116  RecHitContainer hits;
117  hits.reserve(theData.size());
118 
119  for (Trajectory::DataContainer::const_iterator itm
120  = theData.begin(); itm != theData.end(); itm++) {
121  hits.push_back((*itm).recHit());
122  }
123  return hits;
124 }
125 
126 */
127 
130  else throw cms::Exception("TrackingTools/PatternTools","Trajectory::direction() requested but not set");
131 }
132 
133 void TempTrajectory::check() const {
134  if ( theData.size() == 0)
135  throw cms::Exception("TrackingTools/PatternTools","Trajectory::check() - information requested from empty Trajectory");
136 }
137 
139 {
140  if ( hit.isValid()) return false;
141  else {
142  // // A DetLayer is always inactive in this logic.
143  // // The DetLayer is the Det of an invalid RecHit only if no DetUnit
144  // // is compatible with the predicted state, so we don't really expect
145  // // a hit in this case.
146 
147  if(hit.geographicalId().rawId() == 0) {return false;}
148  else{
149  return hit.getType() == TrackingRecHit::missing;
150  }
151  }
152 }
153 
156 
157  traj.reserve(theData.size());
158  static std::vector<const TrajectoryMeasurement*> work;
159  work.resize(theData.size(), 0);
160  std::vector<const TrajectoryMeasurement*>::iterator workend = work.end(), itwork = workend;
161  for (TempTrajectory::DataContainer::const_iterator it = theData.rbegin(), ed = theData.rend(); it != ed; --it) {
162  --itwork; *itwork = (&(*it));
163  }
164  for (; itwork != workend; ++itwork) {
165  traj.push(**itwork);
166  }
167  return traj;
168 }
169 
const_iterator rend() const
Definition: bqueue.h:142
T perp() const
Definition: PV3DBase.h:66
void join(TempTrajectory &segment)
bool empty() const
True if trajectory has no measurements.
const DataContainer & measurements() const
GlobalPoint globalPosition() const
ConstRecHitPointer recHit() const
PropagationDirection theDirection
PropagationDirection
void reserve(unsigned int n)
Definition: Trajectory.h:125
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:169
bool shared()
Definition: bqueue.h:151
Trajectory toTrajectory() const
Convert to a standard Trajectory.
void check() const
void clear()
Definition: bqueue.h:172
TrajectoryStateOnSurface updatedState() const
#define end
Definition: vmac.h:38
boost::shared_ptr< const TrajectorySeed > theSeed
Type getType() const
iterator rbegin()
Definition: bqueue.h:140
bool isValid() const
#define begin
Definition: vmac.h:31
void pop_back()
Definition: bqueue.h:130
void join(bqueue< T > &other)
Definition: bqueue.h:158
~TempTrajectory()
destruct a TempTrajectory
size_type size() const
Definition: bqueue.h:143
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:119
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)