Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
persistency
P01
src
ExP01MagneticField.cc
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
28
//
29
//
30
// $Id$
31
//
32
// User Field class implementation.
33
//
34
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
36
37
#include "
ExP01MagneticField.hh
"
38
#include "
G4FieldManager.hh
"
39
40
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41
42
ExP01MagneticField::ExP01MagneticField
()
43
:
G4UniformMagField
(
G4ThreeVector
())
44
{
45
GetGlobalFieldManager
()->
SetDetectorField
(
this
);
46
GetGlobalFieldManager
()->
CreateChordFinder
(
this
);
47
}
48
49
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50
51
ExP01MagneticField::ExP01MagneticField
(
G4ThreeVector
fieldVector)
52
:
G4UniformMagField
(fieldVector)
53
{
54
GetGlobalFieldManager
()->
SetDetectorField
(
this
);
55
GetGlobalFieldManager
()->
CreateChordFinder
(
this
);
56
}
57
58
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59
60
// Set the value of the Global Field to fieldValue along X
61
//
62
void
ExP01MagneticField::SetFieldValue
(
G4double
fieldValue)
63
{
64
G4UniformMagField::SetFieldValue
(
G4ThreeVector
(fieldValue,0,0));
65
}
66
67
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68
69
// Set the value of the Global Field
70
//
71
void
ExP01MagneticField::SetFieldValue
(
G4ThreeVector
fieldVector)
72
{
73
// Find the Field Manager for the global field
74
G4FieldManager
* fieldMgr=
GetGlobalFieldManager
();
75
76
if
(fieldVector!=
G4ThreeVector
(0.,0.,0.))
77
{
78
G4UniformMagField::SetFieldValue
(fieldVector);
79
fieldMgr->
SetDetectorField
(
this
);
80
}
else
{
81
// If the new field's value is Zero, then it is best to
82
// insure that it is not used for propagation.
83
G4MagneticField
* magField = NULL;
84
fieldMgr->
SetDetectorField
(magField);
85
}
86
}
87
88
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89
90
ExP01MagneticField::~ExP01MagneticField
()
91
{
92
// GetGlobalFieldManager()->SetDetectorField(0);
93
}
94
95
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96
97
#include "
G4TransportationManager.hh
"
98
99
G4FieldManager
*
ExP01MagneticField::GetGlobalFieldManager
()
100
{
101
return
G4TransportationManager::GetTransportationManager
()->
GetFieldManager
();
102
}
103
104
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Generated on Sat May 25 2013 14:33:00 for Geant4 by
1.8.4