Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
16class TVirtualMagField : public TNamed {
17public:
19 TVirtualMagField(const char *name) : TNamed(name, "") {}
20 ~TVirtualMagField() override;
21
22 virtual void Field(const Double_t *x, Double_t *B) = 0;
23
24 ClassDefOverride(TVirtualMagField, 1) // Abstract base field class
25};
26
27////////////////////////////////////////////////////////////////////////////
28// //
29// TGeoUniformMagField - Uniform magnetic field class. //
30// //
31////////////////////////////////////////////////////////////////////////////
32
34private:
35 Double_t fB[3]; // Magnetic field vector
36
37protected:
40
41public:
45
46 void Field(const Double_t * /*x*/, Double_t *B) override
47 {
48 B[0] = fB[0];
49 B[1] = fB[1];
50 B[2] = fB[2];
51 }
52
53 const Double_t *GetFieldValue() const { return &fB[0]; }
55 {
56 fB[0] = Bx;
57 fB[1] = By;
58 fB[2] = Bz;
59 }
60
61 ClassDefOverride(TGeoUniformMagField, 1) // Uniform magnetic field
62};
63
64#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
char name[80]
Definition TGX11.cxx:110
Implementation for uniform magnetic field.
void Field(const Double_t *, Double_t *B) override
TGeoUniformMagField()
Default constructor;.
~TGeoUniformMagField() override
void SetFieldValue(Double_t Bx, Double_t By, Double_t Bz)
TGeoUniformMagField(const TGeoUniformMagField &)=delete
TGeoUniformMagField & operator=(const TGeoUniformMagField &)=delete
const Double_t * GetFieldValue() const
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Abstract class for magnetic field.
virtual void Field(const Double_t *x, Double_t *B)=0
TVirtualMagField(const char *name)
~TVirtualMagField() override
Destructor. Unregisters the field.
Double_t x[n]
Definition legend1.C:17