Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
ExN03DetectorMessenger Class Reference

#include <ExN03DetectorMessenger.hh>

Inheritance diagram for ExN03DetectorMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 ExN03DetectorMessenger (ExN03DetectorConstruction *)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
void SetNewValue (G4UIcommand *, G4String)
 
 ~ExN03DetectorMessenger ()
 

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

G4UIcmdWithAStringAbsMaterCmd
 
G4UIcmdWithADoubleAndUnitAbsThickCmd
 
G4UIdirectorydetDir
 
ExN03DetectorConstructionExN03Detector
 
G4UIcmdWithAStringGapMaterCmd
 
G4UIcmdWithADoubleAndUnitGapThickCmd
 
G4UIcmdWithADoubleAndUnitMagFieldCmd
 
G4UIdirectoryN03Dir
 
G4UIcmdWithAnIntegerNbLayersCmd
 
G4UIcmdWithADoubleAndUnitSizeYZCmd
 
G4UIcmdWithoutParameterUpdateCmd
 

Detailed Description

Definition at line 48 of file ExN03DetectorMessenger.hh.

Constructor & Destructor Documentation

◆ ExN03DetectorMessenger()

ExN03DetectorMessenger::ExN03DetectorMessenger ( ExN03DetectorConstruction ExN03Det)

Definition at line 44 of file ExN03DetectorMessenger.cc.

46:ExN03Detector(ExN03Det)
47{
48 N03Dir = new G4UIdirectory("/N03/");
49 N03Dir->SetGuidance("UI commands of this example");
50
51 detDir = new G4UIdirectory("/N03/det/");
52 detDir->SetGuidance("detector control");
53
54 AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
55 AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
56 AbsMaterCmd->SetParameterName("choice",false);
58
59 GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
60 GapMaterCmd->SetGuidance("Select Material of the Gap.");
61 GapMaterCmd->SetParameterName("choice",false);
63
64 AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
65 AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
66 AbsThickCmd->SetParameterName("Size",false);
67 AbsThickCmd->SetRange("Size>=0.");
70
71 GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
72 GapThickCmd->SetGuidance("Set Thickness of the Gap");
73 GapThickCmd->SetParameterName("Size",false);
74 GapThickCmd->SetRange("Size>=0.");
75 GapThickCmd->SetUnitCategory("Length");
77
78 SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
79 SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
80 SizeYZCmd->SetParameterName("Size",false);
81 SizeYZCmd->SetRange("Size>0.");
82 SizeYZCmd->SetUnitCategory("Length");
84
85 NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
86 NbLayersCmd->SetGuidance("Set number of layers.");
87 NbLayersCmd->SetParameterName("NbLayers",false);
88 NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
90
91 UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
92 UpdateCmd->SetGuidance("Update calorimeter geometry.");
93 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
94 UpdateCmd->SetGuidance("if you changed geometrical value(s).");
96
97 MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setField",this);
98 MagFieldCmd->SetGuidance("Define magnetic field.");
99 MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
100 MagFieldCmd->SetParameterName("Bz",false);
101 MagFieldCmd->SetUnitCategory("Magnetic flux density");
103}
@ G4State_Idle
@ G4State_PreInit
G4UIcmdWithADoubleAndUnit * MagFieldCmd
G4UIcmdWithoutParameter * UpdateCmd
G4UIcmdWithAString * GapMaterCmd
G4UIcmdWithAString * AbsMaterCmd
ExN03DetectorConstruction * ExN03Detector
G4UIcmdWithADoubleAndUnit * SizeYZCmd
G4UIcmdWithADoubleAndUnit * GapThickCmd
G4UIcmdWithADoubleAndUnit * AbsThickCmd
G4UIcmdWithAnInteger * NbLayersCmd
void SetUnitCategory(const char *unitCategory)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
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

References AbsMaterCmd, AbsThickCmd, G4UIcommand::AvailableForStates(), detDir, G4State_Idle, G4State_PreInit, GapMaterCmd, GapThickCmd, MagFieldCmd, N03Dir, NbLayersCmd, G4UIcommand::SetGuidance(), G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcmdWithAString::SetParameterName(), G4UIcommand::SetRange(), G4UIcmdWithADoubleAndUnit::SetUnitCategory(), SizeYZCmd, and UpdateCmd.

◆ ~ExN03DetectorMessenger()

ExN03DetectorMessenger::~ExN03DetectorMessenger ( )

Definition at line 107 of file ExN03DetectorMessenger.cc.

108{
109 delete NbLayersCmd;
110 delete AbsMaterCmd; delete GapMaterCmd;
111 delete AbsThickCmd; delete GapThickCmd;
112 delete SizeYZCmd; delete UpdateCmd;
113 delete MagFieldCmd;
114 delete detDir;
115 delete N03Dir;
116}

References AbsMaterCmd, AbsThickCmd, detDir, GapMaterCmd, GapThickCmd, MagFieldCmd, N03Dir, NbLayersCmd, SizeYZCmd, and UpdateCmd.

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 G4UImessenger::GetCurrentValue ( G4UIcommand command)
virtualinherited

Reimplemented in G4ScoreQuantityMessenger, G4VisCommandModelCreate< Factory >, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4ToolsAnalysisMessenger, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4GeometryMessenger, G4GenericMessenger, G4UIcontrolMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4SchedulerMessenger, G4VITSteppingVerbose, G4MoleculeShootMessenger, G4MoleculeGunMessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4MatScanMessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandAbortReviewKeptEvents, G4VisCommandDrawOnlyToBeKeptEvents, G4VisCommandEnable, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandVerbose, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceCloud, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneRemoveModel, G4VisCommandSceneSelect, G4VisCommandSceneShowExtents, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddExtent, G4VisCommandSceneAddElectricField, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGPS, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLocalAxes, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddMagneticField, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneAddPlotter, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetArrow3DLineSegmentsPerCircle, G4VisCommandSetColour, G4VisCommandSetExtentForField, G4VisCommandSetLineWidth, G4VisCommandSetTextColour, G4VisCommandSetTextLayout, G4VisCommandSetTextSize, G4VisCommandSetTouchable, G4VisCommandSetVolumeForField, G4VisCommandsTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerCentreOn, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClearVisAttributesModifiers, G4VisCommandViewerClone, G4VisCommandViewerColourByDensity, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerInterpolate, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerReset, G4VisCommandViewerRefresh, G4VisCommandViewerRebuild, G4VisCommandViewerSave, G4VisCommandViewerScale, G4VisCommandViewerSelect, G4VisCommandViewerUpdate, G4VisCommandViewerZoom, G4VisCommandViewerDefaultHiddenEdge, G4VisCommandViewerDefaultStyle, G4VisCommandsViewerSet, G4VModelCommand< T >, G4VModelCommand< M >, G4RTMessenger, G4ASCIITreeMessenger, G4VtkMessenger, G4PolarizationMessenger, and G4DNAChemistryManager.

Definition at line 58 of file G4UImessenger.cc.

59{
60 G4String nullString;
61 return nullString;
62}

Referenced by G4UIcommand::DoIt(), and G4UIcommand::GetCurrentValue().

◆ 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==()

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

Definition at line 70 of file G4UImessenger.cc.

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

◆ SetNewValue()

void ExN03DetectorMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 120 of file ExN03DetectorMessenger.cc.

121{
122 if( command == AbsMaterCmd )
124
125 if( command == GapMaterCmd )
126 { ExN03Detector->SetGapMaterial(newValue);}
127
128 if( command == AbsThickCmd )
130 ->GetNewDoubleValue(newValue));}
131
132 if( command == GapThickCmd )
134
135 if( command == SizeYZCmd )
137
138 if( command == NbLayersCmd )
140
141 if( command == UpdateCmd )
143
144 if( command == MagFieldCmd )
146}
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)

References AbsMaterCmd, AbsThickCmd, ExN03Detector, GapMaterCmd, GapThickCmd, G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), MagFieldCmd, NbLayersCmd, ExN03DetectorConstruction::SetAbsorberMaterial(), ExN03DetectorConstruction::SetAbsorberThickness(), ExN03DetectorConstruction::SetCalorSizeYZ(), ExN03DetectorConstruction::SetGapMaterial(), ExN03DetectorConstruction::SetGapThickness(), ExN03DetectorConstruction::SetMagField(), ExN03DetectorConstruction::SetNbOfLayers(), SizeYZCmd, UpdateCmd, and ExN03DetectorConstruction::UpdateGeometry().

◆ 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

◆ AbsMaterCmd

G4UIcmdWithAString* ExN03DetectorMessenger::AbsMaterCmd
private

◆ AbsThickCmd

G4UIcmdWithADoubleAndUnit* ExN03DetectorMessenger::AbsThickCmd
private

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ detDir

G4UIdirectory* ExN03DetectorMessenger::detDir
private

Definition at line 60 of file ExN03DetectorMessenger.hh.

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

◆ ExN03Detector

ExN03DetectorConstruction* ExN03DetectorMessenger::ExN03Detector
private

Definition at line 57 of file ExN03DetectorMessenger.hh.

Referenced by SetNewValue().

◆ GapMaterCmd

G4UIcmdWithAString* ExN03DetectorMessenger::GapMaterCmd
private

◆ GapThickCmd

G4UIcmdWithADoubleAndUnit* ExN03DetectorMessenger::GapThickCmd
private

◆ MagFieldCmd

G4UIcmdWithADoubleAndUnit* ExN03DetectorMessenger::MagFieldCmd
private

◆ N03Dir

G4UIdirectory* ExN03DetectorMessenger::N03Dir
private

Definition at line 59 of file ExN03DetectorMessenger.hh.

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

◆ NbLayersCmd

G4UIcmdWithAnInteger* ExN03DetectorMessenger::NbLayersCmd
private

◆ SizeYZCmd

G4UIcmdWithADoubleAndUnit* ExN03DetectorMessenger::SizeYZCmd
private

◆ UpdateCmd

G4UIcmdWithoutParameter* ExN03DetectorMessenger::UpdateCmd
private

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