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(), ptr_(), hasTime(false), timeExt_(0), dtErrorExt_(0), theField(nullptr), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset)
25 {
26 }
27 
28 
30  Track(* ptr->bestTrack()), ptr_(ptr), hasTime(false), timeExt_(0), dtErrorExt_(0), theField(field), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset)
31 {
32 
34 }
35 
36 CandidatePtrTransientTrack::CandidatePtrTransientTrack(const CandidatePtr & ptr, const double time, const double dtime, const MagneticField* field) :
37  Track(* ptr->bestTrack()), ptr_(ptr), hasTime(true), timeExt_(time), dtErrorExt_(dtime), theField(field), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset)
38 {
39 
41 }
42 
44 Track(* ptr->bestTrack()), ptr_(ptr), hasTime(false), timeExt_(0), dtErrorExt_(0), theField(field), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset), theTrackingGeometry(tg)
45 {
46 
48 }
49 
51 Track(* ptr->bestTrack()), ptr_(ptr), hasTime(true), timeExt_(time), dtErrorExt_(dtime), theField(field), m_TSOS(kUnset), m_TSCP(kUnset), m_SCTBL(kUnset), theTrackingGeometry(tg)
52 {
53 
55 }
56 
57 
59  Track(tt), ptr_(tt.candidate()),
60  hasTime(tt.hasTime),
62  theField(tt.field()),
64 {
65  // see ThreadSafe statement above about the order of operator= and store
66  if (kSet == tt.m_TSOS.load()) {
68  m_TSOS.store(kSet);
69  }
70  // see ThreadSafe statement above about the order of operator= and store
71  if (kSet == tt.m_TSCP.load()) {
73  m_TSCP.store(kSet);
74  }
75 }
76 
78 
80 
81 }
82 
84 
86 
87 }
88 
90 {
92  m_SCTBL = kUnset;
93 }
94 
96 {
97  // see ThreadSafe statement above about the order of operator= and store
98  if(kSet == m_TSOS.load()) return initialTSOS;
100  auto tmp = tipe.extrapolate(initialFTS, initialFTS.position());
101  char expected = kUnset;
102  if(m_TSOS.compare_exchange_strong(expected, kSetting)) {
103  initialTSOS = tmp;
104  m_TSOS.store(kSet);
105  return initialTSOS;
106  }
107  return tmp;
108 }
109 
111 {
112  // see ThreadSafe statement above about the order of operator= and store
113  if(kSet == m_TSCP.load()) return initialTSCP;
115  char expected = kUnset;
116  if(m_TSCP.compare_exchange_strong(expected, kSetting)) {
117  initialTSCP = tmp;
118  m_TSCP.store(kSet);
119  return initialTSCP;
120  }
121  return tmp;
122 }
123 
125 {
126 
128 }
129 
131 {
132 
134 }
135 
138 {
140  return tipe.extrapolate(initialFTS, point);
141 }
142 
144 {
145  // see ThreadSafe statement above about the order of operator= and store
146  if(kSet == m_SCTBL.load()) return trajectoryStateClosestToBeamLine;
147  TSCBLBuilderNoMaterial blsBuilder;
148  const auto tmp = blsBuilder(initialFTS, theBeamSpot);
149  char expected = kUnset;
150  if(m_SCTBL.compare_exchange_strong(expected, kSetting)) {
152  m_SCTBL.store(kSet);
154  }
155  return tmp;
156 }
157 
TrajectoryStateClosestToPoint initialTSCP
const MagneticField * field() const override
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)
virtual const Track * bestTrack() const
Definition: Candidate.h:247
TrajectoryStateOnSurface impactPointState() const override
void setBeamSpot(const reco::BeamSpot &beamSpot) override
#define nullptr
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
void setTrackingGeometry(const edm::ESHandle< GlobalTrackingGeometry > &) override
void setES(const edm::EventSetup &) override
TrajectoryStateClosestToBeamLine trajectoryStateClosestToBeamLine
TrajectoryStateClosestToPoint impactPointTSCP() const override
CandidatePtr candidate() const override
FreeTrajectoryState initialFreeState() const override
TrajectoryStateOnSurface innermostMeasurementState() const override
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const override
GlobalPoint position() const
TrajectoryStateOnSurface outermostMeasurementState() 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
T get() const
Definition: EventSetup.h:71
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
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)