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 public:
21  MagneticField();
22  MagneticField(const MagneticField& orig);
23  virtual ~MagneticField();
24 
27  virtual MagneticField* clone() const { return nullptr; }
28 
30  virtual GlobalVector inTesla(const GlobalPoint& gp) const = 0;
31 
33  GlobalVector inKGauss(const GlobalPoint& gp) const { return inTesla(gp) * 10.F; }
34 
36  GlobalVector inInverseGeV(const GlobalPoint& gp) const { return inTesla(gp) * 2.99792458e-3F; }
37 
39  // engine is defined.
40  virtual bool isDefined(const GlobalPoint& /*gp*/) const { return true; }
41 
44  virtual GlobalVector inTeslaUnchecked(const GlobalPoint& gp) const {
45  return inTesla(gp); // default dummy implementation
46  }
47 
49  int nominalValue() const {
50  if (kSet == nominalValueCompiuted.load())
51  return theNominalValue;
52  return computeNominalValue();
53  }
54 
55 private:
56  //nominal field value
57  virtual int computeNominalValue() const;
58  mutable std::atomic<char> nominalValueCompiuted;
59  // CMS_THREAD_GUARD(nominalValueCompiuted) mutable int theNominalValue;
60  // PG temporary fix for clang 3.4 which is not parsing thread_guard correctly
63 };
64 
65 #endif
Vector3DBase
Definition: Vector3DBase.h:8
Likely.h
Visibility.h
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
MagneticField::isDefined
virtual bool isDefined(const GlobalPoint &) const
True if the point is within the region where the concrete field.
Definition: MagneticField.h:40
MagneticField::computeNominalValue
virtual int computeNominalValue() const
Definition: MagneticField.cc:19
MagneticField::theNominalValue
int theNominalValue
Definition: MagneticField.h:61
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
MagneticField::MagneticField
MagneticField()
Definition: MagneticField.cc:8
MagneticField::nominalValue
int nominalValue() const
The nominal field value for this map in kGauss.
Definition: MagneticField.h:49
CMS_THREAD_SAFE
#define CMS_THREAD_SAFE
Definition: thread_safety_macros.h:4
Point3DBase< float, GlobalTag >
MagneticField::inInverseGeV
GlobalVector inInverseGeV(const GlobalPoint &gp) const
Field value ad specified global point, in 1/Gev.
Definition: MagneticField.h:36
MagneticField::clone
virtual MagneticField * clone() const
Definition: MagneticField.h:27
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
MagneticField::FooStates
FooStates
Definition: MagneticField.h:62
thread_safety_macros.h
MagneticField::nominalValueCompiuted
std::atomic< char > nominalValueCompiuted
Definition: MagneticField.h:58
MagneticField::~MagneticField
virtual ~MagneticField()
Definition: MagneticField.cc:17
MagneticField::kUnset
Definition: MagneticField.h:62
MagneticField::kSetting
Definition: MagneticField.h:62
GlobalVector.h
MagneticField::inKGauss
GlobalVector inKGauss(const GlobalPoint &gp) const
Field value ad specified global point, in KGauss.
Definition: MagneticField.h:33
MagneticField
Definition: MagneticField.h:19
GlobalPoint.h
MagneticField::inTeslaUnchecked
virtual GlobalVector inTeslaUnchecked(const GlobalPoint &gp) const
Definition: MagneticField.h:44
MagneticField::kSet
Definition: MagneticField.h:62