Logo ROOT   6.10/09
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; // Magnetic field
23  Bool_t fLock; // 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
static double B[]
virtual void Field(const Double_t *x, Double_t *B)=0
TVirtualMagField * GetField() const
static TGeoGlobalMagField * Instance()
Returns always a valid static pointer to the field manager.
bool Bool_t
Definition: RtypesCore.h:59
void Field(const Double_t *x, Double_t *B)
TGeoGlobalMagField()
Global field default constructor.
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual ~TGeoGlobalMagField()
Global field destructor.
Global magnetic field manager.
static TGeoGlobalMagField * GetInstance()
Static getter that does not create the object.
static TGeoGlobalMagField * fgInstance
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGeoGlobalMagField & operator=(const TGeoGlobalMagField &)
double Double_t
Definition: RtypesCore.h:55
Abstract class for magnetic field.
TVirtualMagField * fField
Mother of all ROOT objects.
Definition: TObject.h:37
void Lock()
Locks the global magnetic field if this is set. Cannot be unlocked.
void SetField(TVirtualMagField *field)
Field setter. Deletes previous field if any. Acts only if fLock=kFALSE.