Logo ROOT   6.08/07
Reference Guide
TVirtualMagField.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_TVirtualMagField
12 #define ROOT_TVirtualMagField
13 
14 #ifndef ROOT_TNamed
15 #include "TNamed.h"
16 #endif
17 
18 class TVirtualMagField : public TNamed
19 {
20 public:
22  TVirtualMagField(const char *name) : TNamed(name,"") {}
23  virtual ~TVirtualMagField();
24 
25  virtual void Field(const Double_t *x, Double_t *B) = 0;
26 
27  ClassDef(TVirtualMagField, 1) // Abstract base field class
28 };
29 
30 
31 ////////////////////////////////////////////////////////////////////////////
32 // //
33 // TGeoUniformMagField - Uniform magnetic field class. //
34 // //
35 ////////////////////////////////////////////////////////////////////////////
36 
38 {
39 private:
40  Double_t fB[3]; // Magnetic field vector
41 
42 protected:
45 
46 public:
49  virtual ~TGeoUniformMagField() {}
50 
51  void Field(const Double_t * /*x*/, Double_t *B) {B[0]=fB[0]; B[1]=fB[1]; B[2]=fB[2];}
52 
53  const Double_t *GetFieldValue() const { return &fB[0]; }
54  void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz) {fB[0]=Bx; fB[1]=By; fB[2]=Bz;}
55 
56  ClassDef(TGeoUniformMagField, 1) // Uniform magnetic field
57 };
58 
59 #endif
static double B[]
const Double_t * GetFieldValue() const
virtual void Field(const Double_t *x, Double_t *B)=0
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
TVirtualMagField(const char *name)
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:42
virtual ~TGeoUniformMagField()
double Double_t
Definition: RtypesCore.h:55
Abstract class for magnetic field.
virtual ~TVirtualMagField()
Destructor. Unregisters the field.
void Field(const Double_t *, Double_t *B)
char name[80]
Definition: TGX11.cxx:109
Implementation for uniform magnetic field.
void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz)