CMS 3D CMS Logo

CandidatePtrTransientTrack.cc
Go to the documentation of this file.
6 #include <iostream>
7 
8 /*
9  * ThreadSafe statement:
10  * This class is using mutable member data: initialTSOS, initialTSCP,
11  * trajectoryStateClosestToBeamLine. To guarantee thread safeness we
12  * rely on helper member data: m_TSOS, m_TSCP and m_SCTBL, respectively.
13  * Each time we'll change mutable member data we rely on specific order of the
14  * operator= and the store. It is important since C++11 will guarantee that
15  * the value changed by the operator= will be seen by all threads as occuring
16  * before the call to store and therefore the kSet == m_TSOS.load is always
17  * guaranteed to be true if and only if the thread will see the most recent
18  * value of initialTSOS
19  */
20 
21 using namespace reco;
22 
24  : Track(),
25  ptr_(),
26  hasTime(false),
27  timeExt_(0),
28  dtErrorExt_(0),
29  theField(nullptr),
30  m_TSOS(kUnset),
31  m_TSCP(kUnset),
32  m_SCTBL(kUnset) {}
33 
35  : Track(*ptr->bestTrack()),
36  ptr_(ptr),
37  hasTime(false),
38  timeExt_(0),
39  dtErrorExt_(0),
40  theField(field),
41  m_TSOS(kUnset),
42  m_TSCP(kUnset),
43  m_SCTBL(kUnset) {
45 }
46 
48  const double time,
49  const double dtime,
50  const MagneticField* field)
51  : Track(*ptr->bestTrack()),
52  ptr_(ptr),
53  hasTime(true),
54  timeExt_(time),
55  dtErrorExt_(dtime),
56  theField(field),
57  m_TSOS(kUnset),
58  m_TSCP(kUnset),
59  m_SCTBL(kUnset) {
61 }
62 
64  const MagneticField* field,
66  : Track(*ptr->bestTrack()),
67  ptr_(ptr),
68  hasTime(false),
69  timeExt_(0),
70  dtErrorExt_(0),
71  theField(field),
72  m_TSOS(kUnset),
73  m_TSCP(kUnset),
74  m_SCTBL(kUnset),
75  theTrackingGeometry(tg) {
77 }
78 
80  const double time,
81  const double dtime,
82  const MagneticField* field,
84  : Track(*ptr->bestTrack()),
85  ptr_(ptr),
86  hasTime(true),
87  timeExt_(time),
88  dtErrorExt_(dtime),
89  theField(field),
90  m_TSOS(kUnset),
91  m_TSCP(kUnset),
92  m_SCTBL(kUnset),
93  theTrackingGeometry(tg) {
95 }
96 
98  : Track(tt),
99  ptr_(tt.candidate()),
100  hasTime(tt.hasTime),
101  timeExt_(tt.timeExt_),
102  dtErrorExt_(tt.dtErrorExt_),
103  theField(tt.field()),
104  initialFTS(tt.initialFreeState()),
105  m_TSOS(kUnset),
106  m_TSCP(kUnset) {
107  // see ThreadSafe statement above about the order of operator= and store
108  if (kSet == tt.m_TSOS.load()) {
109  initialTSOS = tt.impactPointState();
110  m_TSOS.store(kSet);
111  }
112  // see ThreadSafe statement above about the order of operator= and store
113  if (kSet == tt.m_TSCP.load()) {
114  initialTSCP = tt.impactPointTSCP();
115  m_TSCP.store(kSet);
116  }
117 }
118 
120  theTrackingGeometry = tg;
121 }
122 
125  m_SCTBL = kUnset;
126 }
127 
129  // see ThreadSafe statement above about the order of operator= and store
130  if (kSet == m_TSOS.load())
131  return initialTSOS;
133  auto tmp = tipe.extrapolate(initialFTS, initialFTS.position());
134  char expected = kUnset;
135  if (m_TSOS.compare_exchange_strong(expected, kSetting)) {
136  initialTSOS = tmp;
137  m_TSOS.store(kSet);
138  return initialTSOS;
139  }
140  return tmp;
141 }
142 
144  // see ThreadSafe statement above about the order of operator= and store
145  if (kSet == m_TSCP.load())
146  return initialTSCP;
148  char expected = kUnset;
149  if (m_TSCP.compare_exchange_strong(expected, kSetting)) {
150  initialTSCP = tmp;
151  m_TSCP.store(kSet);
152  return initialTSCP;
153  }
154  return tmp;
155 }
156 
159 }
160 
163 }
164 
167  return tipe.extrapolate(initialFTS, point);
168 }
169 
171  // see ThreadSafe statement above about the order of operator= and store
172  if (kSet == m_SCTBL.load())
174  TSCBLBuilderNoMaterial blsBuilder;
175  const auto tmp = blsBuilder(initialFTS, theBeamSpot);
176  char expected = kUnset;
177  if (m_SCTBL.compare_exchange_strong(expected, kSetting)) {
179  m_SCTBL.store(kSet);
181  }
182  return tmp;
183 }
TrajectoryStateClosestToPoint initialTSCP
TrajectoryStateClosestToBeamLine stateAtBeamLine() const override
const char * ptr_
Definition: DataKey.cc:76
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
void setBeamSpot(const reco::BeamSpot &beamSpot) override
void setTrackingGeometry(const edm::ESHandle< GlobalTrackingGeometry > &) override
GlobalPoint position() const
TrajectoryStateOnSurface impactPointState() const override
TrajectoryStateClosestToBeamLine trajectoryStateClosestToBeamLine
TrajectoryStateClosestToPoint impactPointTSCP() const override
const MagneticField * field() const override
TrajectoryStateOnSurface outermostMeasurementState() const override
double dtime()
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
fixed size matrix
virtual const Track * bestTrack() const
Definition: Candidate.h:268
tmp
align.sh
Definition: createJobs.py:716
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const override
TrajectoryStateOnSurface innermostMeasurementState() const override
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)