Geant4  10.02.p01
GB03DetectorMessenger.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 //
26 // $Id$
27 //
30 
31 #include "GB03DetectorMessenger.hh"
32 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAString.hh"
36 #include "G4UIcmdWithABool.hh"
37 #include "G4UIcmdWithAnInteger.hh"
38 #include "G4Material.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
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);
61 
62  fGapMaterialCmd = new G4UIcmdWithAString("/GB03/setGapMat",this);
63  fGapMaterialCmd->SetGuidance("Select Material of the Gap.");
64  fGapMaterialCmd->SetParameterName("choice",false);
67 
68  fNumLayerCmd = new G4UIcmdWithAnInteger("/GB03/numberOfLayers",this);
69  fNumLayerCmd->SetGuidance("Set number of layers.");
70  fNumLayerCmd->SetParameterName("nl",false);
72  fNumLayerCmd->SetRange("nl>0");
73 
74  fVerboseCmd = new G4UIcmdWithAnInteger("/GB03/verbose",this);
75  fVerboseCmd->SetGuidance("Set verbosity level");
76  fVerboseCmd->SetParameterName("verbose",false);
78  fVerboseCmd->SetRange("verbose>=0");
79 
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  delete fAbsMaterialCmd;
87  delete fGapMaterialCmd;
88  delete fNumLayerCmd;
89  delete fVerboseCmd;
90  delete fDirectory;
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
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 ) {
105 
106  } else if( command == fVerboseCmd ) {
108  }
109 }
110 
111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
112 
114 {
115  G4String ans;
116  if( command == fAbsMaterialCmd ){
118 
119  } else if( command == fGapMaterialCmd ){
120  ans=fDetector->GetGapMaterial();
121 
122  } else if( command == fNumLayerCmd ) {
124 
125  } else if( command == fVerboseCmd ) {
127 
128  }
129  return ans;
130 }
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
Definition of the GB03DetectorConstruction class.
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
std::vector< G4Material * > G4MaterialTable
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
Definition of the GB03DetectorMessenger class.
G4UIcmdWithAnInteger * fVerboseCmd
void SetGapMaterial(G4String materialChoice)
virtual G4String GetCurrentValue(G4UIcommand *command)
GB03DetectorMessenger(GB03DetectorConstruction *)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
GB03DetectorConstruction * fDetector
G4UIcmdWithAnInteger * fNumLayerCmd
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:596
G4UIcmdWithAString * fAbsMaterialCmd
void SetAbsorberMaterial(G4String materialChoice)
void SetCandidates(const char *candidateList)
G4UIcmdWithAString * fGapMaterialCmd
virtual void SetNewValue(G4UIcommand *, G4String)