Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // GEANT4 test IBREM
31 //
32 // Authors: V.Grichine, V.Ivanchenko
33 //
34 // Modified:
35 //
36 // 18-02-03 V.Ivanchenko create
37 //
38 // -------------------------------------------------------------
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
42 
43 #include "DetectorMessenger.hh"
44 #include "DetectorConstruction.hh"
45 #include "Histo.hh"
46 #include "G4UIdirectory.hh"
47 #include "G4UIcmdWithABool.hh"
48 #include "G4UIcmdWithAString.hh"
49 #include "G4UIcmdWithAnInteger.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54 
56  fDetector(h)
57 {
58  fDetDir = new G4UIdirectory("/testem/");
59  fDetDir->SetGuidance("General commands");
60  fDetDir1= new G4UIdirectory("/testem/physics/");
61  fDetDir1->SetGuidance(" commands to define physics");
62  fDetDir2= new G4UIdirectory("/testem/gun/");
63  fDetDir2->SetGuidance(" commands to define gun");
64 
65  fAbsMaterCmd = new G4UIcmdWithAString("/testem/target1Material",this);
66  fAbsMaterCmd->SetGuidance("Select Material of the target1.");
67  fAbsMaterCmd->SetParameterName("Material1",false);
69 
70  fWorldMaterCmd = new G4UIcmdWithAString("/testem/target2Material",this);
71  fWorldMaterCmd->SetGuidance("Select Material of the target2.");
72  fWorldMaterCmd->SetParameterName("Material2",false);
74 
75  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/mylarZ",this);
76  fAbsThickCmd->SetGuidance("Set mylarZ");
77  fAbsThickCmd->SetParameterName("mylarZ",false);
78  fAbsThickCmd->SetUnitCategory("Length");
80 
81  fAbsGapCmd = new G4UIcmdWithADoubleAndUnit("/testem/delta",this);
82  fAbsGapCmd->SetGuidance("Set gap between absorbers");
83  fAbsGapCmd->SetParameterName("delta",false);
84  fAbsGapCmd->SetUnitCategory("Length");
86 
87  fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/target1Z",this);
88  fAbsSizYZCmd->SetGuidance("Set targeet1Z");
89  fAbsSizYZCmd->SetParameterName("target1Z",false);
90  fAbsSizYZCmd->SetUnitCategory("Length");
92 
93  fWorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/target2Z",this);
94  fWorldXCmd->SetGuidance("Set target2Z");
95  fWorldXCmd->SetParameterName("target2Z",false);
96  fWorldXCmd->SetUnitCategory("Length");
98 
99  fUpdateCmd = new G4UIcmdWithoutParameter("/testem/update",this);
100  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
101  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
102  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
104 
105  fXMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/checkShiftZ",this);
106  fXMagFieldCmd->SetGuidance("Define checkShftZ");
107  fXMagFieldCmd->SetParameterName("CheckSZ",false);
108  fXMagFieldCmd->SetUnitCategory("Length");
110 
111  fYMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdZ",this);
112  fYMagFieldCmd->SetGuidance("Define sensitive detector Z");
113  fYMagFieldCmd->SetParameterName("sdZ",false);
114  fYMagFieldCmd->SetUnitCategory("Length");
116 
117  fZMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdShiftZ",this);
118  fZMagFieldCmd->SetGuidance("Define shift of sensitive detector");
119  fZMagFieldCmd->SetParameterName("sdShiftZ",false);
120  fZMagFieldCmd->SetUnitCategory("Length");
122 
123  fHistoCmd = new G4UIcmdWithAString("/testem/histoName",this);
124  fHistoCmd->SetGuidance("Set the name of the histo file");
125  fHistoCmd->SetParameterName("histo",false);
127 
128  fNumOfAbsCmd = new G4UIcmdWithAnInteger("/testem/numberDivR",this);
129  fNumOfAbsCmd->SetGuidance("Set number divisions R");
130  fNumOfAbsCmd->SetParameterName("NR",false);
132 
133  fNumOfEvt = new G4UIcmdWithAnInteger("/testem/numberDivZ",this);
134  fNumOfEvt->SetGuidance("Set number of divisions Z");
135  fNumOfEvt->SetParameterName("NZ",false);
137 
138  fVerbCmd = new G4UIcmdWithAnInteger("/testem/verbose",this);
139  fVerbCmd->SetGuidance("Set verbose for ");
140  fVerbCmd->SetParameterName("verb",false);
142 
143  fIntCmd = new G4UIcmdWithAnInteger("/testem/numberDivE",this);
144  fIntCmd->SetGuidance("Set number of divisions E");
145  fIntCmd->SetParameterName("NZ",false);
147 
148  fDeltaECmd = new G4UIcmdWithADoubleAndUnit("/testem/maxEnergy",this);
149  fDeltaECmd->SetGuidance("Define scale of secondary energy histogram");
150  fDeltaECmd->SetParameterName("DeltaE",false);
151  fDeltaECmd->SetUnitCategory("Energy");
153 
154 }
155 
156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
157 
159 {
160  delete fNumOfAbsCmd;
161  delete fAbsMaterCmd;
162  delete fAbsThickCmd;
163  delete fAbsGapCmd;
164  delete fAbsSizYZCmd;
165  delete fWorldMaterCmd;
166  delete fWorldXCmd;
167  delete fUpdateCmd;
168  delete fXMagFieldCmd;
169  delete fYMagFieldCmd;
170  delete fZMagFieldCmd;
171  delete fHistoCmd;
172  delete fNumOfEvt;
173  delete fVerbCmd;
174  delete fIntCmd;
175  delete fDetDir;
176  delete fDetDir1;
177  delete fDetDir2;
178  delete fDeltaECmd;
179 }
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
182 
184 {
185  if( command == fAbsMaterCmd )
186  { fDetector->SetTarget1Material(newValue);}
187 
188  if( command == fWorldMaterCmd )
189  { fDetector->SetTarget2Material(newValue);}
190 
191  if( command == fAbsThickCmd )
192  { fDetector->SetMylarZ(fAbsThickCmd->GetNewDoubleValue(newValue));}
193 
194  if( command == fAbsGapCmd )
195  { fDetector->SetGap(fAbsGapCmd->GetNewDoubleValue(newValue));}
196 
197  if( command == fAbsSizYZCmd )
198  { fDetector->SetTarget1Z(fAbsSizYZCmd->GetNewDoubleValue(newValue));}
199 
200  if( command == fWorldXCmd )
201  { fDetector->SetTarget2Z(fWorldXCmd->GetNewDoubleValue(newValue));}
202 
203  if( command == fUpdateCmd )
204  { fDetector->UpdateGeometry(); }
205 
206  if( command == fXMagFieldCmd )
207  { fDetector->SetCheckShiftZ(fXMagFieldCmd->GetNewDoubleValue(newValue));}
208 
209  if( command == fYMagFieldCmd )
210  { G4double x = fYMagFieldCmd->GetNewDoubleValue(newValue);
211  fDetector->SetAbsorberZ(x);
212  }
213 
214  if( command == fZMagFieldCmd )
215  { fDetector->SetAbsorberShiftZ(fZMagFieldCmd->GetNewDoubleValue(newValue));}
216 
217  if( command == fHistoCmd )
218  { (Histo::GetPointer())->SetHistoName(newValue);}
219 
220  if( command == fNumOfAbsCmd )
221  {(Histo::GetPointer())->SetNumberDivR(fNumOfAbsCmd->GetNewIntValue(newValue));}
222 
223  if( command == fNumOfEvt )
224  {(Histo::GetPointer())->SetNumberDivZ(fNumOfEvt->GetNewIntValue(newValue));}
225 
226  if( command == fVerbCmd ){
227  G4int ver = fVerbCmd->GetNewIntValue(newValue);
228  (Histo::GetPointer())->SetVerbose(ver);
229  }
230 
231  if( command == fIntCmd )
232  {(Histo::GetPointer())->SetNumberDivE(fIntCmd->GetNewIntValue(newValue));}
233 
234  if( command == fDeltaECmd )
235  {(Histo::GetPointer()) ->SetMaxEnergy(fDeltaECmd->GetNewDoubleValue(newValue));}
236 
237 }
238 
239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....