Geant4-11
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Private Attributes
G4PolarizationMessenger Class Reference

#include <G4PolarizationMessenger.hh>

Inheritance diagram for G4PolarizationMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4PolarizationMessenger (const G4PolarizationMessenger &)=delete
 
 G4PolarizationMessenger (G4PolarizationManager *runMgr)
 
G4String GetCurrentValue (G4UIcommand *command) override
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4PolarizationMessengeroperator= (const G4PolarizationMessenger &right)=delete
 
G4bool operator== (const G4UImessenger &messenger) const
 
void SetNewValue (G4UIcommand *command, G4String newValues) override
 
 ~G4PolarizationMessenger () override
 

Data Fields

G4PolarizationManagerpolarizationManager
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Attributes

G4UIdirectorymanagerDirectory
 
G4UIcmdWithABooloptActivateCmd
 
G4UIdirectorypolarizationDirectory
 
G4UIcmdWithoutParameterprintVolumeListCmd
 
G4UIcommandsetPolarizationCmd
 
G4UIdirectorytestDirectory
 
G4UIcmdWithoutParametertestInteractionFrameCmd
 
G4UIcmdWithoutParametertestPolarizationTransformationCmd
 
G4UIcmdWithAnIntegerverboseCmd
 
G4UIdirectoryvolumeDirectory
 

Detailed Description

Definition at line 52 of file G4PolarizationMessenger.hh.

Constructor & Destructor Documentation

◆ G4PolarizationMessenger() [1/2]

G4PolarizationMessenger::G4PolarizationMessenger ( G4PolarizationManager runMgr)
explicit

Definition at line 48 of file G4PolarizationMessenger.cc.

49 : polarizationManager(polMgr)
50{
51 polarizationDirectory = new G4UIdirectory("/polarization/");
52 polarizationDirectory->SetGuidance("polarization control commands.");
53
54 managerDirectory = new G4UIdirectory("/polarization/manager/");
55 managerDirectory->SetGuidance("general polarization information.");
56
57 verboseCmd = new G4UIcmdWithAnInteger("/polarization/manager/verbose", this);
58 verboseCmd->SetGuidance("Set the Verbose level of G4PolarizationManager.");
59 verboseCmd->SetGuidance(" 0 : Silent (default)");
60 verboseCmd->SetGuidance(" 1 : Verbose");
61 verboseCmd->SetParameterName("level", true);
63 verboseCmd->SetRange("level >=0 && level <=1");
64
65 optActivateCmd = new G4UIcmdWithABool("/polarization/manager/activate", this);
66 optActivateCmd->SetGuidance("activate/deactivate polarization treatment");
67 optActivateCmd->SetParameterName("flag", true);
69
70 volumeDirectory = new G4UIdirectory("/polarization/volume/");
72 "Status control commands of registered polarized logical volumes.");
73
75 new G4UIcmdWithoutParameter("/polarization/volume/list", this);
77 "print list of registered polarized logical volumes");
80
81 setPolarizationCmd = new G4UIcommand("/polarization/volume/set", this);
83 "set or change polarization of a logical volume");
86
87 G4UIparameter* param;
88 param = new G4UIparameter("logicalVolumeName", 's', false);
89 param->SetDefaultValue("worldVolume");
91 param = new G4UIparameter("px", 'd', true);
92 param->SetDefaultValue("0.0");
94 param = new G4UIparameter("py", 'd', true);
95 param->SetDefaultValue("0.0");
97 param = new G4UIparameter("pz", 'd', true);
98 param->SetDefaultValue("0.0");
100
101 testDirectory = new G4UIdirectory("/polarization/test/");
102 testDirectory->SetGuidance("provides access to some internal test routines.");
103
105 "/polarization/test/polarizationTransformation", this);
107 "checks definition of particle reference frame and corresponding "
108 "translation routines");
111
113 new G4UIcmdWithoutParameter("/polarization/test/interactionFrame", this);
115 "checks definition of interaction frame");
118}
@ G4State_Idle
@ G4State_GeomClosed
@ G4State_PreInit
G4UIcmdWithoutParameter * testInteractionFrameCmd
G4UIcmdWithoutParameter * testPolarizationTransformationCmd
G4PolarizationManager * polarizationManager
G4UIcmdWithoutParameter * printVolumeListCmd
G4UIcmdWithAnInteger * verboseCmd
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:288
void SetDefaultValue(const char *theDefaultValue)

References G4UIcommand::AvailableForStates(), G4State_GeomClosed, G4State_Idle, G4State_PreInit, managerDirectory, optActivateCmd, polarizationDirectory, printVolumeListCmd, G4UIparameter::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithABool::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), setPolarizationCmd, G4UIcommand::SetRange(), testDirectory, testInteractionFrameCmd, testPolarizationTransformationCmd, verboseCmd, and volumeDirectory.

◆ ~G4PolarizationMessenger()

G4PolarizationMessenger::~G4PolarizationMessenger ( )
override

◆ G4PolarizationMessenger() [2/2]

G4PolarizationMessenger::G4PolarizationMessenger ( const G4PolarizationMessenger )
delete

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4PolarizationMessenger::GetCurrentValue ( G4UIcommand command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 181 of file G4PolarizationMessenger.cc.

182{
183 G4String cv;
184 if(command == verboseCmd)
185 {
187 }
188
189 return cv;
190}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4UIcommand::ConvertToString(), G4PolarizationManager::GetVerbose(), polarizationManager, and verboseCmd.

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator=()

G4PolarizationMessenger & G4PolarizationMessenger::operator= ( const G4PolarizationMessenger right)
delete

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 134 of file G4PolarizationMessenger.cc.

136{
137 if(command == verboseCmd)
138 {
140 }
141 else if(command == optActivateCmd)
142 {
145 }
146 else if(command == printVolumeListCmd)
147 {
149 }
150 else if(command == setPolarizationCmd)
151 {
152 G4Tokenizer next(newValue);
153 G4String volumeName = next();
154 G4double px = 0., py = 0., pz = 0.;
155 G4String dvalue = next();
156 if(!dvalue.empty())
157 {
158 px = StoD(dvalue);
159 dvalue = next();
160 if(!dvalue.empty())
161 {
162 py = StoD(dvalue);
163 dvalue = next();
164 if(!dvalue.empty())
165 pz = StoD(dvalue);
166 }
167 }
168 G4ThreeVector pol(px, py, pz);
170 }
171 else if(command == testPolarizationTransformationCmd)
172 {
174 }
175 else if(command == testInteractionFrameCmd)
176 {
178 }
179}
double G4double
Definition: G4Types.hh:83
static void TestPolarizationTransformations()
static void TestInteractionFrame()
void SetVolumePolarization(G4LogicalVolume *lVol, const G4ThreeVector &pol)
static G4bool GetNewBoolValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)
G4double StoD(G4String s)

References G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithAnInteger::GetNewIntValue(), G4PolarizationManager::ListVolumes(), optActivateCmd, polarizationManager, printVolumeListCmd, G4PolarizationManager::SetActivated(), setPolarizationCmd, G4PolarizationManager::SetVerbose(), G4PolarizationManager::SetVolumePolarization(), G4UImessenger::StoD(), G4PolarizationHelper::TestInteractionFrame(), testInteractionFrameCmd, testPolarizationTransformationCmd, G4PolarizationHelper::TestPolarizationTransformations(), and verboseCmd.

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ managerDirectory

G4UIdirectory* G4PolarizationMessenger::managerDirectory
private

Definition at line 70 of file G4PolarizationMessenger.hh.

Referenced by G4PolarizationMessenger(), and ~G4PolarizationMessenger().

◆ optActivateCmd

G4UIcmdWithABool* G4PolarizationMessenger::optActivateCmd
private

◆ polarizationDirectory

G4UIdirectory* G4PolarizationMessenger::polarizationDirectory
private

Definition at line 68 of file G4PolarizationMessenger.hh.

Referenced by G4PolarizationMessenger(), and ~G4PolarizationMessenger().

◆ polarizationManager

G4PolarizationManager* G4PolarizationMessenger::polarizationManager

Definition at line 61 of file G4PolarizationMessenger.hh.

Referenced by GetCurrentValue(), and SetNewValue().

◆ printVolumeListCmd

G4UIcmdWithoutParameter* G4PolarizationMessenger::printVolumeListCmd
private

◆ setPolarizationCmd

G4UIcommand* G4PolarizationMessenger::setPolarizationCmd
private

◆ testDirectory

G4UIdirectory* G4PolarizationMessenger::testDirectory
private

Definition at line 78 of file G4PolarizationMessenger.hh.

Referenced by G4PolarizationMessenger(), and ~G4PolarizationMessenger().

◆ testInteractionFrameCmd

G4UIcmdWithoutParameter* G4PolarizationMessenger::testInteractionFrameCmd
private

◆ testPolarizationTransformationCmd

G4UIcmdWithoutParameter* G4PolarizationMessenger::testPolarizationTransformationCmd
private

◆ verboseCmd

G4UIcmdWithAnInteger* G4PolarizationMessenger::verboseCmd
private

◆ volumeDirectory

G4UIdirectory* G4PolarizationMessenger::volumeDirectory
private

Definition at line 74 of file G4PolarizationMessenger.hh.

Referenced by G4PolarizationMessenger(), and ~G4PolarizationMessenger().


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