ROOT  6.06/09
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 ////////////////////////////////////////////////////////////////////////////
19 // //
20 // TVirtualMagField - ABC for magnetic field. Derived classes must //
21 // implement the method: Field(const Double_t *x, Double_t *B) //
22 // //
23 ////////////////////////////////////////////////////////////////////////////
24 
25 class TVirtualMagField : public TNamed
26 {
27 public:
29  TVirtualMagField(const char *name) : TNamed(name,"") {}
30  virtual ~TVirtualMagField();
31 
32  virtual void Field(const Double_t *x, Double_t *B) = 0;
33 
34  ClassDef(TVirtualMagField, 1) // Abstract base field class
35 };
36 
37 
38 ////////////////////////////////////////////////////////////////////////////
39 // //
40 // TGeoUniformMagField - Uniform magnetic field class. //
41 // //
42 ////////////////////////////////////////////////////////////////////////////
43 
45 {
46 private:
47  Double_t fB[3]; // Magnetic field vector
48 
49 protected:
52 
53 public:
56  virtual ~TGeoUniformMagField() {}
57 
58  void Field(const Double_t * /*x*/, Double_t *B) {B[0]=fB[0]; B[1]=fB[1]; B[2]=fB[2];}
59 
60  const Double_t *GetFieldValue() const { return &fB[0]; }
61  void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz) {fB[0]=Bx; fB[1]=By; fB[2]=Bz;}
62 
63  ClassDef(TGeoUniformMagField, 1) // Uniform magnetic field
64 };
65 
66 #endif
static double B[]
virtual void Field(const Double_t *x, Double_t *B)=0
const Double_t * GetFieldValue() const
TGeoUniformMagField & operator=(const TGeoUniformMagField &)
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)
virtual ~TGeoUniformMagField()
double Double_t
Definition: RtypesCore.h:55
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual ~TVirtualMagField()
void Field(const Double_t *, Double_t *B)
void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz)