Logo ROOT  
Reference Guide
TGeoGlobalMagField.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_TGeoGlobalMagField
12 #define ROOT_TGeoGlobalMagField
13 
14 #include "TObject.h"
15 
16 #include "TVirtualMagField.h"
17 
19 {
20 private:
21  static TGeoGlobalMagField *fgInstance; // Static pointer to the field manager;
22  TVirtualMagField *fField{nullptr}; // Magnetic field
23  Bool_t fLock{kFALSE}; // Lock flag for global field.
24 
25 protected:
28  void Unlock() {fLock = kFALSE;}
29 
30 public:
32  virtual ~TGeoGlobalMagField();
33 
34  // Using SetField() makes a given field global. The field manager owns it from now on.
35  TVirtualMagField *GetField() const {return fField;}
36  void SetField(TVirtualMagField *field);
37  Bool_t IsLocked() {return fLock;}
38  void Lock();
39 
40  // The field manager should be accessed via TGeoGlobalMagField::Instance()
41  static TGeoGlobalMagField *Instance();
43 
44  // Inline access to Field() method
45  void Field(const Double_t *x, Double_t *B) {if (fField) fField->Field(x,B);}
46 
47  ClassDef(TGeoGlobalMagField, 0) // Global field manager
48 };
49 
50 #endif
TGeoGlobalMagField::Instance
static TGeoGlobalMagField * Instance()
Returns always a valid static pointer to the field manager.
Definition: TGeoGlobalMagField.cxx:116
TGeoGlobalMagField::Field
void Field(const Double_t *x, Double_t *B)
Definition: TGeoGlobalMagField.h:45
TGeoGlobalMagField::IsLocked
Bool_t IsLocked()
Definition: TGeoGlobalMagField.h:37
TGeoGlobalMagField::Lock
void Lock()
Locks the global magnetic field if this is set. Cannot be unlocked.
Definition: TGeoGlobalMagField.cxx:125
TGeoGlobalMagField::operator=
TGeoGlobalMagField & operator=(const TGeoGlobalMagField &)=delete
TVirtualMagField::Field
virtual void Field(const Double_t *x, Double_t *B)=0
TGeoGlobalMagField::TGeoGlobalMagField
TGeoGlobalMagField()
Global field default constructor.
Definition: TGeoGlobalMagField.cxx:50
x
Double_t x[n]
Definition: legend1.C:17
TVirtualMagField
Abstract class for magnetic field.
Definition: TVirtualMagField.h:17
bool
TGeoGlobalMagField::Unlock
void Unlock()
Definition: TGeoGlobalMagField.h:28
TGeoGlobalMagField::GetInstance
static TGeoGlobalMagField * GetInstance()
Static getter that does not create the object.
Definition: TGeoGlobalMagField.cxx:108
TGeoGlobalMagField::fLock
Bool_t fLock
Definition: TGeoGlobalMagField.h:23
TGeoGlobalMagField
Global magnetic field manager.
Definition: TGeoGlobalMagField.h:19
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TVirtualMagField.h
TGeoGlobalMagField::~TGeoGlobalMagField
virtual ~TGeoGlobalMagField()
Global field destructor.
Definition: TGeoGlobalMagField.cxx:72
Double_t
double Double_t
Definition: RtypesCore.h:59
TObject.h
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGeoGlobalMagField::fgInstance
static TGeoGlobalMagField * fgInstance
Definition: TGeoGlobalMagField.h:21
TGeoGlobalMagField::SetField
void SetField(TVirtualMagField *field)
Field setter. Deletes previous field if any. Acts only if fLock=kFALSE.
Definition: TGeoGlobalMagField.cxx:86
ROOT::Math::Cephes::B
static double B[]
Definition: SpecFuncCephes.cxx:178
TGeoGlobalMagField::GetField
TVirtualMagField * GetField() const
Definition: TGeoGlobalMagField.h:35
TGeoGlobalMagField::TGeoGlobalMagField
TGeoGlobalMagField(const TGeoGlobalMagField &)=delete
TGeoGlobalMagField::fField
TVirtualMagField * fField
Definition: TGeoGlobalMagField.h:22