Geant4  10.00.p02
RE06DetectorMessenger.cc
Go to the documentation of this file.
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 //
28 //
29 // $Id: RE06DetectorMessenger.cc 68026 2013-03-13 13:45:22Z gcosmo $
30 //
31 
32 #include "RE06DetectorMessenger.hh"
33 
35 #include "G4UIdirectory.hh"
36 #include "G4UIcmdWithAString.hh"
37 #include "G4UIcmdWithABool.hh"
38 #include "G4UIcmdWithAnInteger.hh"
39 #include "G4Material.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44  : G4UImessenger(),
45  fDetector(det),
46  fDirectory(0),
47  fAbsMaterialCmd(0),
48  fGapMaterialCmd(0),
49  fNumLayerCmd(0),
50  fSerialCmd(0),
51  fVerboseCmd(0),
52  fAddMaterialCmd(0)
53 {
54  fDirectory = new G4UIdirectory("/RE06/");
55  fDirectory->SetGuidance("UI commands of this example");
56 
57  G4String matList;
59  for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
60  {
61  matList += (*matTbl)[i]->GetName();
62  matList += " ";
63  }
64 
65  fAbsMaterialCmd = new G4UIcmdWithAString("/RE06/setAbsMat",this);
66  fAbsMaterialCmd->SetGuidance("Select Material of the Absorber.");
67  fAbsMaterialCmd->SetParameterName("choice",false);
70 
71  fGapMaterialCmd = new G4UIcmdWithAString("/RE06/setGapMat",this);
72  fGapMaterialCmd->SetGuidance("Select Material of the Gap.");
73  fGapMaterialCmd->SetParameterName("choice",false);
76 
77  fNumLayerCmd = new G4UIcmdWithAnInteger("/RE06/numberOfLayers",this);
78  fNumLayerCmd->SetGuidance("Set number of layers.");
79  fNumLayerCmd->SetParameterName("nl",false);
81  fNumLayerCmd->SetRange("nl>0");
82 
83  fSerialCmd = new G4UIcmdWithABool("/RE06/serialGeometry",this);
85  ->SetGuidance("Select calorimeters to be placed in serial or parallel.");
86  fSerialCmd->SetParameterName("serialize",false);
88 
89  fVerboseCmd = new G4UIcmdWithAnInteger("/RE06/verbose",this);
90  fVerboseCmd->SetGuidance("Set verbosity level");
91  fVerboseCmd->SetParameterName("verbose",false);
93  fVerboseCmd->SetRange("verbose>=0");
94 
95  fAddMaterialCmd = new G4UIcmdWithABool("/RE06/AddMaterial",this);
96  fAddMaterialCmd->SetGuidance("Add materials ");
97  fAddMaterialCmd->SetParameterName("dummy",true);
99 }
100 
101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102 
104 {
105  delete fAbsMaterialCmd;
106  delete fGapMaterialCmd;
107  delete fNumLayerCmd;
108  delete fSerialCmd;
109  delete fDirectory;
110 }
111 
113 {
114  if( command == fAbsMaterialCmd ) {
115  fDetector->SetAbsorberMaterial(newValue);
116 
117  } else if( command == fGapMaterialCmd ){
118  fDetector->SetGapMaterial(newValue);
119 
120  } else if( command == fNumLayerCmd ) {
122 
123  } else if( command == fSerialCmd ) {
125 
126  } else if( command == fVerboseCmd ) {
128 
129  } else if( command == fAddMaterialCmd ) {
132  }
133 }
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136 
138 {
139  G4String ans;
140  if( command == fAbsMaterialCmd ){
142 
143  } else if( command == fGapMaterialCmd ){
144  ans=fDetector->GetGapMaterial();
145 
146  } else if( command == fNumLayerCmd ) {
148 
149  } else if( command == fSerialCmd ){
151 
152  } else if( command == fSerialCmd ) {
154 
155  } else if( command == fVerboseCmd ) {
157 
158  }
159  return ans;
160 }
161 
162 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
163 
165 {
166  G4String matList;
168  for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
169  {
170  matList += (*matTbl)[i]->GetName();
171  matList += " ";
172  }
173 
174  if(fAbsMaterialCmd !=0) {
175  fAbsMaterialCmd->SetCandidates(matList);
176  }
177  if (fGapMaterialCmd !=0) {
178  fGapMaterialCmd->SetCandidates(matList);
179  }
180 }
181 
182 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithAString * fAbsMaterialCmd
virtual G4String GetCurrentValue(G4UIcommand *command)
Definition of the RE06DetectorMessenger class.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void SetNewValue(G4UIcommand *, G4String)
static G4int GetNewIntValue(const char *paramString)
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
G4UIcmdWithAString * fGapMaterialCmd
RE06DetectorMessenger(RE06DetectorConstruction *)
static G4bool GetNewBoolValue(const char *paramString)
G4UIcmdWithAnInteger * fNumLayerCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
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:225
G4UIcmdWithABool * fSerialCmd
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
void SetAbsorberMaterial(G4String materialChoice)
RE06DetectorConstruction * fDetector
void SetCandidates(const char *candidateList)
Definition of the RE06DetectorConstruction class.
G4UIcmdWithAnInteger * fVerboseCmd
void SetGapMaterial(G4String materialChoice)
G4UIcmdWithABool * fAddMaterialCmd