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(kUnset), theNominalValue(0)
9 {
10 }
11 
12 MagneticField::MagneticField(const MagneticField& orig) : nominalValueCompiuted(kUnset), theNominalValue(0)
13 {
14  if(orig.nominalValueCompiuted.load() == kSet) {
17  }
18 }
19 
21 
23  int tmp = int((inTesla(GlobalPoint(0.f,0.f,0.f))).z() * 10.f + 0.5f);
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
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 }
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:64
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