VMC Examples
Version 6.7
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
1
2
3
6
a
b
c
d
e
f
g
h
i
k
m
n
o
p
r
s
t
u
~
Functions
1
2
3
6
a
b
c
d
e
f
g
h
i
m
o
p
r
s
t
u
~
Variables
c
f
n
Enumerations
Enumerator
Files
File List
File Members
All
3
b
c
e
f
g
h
i
l
m
n
o
r
s
t
u
v
Functions
b
c
g
h
i
l
m
n
o
r
s
t
u
v
Variables
Typedefs
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Modules
Pages
Loading...
Searching...
No Matches
examples
E02
src
Ex02MagField.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4
// All rights reserved.
5
//
6
// For the licensing terms see geant4_vmc/LICENSE.
7
// Contact: root-vmc@cern.ch
8
//-------------------------------------------------
9
10
/// \file Ex02MagField.cxx
11
/// \brief Implementation of the Ex02MagField class
12
///
13
/// Geant4 ExampleN02 adapted to Virtual Monte Carlo
14
///
15
/// \author I. Hrivnacova; IPN, Orsay
16
17
#include "
Ex02MagField.h
"
18
19
/// \cond CLASSIMP
20
ClassImp(
Ex02MagField
)
21
/// \endcond
22
23
//______________________________________________________________________________
24
Ex02MagField
::
Ex02MagField
(Double_t Bx, Double_t By, Double_t Bz)
25
:
TVirtualMagField
(
"Ex02 magnetic field"
)
26
{
27
/// Standard constructor
28
/// \param Bx The x component of the field value (in kiloGauss)
29
/// \param By The y component of the field value (in kiloGauss)
30
/// \param Bz The z component of the field value (in kiloGauss)
31
32
fB
[0] = Bx;
33
fB
[1] = By;
34
fB
[2] = Bz;
35
}
24
Ex02MagField
::
Ex02MagField
(Double_t Bx, Double_t By, Double_t Bz) {
…
}
36
37
//______________________________________________________________________________
38
Ex02MagField::Ex02MagField
() :
TVirtualMagField
()
39
{
40
/// Default constructor
41
fB
[0] = 0.;
42
fB
[1] = 0.;
43
fB
[2] = 0.;
44
}
38
Ex02MagField::Ex02MagField
() :
TVirtualMagField
() {
…
}
45
46
//______________________________________________________________________________
47
Ex02MagField::~Ex02MagField
()
48
{
49
/// Destructor
50
}
47
Ex02MagField::~Ex02MagField
() {
…
}
51
52
//______________________________________________________________________________
53
void
Ex02MagField::Field
(
const
Double_t*
/*x*/
, Double_t* B)
54
{
55
/// Fill in the field value B in the given position at x.
56
/// (In case of a uniform magnetic field the value B does not depend on
57
/// the position x )
58
/// \param x The position
59
/// \param B he field value (in kiloGauss)
60
61
// cout << "+++ Getting field in "
62
// << gMC->CurrentVolName() << " " << gMC->CurrentMedium() << endl;
63
64
B[0] =
fB
[0];
65
B[1] =
fB
[1];
66
B[2] =
fB
[2];
67
}
53
void
Ex02MagField::Field
(
const
Double_t*
/*x*/
, Double_t* B) {
…
}
Ex02MagField.h
Definition of the Ex02MagField class.
Ex02MagField
Definition of a uniform magnetic field.
Definition
Ex02MagField.h:35
Ex02MagField::Field
virtual void Field(const Double_t *x, Double_t *B)
Definition
Ex02MagField.cxx:53
Ex02MagField::fB
Double_t fB[3]
Magnetic field vector.
Definition
Ex02MagField.h:47
Ex02MagField::Ex02MagField
Ex02MagField(Double_t Bx, Double_t By, Double_t Bz)
Definition
Ex02MagField.cxx:24
Ex02MagField::Ex02MagField
Ex02MagField()
Definition
Ex02MagField.cxx:38
Ex02MagField::~Ex02MagField
virtual ~Ex02MagField()
Definition
Ex02MagField.cxx:47
TVirtualMagField
Generated on Tue Apr 1 2025 13:04:57 for VMC Examples by
1.13.2