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(), tkr_(), hasTime(false), timeExt_(0.), dtErrorExt_(0.), theField(nullptr), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset)
25 
26 {
27 }
28 
31 {
32 
34 }
35 
37  const double dtime,
38  const MagneticField* field) :
39  Track(tk), tkr_(), hasTime(true), timeExt_(time), dtErrorExt_(dtime), theField(field), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset)
40 {
41 
43 }
44 
45 
48 {
49 
51 }
52 
54  const double dtime,
55  const MagneticField* field) :
56  Track(*tk), tkr_(tk), hasTime(true), timeExt_(time), dtErrorExt_(dtime), theField(field), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset)
57 {
58 
60 }
61 
64 {
65 
67 }
68 
71 {
72 
74 }
75 
77  const double dtime,
78  const MagneticField* field,
81 {
82 
84 }
85 
87  const double dtime,
88  const MagneticField* field,
91 {
92 
94 }
95 
96 
98  Track(tt), tkr_(tt.persistentTrackRef()),
100  theField(tt.field()),
102 {
103  // see ThreadSafe statement above about the order of operator= and store
104  if (kSet == tt.m_TSOS.load()) {
106  m_TSOS.store(kSet);
107  }
108  // see ThreadSafe statement above about the order of operator= and store
109  if (kSet == tt.m_TSCP.load()) {
111  m_TSCP.store(kSet);
112  }
113 }
114 
116 
118 
119 }
120 
122 
123  theTrackingGeometry = tg;
124 
125 }
126 
128 {
130  m_SCTBL = kUnset;
131 }
132 
134 {
135  // see ThreadSafe statement above about the order of operator= and store
136  if(kSet == m_TSOS.load()) return initialTSOS;
138  auto tmp = tipe.extrapolate(initialFTS, initialFTS.position());
139  char expected = kUnset;
140  if(m_TSOS.compare_exchange_strong(expected, kSetting)) {
141  initialTSOS = tmp;
142  m_TSOS.store(kSet);
143  return initialTSOS;
144  }
145  return tmp;
146 }
147 
149 {
150  // see ThreadSafe statement above about the order of operator= and store
151  if(kSet == m_TSCP.load()) return initialTSCP;
153  char expected = kUnset;
154  if(m_TSCP.compare_exchange_strong(expected, kSetting)) {
155  initialTSCP = tmp;
156  m_TSCP.store(kSet);
157  return initialTSCP;
158  }
159  return tmp;
160 }
161 
163 {
164 
166 }
167 
169 {
170 
172 }
173 
176 {
178  return tipe.extrapolate(initialFTS, point);
179 }
180 
182 {
183  // see ThreadSafe statement above about the order of operator= and store
184  if(kSet == m_SCTBL.load()) return trajectoryStateClosestToBeamLine;
185  TSCBLBuilderNoMaterial blsBuilder;
186  const auto tmp = blsBuilder(initialFTS, theBeamSpot);
187  char expected = kUnset;
188  if(m_SCTBL.compare_exchange_strong(expected, kSetting)) {
190  m_SCTBL.store(kSet);
192  }
193  return tmp;
194 }
195 
TrajectoryStateOnSurface initialTSOS
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const override
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
const MagneticField * field() const override
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
double dtErrorExt() const override
FreeTrajectoryState initialFreeState() const override
void setES(const edm::EventSetup &) override
#define nullptr
std::atomic< char > m_TSOS
TrackRef persistentTrackRef() const
void setTrackingGeometry(const edm::ESHandle< GlobalTrackingGeometry > &) override
TSCPBuilderNoMaterial builder
TrajectoryStateClosestToBeamLine trajectoryStateClosestToBeamLine
double timeExt() const override
const MagneticField * theField
TrajectoryStateOnSurface impactPointState() const override
GlobalPoint position() const
const T & get() const
Definition: EventSetup.h:59
TrajectoryStateOnSurface innermostMeasurementState() const override
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:17
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
fixed size matrix
TrajectoryStateClosestToPoint initialTSCP
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
TrajectoryStateOnSurface outermostMeasurementState() const override
TrajectoryStateClosestToPoint impactPointTSCP() 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
FreeTrajectoryState initialFTS
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
void setBeamSpot(const reco::BeamSpot &beamSpot) override
TrajectoryStateClosestToBeamLine stateAtBeamLine() const override