Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGeoGlobalMagField.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/geom:$Id$
0002 
0003 /*************************************************************************
0004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0005  * All rights reserved.                                                  *
0006  *                                                                       *
0007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0009  *************************************************************************/
0010 
0011 #ifndef ROOT_TGeoGlobalMagField
0012 #define ROOT_TGeoGlobalMagField
0013 
0014 #include "TObject.h"
0015 
0016 #include "TVirtualMagField.h"
0017 
0018 class TGeoGlobalMagField : public TObject {
0019 private:
0020    static TGeoGlobalMagField *fgInstance; // Static pointer to the field manager;
0021    TVirtualMagField *fField{nullptr};     // Magnetic field
0022    Bool_t fLock{kFALSE};                  // Lock flag for global field.
0023 
0024 protected:
0025    TGeoGlobalMagField(const TGeoGlobalMagField &) = delete;
0026    TGeoGlobalMagField &operator=(const TGeoGlobalMagField &) = delete;
0027    void Unlock() { fLock = kFALSE; }
0028 
0029 public:
0030    TGeoGlobalMagField();
0031    ~TGeoGlobalMagField() override;
0032 
0033    // Using SetField() makes a given field global. The field manager owns it from now on.
0034    TVirtualMagField *GetField() const { return fField; }
0035    void SetField(TVirtualMagField *field);
0036    Bool_t IsLocked() { return fLock; }
0037    void Lock();
0038 
0039    // The field manager should be accessed via TGeoGlobalMagField::Instance()
0040    static TGeoGlobalMagField *Instance();
0041    static TGeoGlobalMagField *GetInstance();
0042 
0043    // Inline access to Field() method
0044    void Field(const Double_t *x, Double_t *B)
0045    {
0046       if (fField)
0047          fField->Field(x, B);
0048    }
0049 
0050    ClassDefOverride(TGeoGlobalMagField, 0) // Global field manager
0051 };
0052 
0053 #endif