CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MagneticField.cc
Go to the documentation of this file.
1 
7 
8 MagneticField::MagneticField() { nominalValueCompiuted.store(kUnset, std::memory_order_release); }
9 
10 MagneticField::MagneticField(const MagneticField& orig) : theNominalValue (orig.theNominalValue)
11 { nominalValueCompiuted.store(orig.nominalValueCompiuted.load(std::memory_order_acquire), std::memory_order_release); }
12 
14 
16  return int((inTesla(GlobalPoint(0.f,0.f,0.f))).z() * 10.f + 0.5f);
17 }
18 
20  if(kSet==nominalValueCompiuted.load(std::memory_order_acquire)) return theNominalValue;
21 
22  //need to make one
23  int tmp = computeNominalValue();
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
30 
31  //this must be after the swap
32  nominalValueCompiuted.store(kSet, std::memory_order_release);
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 }
int nominalValue() const
The nominal field value for this map in kGauss.
virtual ~MagneticField()
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
float float float z
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:61
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
virtual int computeNominalValue() const
double f[11][100]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100