Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file DetectorMessenger.cc 27 /// \brief Implementation of the DetectorMesse 28 // 29 // 30 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 #include "DetectorMessenger.hh" 35 36 #include "DetectorConstruction.hh" 37 38 #include "G4UIcmdWithABool.hh" 39 #include "G4UIcmdWithADouble.hh" 40 #include "G4UIcmdWithADoubleAndUnit.hh" 41 #include "G4UIcmdWithAString.hh" 42 #include "G4UIcmdWithAnInteger.hh" 43 #include "G4UIcmdWithoutParameter.hh" 44 #include "G4UIdirectory.hh" 45 #include "globals.hh" 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 DetectorMessenger::DetectorMessenger(DetectorC 50 { 51 fDetectorDir = new G4UIdirectory("/mydet/"); 52 fDetectorDir->SetGuidance("Detector control. 53 54 fFieldCommand = new G4UIcmdWithADoubleAndUni 55 fFieldCommand->SetGuidance("Define uniform m 56 fFieldCommand->SetGuidance(" -> in unit of 57 fFieldCommand->SetParameterName("By", false) 58 fFieldCommand->SetDefaultValue(0.0); 59 fFieldCommand->SetUnitCategory("Magnetic flu 60 fFieldCommand->AvailableForStates(G4State_Pr 61 62 fAbsorberMaterial = new G4UIcmdWithAString(" 63 fAbsorberMaterial->SetGuidance("Choice of th 64 fAbsorberMaterial->SetGuidance(" iron / co 65 fAbsorberMaterial->SetParameterName("choiceA 66 fAbsorberMaterial->SetDefaultValue("iron"); 67 fAbsorberMaterial->AvailableForStates(G4Stat 68 69 fActiveMaterial = new G4UIcmdWithAString("/m 70 fActiveMaterial->SetGuidance("Choice of the 71 fActiveMaterial->SetGuidance(" scintillato 72 fActiveMaterial->SetParameterName("choiceAct 73 fActiveMaterial->SetDefaultValue("scintillat 74 fActiveMaterial->AvailableForStates(G4State_ 75 76 fIsCalHomogeneous = new G4UIcmdWithABool("/m 77 fIsCalHomogeneous->SetParameterName("choiceI 78 fIsCalHomogeneous->SetGuidance("Is the calor 79 fIsCalHomogeneous->SetGuidance(" -> yes|y|tr 80 fIsCalHomogeneous->SetGuidance(" -> no|n|fal 81 fIsCalHomogeneous->SetDefaultValue(false); 82 fIsCalHomogeneous->AvailableForStates(G4Stat 83 84 fIsUnitInLambda = new G4UIcmdWithABool("/myd 85 fIsUnitInLambda->SetParameterName("choiceIsU 86 fIsUnitInLambda->SetGuidance("Is unit for ab 87 fIsUnitInLambda->SetGuidance(" -> yes|y|true 88 fIsUnitInLambda->SetGuidance(" -> no|n|false 89 fIsUnitInLambda->SetDefaultValue(false); // 90 fIsUnitInLambda->AvailableForStates(G4State_ 91 92 fAbsorberTotalLength = new G4UIcmdWithADoubl 93 fAbsorberTotalLength->SetParameterName("choi 94 fAbsorberTotalLength->SetGuidance("Absorber 95 fAbsorberTotalLength->SetGuidance(" -> in un 96 fAbsorberTotalLength->SetGuidance(" -> depen 97 fAbsorberTotalLength->SetDefaultValue(2000.0 98 fAbsorberTotalLength->AvailableForStates(G4S 99 100 fCalorimeterRadius = new G4UIcmdWithADouble( 101 fCalorimeterRadius->SetParameterName("choice 102 fCalorimeterRadius->SetGuidance("Calorimeter 103 fCalorimeterRadius->SetGuidance(" -> in unit 104 fCalorimeterRadius->SetGuidance(" -> dependi 105 fCalorimeterRadius->SetDefaultValue(1000.0); 106 fCalorimeterRadius->AvailableForStates(G4Sta 107 108 fActiveLayerNumber = new G4UIcmdWithAnIntege 109 fActiveLayerNumber->SetParameterName("choice 110 fActiveLayerNumber->SetGuidance("Number of a 111 fActiveLayerNumber->SetDefaultValue(50); 112 fActiveLayerNumber->AvailableForStates(G4Sta 113 114 fActiveLayerSize = new G4UIcmdWithADouble("/ 115 fActiveLayerSize->SetParameterName("choiceAc 116 fActiveLayerSize->SetGuidance("Size (thickne 117 fActiveLayerSize->SetDefaultValue(4.0); // 118 fActiveLayerSize->AvailableForStates(G4State 119 120 fIsRadiusUnitInLambda = new G4UIcmdWithABool 121 fIsRadiusUnitInLambda->SetParameterName("cho 122 fIsRadiusUnitInLambda->SetGuidance("Is unit 123 fIsRadiusUnitInLambda->SetGuidance(" -> yes| 124 fIsRadiusUnitInLambda->SetGuidance(" -> no|n 125 fIsRadiusUnitInLambda->SetDefaultValue(false 126 fIsRadiusUnitInLambda->AvailableForStates(G4 127 128 fUpdateCommand = new G4UIcmdWithoutParameter 129 fUpdateCommand->SetGuidance("Update calorime 130 fUpdateCommand->SetGuidance("This command MU 131 fUpdateCommand->SetGuidance("if you changed 132 fUpdateCommand->AvailableForStates(G4State_I 133 } 134 135 //....oooOO0OOooo........oooOO0OOooo........oo 136 137 DetectorMessenger::~DetectorMessenger() 138 { 139 delete fFieldCommand; 140 delete fDetectorDir; 141 delete fAbsorberMaterial; 142 delete fActiveMaterial; 143 delete fIsCalHomogeneous; 144 delete fIsUnitInLambda; 145 delete fAbsorberTotalLength; 146 delete fCalorimeterRadius; 147 delete fActiveLayerNumber; 148 delete fActiveLayerSize; 149 delete fIsRadiusUnitInLambda; 150 delete fUpdateCommand; 151 } 152 153 //....oooOO0OOooo........oooOO0OOooo........oo 154 155 void DetectorMessenger::SetNewValue(G4UIcomman 156 { 157 if (command == fFieldCommand) { 158 fDetector->SetMagField(fFieldCommand->GetN 159 } 160 if (command == fAbsorberMaterial) { 161 fDetector->SetAbsorberMaterial(newValue); 162 } 163 if (command == fActiveMaterial) { 164 fDetector->SetActiveMaterial(newValue); 165 } 166 if (command == fIsCalHomogeneous) { 167 fDetector->SetIsCalHomogeneous(fIsCalHomog 168 } 169 if (command == fIsUnitInLambda) { 170 fDetector->SetIsUnitInLambda(fIsUnitInLamb 171 } 172 if (command == fAbsorberTotalLength) { 173 fDetector->SetAbsorberTotalLength(fAbsorbe 174 } 175 if (command == fCalorimeterRadius) { 176 fDetector->SetCalorimeterRadius(fCalorimet 177 } 178 if (command == fActiveLayerNumber) { 179 fDetector->SetActiveLayerNumber(fActiveLay 180 } 181 if (command == fActiveLayerSize) { 182 fDetector->SetActiveLayerSize(fActiveLayer 183 } 184 if (command == fIsRadiusUnitInLambda) { 185 fDetector->SetIsRadiusUnitInLambda(fIsRadi 186 } 187 if (command == fUpdateCommand) { 188 fDetector->UpdateGeometry(); 189 } 190 } 191 192 //....oooOO0OOooo........oooOO0OOooo........oo 193