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 
121 }
122 
124  theTrackingGeometry = tg;
125 }
126 
129  m_SCTBL = kUnset;
130 }
131 
133  // see ThreadSafe statement above about the order of operator= and store
134  if (kSet == m_TSOS.load())
135  return initialTSOS;
137  auto tmp = tipe.extrapolate(initialFTS, initialFTS.position());
138  char expected = kUnset;
139  if (m_TSOS.compare_exchange_strong(expected, kSetting)) {
140  initialTSOS = tmp;
141  m_TSOS.store(kSet);
142  return initialTSOS;
143  }
144  return tmp;
145 }
146 
148  // see ThreadSafe statement above about the order of operator= and store
149  if (kSet == m_TSCP.load())
150  return initialTSCP;
152  char expected = kUnset;
153  if (m_TSCP.compare_exchange_strong(expected, kSetting)) {
154  initialTSCP = tmp;
155  m_TSCP.store(kSet);
156  return initialTSCP;
157  }
158  return tmp;
159 }
160 
163 }
164 
167 }
168 
171  return tipe.extrapolate(initialFTS, point);
172 }
173 
175  // see ThreadSafe statement above about the order of operator= and store
176  if (kSet == m_SCTBL.load())
178  TSCBLBuilderNoMaterial blsBuilder;
179  const auto tmp = blsBuilder(initialFTS, theBeamSpot);
180  char expected = kUnset;
181  if (m_SCTBL.compare_exchange_strong(expected, kSetting)) {
183  m_SCTBL.store(kSet);
185  }
186  return tmp;
187 }
reco::CandidatePtrTransientTrack::m_TSCP
std::atomic< char > m_TSCP
Definition: CandidatePtrTransientTrack.h:105
TSCBLBuilderNoMaterial.h
TrajectoryStateClosestToBeamLine
Definition: TrajectoryStateClosestToBeamLine.h:15
reco::CandidatePtrTransientTrack::initialTSOS
TrajectoryStateOnSurface initialTSOS
Definition: CandidatePtrTransientTrack.h:100
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
funct::false
false
Definition: Factorize.h:34
trajectoryStateTransform::initialFreeState
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:58
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
reco::CandidatePtrTransientTrack::CandidatePtrTransientTrack
CandidatePtrTransientTrack()
Definition: CandidatePtrTransientTrack.cc:23
reco::CandidatePtrTransientTrack::theField
const MagneticField * theField
Definition: CandidatePtrTransientTrack.h:94
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
reco::CandidatePtrTransientTrack
Definition: CandidatePtrTransientTrack.h:19
reco::CandidatePtrTransientTrack::trajectoryStateClosestToBeamLine
TrajectoryStateClosestToBeamLine trajectoryStateClosestToBeamLine
Definition: CandidatePtrTransientTrack.h:102
TransverseImpactPointExtrapolator
Definition: TransverseImpactPointExtrapolator.h:26
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
ptr_
const char * ptr_
Definition: DataKey.cc:76
reco::CandidatePtrTransientTrack::initialTSCP
TrajectoryStateClosestToPoint initialTSCP
Definition: CandidatePtrTransientTrack.h:101
reco::CandidatePtrTransientTrack::impactPointState
TrajectoryStateOnSurface impactPointState() const override
Definition: CandidatePtrTransientTrack.cc:132
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
trajectoryStateTransform::outerStateOnSurface
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:118
reco::CandidatePtrTransientTrack::initialFTS
FreeTrajectoryState initialFTS
Definition: CandidatePtrTransientTrack.h:96
reco::CandidatePtrTransientTrack::builder
TSCPBuilderNoMaterial builder
Definition: CandidatePtrTransientTrack.h:108
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
reco::CandidatePtrTransientTrack::m_SCTBL
std::atomic< char > m_SCTBL
Definition: CandidatePtrTransientTrack.h:106
reco::CandidatePtrTransientTrack::field
const MagneticField * field() const override
Definition: CandidatePtrTransientTrack.h:81
reco::BeamSpot
Definition: BeamSpot.h:21
reco::Track
Definition: Track.h:27
reco::CandidatePtrTransientTrack::outermostMeasurementState
TrajectoryStateOnSurface outermostMeasurementState() const override
Definition: CandidatePtrTransientTrack.cc:161
reco::CandidatePtrTransientTrack::theTrackingGeometry
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
Definition: CandidatePtrTransientTrack.h:109
edm::ESHandle< GlobalTrackingGeometry >
reco::CandidatePtrTransientTrack::innermostMeasurementState
TrajectoryStateOnSurface innermostMeasurementState() const override
Definition: CandidatePtrTransientTrack.cc:165
reco::CandidatePtrTransientTrack::kUnset
Definition: CandidatePtrTransientTrack.h:113
GlobalTrackingGeometryRecord.h
funct::true
true
Definition: Factorize.h:173
reco::CandidatePtrTransientTrack::stateOnSurface
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const override
Definition: CandidatePtrTransientTrack.cc:169
reco::CandidatePtrTransientTrack::setES
void setES(const edm::EventSetup &) override
Definition: CandidatePtrTransientTrack.cc:119
edm::EventSetup
Definition: EventSetup.h:57
TrajectoryStateClosestToPoint
Definition: TrajectoryStateClosestToPoint.h:18
reco::CandidatePtrTransientTrack::stateAtBeamLine
TrajectoryStateClosestToBeamLine stateAtBeamLine() const override
Definition: CandidatePtrTransientTrack.cc:174
reco::get
T get(const Candidate &c)
Definition: component.h:60
edm::Ptr< Candidate >
CandidatePtrTransientTrack.h
reco::CandidatePtrTransientTrack::kSetting
Definition: CandidatePtrTransientTrack.h:113
reco::CandidatePtrTransientTrack::kSet
Definition: CandidatePtrTransientTrack.h:113
reco::Candidate::bestTrack
virtual const Track * bestTrack() const
Definition: Candidate.h:268
TSCBLBuilderNoMaterial
Definition: TSCBLBuilderNoMaterial.h:13
reco::CandidatePtrTransientTrack::impactPointTSCP
TrajectoryStateClosestToPoint impactPointTSCP() const override
Definition: CandidatePtrTransientTrack.cc:147
reco::CandidatePtrTransientTrack::theBeamSpot
reco::BeamSpot theBeamSpot
Definition: CandidatePtrTransientTrack.h:110
TransverseImpactPointExtrapolator.h
TransverseImpactPointExtrapolator::extrapolate
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
Definition: TransverseImpactPointExtrapolator.cc:23
TrajectoryStateTransform.h
reco::CandidatePtrTransientTrack::m_TSOS
std::atomic< char > m_TSOS
Definition: CandidatePtrTransientTrack.h:104
math::GlobalPoint
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
trajectoryStateTransform::innerStateOnSurface
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field, bool withErr=true)
Definition: TrajectoryStateTransform.cc:110
point
*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
ntuplemaker.time
time
Definition: ntuplemaker.py:310
reco::CandidatePtrTransientTrack::setBeamSpot
void setBeamSpot(const reco::BeamSpot &beamSpot) override
Definition: CandidatePtrTransientTrack.cc:127
MagneticField
Definition: MagneticField.h:19
reco::CandidatePtrTransientTrack::setTrackingGeometry
void setTrackingGeometry(const edm::ESHandle< GlobalTrackingGeometry > &) override
Definition: CandidatePtrTransientTrack.cc:123