Main Page
Namespaces
Classes
Package Documentation
MagneticField
Engine
src
MagneticField.cc
Go to the documentation of this file.
1
6
#include "
MagneticField/Engine/interface/MagneticField.h
"
7
8
MagneticField::MagneticField
() : nominalValueCompiuted(kUnset), theNominalValue(0) {}
9
10
MagneticField::MagneticField
(
const
MagneticField
& orig) :
nominalValueCompiuted
(
kUnset
),
theNominalValue
(0) {
11
if
(orig.
nominalValueCompiuted
.load() ==
kSet
) {
12
theNominalValue
= orig.
theNominalValue
;
13
nominalValueCompiuted
.store(
kSet
);
14
}
15
}
16
17
MagneticField::~MagneticField
() {}
18
19
int
MagneticField::computeNominalValue
()
const
{
20
int
tmp
=
int
((
inTesla
(
GlobalPoint
(0.
f
, 0.
f
, 0.
f
))).
z
() * 10.
f
+ 0.5
f
);
21
22
//Try to cache
23
char
expected =
kUnset
;
24
if
(
nominalValueCompiuted
.compare_exchange_strong(expected,
kSetting
)) {
25
//it is our job to set the value
26
std::swap
(
theNominalValue
, tmp);
27
28
//this must be after the swap
29
nominalValueCompiuted
.store(
kSet
);
30
return
theNominalValue
;
31
}
32
//another thread beat us to trying to set theNominalValue
33
// since we don't know when the other thread will finish
34
// we just return tmp
35
return
tmp
;
36
}
MagneticField::kSetting
Definition:
MagneticField.h:62
MagneticField::~MagneticField
virtual ~MagneticField()
Definition:
MagneticField.cc:17
GlobalPoint
Global3DPoint GlobalPoint
Definition:
GlobalPoint.h:10
MagneticField
Definition:
MagneticField.h:19
MagneticField::kSet
Definition:
MagneticField.h:62
MagneticField::nominalValueCompiuted
std::atomic< char > nominalValueCompiuted
Definition:
MagneticField.h:58
MagneticField.h
createfilelist.int
int
Definition:
createfilelist.py:10
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition:
DataFrameContainer.h:205
MagneticField::computeNominalValue
virtual int computeNominalValue() const
Definition:
MagneticField.cc:19
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
MagneticField::theNominalValue
int theNominalValue
Definition:
MagneticField.h:61
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
DDAxes::z
MagneticField::kUnset
Definition:
MagneticField.h:62
MagneticField::MagneticField
MagneticField()
Definition:
MagneticField.cc:8
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
Generated for CMSSW Reference Manual by
1.8.11