Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Em10DetectorMessenger.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 /// \file electromagnetic/TestEm10/src/Em10DetectorMessenger.cc
27 /// \brief Implementation of the Em10DetectorMessenger class
28 //
29 //
30 // $Id: Em10DetectorMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
31 //
32 //
33 
34 #include "Em10DetectorMessenger.hh"
35 
37 #include "G4UIdirectory.hh"
38 #include "G4UIcmdWithAString.hh"
39 #include "G4UIcmdWithAnInteger.hh"
42 
43 //////////////////////////////////////////////////////////////////////////////
44 
46 :G4UImessenger(),
47  Em10Detector(Em10Det)
48 {
49  Em10detDir = new G4UIdirectory("/XTRdetector/");
50  Em10detDir->SetGuidance("Em10 detector control.");
51 
52  AbsMaterCmd = new G4UIcmdWithAString("/XTRdetector/setAbsMat",this);
53  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
54  AbsMaterCmd->SetParameterName("choice",true);
55  AbsMaterCmd->SetDefaultValue("Xe");
56  AbsMaterCmd->AvailableForStates(G4State_Idle);
57 
58  RadiatorMaterCmd = new G4UIcmdWithAString("/XTRdetector/setRadMat",this);
59  RadiatorMaterCmd->SetGuidance("Select Material of the XTR radiator.");
60  RadiatorMaterCmd->SetParameterName("choice",true);
61  RadiatorMaterCmd->SetDefaultValue("CH2");
62  RadiatorMaterCmd->AvailableForStates(G4State_Idle);
63 
64  DetectorSetUpCmd = new G4UIcmdWithAString("/XTRdetector/setup",this);
65  DetectorSetUpCmd->SetGuidance("Select setup for comparison with experiment");
66  DetectorSetUpCmd->SetParameterName("choice",true);
67  DetectorSetUpCmd->SetDefaultValue("simpleALICE");
69 
70  ModelCmd = new G4UIcmdWithAnInteger("/XTRdetector/setModel",this);
71  ModelCmd->SetGuidance("Select Model for XTR");
72  ModelCmd->SetParameterName("choice",true);
73  ModelCmd->SetDefaultValue(0);
74  // ModelCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
76 
77  FoilNumCmd = new G4UIcmdWithAnInteger("/XTRdetector/setFoilNum",this);
78  FoilNumCmd->SetGuidance("Select foil number for XTR");
79  FoilNumCmd->SetParameterName("choice",true);
80  FoilNumCmd->SetDefaultValue(0);
82 
83  WorldMaterCmd = new G4UIcmdWithAString("/XTRdetector/setWorldMat",this);
84  WorldMaterCmd->SetGuidance("Select Material of the World.");
85  WorldMaterCmd->SetParameterName("wchoice",true);
86  WorldMaterCmd->SetDefaultValue("Air");
87  WorldMaterCmd->AvailableForStates(G4State_Idle);
88 
89  AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setAbsThick",this);
90  AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
91  AbsThickCmd->SetParameterName("SizeZ",false,false);
92  AbsThickCmd->SetDefaultUnit("mm");
93  AbsThickCmd->SetRange("SizeZ>0.");
94  AbsThickCmd->AvailableForStates(G4State_Idle);
95 
96  RadiatorThickCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setRadThick",this);
97  RadiatorThickCmd->SetGuidance("Set Thickness of XTR radiator");
98  RadiatorThickCmd->SetParameterName("SizeZ",false,false);
99  RadiatorThickCmd->SetDefaultUnit("mm");
100  RadiatorThickCmd->SetRange("SizeZ>0.");
101  RadiatorThickCmd->AvailableForStates(G4State_Idle);
102 
103  GasGapThickCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setGasGapThick",this);
104  GasGapThickCmd->SetGuidance("Set Thickness of XTR gas gaps");
105  GasGapThickCmd->SetParameterName("SizeZ",false,false);
106  GasGapThickCmd->SetDefaultUnit("mm");
107  GasGapThickCmd->SetRange("SizeZ>0.");
108  GasGapThickCmd->AvailableForStates(G4State_Idle);
109 
110  AbsRadCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setAbsRad",this);
111  AbsRadCmd->SetGuidance("Set radius of the Absorber");
112  AbsRadCmd->SetParameterName("SizeR",false,false);
113  AbsRadCmd->SetDefaultUnit("mm");
114  AbsRadCmd->SetRange("SizeR>0.");
115  AbsRadCmd->AvailableForStates(G4State_Idle);
116 
117  AbsZposCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setAbsZpos",this);
118  AbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
119  AbsZposCmd->SetParameterName("Zpos",false,false);
120  AbsZposCmd->SetDefaultUnit("mm");
121  AbsZposCmd->AvailableForStates(G4State_Idle);
122 
123  WorldZCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setWorldZ",this);
124  WorldZCmd->SetGuidance("Set Z size of the World");
125  WorldZCmd->SetParameterName("WSizeZ",false,false);
126  WorldZCmd->SetDefaultUnit("mm");
127  WorldZCmd->SetRange("WSizeZ>0.");
128  WorldZCmd->AvailableForStates(G4State_Idle);
129 
130  WorldRCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setWorldR",this);
131  WorldRCmd->SetGuidance("Set R size of the World");
132  WorldRCmd->SetParameterName("WSizeR",false,false);
133  WorldRCmd->SetDefaultUnit("mm");
134  WorldRCmd->SetRange("WSizeR>0.");
135  WorldRCmd->AvailableForStates(G4State_Idle);
136 
137  UpdateCmd = new G4UIcmdWithoutParameter("/XTRdetector/update",this);
138  UpdateCmd->SetGuidance("Update calorimeter geometry.");
139  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
140  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
141  UpdateCmd->AvailableForStates(G4State_Idle);
142 
143  MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setField",this);
144  MagFieldCmd->SetGuidance("Define magnetic field.");
145  MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
146  MagFieldCmd->SetParameterName("Bz",false,false);
147  MagFieldCmd->SetDefaultUnit("tesla");
148  MagFieldCmd->AvailableForStates(G4State_Idle);
149  /*
150  ElectronCutCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setElectronCut",this);
151  ElectronCutCmd->SetGuidance("Set electron cut in mm for vertex region");
152  ElectronCutCmd->SetParameterName("ElectronCut",false,false);
153  ElectronCutCmd->SetDefaultUnit("mm");
154  ElectronCutCmd->SetRange("ElectronCut>0.");
155  ElectronCutCmd->AvailableForStates(G4State_Idle);
156 
157 
158  PositronCutCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setPositronCut",this);
159  PositronCutCmd->SetGuidance("Set positron cut in mm for vertex region");
160  PositronCutCmd->SetParameterName("PositronCut",false,false);
161  PositronCutCmd->SetDefaultUnit("mm");
162  PositronCutCmd->SetRange("PositronCut>0.");
163  PositronCutCmd->AvailableForStates(G4State_Idle);
164 
165 
166  GammaCutCmd = new G4UIcmdWithADoubleAndUnit("/XTRdetector/setGammaCut",this);
167  GammaCutCmd->SetGuidance("Set gamma cut in mm for vertex region");
168  GammaCutCmd->SetParameterName("GammaCut",false,false);
169  GammaCutCmd->SetDefaultUnit("mm");
170  GammaCutCmd->SetRange("GammaCut>0.");
171  GammaCutCmd->AvailableForStates(G4State_Idle);
172  */
173 
174 }
175 
176 ///////////////////////////////////////////////////////////////////////////////
177 
179 {
180  delete AbsMaterCmd;
181  delete ModelCmd;
182  delete FoilNumCmd;
183  delete AbsThickCmd;
184  delete RadiatorThickCmd;
185  delete GasGapThickCmd;
186  delete AbsRadCmd;
187  delete AbsZposCmd;
188  delete WorldMaterCmd;
189  delete RadiatorMaterCmd;
190  delete WorldZCmd;
191  delete WorldRCmd;
192  delete UpdateCmd;
193  delete MagFieldCmd;
194  delete Em10detDir;
195 }
196 
197 /////////////////////////////////////////////////////////////////////////////
198 
200 {
201  if( command == ModelCmd && newValue == 0 )
202  {
203  // Em10Detector->SetParametrisationModel(newValue);
204  Em10Detector->Construct();
205  }
206 }
207 ////////////////////////////////////////////////////////////////////////////
208 //
209 //
210 
212 {
213  if( command == ModelCmd )
214  {
215  // Em10Detector->SetParametrisationModel(ModelCmd->GetNewIntValue(newValue));
216  // Em10Detector->ParametrisationModel();
217  }
218  if( command == FoilNumCmd )
219  {
220  Em10Detector->SetFoilNumber(FoilNumCmd->GetNewIntValue(newValue));
221  }
222  if( command == AbsMaterCmd )
223  { Em10Detector->SetAbsorberMaterial(newValue);}
224 
225  if( command == DetectorSetUpCmd )
226  { Em10Detector->SetDetectorSetUp(newValue);}
227 
228  if( command == RadiatorMaterCmd )
229  { Em10Detector->SetRadiatorMaterial(newValue);}
230 
231  if( command == WorldMaterCmd )
232  { Em10Detector->SetWorldMaterial(newValue);}
233 
234  if( command == AbsThickCmd )
235  { Em10Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
236 
237  if( command == RadiatorThickCmd )
238  { Em10Detector->SetRadiatorThickness(RadiatorThickCmd->
239  GetNewDoubleValue(newValue));}
240 
241  if( command == GasGapThickCmd )
242  { Em10Detector->SetGasGapThickness(GasGapThickCmd->
243  GetNewDoubleValue(newValue));}
244 
245  if( command == AbsRadCmd )
246  { Em10Detector->SetAbsorberRadius(AbsRadCmd->GetNewDoubleValue(newValue));}
247 
248  if( command == AbsZposCmd )
249  { Em10Detector->SetAbsorberZpos(AbsZposCmd->GetNewDoubleValue(newValue));}
250 
251  if( command == WorldZCmd )
252  { Em10Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));}
253 
254  if( command == WorldRCmd )
255  { Em10Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));}
256 
257  if( command == UpdateCmd )
258  { Em10Detector->UpdateGeometry(); }
259 
260  if( command == MagFieldCmd )
261  { Em10Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
262  /*
263  if( command == ElectronCutCmd )
264  {
265  Em10Detector->SetElectronCut(WorldRCmd->GetNewDoubleValue(newValue));
266  }
267  if( command == PositronCutCmd )
268  {
269  Em10Detector->SetPositronCut(WorldRCmd->GetNewDoubleValue(newValue));
270  }
271  if( command == GammaCutCmd )
272  {
273  Em10Detector->SetGammaCut(WorldRCmd->GetNewDoubleValue(newValue));
274  }
275  */
276 }
277 
278 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Em10DetectorMessenger(Em10DetectorConstruction *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
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
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
Definition of the Em10DetectorMessenger class.
Definition of the Em10DetectorConstruction class.
void SetDefaultValue(G4int defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetNewValue(G4UIcommand *, G4String)