Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PolarizationMessenger Class Reference

#include <G4PolarizationMessenger.hh>

+ Inheritance diagram for G4PolarizationMessenger:

Public Member Functions

 G4PolarizationMessenger (G4PolarizationManager *runMgr)
 
 ~G4PolarizationMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues) override
 
G4String GetCurrentValue (G4UIcommand *command) override
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 60 of file G4PolarizationMessenger.hh.

Constructor & Destructor Documentation

◆ G4PolarizationMessenger()

G4PolarizationMessenger::G4PolarizationMessenger ( G4PolarizationManager runMgr)
explicit

Definition at line 56 of file G4PolarizationMessenger.cc.

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");
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.");
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");
115}
@ G4State_Idle
@ G4State_GeomClosed
@ G4State_PreInit
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:146
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:273
void SetDefaultValue(const char *theDefaultValue)

◆ ~G4PolarizationMessenger()

G4PolarizationMessenger::~G4PolarizationMessenger ( )

Definition at line 117 of file G4PolarizationMessenger.cc.

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}

Member Function Documentation

◆ GetCurrentValue()

G4String G4PolarizationMessenger::GetCurrentValue ( G4UIcommand command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 167 of file G4PolarizationMessenger.cc.

168{
169 G4String cv;
170 if( command==verboseCmd )
171 { cv = verboseCmd->ConvertToString(polarizationManager->GetVerbose()); }
172
173 return cv;
174}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:430

◆ SetNewValue()

void G4PolarizationMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 131 of file G4PolarizationMessenger.cc.

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 ) {
161 }
162 else if (command==testInteractionFrameCmd ) {
164 }
165}
double G4double
Definition: G4Types.hh:83
static void TestPolarizationTransformations()
static void TestInteractionFrame()
void SetVolumePolarization(G4LogicalVolume *lVol, const G4ThreeVector &pol)
G4bool isNull() const
static G4bool GetNewBoolValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)
G4double StoD(G4String s)

The documentation for this class was generated from the following files: