Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GB03DetectorMessenger Class Reference

#include <GB03DetectorMessenger.hh>

Inheritance diagram for GB03DetectorMessenger:
Collaboration diagram for GB03DetectorMessenger:

Public Member Functions

 GB03DetectorMessenger (GB03DetectorConstruction *)
 
virtual ~GB03DetectorMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
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)
 
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
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 43 of file GB03DetectorMessenger.hh.

Constructor & Destructor Documentation

GB03DetectorMessenger::GB03DetectorMessenger ( GB03DetectorConstruction det)

Definition at line 42 of file GB03DetectorMessenger.cc.

43  : G4UImessenger(), fDetector(det)
44 {
45  fDirectory = new G4UIdirectory("/GB03/");
46  fDirectory->SetGuidance("UI commands of this example");
47 
48  G4String matList;
50  for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
51  {
52  matList += (*matTbl)[i]->GetName();
53  matList += " ";
54  }
55 
56  fAbsMaterialCmd = new G4UIcmdWithAString("/GB03/setAbsMat",this);
57  fAbsMaterialCmd->SetGuidance("Select Material of the Absorber.");
58  fAbsMaterialCmd->SetParameterName("choice",false);
59  fAbsMaterialCmd->AvailableForStates(G4State_Idle);
60  fAbsMaterialCmd->SetCandidates(matList);
61 
62  fGapMaterialCmd = new G4UIcmdWithAString("/GB03/setGapMat",this);
63  fGapMaterialCmd->SetGuidance("Select Material of the Gap.");
64  fGapMaterialCmd->SetParameterName("choice",false);
65  fGapMaterialCmd->AvailableForStates(G4State_Idle);
66  fGapMaterialCmd->SetCandidates(matList);
67 
68  fNumLayerCmd = new G4UIcmdWithAnInteger("/GB03/numberOfLayers",this);
69  fNumLayerCmd->SetGuidance("Set number of layers.");
70  fNumLayerCmd->SetParameterName("nl",false);
71  fNumLayerCmd->AvailableForStates(G4State_Idle);
72  fNumLayerCmd->SetRange("nl>0");
73 
74  fVerboseCmd = new G4UIcmdWithAnInteger("/GB03/verbose",this);
75  fVerboseCmd->SetGuidance("Set verbosity level");
76  fVerboseCmd->SetParameterName("verbose",false);
77  fVerboseCmd->AvailableForStates(G4State_Idle);
78  fVerboseCmd->SetRange("verbose>=0");
79 
80 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
void SetCandidates(const char *candidateList)

Here is the call graph for this function:

GB03DetectorMessenger::~GB03DetectorMessenger ( )
virtual

Definition at line 84 of file GB03DetectorMessenger.cc.

85 {
86  delete fAbsMaterialCmd;
87  delete fGapMaterialCmd;
88  delete fNumLayerCmd;
89  delete fVerboseCmd;
90  delete fDirectory;
91 }

Member Function Documentation

G4String GB03DetectorMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 113 of file GB03DetectorMessenger.cc.

114 {
115  G4String ans;
116  if( command == fAbsMaterialCmd ){
117  ans=fDetector->GetAbsorberMaterial();
118 
119  } else if( command == fGapMaterialCmd ){
120  ans=fDetector->GetGapMaterial();
121 
122  } else if( command == fNumLayerCmd ) {
124 
125  } else if( command == fVerboseCmd ) {
126  ans=fVerboseCmd->ConvertToString(fDetector->GetVerboseLevel());
127 
128  }
129  return ans;
130 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372

Here is the call graph for this function:

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

Reimplemented from G4UImessenger.

Definition at line 95 of file GB03DetectorMessenger.cc.

96 {
97  if( command == fAbsMaterialCmd ) {
98  fDetector->SetAbsorberMaterial(newValue);
99 
100  } else if( command == fGapMaterialCmd ){
101  fDetector->SetGapMaterial(newValue);
102 
103  } else if( command == fNumLayerCmd ) {
104  fDetector->SetNumberOfLayers(fNumLayerCmd->GetNewIntValue(newValue));
105 
106  } else if( command == fVerboseCmd ) {
107  fDetector->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
108  }
109 }
static G4int GetNewIntValue(const char *paramString)
void SetGapMaterial(G4String materialChoice)
void SetAbsorberMaterial(G4String materialChoice)

Here is the call graph for this function:


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