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