CMS 3D CMS Logo

TrackTransientTrack.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  tkr_(),
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 
34 {}
35 
37  : Track(tk),
38  tkr_(),
39  hasTime(false),
40  timeExt_(0.),
41  dtErrorExt_(0.),
42  theField(field),
43  m_TSOS(kUnset),
44  m_TSCP(kUnset),
45  m_SCTBL(kUnset) {
47 }
48 
50  const double time,
51  const double dtime,
52  const MagneticField* field)
53  : Track(tk),
54  tkr_(),
55  hasTime(true),
56  timeExt_(time),
57  dtErrorExt_(dtime),
58  theField(field),
59  m_TSOS(kUnset),
60  m_TSCP(kUnset),
61  m_SCTBL(kUnset) {
63 }
64 
66  : Track(*tk),
67  tkr_(tk),
68  hasTime(false),
69  timeExt_(0.),
70  dtErrorExt_(0.),
71  theField(field),
72  m_TSOS(kUnset),
73  m_TSCP(kUnset),
74  m_SCTBL(kUnset) {
76 }
77 
79  const double time,
80  const double dtime,
81  const MagneticField* field)
82  : Track(*tk),
83  tkr_(tk),
84  hasTime(true),
85  timeExt_(time),
86  dtErrorExt_(dtime),
87  theField(field),
88  m_TSOS(kUnset),
89  m_TSCP(kUnset),
90  m_SCTBL(kUnset) {
92 }
93 
95  const MagneticField* field,
97  : Track(tk),
98  tkr_(),
99  hasTime(false),
100  timeExt_(0.),
101  dtErrorExt_(0.),
102  theField(field),
103  m_TSOS(kUnset),
104  m_TSCP(kUnset),
105  m_SCTBL(kUnset),
106  theTrackingGeometry(tg) {
108 }
109 
111  const MagneticField* field,
113  : Track(*tk),
114  tkr_(tk),
115  hasTime(false),
116  timeExt_(0.),
117  dtErrorExt_(0.),
118  theField(field),
119  m_TSOS(kUnset),
120  m_TSCP(kUnset),
121  m_SCTBL(kUnset),
122  theTrackingGeometry(tg) {
124 }
125 
127  const double time,
128  const double dtime,
129  const MagneticField* field,
131  : Track(tk),
132  tkr_(),
133  hasTime(true),
134  timeExt_(time),
135  dtErrorExt_(dtime),
136  theField(field),
137  m_TSOS(kUnset),
138  m_TSCP(kUnset),
139  m_SCTBL(kUnset),
140  theTrackingGeometry(tg) {
142 }
143 
145  const double time,
146  const double dtime,
147  const MagneticField* field,
149  : Track(*tk),
150  tkr_(tk),
151  hasTime(true),
152  timeExt_(time),
153  dtErrorExt_(dtime),
154  theField(field),
155  m_TSOS(kUnset),
156  m_TSCP(kUnset),
157  m_SCTBL(kUnset),
158  theTrackingGeometry(tg) {
160 }
161 
163  : Track(tt),
164  tkr_(tt.persistentTrackRef()),
165  hasTime(tt.hasTime),
166  timeExt_(tt.timeExt()),
167  dtErrorExt_(tt.dtErrorExt()),
168  theField(tt.field()),
169  initialFTS(tt.initialFreeState()),
170  m_TSOS(kUnset),
171  m_TSCP(kUnset) {
172  // see ThreadSafe statement above about the order of operator= and store
173  if (kSet == tt.m_TSOS.load()) {
174  initialTSOS = tt.impactPointState();
175  m_TSOS.store(kSet);
176  }
177  // see ThreadSafe statement above about the order of operator= and store
178  if (kSet == tt.m_TSCP.load()) {
179  initialTSCP = tt.impactPointTSCP();
180  m_TSCP.store(kSet);
181  }
182 }
183 
185  theTrackingGeometry = tg;
186 }
187 
190  m_SCTBL = kUnset;
191 }
192 
194  // see ThreadSafe statement above about the order of operator= and store
195  if (kSet == m_TSOS.load())
196  return initialTSOS;
198  auto tmp = tipe.extrapolate(initialFTS, initialFTS.position());
199  char expected = kUnset;
200  if (m_TSOS.compare_exchange_strong(expected, kSetting)) {
201  initialTSOS = tmp;
202  m_TSOS.store(kSet);
203  return initialTSOS;
204  }
205  return tmp;
206 }
207 
209  // see ThreadSafe statement above about the order of operator= and store
210  if (kSet == m_TSCP.load())
211  return initialTSCP;
213  char expected = kUnset;
214  if (m_TSCP.compare_exchange_strong(expected, kSetting)) {
215  initialTSCP = tmp;
216  m_TSCP.store(kSet);
217  return initialTSCP;
218  }
219  return tmp;
220 }
221 
224 }
225 
228 }
229 
232  return tipe.extrapolate(initialFTS, point);
233 }
234 
236  // see ThreadSafe statement above about the order of operator= and store
237  if (kSet == m_SCTBL.load())
239  TSCBLBuilderNoMaterial blsBuilder;
240  const auto tmp = blsBuilder(initialFTS, theBeamSpot);
241  char expected = kUnset;
242  if (m_SCTBL.compare_exchange_strong(expected, kSetting)) {
244  m_SCTBL.store(kSet);
246  }
247  return tmp;
248 }
TrajectoryStateOnSurface initialTSOS
TrajectoryStateOnSurface innermostMeasurementState() const override
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
const MagneticField * field() const override
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
GlobalPoint position() const
Definition: TTTypes.h:54
TrajectoryStateOnSurface outermostMeasurementState() const override
void setTrackingGeometry(const edm::ESHandle< GlobalTrackingGeometry > &) override
TSCPBuilderNoMaterial builder
TrajectoryStateClosestToBeamLine trajectoryStateClosestToBeamLine
const MagneticField * theField
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const override
double dtime()
constexpr unsigned int kUnset
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
TrajectoryStateOnSurface impactPointState() const override
fixed size matrix
TrajectoryStateClosestToBeamLine stateAtBeamLine() const override
TrajectoryStateClosestToPoint initialTSCP
tmp
align.sh
Definition: createJobs.py:716
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
*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
TrajectoryStateClosestToPoint impactPointTSCP() const override
FreeTrajectoryState initialFTS
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
void setBeamSpot(const reco::BeamSpot &beamSpot) override