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