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 electromagnetic/TestEm9/src/Detector 27 /// \brief Implementation of the DetectorMesse 28 // 29 // 30 // 31 ////////////////////////////////////////////// 32 // 33 // TestEm9: Crystal calorimeter 34 // 35 // Created: 31.01.03 V.Ivanchenko 36 // 37 // Modified: 38 // 39 ////////////////////////////////////////////// 40 // 41 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oo 44 45 #include "DetectorMessenger.hh" 46 47 #include "DetectorConstruction.hh" 48 #include "HistoManager.hh" 49 50 #include "G4UIcmdWith3Vector.hh" 51 #include "G4UIcmdWithADoubleAndUnit.hh" 52 #include "G4UIcmdWithAString.hh" 53 #include "G4UIcmdWithoutParameter.hh" 54 #include "G4UIdirectory.hh" 55 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 58 DetectorMessenger::DetectorMessenger(DetectorC 59 : G4UImessenger(), 60 fDetector(det), 61 fAtestemDir(0), 62 fAMaterCmd(0), 63 fALBinCmd(0), 64 fAl1Cmd(0), 65 fAl2Cmd(0), 66 fAl3Cmd(0), 67 fAl4Cmd(0), 68 fAl5Cmd(0), 69 fAl6Cmd(0), 70 fAUpdateCmd(0), 71 fAaccCmd1(0), 72 fAaccCmd2(0), 73 fAaccCmd3(0) 74 { 75 fAtestemDir = new G4UIdirectory("/testem/"); 76 fAtestemDir->SetGuidance(" detector control. 77 78 fAMaterCmd = new G4UIcmdWithAString("/testem 79 fAMaterCmd->SetGuidance("Select Material for 80 fAMaterCmd->SetParameterName("calMaterial", 81 fAMaterCmd->AvailableForStates(G4State_PreIn 82 83 fALBinCmd = new G4UIcmdWithAString("/testem/ 84 fALBinCmd->SetGuidance("Select Material for 85 fALBinCmd->SetParameterName("absMarerial", f 86 fALBinCmd->AvailableForStates(G4State_PreIni 87 88 fAl1Cmd = new G4UIcmdWithADoubleAndUnit("/te 89 fAl1Cmd->SetGuidance("Set length of Ecal"); 90 fAl1Cmd->SetParameterName("lEcal", false); 91 fAl1Cmd->SetUnitCategory("Length"); 92 fAl1Cmd->SetRange("lEcal>0"); 93 fAl1Cmd->AvailableForStates(G4State_PreInit, 94 95 fAl2Cmd = new G4UIcmdWithADoubleAndUnit("/te 96 fAl2Cmd->SetGuidance("Set width of Ecal crys 97 fAl2Cmd->SetParameterName("wEcal", false); 98 fAl2Cmd->SetUnitCategory("Length"); 99 fAl2Cmd->AvailableForStates(G4State_PreInit, 100 101 fAl3Cmd = new G4UIcmdWithADoubleAndUnit("/te 102 fAl3Cmd->SetGuidance("Set length of the abso 103 fAl3Cmd->SetParameterName("lAbs", false); 104 fAl3Cmd->SetUnitCategory("Length"); 105 fAl3Cmd->AvailableForStates(G4State_PreInit, 106 107 fAl4Cmd = new G4UIcmdWithADoubleAndUnit("/te 108 fAl4Cmd->SetGuidance("Set length of the vert 109 fAl4Cmd->SetParameterName("lVert", false); 110 fAl4Cmd->SetUnitCategory("Length"); 111 fAl4Cmd->AvailableForStates(G4State_PreInit, 112 113 fAl5Cmd = new G4UIcmdWithADoubleAndUnit("/te 114 fAl5Cmd->SetGuidance("Set length of vertex d 115 fAl5Cmd->SetParameterName("lPad", false); 116 fAl5Cmd->SetUnitCategory("Length"); 117 fAl5Cmd->AvailableForStates(G4State_PreInit, 118 119 fAl6Cmd = new G4UIcmdWithADoubleAndUnit("/te 120 fAl6Cmd->SetGuidance("Set width of a vertex 121 fAl6Cmd->SetParameterName("wPad", false); 122 fAl6Cmd->SetUnitCategory("Length"); 123 fAl6Cmd->AvailableForStates(G4State_PreInit, 124 125 fAUpdateCmd = new G4UIcmdWithoutParameter("/ 126 fAUpdateCmd->SetGuidance("Update geometry.") 127 fAUpdateCmd->SetGuidance("This command MUST 128 fAUpdateCmd->SetGuidance("if you changed geo 129 fAUpdateCmd->AvailableForStates(G4State_PreI 130 131 fAaccCmd1 = new G4UIcmdWith3Vector("/testem/ 132 fAaccCmd1->SetGuidance("set Edep and RMS"); 133 fAaccCmd1->SetGuidance("acceptance values fo 134 fAaccCmd1->SetParameterName("edep", "rms", " 135 fAaccCmd1->SetRange("edep>0 && edep<1 && rms 136 fAaccCmd1->AvailableForStates(G4State_PreIni 137 138 fAaccCmd2 = new G4UIcmdWith3Vector("/testem/ 139 fAaccCmd2->SetGuidance("set Edep and RMS"); 140 fAaccCmd2->SetGuidance("acceptance values fo 141 fAaccCmd2->SetParameterName("edep", "rms", " 142 fAaccCmd2->SetRange("edep>0 && edep<1 && rms 143 fAaccCmd2->AvailableForStates(G4State_PreIni 144 145 fAaccCmd3 = new G4UIcmdWith3Vector("/testem/ 146 fAaccCmd3->SetGuidance("set Edep and RMS"); 147 fAaccCmd3->SetGuidance("acceptance values fo 148 fAaccCmd3->SetParameterName("edep", "rms", " 149 fAaccCmd3->SetRange("edep>0 && edep<1 && rms 150 fAaccCmd3->AvailableForStates(G4State_PreIni 151 } 152 153 //....oooOO0OOooo........oooOO0OOooo........oo 154 155 DetectorMessenger::~DetectorMessenger() 156 { 157 delete fAMaterCmd; 158 delete fALBinCmd; 159 delete fAl1Cmd; 160 delete fAl2Cmd; 161 delete fAl3Cmd; 162 delete fAl4Cmd; 163 delete fAl5Cmd; 164 delete fAl6Cmd; 165 delete fAUpdateCmd; 166 delete fAtestemDir; 167 delete fAaccCmd1; 168 delete fAaccCmd2; 169 delete fAaccCmd3; 170 } 171 172 //....oooOO0OOooo........oooOO0OOooo........oo 173 174 void DetectorMessenger::SetNewValue(G4UIcomman 175 { 176 if (command == fAMaterCmd) { 177 fDetector->SetEcalMaterial(newValue); 178 } 179 180 if (command == fALBinCmd) { 181 fDetector->SetAbsMaterial(newValue); 182 } 183 184 if (command == fAl1Cmd) { 185 fDetector->SetEcalLength(fAl1Cmd->GetNewDo 186 } 187 188 if (command == fAl2Cmd) { 189 fDetector->SetEcalWidth(fAl2Cmd->GetNewDou 190 } 191 192 if (command == fAl3Cmd) { 193 fDetector->SetAbsLength(fAl3Cmd->GetNewDou 194 } 195 196 if (command == fAl4Cmd) { 197 fDetector->SetVertexLength(fAl4Cmd->GetNew 198 } 199 200 if (command == fAl5Cmd) { 201 fDetector->SetPadLength(fAl5Cmd->GetNewDou 202 } 203 204 if (command == fAl6Cmd) { 205 fDetector->SetPadWidth(fAl6Cmd->GetNewDoub 206 } 207 208 if (command == fAUpdateCmd) { 209 fDetector->UpdateGeometry(); 210 } 211 212 HistoManager* histo = HistoManager::GetPoint 213 if (command == fAaccCmd1) { 214 histo->SetEdepAndRMS(0, fAaccCmd1->GetNew3 215 } 216 217 if (command == fAaccCmd2) { 218 histo->SetEdepAndRMS(1, fAaccCmd2->GetNew3 219 } 220 221 if (command == fAaccCmd3) { 222 histo->SetEdepAndRMS(2, fAaccCmd3->GetNew3 223 } 224 } 225 226 //....oooOO0OOooo........oooOO0OOooo........oo 227