VMC Examples
Version 6.6
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
}
38
39
//______________________________________________________________________________
40
A01MagField::A01MagField
() :
TVirtualMagField
()
41
{
42
/// Default constructor
43
fB
[0] = 0.;
44
fB
[1] = 0.;
45
fB
[2] = 0.;
46
}
47
48
//______________________________________________________________________________
49
A01MagField::~A01MagField
()
50
{
51
/// Destructor
52
}
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
}
A01MagField.h
Definition of the A01MagField class.
A01MagField
Definition of a uniform magnetic field within a given region.
Definition
A01MagField.h:30
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 Thu Oct 17 2024 08:29:51 for VMC Examples by
1.12.0