Geant4  10.02.p01
DetectorMessenger.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 //
30 // $Id: DetectorMessenger.cc 77206 2013-11-22 01:33:52Z adotti $
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
36 
37 #include "DetectorMessenger.hh"
38 
39 #include "DetectorConstruction.hh"
40 #include "G4UIdirectory.hh"
41 #include "G4UIcmdWithAString.hh"
42 #include "G4UIcmdWithAnInteger.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 : G4UImessenger(),
50  fDetector(Det),
51  fN03Dir(0),
52  fDetDir(0),
53  fAbsMaterCmd(0),
54  fGapMaterCmd(0),
55  fAbsThickCmd(0),
56  fGapThickCmd(0),
57  fSizeYZCmd(0),
58  fNbLayersCmd(0)
59 {
60  fN03Dir = new G4UIdirectory("/N03/");
61  fN03Dir->SetGuidance("UI commands of this example");
62 
63  G4bool broadcast = false;
64  fDetDir = new G4UIdirectory("/N03/det/",broadcast);
65  fDetDir->SetGuidance("detector control");
66 
67  fAbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
68  fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
69  fAbsMaterCmd->SetParameterName("choice",false);
71 
72  fGapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
73  fGapMaterCmd->SetGuidance("Select Material of the Gap.");
74  fGapMaterCmd->SetParameterName("choice",false);
76 
77  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
78  fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
79  fAbsThickCmd->SetParameterName("Size",false);
80  fAbsThickCmd->SetRange("Size>=0.");
81  fAbsThickCmd->SetUnitCategory("Length");
83 
84  fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
85  fGapThickCmd->SetGuidance("Set Thickness of the Gap");
86  fGapThickCmd->SetParameterName("Size",false);
87  fGapThickCmd->SetRange("Size>=0.");
88  fGapThickCmd->SetUnitCategory("Length");
90 
91  fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
92  fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
93  fSizeYZCmd->SetParameterName("Size",false);
94  fSizeYZCmd->SetRange("Size>0.");
95  fSizeYZCmd->SetUnitCategory("Length");
97 
98  fNbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
99  fNbLayersCmd->SetGuidance("Set number of layers.");
100  fNbLayersCmd->SetParameterName("NbLayers",false);
101  fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
103 
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107 
109 {
110  delete fNbLayersCmd;
111  delete fAbsMaterCmd; delete fGapMaterCmd;
112  delete fAbsThickCmd; delete fGapThickCmd;
113  delete fSizeYZCmd;
114  delete fDetDir;
115  delete fN03Dir;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  if( command == fAbsMaterCmd )
123  { fDetector->SetAbsorberMaterial(newValue);}
124 
125  if( command == fGapMaterCmd )
126  { fDetector->SetGapMaterial(newValue);}
127 
128  if( command == fAbsThickCmd )
130  ->GetNewDoubleValue(newValue));}
131 
132  if( command == fGapThickCmd )
134 
135  if( command == fSizeYZCmd )
137 
138  if( command == fNbLayersCmd )
140 }
141 
142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithAnInteger * fNbLayersCmd
void SetNewValue(G4UIcommand *, G4String)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetAbsorberThickness(G4double)
G4UIcmdWithAString * fAbsMaterCmd
G4UIdirectory * fN03Dir
bool G4bool
Definition: G4Types.hh:79
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:239
G4UIdirectory * fDetDir
G4UIcmdWithAString * fGapMaterCmd
G4UIcmdWithADoubleAndUnit * fAbsThickCmd
G4UIcmdWithADoubleAndUnit * fSizeYZCmd
DetectorMessenger(DetectorConstruction *)
G4UIcmdWithADoubleAndUnit * fGapThickCmd
Detector construction class to demonstrate various ways of placement.
DetectorConstruction * fDetector
void SetAbsorberMaterial(G4String)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)