// ------------------------------------------------------------------------- // ----- FairField header file ----- // ----- Created 06/01/04 by M. Al-Turany ----- // ----- Redesign 13/02/06 by V. Friese ----- // ----- Redesign 04/08/06 by M. Al-Turany ----- // ------------------------------------------------------------------------- /** FairField.h ** @author M.Al-Turany ** @author V.Friese ** @since 06.01.2004 ** @version1.0 ** ** Abstract base class for magnetic fields in FAIR ** Concrete field should implement the pure virtual methods ** GetBx, GetBy and GetBz and/or GetBxyz ** ** Note: Field values should be returned in kG (thanks to GEANT3) **/ #ifndef FAIRFIELD_H #define FAIRFIELD_H 1 #include "RVersion.h" // for ROOT_VERSION_CODE #include "Riosfwd.h" // for ostream #include "Rtypes.h" // for Double_t, Bool_t, etc #if ROOT_VERSION_CODE < 333824 #ifndef ROOT_TVirtualMagField #define ROOT_TVirtualMagField // copied from ROOT for backward compatibility with ROOT versions before 5.24 #include "TNamed.h" class TVirtualMagField : public TNamed { public: TVirtualMagField() : TNamed() {} TVirtualMagField(const char* name) : TNamed(name,"") {} virtual ~TVirtualMagField() {} virtual void Field(const Double_t* x, Double_t* B) = 0; ClassDef(TVirtualMagField, 1) // Abstract base field class }; ClassImp(TVirtualMagField) #endif #else #include "TVirtualMagField.h" #endif #include // for printf #include // for operator<<, basic_ostream, etc #include "FairLogger.h" class FairField : public TVirtualMagField { public: /** Default constructor **/ FairField(); /** Constructor with name and title **/ FairField(const char* name, const char* title = "FAIR Magnetic Field"); FairField& operator=(const FairField&) {return *this;} /** Destructor **/ virtual ~FairField(); /** Intialisation. E.g. read in the field map. If needed, to be ** implemented in the concrete class. **/ virtual void Init() { }; /** Test whether field type is Constant **/ Bool_t IsConst(); /** Test whether field typ is Map **/ Bool_t IsMap(); /** Field type ( 0=constant, 1=map, 2=map sym2, 3 = map sym3 ) **/ Int_t GetType() const { return fType; } /** Get x component of magnetic field [kG] ** @param x,y,z Position [cm] **/ virtual Double_t GetBx(Double_t x, Double_t y, Double_t z) {LOG(WARNING)<<"FairField::GetBx Should be implemented in User class"<