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
G4PolarizationMessenger.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4PolarizationMessenger.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
//
26
//
27
//
28
// GEANT4 Class file
29
//
30
// File name: G4PolarizationManager
31
//
32
// Author: Andreas Schaelicke
33
//
34
// Creation date: 01.05.2005
35
//
36
// Modifications:
37
//
38
// Class Description:
39
//
40
// Provides access to general polarization information and to
41
// polarization for logical volumes through macro files.
42
43
#include "
G4PolarizationMessenger.hh
"
44
#include "
G4PolarizationManager.hh
"
45
#include "
G4PolarizationHelper.hh
"
46
47
#include "
G4UIdirectory.hh
"
48
#include "
G4Tokenizer.hh
"
49
#include "
G4UIcmdWithoutParameter.hh
"
50
#include "
G4UIcmdWithAString.hh
"
51
#include "
G4UIcmdWithAnInteger.hh
"
52
#include "
G4UIcmdWithABool.hh
"
53
#include "
G4ios.hh
"
54
55
56
G4PolarizationMessenger::G4PolarizationMessenger
(
G4PolarizationManager
* polMgr)
57
: polarizationManager(polMgr)
58
{
59
polarizationDirectory
=
new
G4UIdirectory
(
"/polarization/"
);
60
polarizationDirectory
->
SetGuidance
(
"polarization control commands."
);
61
62
managerDirectory
=
new
G4UIdirectory
(
"/polarization/manager/"
);
63
managerDirectory
->
SetGuidance
(
"general polarization information."
);
64
65
verboseCmd
=
new
G4UIcmdWithAnInteger
(
"/polarization/manager/verbose"
,
this
);
66
verboseCmd
->
SetGuidance
(
"Set the Verbose level of G4PolarizationManager."
);
67
verboseCmd
->
SetGuidance
(
" 0 : Silent (default)"
);
68
verboseCmd
->
SetGuidance
(
" 1 : Verbose"
);
69
verboseCmd
->
SetParameterName
(
"level"
,
true
);
70
verboseCmd
->
SetDefaultValue
(0);
71
verboseCmd
->
SetRange
(
"level >=0 && level <=1"
);
72
73
optActivateCmd
=
new
G4UIcmdWithABool
(
"/polarization/manager/activate"
,
this
);
74
optActivateCmd
->
SetGuidance
(
"activate/deactivate polarization treatment"
);
75
optActivateCmd
->
SetParameterName
(
"flag"
,
true
);
76
optActivateCmd
->
SetDefaultValue
(
true
);
77
78
volumeDirectory
=
new
G4UIdirectory
(
"/polarization/volume/"
);
79
volumeDirectory
->
SetGuidance
(
"Status control commands of registered polarized logical volumes."
);
80
81
printVolumeListCmd
=
new
G4UIcmdWithoutParameter
(
"/polarization/volume/list"
,
this
);
82
printVolumeListCmd
->
SetGuidance
(
"print list of registered polarized logical volumes"
);
83
printVolumeListCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
,
G4State_GeomClosed
);
84
85
setPolarizationCmd
=
new
G4UIcommand
(
"/polarization/volume/set"
,
this
);
86
setPolarizationCmd
->
SetGuidance
(
"set or change polarization of a logical volume"
);
87
// setPolarizationCmd->SetParameterName("polarization",true);
88
// setPolarizationCmd->SetDefaultValue("worldVolume 0. 0. 0.");
89
setPolarizationCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
,
G4State_GeomClosed
);
90
91
G4UIparameter
* param;
92
param =
new
G4UIparameter
(
"logicalVolumeName"
,
's'
,
false
);
93
param->
SetDefaultValue
(
"worldVolume"
);
94
setPolarizationCmd
->
SetParameter
(param);
95
param =
new
G4UIparameter
(
"px"
,
'd'
,
true
);
96
param->
SetDefaultValue
(
"0.0"
);
97
setPolarizationCmd
->
SetParameter
(param);
98
param =
new
G4UIparameter
(
"py"
,
'd'
,
true
);
99
param->
SetDefaultValue
(
"0.0"
);
100
setPolarizationCmd
->
SetParameter
(param);
101
param =
new
G4UIparameter
(
"pz"
,
'd'
,
true
);
102
param->
SetDefaultValue
(
"0.0"
);
103
setPolarizationCmd
->
SetParameter
(param);
104
105
testDirectory
=
new
G4UIdirectory
(
"/polarization/test/"
);
106
testDirectory
->
SetGuidance
(
"provides access to some internal test routines."
);
107
108
testPolarizationTransformationCmd
=
new
G4UIcmdWithoutParameter
(
"/polarization/test/polarizationTransformation"
,
this
);
109
testPolarizationTransformationCmd
->
SetGuidance
(
"checks definition of particle reference frame and corresponding translation routines"
);
110
testPolarizationTransformationCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
,
G4State_GeomClosed
);
111
112
testInteractionFrameCmd
=
new
G4UIcmdWithoutParameter
(
"/polarization/test/interactionFrame"
,
this
);
113
testInteractionFrameCmd
->
SetGuidance
(
"checks definition of interaction frame"
);
114
testInteractionFrameCmd
->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
,
G4State_GeomClosed
);
115
}
116
117
G4PolarizationMessenger::~G4PolarizationMessenger
()
118
{
119
delete
verboseCmd
;
120
delete
testInteractionFrameCmd
;
121
delete
testPolarizationTransformationCmd
;
122
delete
testDirectory
;
123
delete
setPolarizationCmd
;
124
delete
printVolumeListCmd
;
125
delete
volumeDirectory
;
126
delete
optActivateCmd
;
127
delete
managerDirectory
;
128
delete
polarizationDirectory
;
129
}
130
131
void
G4PolarizationMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
132
{
133
if
( command==
verboseCmd
) {
134
polarizationManager
->
SetVerbose
(
verboseCmd
->
GetNewIntValue
(newValue));
135
}
136
else
if
( command==
optActivateCmd
) {
137
polarizationManager
->
SetActivated
(
optActivateCmd
->
GetNewBoolValue
(newValue));
138
}
139
else
if
( command==
printVolumeListCmd
) {
140
polarizationManager
->
ListVolumes
();
141
}
142
else
if
( command==
setPolarizationCmd
) {
143
G4Tokenizer
next( newValue );
144
G4String
volumeName=next();
145
G4double
px=0.,py=0.,pz=0.;
146
G4String
dvalue=next();
147
if
(!dvalue.
isNull
()) {
148
px=
StoD
(dvalue);
149
dvalue=next();
150
if
(!dvalue.
isNull
()) {
151
py=
StoD
(dvalue);
152
dvalue=next();
153
if
(!dvalue.
isNull
()) pz=
StoD
(dvalue);
154
}
155
}
156
G4ThreeVector
pol(px,py,pz);
157
polarizationManager
->
SetVolumePolarization
(volumeName,pol);
158
}
159
else
if
( command==
testPolarizationTransformationCmd
) {
160
G4PolarizationHelper::TestPolarizationTransformations
();
161
}
162
else
if
(command==
testInteractionFrameCmd
) {
163
G4PolarizationHelper::TestInteractionFrame
();
164
}
165
}
166
167
G4String
G4PolarizationMessenger::GetCurrentValue
(
G4UIcommand
* command)
168
{
169
G4String
cv;
170
if
( command==
verboseCmd
)
171
{ cv =
verboseCmd
->
ConvertToString
(
polarizationManager
->
GetVerbose
()); }
172
173
return
cv;
174
}
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
polarisation
src
G4PolarizationMessenger.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:33
using
1.8.2 with
ECCE GitHub integration