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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 //
 27 /// \file medical/GammaTherapy/src/DetectorMessenger.cc
 28 /// \brief Implementation of the DetectorMessenger class
 29 //
 30 // -------------------------------------------------------------
 31 //      GEANT4  test  IBREM
 32 //
 33 // Authors: V.Grichine, V.Ivanchenko
 34 //
 35 // Modified:
 36 //
 37 // 18-02-03 V.Ivanchenko create
 38 //
 39 // -------------------------------------------------------------
 40 
 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43 
 44 #include "DetectorMessenger.hh"
 45 
 46 #include "DetectorConstruction.hh"
 47 
 48 #include "G4UIcmdWithABool.hh"
 49 #include "G4UIcmdWithADoubleAndUnit.hh"
 50 #include "G4UIcmdWithAString.hh"
 51 #include "G4UIcmdWithAnInteger.hh"
 52 #include "G4UIcmdWithoutParameter.hh"
 53 #include "G4UIdirectory.hh"
 54 
 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 56 
 57 DetectorMessenger::DetectorMessenger(DetectorConstruction* h) : fDetector(h)
 58 {
 59   fDetDir = new G4UIdirectory("/testem/");
 60   fDetDir->SetGuidance("General  commands");
 61   fDetDir1 = new G4UIdirectory("/testem/physics/");
 62   fDetDir1->SetGuidance(" commands to define physics");
 63   fDetDir2 = new G4UIdirectory("/testem/gun/");
 64   fDetDir2->SetGuidance(" commands to define gun");
 65 
 66   fAbsMaterCmd = new G4UIcmdWithAString("/testem/target1Material", this);
 67   fAbsMaterCmd->SetGuidance("Select Material of the target1.");
 68   fAbsMaterCmd->SetParameterName("Material1", false);
 69   fAbsMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 70 
 71   fWorldMaterCmd = new G4UIcmdWithAString("/testem/target2Material", this);
 72   fWorldMaterCmd->SetGuidance("Select Material of the target2.");
 73   fWorldMaterCmd->SetParameterName("Material2", false);
 74   fWorldMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 75 
 76   fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/mylarZ", this);
 77   fAbsThickCmd->SetGuidance("Set mylarZ");
 78   fAbsThickCmd->SetParameterName("mylarZ", false);
 79   fAbsThickCmd->SetUnitCategory("Length");
 80   fAbsThickCmd->AvailableForStates(G4State_PreInit);
 81 
 82   fAbsGapCmd = new G4UIcmdWithADoubleAndUnit("/testem/delta", this);
 83   fAbsGapCmd->SetGuidance("Set gap between absorbers");
 84   fAbsGapCmd->SetParameterName("delta", false);
 85   fAbsGapCmd->SetUnitCategory("Length");
 86   fAbsGapCmd->AvailableForStates(G4State_PreInit);
 87 
 88   fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/target1Z", this);
 89   fAbsSizYZCmd->SetGuidance("Set targeet1Z");
 90   fAbsSizYZCmd->SetParameterName("target1Z", false);
 91   fAbsSizYZCmd->SetUnitCategory("Length");
 92   fAbsSizYZCmd->AvailableForStates(G4State_PreInit);
 93 
 94   fWorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/target2Z", this);
 95   fWorldXCmd->SetGuidance("Set target2Z");
 96   fWorldXCmd->SetParameterName("target2Z", false);
 97   fWorldXCmd->SetUnitCategory("Length");
 98   fWorldXCmd->AvailableForStates(G4State_PreInit);
 99 
100   fXMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/checkShiftZ", this);
101   fXMagFieldCmd->SetGuidance("Define checkShftZ");
102   fXMagFieldCmd->SetParameterName("CheckSZ", false);
103   fXMagFieldCmd->SetUnitCategory("Length");
104   fXMagFieldCmd->AvailableForStates(G4State_PreInit);
105 
106   fYMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdZ", this);
107   fYMagFieldCmd->SetGuidance("Define sensitive detector Z");
108   fYMagFieldCmd->SetParameterName("sdZ", false);
109   fYMagFieldCmd->SetUnitCategory("Length");
110   fYMagFieldCmd->AvailableForStates(G4State_PreInit);
111 
112   fZMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdShiftZ", this);
113   fZMagFieldCmd->SetGuidance("Define shift of sensitive detector");
114   fZMagFieldCmd->SetParameterName("sdShiftZ", false);
115   fZMagFieldCmd->SetUnitCategory("Length");
116   fZMagFieldCmd->AvailableForStates(G4State_PreInit);
117 
118   fNumOfAbsCmd = new G4UIcmdWithAnInteger("/testem/numberDivR", this);
119   fNumOfAbsCmd->SetGuidance("Set number divisions R");
120   fNumOfAbsCmd->SetParameterName("NR", false);
121   fNumOfAbsCmd->AvailableForStates(G4State_PreInit);
122 
123   fNumOfEvt = new G4UIcmdWithAnInteger("/testem/numberDivZ", this);
124   fNumOfEvt->SetGuidance("Set number of divisions Z");
125   fNumOfEvt->SetParameterName("NZ", false);
126   fNumOfEvt->AvailableForStates(G4State_PreInit);
127 
128   fVerbCmd = new G4UIcmdWithAnInteger("/testem/verbose", this);
129   fVerbCmd->SetGuidance("Set verbose for ");
130   fVerbCmd->SetParameterName("verb", false);
131   fVerbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
132 
133   fIntCmd = new G4UIcmdWithAnInteger("/testem/numberDivE", this);
134   fIntCmd->SetGuidance("Set number of divisions E");
135   fIntCmd->SetParameterName("NZ", false);
136   fIntCmd->AvailableForStates(G4State_PreInit);
137 
138   fDeltaECmd = new G4UIcmdWithADoubleAndUnit("/testem/maxEnergy", this);
139   fDeltaECmd->SetGuidance("Define scale of secondary energy histogram");
140   fDeltaECmd->SetParameterName("DeltaE", false);
141   fDeltaECmd->SetUnitCategory("Energy");
142   fDeltaECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146 
147 DetectorMessenger::~DetectorMessenger()
148 {
149   delete fDetDir;
150   delete fDetDir1;
151   delete fDetDir2;
152 
153   delete fAbsMaterCmd;
154   delete fAbsThickCmd;
155   delete fAbsGapCmd;
156   delete fAbsSizYZCmd;
157   delete fWorldMaterCmd;
158   delete fWorldXCmd;
159   delete fXMagFieldCmd;
160   delete fYMagFieldCmd;
161   delete fZMagFieldCmd;
162   delete fNumOfAbsCmd;
163   delete fNumOfEvt;
164   delete fVerbCmd;
165   delete fIntCmd;
166   delete fDeltaECmd;
167 }
168 
169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
170 
171 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
172 {
173   if (command == fAbsMaterCmd) {
174     fDetector->SetTarget1Material(newValue);
175   }
176 
177   if (command == fWorldMaterCmd) {
178     fDetector->SetTarget2Material(newValue);
179   }
180 
181   if (command == fAbsThickCmd) {
182     fDetector->SetMylarZ(fAbsThickCmd->GetNewDoubleValue(newValue));
183   }
184 
185   if (command == fAbsGapCmd) {
186     fDetector->SetGap(fAbsGapCmd->GetNewDoubleValue(newValue));
187   }
188 
189   if (command == fAbsSizYZCmd) {
190     fDetector->SetTarget1Z(fAbsSizYZCmd->GetNewDoubleValue(newValue));
191   }
192 
193   if (command == fWorldXCmd) {
194     fDetector->SetTarget2Z(fWorldXCmd->GetNewDoubleValue(newValue));
195   }
196 
197   if (command == fXMagFieldCmd) {
198     fDetector->SetCheckShiftZ(fXMagFieldCmd->GetNewDoubleValue(newValue));
199   }
200 
201   if (command == fYMagFieldCmd) {
202     G4double x = fYMagFieldCmd->GetNewDoubleValue(newValue);
203     fDetector->SetAbsorberZ(x);
204   }
205 
206   if (command == fZMagFieldCmd) {
207     fDetector->SetAbsorberShiftZ(fZMagFieldCmd->GetNewDoubleValue(newValue));
208   }
209 
210   if (command == fNumOfAbsCmd) {
211     fDetector->SetNumberDivR(fNumOfAbsCmd->GetNewIntValue(newValue));
212   }
213 
214   if (command == fNumOfEvt) {
215     fDetector->SetNumberDivZ(fNumOfEvt->GetNewIntValue(newValue));
216   }
217 
218   if (command == fIntCmd) {
219     fDetector->SetNumberDivE(fIntCmd->GetNewIntValue(newValue));
220   }
221   if (command == fDeltaECmd) {
222     fDetector->SetMaxEnergy(fDeltaECmd->GetNewDoubleValue(newValue));
223   }
224 
225   if (command == fVerbCmd) {
226     G4int ver = fVerbCmd->GetNewIntValue(newValue);
227     fDetector->SetVerbose(ver);
228   }
229 }
230 
231 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
232