Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F01DetectorMessenger.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$
31 //
32 //
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
37 #include "F01DetectorMessenger.hh"
38 
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  fDetDir(0),
52  fAbsMaterCmd(0),
53  fAbsThickCmd(0),
54  fAbsRadCmd(0),
55  fAbsZposCmd(0),
56  fWorldMaterCmd(0),
57  fWorldZCmd(0),
58  fWorldRCmd(0),
59  fUpdateCmd(0)
60 {
61  fDetDir = new G4UIdirectory("/calor/");
62  fDetDir->SetGuidance("F01 detector control.");
63 
64  fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
65  fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
66  fAbsMaterCmd->SetParameterName("choice",true);
67  fAbsMaterCmd->SetDefaultValue("Lead");
68  fAbsMaterCmd->AvailableForStates(G4State_Idle);
69 
70  fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
71  fWorldMaterCmd->SetGuidance("Select Material of the World.");
72  fWorldMaterCmd->SetParameterName("wchoice",true);
73  fWorldMaterCmd->SetDefaultValue("Air");
74  fWorldMaterCmd->AvailableForStates(G4State_Idle);
75 
76  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
77  fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
78  fAbsThickCmd->SetParameterName("SizeZ",false,false);
79  fAbsThickCmd->SetDefaultUnit("mm");
80  fAbsThickCmd->SetRange("SizeZ>0.");
81  fAbsThickCmd->AvailableForStates(G4State_Idle);
82 
83  fAbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad",this);
84  fAbsRadCmd->SetGuidance("Set radius of the Absorber");
85  fAbsRadCmd->SetParameterName("SizeR",false,false);
86  fAbsRadCmd->SetDefaultUnit("mm");
87  fAbsRadCmd->SetRange("SizeR>0.");
88  fAbsRadCmd->AvailableForStates(G4State_Idle);
89 
90  fAbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos",this);
91  fAbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
92  fAbsZposCmd->SetParameterName("Zpos",false,false);
93  fAbsZposCmd->SetDefaultUnit("mm");
94  fAbsZposCmd->AvailableForStates(G4State_Idle);
95 
96  fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ",this);
97  fWorldZCmd->SetGuidance("Set Z size of the World");
98  fWorldZCmd->SetParameterName("WSizeZ",false,false);
99  fWorldZCmd->SetDefaultUnit("mm");
100  fWorldZCmd->SetRange("WSizeZ>0.");
101  fWorldZCmd->AvailableForStates(G4State_Idle);
102 
103  fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR",this);
104  fWorldRCmd->SetGuidance("Set R size of the World");
105  fWorldRCmd->SetParameterName("WSizeR",false,false);
106  fWorldRCmd->SetDefaultUnit("mm");
107  fWorldRCmd->SetRange("WSizeR>0.");
108  fWorldRCmd->AvailableForStates(G4State_Idle);
109 
110  fUpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
111  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
112  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
113  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
114  fUpdateCmd->AvailableForStates(G4State_Idle);
115 
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
119 
121 {
122  delete fAbsMaterCmd;
123  delete fAbsThickCmd;
124  delete fAbsRadCmd;
125  delete fAbsZposCmd;
126  delete fWorldMaterCmd;
127  delete fWorldZCmd;
128  delete fWorldRCmd;
129  delete fUpdateCmd;
130  delete fDetDir;
131 }
132 
133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
134 
136 {
137  if( command == fAbsMaterCmd )
138  { fDetector->SetAbsorberMaterial(newValue);}
139 
140  if( command == fWorldMaterCmd )
141  { fDetector->SetWorldMaterial(newValue);}
142 
143  if( command == fAbsThickCmd )
144  { fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
145 
146  if( command == fAbsRadCmd )
147  { fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
148 
149  if( command == fAbsZposCmd )
150  { fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
151 
152  if( command == fWorldZCmd )
153  { fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
154 
155  if( command == fWorldRCmd )
156  { fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
157 
158  if( command == fUpdateCmd )
159  { fDetector->UpdateGeometry(); }
160 
161 }
162 
163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....