CMS 3D CMS Logo

MagneticField.h
Go to the documentation of this file.
1 #ifndef MagneticField_MagneticField_h
2 #define MagneticField_MagneticField_h
3 
11 #include <atomic>
12 
18 
20 {
21  public:
22  MagneticField();
23  MagneticField(const MagneticField& orig);
24  virtual ~MagneticField();
25 
28  virtual MagneticField* clone() const {
29  return nullptr;
30  }
31 
33  virtual GlobalVector inTesla (const GlobalPoint& gp) const = 0;
34 
36  GlobalVector inKGauss(const GlobalPoint& gp) const {
37  return inTesla(gp) * 10.F;
38  }
39 
42  return inTesla(gp) * 2.99792458e-3F;
43  }
44 
46  // engine is defined.
47  virtual bool isDefined(const GlobalPoint& /*gp*/) const {
48  return true;
49  }
50 
53  virtual GlobalVector inTeslaUnchecked (const GlobalPoint& gp) const {
54  return inTesla(gp); // default dummy implementation
55  }
56 
58  int nominalValue() const {
59  if(kSet==nominalValueCompiuted.load()) return theNominalValue;
60  return computeNominalValue();
61  }
62 
63 private:
64  //nominal field value
65  virtual int computeNominalValue() const;
66  mutable std::atomic<char> nominalValueCompiuted;
67 // CMS_THREAD_GUARD(nominalValueCompiuted) mutable int theNominalValue;
68 // PG temporary fix for clang 3.4 which is not parsing thread_guard correctly
71 };
72 
73 #endif
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:53
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:58
virtual ~MagneticField()
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:66
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:41
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:47
virtual int computeNominalValue() const
#define CMS_THREAD_SAFE
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
GlobalVector inKGauss(const GlobalPoint &gp) const
Field value ad specified global point, in KGauss.
Definition: MagneticField.h:36
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
virtual MagneticField * clone() const
Definition: MagneticField.h:28