ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
F03FieldMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file F03FieldMessenger.cc
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
//
31
//
32
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34
35
#include "
F03FieldMessenger.hh
"
36
37
#include "
F03FieldSetup.hh
"
38
#include "
G4UIcmdWithAnInteger.hh
"
39
#include "
G4UIcmdWithADoubleAndUnit.hh
"
40
#include "
G4UIcmdWith3VectorAndUnit.hh
"
41
#include "
G4UIcmdWithoutParameter.hh
"
42
43
#include "
G4SystemOfUnits.hh
"
44
45
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47
F03FieldMessenger::F03FieldMessenger
(
F03FieldSetup
* fieldSetup)
48
:
G4UImessenger
(),
49
fEMfieldSetup(fieldSetup),
50
fFieldDir(0),
51
fStepperCmd(0),
52
fMagFieldZCmd(0),
53
fMagFieldCmd(0),
54
fLocalMagFieldCmd(0),
55
fMinStepCmd(0),
56
fUpdateCmd(0)
57
{
58
fFieldDir
=
new
G4UIdirectory
(
"/field/"
);
59
fFieldDir
->
SetGuidance
(
"F03 field tracking control."
);
60
61
fStepperCmd
=
new
G4UIcmdWithAnInteger
(
"/field/setStepperType"
,
this
);
62
fStepperCmd
->
SetGuidance
(
"Select stepper type for magnetic field"
);
63
fStepperCmd
->
SetParameterName
(
"choice"
,
true
);
64
fStepperCmd
->
SetDefaultValue
(4);
65
fStepperCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
66
67
fUpdateCmd
=
new
G4UIcmdWithoutParameter
(
"/field/update"
,
this
);
68
fUpdateCmd
->
SetGuidance
(
"Update calorimeter geometry."
);
69
fUpdateCmd
->
SetGuidance
(
"This command MUST be applied before \"beamOn\" "
);
70
fUpdateCmd
->
SetGuidance
(
"if you changed geometrical value(s)."
);
71
fUpdateCmd
->
AvailableForStates
(
G4State_Idle
);
72
73
fMagFieldZCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/field/setFieldZ"
,
this
);
74
fMagFieldZCmd
->
SetGuidance
(
"Define global magnetic field."
);
75
fMagFieldZCmd
->
SetGuidance
(
"Global magnetic field will be in Z direction."
);
76
fMagFieldZCmd
->
SetParameterName
(
"Bz"
,
false
,
false
);
77
fMagFieldZCmd
->
SetDefaultUnit
(
"tesla"
);
78
fMagFieldZCmd
->
AvailableForStates
(
G4State_Idle
);
79
80
fMagFieldCmd
=
new
G4UIcmdWith3VectorAndUnit
(
"/field/setField"
,
this
);
81
fMagFieldCmd
->
SetGuidance
(
"Define global magnetic field."
);
82
fMagFieldCmd
->
SetParameterName
(
"Bx"
,
"By"
,
"Bz"
,
false
,
false
);
83
fMagFieldCmd
->
SetDefaultUnit
(
"tesla"
);
84
fMagFieldCmd
->
AvailableForStates
(
G4State_Idle
);
85
86
fLocalMagFieldCmd
=
new
G4UIcmdWith3VectorAndUnit
(
"/field/setLocalField"
,
this
);
87
fLocalMagFieldCmd
->
SetGuidance
(
"Define local magnetic field."
);
88
fLocalMagFieldCmd
->
SetParameterName
(
"Blx"
,
"Bly"
,
"Blz"
,
false
,
false
);
89
fLocalMagFieldCmd
->
SetDefaultUnit
(
"tesla"
);
90
fLocalMagFieldCmd
->
AvailableForStates
(
G4State_Idle
);
91
92
fMinStepCmd
=
new
G4UIcmdWithADoubleAndUnit
(
"/field/setMinStep"
,
this
);
93
fMinStepCmd
->
SetGuidance
(
"Define minimal step"
);
94
fMinStepCmd
->
SetGuidance
(
"Magnetic field will be in Z direction."
);
95
fMinStepCmd
->
SetParameterName
(
"min step"
,
false
,
false
);
96
fMinStepCmd
->
SetDefaultUnit
(
"mm"
);
97
fMinStepCmd
->
AvailableForStates
(
G4State_Idle
);
98
}
99
100
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101
102
F03FieldMessenger::~F03FieldMessenger
()
103
{
104
delete
fStepperCmd
;
105
delete
fMagFieldZCmd
;
106
delete
fMagFieldCmd
;
107
delete
fLocalMagFieldCmd
;
108
delete
fMinStepCmd
;
109
delete
fFieldDir
;
110
delete
fUpdateCmd
;
111
}
112
113
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114
115
void
F03FieldMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
116
{
117
if
( command ==
fStepperCmd
)
118
fEMfieldSetup
->
SetStepperType
(
fStepperCmd
->
GetNewIntValue
(newValue));
119
if
( command ==
fUpdateCmd
)
120
fEMfieldSetup
->
UpdateField
();
121
if
( command ==
fMagFieldZCmd
)
122
{
123
fEMfieldSetup
->
SetFieldZValue
(
fMagFieldZCmd
->
GetNewDoubleValue
(newValue));
124
// Check the value
125
G4cout
<<
"Set global field value to "
<<
126
fEMfieldSetup
->
GetGlobalFieldValue
() /
gauss
<<
" Gauss "
<<
G4endl
;
127
}
128
if
( command ==
fMagFieldCmd
)
129
{
130
fEMfieldSetup
->
SetFieldValue
(
fMagFieldCmd
->
GetNew3VectorValue
(newValue));
131
// Check the value
132
G4cout
<<
"Set global field value to "
<<
133
fEMfieldSetup
->
GetGlobalFieldValue
() /
gauss
<<
" Gauss "
<<
G4endl
;
134
}
135
if
( command ==
fLocalMagFieldCmd
)
136
{
137
fEMfieldSetup
->
SetLocalFieldValue
(
fLocalMagFieldCmd
->
GetNew3VectorValue
(newValue));
138
fEMfieldSetup
->
UpdateField
();
139
// Check the value
140
G4cout
<<
"Set local field value to "
<<
141
fEMfieldSetup
->
GetLocalFieldValue
() /
gauss
<<
" Gauss "
<<
G4endl
;
142
}
143
if
( command ==
fMinStepCmd
)
144
fEMfieldSetup
->
SetMinStep
(
fMinStepCmd
->
GetNewDoubleValue
(newValue));
145
}
146
147
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
field
field03
src
F03FieldMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:05
using
1.8.2 with
ECCE GitHub integration