Logo ROOT  
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 #include "TNamed.h"
15 
16 class TVirtualMagField : public TNamed
17 {
18 public:
20  TVirtualMagField(const char *name) : TNamed(name,"") {}
21  virtual ~TVirtualMagField();
22 
23  virtual void Field(const Double_t *x, Double_t *B) = 0;
24 
25  ClassDef(TVirtualMagField, 1) // Abstract base field class
26 };
27 
28 
29 ////////////////////////////////////////////////////////////////////////////
30 // //
31 // TGeoUniformMagField - Uniform magnetic field class. //
32 // //
33 ////////////////////////////////////////////////////////////////////////////
34 
36 {
37 private:
38  Double_t fB[3]; // Magnetic field vector
39 
40 protected:
43 
44 public:
47  virtual ~TGeoUniformMagField() {}
48 
49  void Field(const Double_t * /*x*/, Double_t *B) override {B[0]=fB[0]; B[1]=fB[1]; B[2]=fB[2];}
50 
51  const Double_t *GetFieldValue() const { return &fB[0]; }
52  void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz) {fB[0]=Bx; fB[1]=By; fB[2]=Bz;}
53 
54  ClassDefOverride(TGeoUniformMagField, 1) // Uniform magnetic field
55 };
56 
57 #endif
TGeoUniformMagField::operator=
TGeoUniformMagField & operator=(const TGeoUniformMagField &)=delete
TGeoUniformMagField
Implementation for uniform magnetic field.
Definition: TVirtualMagField.h:36
TVirtualMagField::Field
virtual void Field(const Double_t *x, Double_t *B)=0
TGeoUniformMagField::TGeoUniformMagField
TGeoUniformMagField()
Default constructor;.
Definition: TVirtualMagField.cxx:62
TNamed.h
x
Double_t x[n]
Definition: legend1.C:17
TVirtualMagField
Abstract class for magnetic field.
Definition: TVirtualMagField.h:17
ClassDefOverride
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
TGeoUniformMagField::fB
Double_t fB[3]
Definition: TVirtualMagField.h:38
TGeoUniformMagField::SetFieldValue
void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz)
Definition: TVirtualMagField.h:52
TGeoUniformMagField::Field
void Field(const Double_t *, Double_t *B) override
Definition: TVirtualMagField.h:49
TVirtualMagField::TVirtualMagField
TVirtualMagField(const char *name)
Definition: TVirtualMagField.h:20
TGeoUniformMagField::TGeoUniformMagField
TGeoUniformMagField(const TGeoUniformMagField &)=delete
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TVirtualMagField::TVirtualMagField
TVirtualMagField()
Definition: TVirtualMagField.h:19
Double_t
double Double_t
Definition: RtypesCore.h:59
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
TGeoUniformMagField::GetFieldValue
const Double_t * GetFieldValue() const
Definition: TVirtualMagField.h:51
ROOT::Math::Cephes::B
static double B[]
Definition: SpecFuncCephes.cxx:178
TGeoUniformMagField::~TGeoUniformMagField
virtual ~TGeoUniformMagField()
Definition: TVirtualMagField.h:47
TVirtualMagField::~TVirtualMagField
virtual ~TVirtualMagField()
Destructor. Unregisters the field.
Definition: TVirtualMagField.cxx:41