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
A01
src
A01MagField.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 A01MagField.cxx
11
/// \brief Implementation of the A01MagField class
12
///
13
/// Geant4 example A01 adapted to Virtual Monte Carlo \n
14
///
15
/// \author I. Hrivnacova; IPN, Orsay
16
17
#include <TMath.h>
18
19
#include "
A01MagField.h
"
20
21
/// \cond CLASSIMP
22
ClassImp(
A01MagField
)
23
/// \endcond
24
25
//______________________________________________________________________________
26
A01MagField
::
A01MagField
(Double_t Bx, Double_t By, Double_t Bz)
27
:
TVirtualMagField
(
"A01 magnetic field"
)
28
{
29
/// Standard constructor
30
/// \param Bx The x component of the field value (in kiloGauss)
31
/// \param By The y component of the field value (in kiloGauss)
32
/// \param Bz The z component of the field value (in kiloGauss)
33
34
fB
[0] = Bx;
35
fB
[1] = By;
36
fB
[2] = Bz;
37
}
26
A01MagField
::
A01MagField
(Double_t Bx, Double_t By, Double_t Bz) {
…
}
38
39
//______________________________________________________________________________
40
A01MagField::A01MagField
() :
TVirtualMagField
()
41
{
42
/// Default constructor
43
fB
[0] = 0.;
44
fB
[1] = 0.;
45
fB
[2] = 0.;
46
}
40
A01MagField::A01MagField
() :
TVirtualMagField
() {
…
}
47
48
//______________________________________________________________________________
49
A01MagField::~A01MagField
()
50
{
51
/// Destructor
52
}
49
A01MagField::~A01MagField
() {
…
}
53
54
//______________________________________________________________________________
55
void
A01MagField::Field
(
const
Double_t* x, Double_t* B)
56
{
57
/// Fill in the field value B in the given position at x.
58
/// \param x The position
59
/// \param B The field value (in kiloGauss)
60
61
// G4VSolid* magneticSolid = new
62
// G4Tubs("magneticTubs",0.,1.*m,1.*m,0.,360.*deg); G4VSolid* magneticSolid =
63
// new G4Tubs("magneticTubs",0.,1.*m,1.*m,0.,360.*deg); G4RotationMatrix*
64
// fieldRot = new G4RotationMatrix(); fieldRot->rotateX(90.*deg); new
65
// G4PVPlacement(fieldRot,G4ThreeVector(),magneticLogical,
66
// "magneticPhysical",worldLogical,0,0);
67
68
if
(TMath::Sqrt(x[0] * x[0] + x[2] * x[2]) <= 100.00 &&
69
TMath::Abs(x[1]) <= 100.00) {
70
B[0] =
fB
[0];
71
B[1] =
fB
[1];
72
B[2] =
fB
[2];
73
}
74
else
{
75
B[0] = 0.;
76
B[1] = 0.;
77
B[2] = 0.;
78
}
79
}
55
void
A01MagField::Field
(
const
Double_t* x, Double_t* B) {
…
}
A01MagField.h
Definition of the A01MagField class.
A01MagField
Definition of a uniform magnetic field within a given region.
Definition
A01MagField.h:30
A01MagField::A01MagField
A01MagField(Double_t Bx, Double_t By, Double_t Bz)
Definition
A01MagField.cxx:26
A01MagField::Field
virtual void Field(const Double_t *, Double_t *B)
Definition
A01MagField.cxx:55
A01MagField::fB
Double_t fB[3]
Magnetic field vector.
Definition
A01MagField.h:42
A01MagField::A01MagField
A01MagField()
Definition
A01MagField.cxx:40
A01MagField::~A01MagField
virtual ~A01MagField()
Definition
A01MagField.cxx:49
TVirtualMagField
Generated on Tue Apr 1 2025 13:04:57 for VMC Examples by
1.13.2