Loading [MathJax]/extensions/tex2jax.js
ROOT
6.10/09
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
+
Namespaces
Namespace List
+
Namespace Members
+
All
<
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
<
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
u
w
x
+
Enumerations
a
e
f
g
m
p
t
w
y
+
Enumerator
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
w
+
All Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
x
y
+
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
w
y
+
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Properties
f
+
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Files
File List
+
File Members
+
All
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Enumerations
c
e
f
i
l
m
p
r
u
x
+
Enumerator
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
v
w
x
y
z
+
Macros
1
2
3
4
5
6
7
8
9
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
geom
geom
src
TVirtualMagField.cxx
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
#include "
TVirtualMagField.h
"
12
13
#include "
TGeoGlobalMagField.h
"
14
#include "
Rtypes.h
"
15
16
/** \class TVirtualMagField
17
\ingroup Geometry_classes
18
Abstract class for magnetic field. Derived classes are encouraged to
19
use the TVirtualMagField named constructor and must implement the method:
20
21
~~~ {.cpp}
22
Field(const Double_t *x, Double_t *B)
23
~~~
24
25
A field object can be made global via:
26
27
~~~ {.cpp}
28
TGlobalMagField::Instance()->SetField(field) [1]
29
~~~
30
31
A field which is made global is owned by the field manager. The used is not
32
allowed to delete it directly anymore (otherwise a Fatal() is issued). Global
33
field can be deleted by calling [1] with a different argument (which can be
34
NULL). Otherwise the global field is deleted together with the field manager.
35
*/
36
37
ClassImp
(
TVirtualMagField
)
38
39
////////////////////////////////////////////////////////////////////////////////
40
/// Destructor. Unregisters the field.
41
42
TVirtualMagField
::~
TVirtualMagField
()
43
{
44
if
(
TGeoGlobalMagField::GetInstance
()) {
45
TVirtualMagField *global_field =
TGeoGlobalMagField::GetInstance
()->
GetField
();
46
if
(global_field ==
this
)
47
Fatal
(
"~TVirtualMagField"
,
"Not allowed to delete a field once set global. \
48
\n To delete the field call: TGeoGlobalMagField::Instance()->SetField(NULL)"
);
49
}
50
}
51
52
/** \class TGeoUniformMagField
53
\ingroup Geometry_classes
54
55
Implementation for uniform magnetic field.
56
*/
57
58
ClassImp
(
TGeoUniformMagField
)
59
60
////////////////////////////////////////////////////////////////////////////////
61
/// Default constructor;
62
63
TGeoUniformMagField
::
TGeoUniformMagField
()
64
:
TVirtualMagField
()
65
{
66
fB[0] = 0.;
67
fB[1] = 0.;
68
fB[2] = 0.;
69
}
70
71
////////////////////////////////////////////////////////////////////////////////
72
/// Default constructor;
73
74
TGeoUniformMagField::TGeoUniformMagField
(
Double_t
Bx,
Double_t
By,
Double_t
Bz)
75
:
TVirtualMagField
(
"Uniform magnetic field"
)
76
{
77
fB
[0] = Bx;
78
fB
[1] = By;
79
fB
[2] = Bz;
80
}
TVirtualMagField.h
Rtypes.h
Fatal
void Fatal(const char *location, const char *msgfmt,...)
TGeoGlobalMagField::GetField
TVirtualMagField * GetField() const
Definition:
TGeoGlobalMagField.h:35
TGeoUniformMagField::fB
Double_t fB[3]
Definition:
TVirtualMagField.h:38
TGeoGlobalMagField::GetInstance
static TGeoGlobalMagField * GetInstance()
Static getter that does not create the object.
Definition:
TGeoGlobalMagField.cxx:106
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:336
Double_t
double Double_t
Definition:
RtypesCore.h:55
TVirtualMagField
Abstract class for magnetic field.
Definition:
TVirtualMagField.h:16
TGeoUniformMagField::TGeoUniformMagField
TGeoUniformMagField()
Default constructor;.
Definition:
TVirtualMagField.cxx:63
TGeoGlobalMagField.h
TGeoUniformMagField
Implementation for uniform magnetic field.
Definition:
TVirtualMagField.h:35