File indexing completed on 2024-04-06 12:22:35
0001 #ifndef MagneticField_UniformMagneticField_h
0002 #define MagneticField_UniformMagneticField_h
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "MagneticField/Engine/interface/MagneticField.h"
0012
0013 class UniformMagneticField final : public MagneticField {
0014 public:
0015
0016 UniformMagneticField(float value) : theField(0.f, 0.f, value) { setNominalValue(); }
0017
0018 UniformMagneticField(GlobalVector value) : theField(value) { setNominalValue(); }
0019
0020 void set(GlobalVector value) { theField = value; }
0021 void set(float value) { set(GlobalVector(0.f, 0.f, value)); }
0022
0023 ~UniformMagneticField() override {}
0024
0025 GlobalVector inTesla(const GlobalPoint&) const override { return theField; }
0026
0027 GlobalVector inTeslaUnchecked(const GlobalPoint& gp) const override { return theField; }
0028
0029 bool isDefined(const GlobalPoint& gp) const override { return true; }
0030
0031 private:
0032 GlobalVector theField;
0033 };
0034
0035 #endif