[807] | 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 | // GEANT4 test IBREM |
---|
| 28 | // |
---|
| 29 | // Authors: V.Grichine, V.Ivanchenko |
---|
| 30 | // |
---|
| 31 | // Modified: |
---|
| 32 | // |
---|
| 33 | // 18-02-03 V.Ivanchenko create |
---|
| 34 | // |
---|
| 35 | // ------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 38 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 39 | |
---|
| 40 | #include "DetectorMessenger.hh" |
---|
| 41 | #include "DetectorConstruction.hh" |
---|
| 42 | #include "Histo.hh" |
---|
| 43 | #include "G4UIdirectory.hh" |
---|
| 44 | #include "G4UIcmdWithABool.hh" |
---|
| 45 | #include "G4UIcmdWithAString.hh" |
---|
| 46 | #include "G4UIcmdWithAnInteger.hh" |
---|
| 47 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 48 | #include "G4UIcmdWithoutParameter.hh" |
---|
| 49 | |
---|
| 50 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 51 | |
---|
| 52 | DetectorMessenger::DetectorMessenger(DetectorConstruction* h): |
---|
| 53 | hDet(h) |
---|
| 54 | { |
---|
| 55 | detDir = new G4UIdirectory("/testem/"); |
---|
| 56 | detDir->SetGuidance("General commands"); |
---|
| 57 | detDir1= new G4UIdirectory("/testem/physics/"); |
---|
| 58 | detDir1->SetGuidance(" commands to define physics"); |
---|
| 59 | detDir2= new G4UIdirectory("/testem/gun/"); |
---|
| 60 | detDir2->SetGuidance(" commands to define gun"); |
---|
| 61 | |
---|
| 62 | AbsMaterCmd = new G4UIcmdWithAString("/testem/target1Material",this); |
---|
| 63 | AbsMaterCmd->SetGuidance("Select Material of the target1."); |
---|
| 64 | AbsMaterCmd->SetParameterName("Material1",false); |
---|
| 65 | AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 66 | |
---|
| 67 | WorldMaterCmd = new G4UIcmdWithAString("/testem/target2Material",this); |
---|
| 68 | WorldMaterCmd->SetGuidance("Select Material of the target2."); |
---|
| 69 | WorldMaterCmd->SetParameterName("Material2",false); |
---|
| 70 | WorldMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 71 | |
---|
| 72 | AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/mylarZ",this); |
---|
| 73 | AbsThickCmd->SetGuidance("Set mylarZ"); |
---|
| 74 | AbsThickCmd->SetParameterName("mylarZ",false); |
---|
| 75 | AbsThickCmd->SetUnitCategory("Length"); |
---|
| 76 | AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 77 | |
---|
| 78 | AbsGapCmd = new G4UIcmdWithADoubleAndUnit("/testem/delta",this); |
---|
| 79 | AbsGapCmd->SetGuidance("Set gap between absorbers"); |
---|
| 80 | AbsGapCmd->SetParameterName("delta",false); |
---|
| 81 | AbsGapCmd->SetUnitCategory("Length"); |
---|
| 82 | AbsGapCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 83 | |
---|
| 84 | AbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/target1Z",this); |
---|
| 85 | AbsSizYZCmd->SetGuidance("Set targeet1Z"); |
---|
| 86 | AbsSizYZCmd->SetParameterName("target1Z",false); |
---|
| 87 | AbsSizYZCmd->SetUnitCategory("Length"); |
---|
| 88 | AbsSizYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 89 | |
---|
| 90 | WorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/target2Z",this); |
---|
| 91 | WorldXCmd->SetGuidance("Set target2Z"); |
---|
| 92 | WorldXCmd->SetParameterName("target2Z",false); |
---|
| 93 | WorldXCmd->SetUnitCategory("Length"); |
---|
| 94 | WorldXCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 95 | |
---|
| 96 | UpdateCmd = new G4UIcmdWithoutParameter("/testem/update",this); |
---|
| 97 | UpdateCmd->SetGuidance("Update calorimeter geometry."); |
---|
| 98 | UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); |
---|
| 99 | UpdateCmd->SetGuidance("if you changed geometrical value(s)."); |
---|
| 100 | UpdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 101 | |
---|
| 102 | XMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/checkShiftZ",this); |
---|
| 103 | XMagFieldCmd->SetGuidance("Define checkShftZ"); |
---|
| 104 | XMagFieldCmd->SetParameterName("CheckSZ",false); |
---|
| 105 | XMagFieldCmd->SetUnitCategory("Length"); |
---|
| 106 | XMagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 107 | |
---|
| 108 | YMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdZ",this); |
---|
| 109 | YMagFieldCmd->SetGuidance("Define sensitive detector Z"); |
---|
| 110 | YMagFieldCmd->SetParameterName("sdZ",false); |
---|
| 111 | YMagFieldCmd->SetUnitCategory("Length"); |
---|
| 112 | YMagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 113 | |
---|
| 114 | ZMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdShiftZ",this); |
---|
| 115 | ZMagFieldCmd->SetGuidance("Define shift of sensitive detector"); |
---|
| 116 | ZMagFieldCmd->SetParameterName("sdShiftZ",false); |
---|
| 117 | ZMagFieldCmd->SetUnitCategory("Length"); |
---|
| 118 | ZMagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 119 | |
---|
| 120 | HistoCmd = new G4UIcmdWithAString("/testem/histoName",this); |
---|
| 121 | HistoCmd->SetGuidance("Set the name of the histo file"); |
---|
| 122 | HistoCmd->SetParameterName("histo",false); |
---|
| 123 | HistoCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 124 | |
---|
| 125 | HistoTCmd = new G4UIcmdWithAString("/testem/histoType",this); |
---|
| 126 | HistoTCmd->SetGuidance("Set the type of the histo file"); |
---|
| 127 | HistoTCmd->SetParameterName("histoT",false); |
---|
| 128 | HistoTCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 129 | |
---|
| 130 | ntupCmd = new G4UIcmdWithABool("/testem/ntuple",this); |
---|
| 131 | ntupCmd->SetGuidance("Set ntuple to fill"); |
---|
| 132 | ntupCmd->SetParameterName("ntuple",false); |
---|
| 133 | ntupCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 134 | |
---|
| 135 | NumOfAbsCmd = new G4UIcmdWithAnInteger("/testem/numberDivR",this); |
---|
| 136 | NumOfAbsCmd->SetGuidance("Set number divisions R"); |
---|
| 137 | NumOfAbsCmd->SetParameterName("NR",false); |
---|
| 138 | NumOfAbsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 139 | |
---|
| 140 | NumOfEvt = new G4UIcmdWithAnInteger("/testem/numberDivZ",this); |
---|
| 141 | NumOfEvt->SetGuidance("Set number of divisions Z"); |
---|
| 142 | NumOfEvt->SetParameterName("NZ",false); |
---|
| 143 | NumOfEvt->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 144 | |
---|
| 145 | verbCmd = new G4UIcmdWithAnInteger("/testem/verbose",this); |
---|
| 146 | verbCmd->SetGuidance("Set verbose for "); |
---|
| 147 | verbCmd->SetParameterName("verb",false); |
---|
| 148 | verbCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 149 | |
---|
| 150 | intCmd = new G4UIcmdWithAnInteger("/testem/numberDivE",this); |
---|
| 151 | intCmd->SetGuidance("Set number of divisions E"); |
---|
| 152 | intCmd->SetParameterName("NZ",false); |
---|
| 153 | intCmd->AvailableForStates(G4State_PreInit); |
---|
| 154 | |
---|
| 155 | nhistCmd = new G4UIcmdWithAnInteger("/testem/histoNumber",this); |
---|
| 156 | nhistCmd->SetGuidance("Set number of histograms to fill"); |
---|
| 157 | nhistCmd->SetParameterName("HistoNumber",false); |
---|
| 158 | nhistCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 159 | |
---|
| 160 | nDebugSCmd = new G4UIcmdWithAnInteger("/testem/nFirstEventToDebug",this); |
---|
| 161 | nDebugSCmd->SetGuidance("Set number of the first event to debug"); |
---|
| 162 | nDebugSCmd->SetParameterName("nFirstEventToDebug",false); |
---|
| 163 | nDebugSCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 164 | |
---|
| 165 | nDebugECmd = new G4UIcmdWithAnInteger("/testem/nLastEventToDebug",this); |
---|
| 166 | nDebugECmd->SetGuidance("Set number of the last event to debug"); |
---|
| 167 | nDebugECmd->SetParameterName("nLastEventToDebug",false); |
---|
| 168 | nDebugECmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 169 | |
---|
| 170 | DeltaECmd = new G4UIcmdWithADoubleAndUnit("/testem/maxEnergy",this); |
---|
| 171 | DeltaECmd->SetGuidance("Define scale of secondary energy histogram"); |
---|
| 172 | DeltaECmd->SetParameterName("DeltaE",false); |
---|
| 173 | DeltaECmd->SetUnitCategory("Energy"); |
---|
| 174 | DeltaECmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
| 175 | |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 179 | |
---|
| 180 | DetectorMessenger::~DetectorMessenger() |
---|
| 181 | { |
---|
| 182 | delete NumOfAbsCmd; |
---|
| 183 | delete AbsMaterCmd; |
---|
| 184 | delete AbsThickCmd; |
---|
| 185 | delete AbsGapCmd; |
---|
| 186 | delete AbsSizYZCmd; |
---|
| 187 | delete WorldMaterCmd; |
---|
| 188 | delete WorldXCmd; |
---|
| 189 | delete UpdateCmd; |
---|
| 190 | delete XMagFieldCmd; |
---|
| 191 | delete YMagFieldCmd; |
---|
| 192 | delete ZMagFieldCmd; |
---|
| 193 | delete HistoCmd; |
---|
| 194 | delete HistoTCmd; |
---|
| 195 | delete NumOfEvt; |
---|
| 196 | delete verbCmd; |
---|
| 197 | delete intCmd; |
---|
| 198 | delete nhistCmd; |
---|
| 199 | delete nDebugSCmd; |
---|
| 200 | delete nDebugECmd; |
---|
| 201 | delete detDir; |
---|
| 202 | delete detDir1; |
---|
| 203 | delete detDir2; |
---|
| 204 | delete DeltaECmd; |
---|
| 205 | delete ntupCmd; |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 209 | |
---|
| 210 | void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) |
---|
| 211 | { |
---|
| 212 | if( command == AbsMaterCmd ) |
---|
| 213 | { hDet->setTarget1Material(newValue);} |
---|
| 214 | |
---|
| 215 | if( command == WorldMaterCmd ) |
---|
| 216 | { hDet->setTarget2Material(newValue);} |
---|
| 217 | |
---|
| 218 | if( command == AbsThickCmd ) |
---|
| 219 | { hDet->setMylarZ(AbsThickCmd->GetNewDoubleValue(newValue));} |
---|
| 220 | |
---|
| 221 | if( command == AbsGapCmd ) |
---|
| 222 | { hDet->setGap(AbsGapCmd->GetNewDoubleValue(newValue));} |
---|
| 223 | |
---|
| 224 | if( command == AbsSizYZCmd ) |
---|
| 225 | { hDet->setTarget1Z(AbsSizYZCmd->GetNewDoubleValue(newValue));} |
---|
| 226 | |
---|
| 227 | if( command == WorldXCmd ) |
---|
| 228 | { hDet->setTarget2Z(WorldXCmd->GetNewDoubleValue(newValue));} |
---|
| 229 | |
---|
| 230 | if( command == UpdateCmd ) |
---|
| 231 | { hDet->UpdateGeometry(); } |
---|
| 232 | |
---|
| 233 | if( command == XMagFieldCmd ) |
---|
| 234 | { hDet->setCheckShiftZ(XMagFieldCmd->GetNewDoubleValue(newValue));} |
---|
| 235 | |
---|
| 236 | if( command == YMagFieldCmd ) |
---|
| 237 | { G4double x = YMagFieldCmd->GetNewDoubleValue(newValue); |
---|
| 238 | hDet->setAbsorberZ(x); |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | if( command == ZMagFieldCmd ) |
---|
| 242 | { hDet->setAbsorberShiftZ(ZMagFieldCmd->GetNewDoubleValue(newValue));} |
---|
| 243 | |
---|
| 244 | if( command == HistoCmd ) |
---|
| 245 | { (Histo::GetPointer())->SetHistoName(newValue);} |
---|
| 246 | |
---|
| 247 | if( command == HistoTCmd ) |
---|
| 248 | { (Histo::GetPointer())->SetHistoType(newValue);} |
---|
| 249 | |
---|
| 250 | if( command == ntupCmd ) |
---|
| 251 | { (Histo::GetPointer())->SetNtuple(ntupCmd->GetNewBoolValue(newValue));} |
---|
| 252 | |
---|
| 253 | if( command == NumOfAbsCmd ) |
---|
| 254 | {(Histo::GetPointer())->SetNumberDivR(NumOfAbsCmd->GetNewIntValue(newValue));} |
---|
| 255 | |
---|
| 256 | if( command == NumOfEvt ) |
---|
| 257 | {(Histo::GetPointer())->SetNumberDivZ(NumOfEvt->GetNewIntValue(newValue));} |
---|
| 258 | |
---|
| 259 | if( command == verbCmd ){ |
---|
| 260 | G4int ver = verbCmd->GetNewIntValue(newValue); |
---|
| 261 | (Histo::GetPointer())->SetVerbose(ver); |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | if( command == intCmd ) |
---|
| 265 | {(Histo::GetPointer())->SetNumberDivE(intCmd->GetNewIntValue(newValue));} |
---|
| 266 | |
---|
| 267 | if( command == nhistCmd ) |
---|
| 268 | { (Histo::GetPointer())->SetHistoNumber(nhistCmd->GetNewIntValue(newValue));} |
---|
| 269 | |
---|
| 270 | if( command == nDebugSCmd ) |
---|
| 271 | {(Histo::GetPointer())->SetFirstEventToDebug(nDebugSCmd->GetNewIntValue(newValue));} |
---|
| 272 | |
---|
| 273 | if( command == nDebugECmd ) |
---|
| 274 | {(Histo::GetPointer())->SetLastEventToDebug(nDebugECmd->GetNewIntValue(newValue));} |
---|
| 275 | |
---|
| 276 | if( command == DeltaECmd ) |
---|
| 277 | {(Histo::GetPointer()) ->SetMaxEnergy(DeltaECmd->GetNewDoubleValue(newValue));} |
---|
| 278 | |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|