CMS 3D CMS Logo

MagneticField.cc
Go to the documentation of this file.
1 
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) {
14  }
15 }
16 
18 
20  int tmp = int((inTesla(GlobalPoint(0.f, 0.f, 0.f))).z() * 10.f + 0.5f);
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
27 
28  //this must be after the swap
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::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
MagneticField::computeNominalValue
virtual int computeNominalValue() const
Definition: MagneticField.cc:19
MagneticField::theNominalValue
int theNominalValue
Definition: MagneticField.h:61
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
MagneticField::MagneticField
MagneticField()
Definition: MagneticField.cc:8
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
DDAxes::z
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
createfilelist.int
int
Definition: createfilelist.py:10
MagneticField::nominalValueCompiuted
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:58
MagneticField::~MagneticField
virtual ~MagneticField()
Definition: MagneticField.cc:17
MagneticField.h
MagneticField::kUnset
Definition: MagneticField.h:62
MagneticField::kSetting
Definition: MagneticField.h:62
MagneticField
Definition: MagneticField.h:19
MagneticField::kSet
Definition: MagneticField.h:62