Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm9/src/Detector 26 /// \file electromagnetic/TestEm9/src/DetectorMessenger.cc 27 /// \brief Implementation of the DetectorMesse 27 /// \brief Implementation of the DetectorMessenger class 28 // 28 // >> 29 // $Id$ 29 // 30 // 30 // 31 // 31 ////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////// 32 // 33 // 33 // TestEm9: Crystal calorimeter 34 // TestEm9: Crystal calorimeter 34 // 35 // 35 // Created: 31.01.03 V.Ivanchenko 36 // Created: 31.01.03 V.Ivanchenko 36 // 37 // 37 // Modified: 38 // Modified: 38 // 39 // 39 ////////////////////////////////////////////// 40 //////////////////////////////////////////////////////////////////////// 40 // 41 // 41 42 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 45 45 #include "DetectorMessenger.hh" 46 #include "DetectorMessenger.hh" 46 47 47 #include "DetectorConstruction.hh" 48 #include "DetectorConstruction.hh" 48 #include "HistoManager.hh" << 49 #include "G4UIdirectory.hh" 49 << 50 #include "G4UIcmdWithAString.hh" 50 #include "G4UIcmdWith3Vector.hh" 51 #include "G4UIcmdWith3Vector.hh" 51 #include "G4UIcmdWithADoubleAndUnit.hh" 52 #include "G4UIcmdWithADoubleAndUnit.hh" 52 #include "G4UIcmdWithAString.hh" << 53 #include "G4UIcmdWithoutParameter.hh" 53 #include "G4UIcmdWithoutParameter.hh" 54 #include "G4UIdirectory.hh" << 54 #include "HistoManager.hh" 55 55 56 //....oooOO0OOooo........oooOO0OOooo........oo 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 57 57 58 DetectorMessenger::DetectorMessenger(DetectorC << 58 DetectorMessenger::DetectorMessenger(DetectorConstruction * det) 59 : G4UImessenger(), << 59 :G4UImessenger(),fDetector(det), 60 fDetector(det), << 60 fAtestemDir(0), 61 fAtestemDir(0), << 61 fAMaterCmd(0), 62 fAMaterCmd(0), << 62 fALBinCmd(0), 63 fALBinCmd(0), << 63 fAl1Cmd(0), 64 fAl1Cmd(0), << 64 fAl2Cmd(0), 65 fAl2Cmd(0), << 65 fAl3Cmd(0), 66 fAl3Cmd(0), << 66 fAl4Cmd(0), 67 fAl4Cmd(0), << 67 fAl5Cmd(0), 68 fAl5Cmd(0), << 68 fAl6Cmd(0), 69 fAl6Cmd(0), << 69 fAUpdateCmd(0), 70 fAUpdateCmd(0), << 70 fAaccCmd1(0), 71 fAaccCmd1(0), << 71 fAaccCmd2(0), 72 fAaccCmd2(0), << 72 fAaccCmd3(0) 73 fAaccCmd3(0) << 74 { 73 { 75 fAtestemDir = new G4UIdirectory("/testem/"); 74 fAtestemDir = new G4UIdirectory("/testem/"); 76 fAtestemDir->SetGuidance(" detector control. 75 fAtestemDir->SetGuidance(" detector control."); 77 76 78 fAMaterCmd = new G4UIcmdWithAString("/testem << 77 fAMaterCmd = new G4UIcmdWithAString("/testem/det/CalMat",this); 79 fAMaterCmd->SetGuidance("Select Material for 78 fAMaterCmd->SetGuidance("Select Material for calorimeter"); 80 fAMaterCmd->SetParameterName("calMaterial", << 79 fAMaterCmd->SetParameterName("calMaterial",false); 81 fAMaterCmd->AvailableForStates(G4State_PreIn << 80 fAMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 82 81 83 fALBinCmd = new G4UIcmdWithAString("/testem/ << 82 fALBinCmd = new G4UIcmdWithAString("/testem/det/AbsMat",this); 84 fALBinCmd->SetGuidance("Select Material for 83 fALBinCmd->SetGuidance("Select Material for absorber"); 85 fALBinCmd->SetParameterName("absMarerial", f << 84 fALBinCmd->SetParameterName("absMarerial",false); 86 fALBinCmd->AvailableForStates(G4State_PreIni << 85 fALBinCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 87 86 88 fAl1Cmd = new G4UIcmdWithADoubleAndUnit("/te << 87 fAl1Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalLength",this); 89 fAl1Cmd->SetGuidance("Set length of Ecal"); 88 fAl1Cmd->SetGuidance("Set length of Ecal"); 90 fAl1Cmd->SetParameterName("lEcal", false); << 89 fAl1Cmd->SetParameterName("lEcal",false); 91 fAl1Cmd->SetUnitCategory("Length"); 90 fAl1Cmd->SetUnitCategory("Length"); 92 fAl1Cmd->SetRange("lEcal>0"); 91 fAl1Cmd->SetRange("lEcal>0"); 93 fAl1Cmd->AvailableForStates(G4State_PreInit, << 92 fAl1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 94 93 95 fAl2Cmd = new G4UIcmdWithADoubleAndUnit("/te << 94 fAl2Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalWidth",this); 96 fAl2Cmd->SetGuidance("Set width of Ecal crys 95 fAl2Cmd->SetGuidance("Set width of Ecal crystal"); 97 fAl2Cmd->SetParameterName("wEcal", false); << 96 fAl2Cmd->SetParameterName("wEcal",false); 98 fAl2Cmd->SetUnitCategory("Length"); 97 fAl2Cmd->SetUnitCategory("Length"); 99 fAl2Cmd->AvailableForStates(G4State_PreInit, << 98 fAl2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 100 99 101 fAl3Cmd = new G4UIcmdWithADoubleAndUnit("/te << 100 fAl3Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/AbsLength",this); 102 fAl3Cmd->SetGuidance("Set length of the abso 101 fAl3Cmd->SetGuidance("Set length of the absorber"); 103 fAl3Cmd->SetParameterName("lAbs", false); << 102 fAl3Cmd->SetParameterName("lAbs",false); 104 fAl3Cmd->SetUnitCategory("Length"); 103 fAl3Cmd->SetUnitCategory("Length"); 105 fAl3Cmd->AvailableForStates(G4State_PreInit, << 104 fAl3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 106 105 107 fAl4Cmd = new G4UIcmdWithADoubleAndUnit("/te << 106 fAl4Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/VertexLength",this); 108 fAl4Cmd->SetGuidance("Set length of the vert 107 fAl4Cmd->SetGuidance("Set length of the vertex region"); 109 fAl4Cmd->SetParameterName("lVert", false); << 108 fAl4Cmd->SetParameterName("lVert",false); 110 fAl4Cmd->SetUnitCategory("Length"); 109 fAl4Cmd->SetUnitCategory("Length"); 111 fAl4Cmd->AvailableForStates(G4State_PreInit, << 110 fAl4Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 112 111 113 fAl5Cmd = new G4UIcmdWithADoubleAndUnit("/te << 112 fAl5Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadLength",this); 114 fAl5Cmd->SetGuidance("Set length of vertex d 113 fAl5Cmd->SetGuidance("Set length of vertex detector"); 115 fAl5Cmd->SetParameterName("lPad", false); << 114 fAl5Cmd->SetParameterName("lPad",false); 116 fAl5Cmd->SetUnitCategory("Length"); 115 fAl5Cmd->SetUnitCategory("Length"); 117 fAl5Cmd->AvailableForStates(G4State_PreInit, << 116 fAl5Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 118 117 119 fAl6Cmd = new G4UIcmdWithADoubleAndUnit("/te << 118 fAl6Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadWidth",this); 120 fAl6Cmd->SetGuidance("Set width of a vertex 119 fAl6Cmd->SetGuidance("Set width of a vertex pad"); 121 fAl6Cmd->SetParameterName("wPad", false); << 120 fAl6Cmd->SetParameterName("wPad",false); 122 fAl6Cmd->SetUnitCategory("Length"); 121 fAl6Cmd->SetUnitCategory("Length"); 123 fAl6Cmd->AvailableForStates(G4State_PreInit, << 122 fAl6Cmd->AvailableForStates(G4State_PreInit,G4State_Idle); 124 123 125 fAUpdateCmd = new G4UIcmdWithoutParameter("/ << 124 fAUpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this); 126 fAUpdateCmd->SetGuidance("Update geometry.") 125 fAUpdateCmd->SetGuidance("Update geometry."); 127 fAUpdateCmd->SetGuidance("This command MUST 126 fAUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); 128 fAUpdateCmd->SetGuidance("if you changed geo 127 fAUpdateCmd->SetGuidance("if you changed geometrical value(s)"); 129 fAUpdateCmd->AvailableForStates(G4State_PreI << 128 fAUpdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 130 129 131 fAaccCmd1 = new G4UIcmdWith3Vector("/testem/ << 130 fAaccCmd1 = new G4UIcmdWith3Vector("/testem/det/acceptance1",this); 132 fAaccCmd1->SetGuidance("set Edep and RMS"); 131 fAaccCmd1->SetGuidance("set Edep and RMS"); 133 fAaccCmd1->SetGuidance("acceptance values fo 132 fAaccCmd1->SetGuidance("acceptance values for central cell"); 134 fAaccCmd1->SetParameterName("edep", "rms", " << 133 fAaccCmd1->SetParameterName("edep","rms","limit",true); 135 fAaccCmd1->SetRange("edep>0 && edep<1 && rms 134 fAaccCmd1->SetRange("edep>0 && edep<1 && rms>0"); 136 fAaccCmd1->AvailableForStates(G4State_PreIni << 135 fAaccCmd1->AvailableForStates(G4State_PreInit,G4State_Idle); 137 136 138 fAaccCmd2 = new G4UIcmdWith3Vector("/testem/ << 137 fAaccCmd2 = new G4UIcmdWith3Vector("/testem/det/acceptance9",this); 139 fAaccCmd2->SetGuidance("set Edep and RMS"); 138 fAaccCmd2->SetGuidance("set Edep and RMS"); 140 fAaccCmd2->SetGuidance("acceptance values fo 139 fAaccCmd2->SetGuidance("acceptance values for 3x3 matrix"); 141 fAaccCmd2->SetParameterName("edep", "rms", " << 140 fAaccCmd2->SetParameterName("edep","rms","limit",true); 142 fAaccCmd2->SetRange("edep>0 && edep<1 && rms 141 fAaccCmd2->SetRange("edep>0 && edep<1 && rms>0"); 143 fAaccCmd2->AvailableForStates(G4State_PreIni << 142 fAaccCmd2->AvailableForStates(G4State_PreInit,G4State_Idle); 144 143 145 fAaccCmd3 = new G4UIcmdWith3Vector("/testem/ << 144 fAaccCmd3 = new G4UIcmdWith3Vector("/testem/det/acceptance25",this); 146 fAaccCmd3->SetGuidance("set Edep and RMS"); 145 fAaccCmd3->SetGuidance("set Edep and RMS"); 147 fAaccCmd3->SetGuidance("acceptance values fo 146 fAaccCmd3->SetGuidance("acceptance values for 5x5 matrix"); 148 fAaccCmd3->SetParameterName("edep", "rms", " << 147 fAaccCmd3->SetParameterName("edep","rms","limit",true); 149 fAaccCmd3->SetRange("edep>0 && edep<1 && rms 148 fAaccCmd3->SetRange("edep>0 && edep<1 && rms>0"); 150 fAaccCmd3->AvailableForStates(G4State_PreIni << 149 fAaccCmd3->AvailableForStates(G4State_PreInit,G4State_Idle); >> 150 151 } 151 } 152 152 153 //....oooOO0OOooo........oooOO0OOooo........oo 153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 154 154 155 DetectorMessenger::~DetectorMessenger() 155 DetectorMessenger::~DetectorMessenger() 156 { 156 { 157 delete fAMaterCmd; 157 delete fAMaterCmd; 158 delete fALBinCmd; 158 delete fALBinCmd; 159 delete fAl1Cmd; 159 delete fAl1Cmd; 160 delete fAl2Cmd; 160 delete fAl2Cmd; 161 delete fAl3Cmd; 161 delete fAl3Cmd; 162 delete fAl4Cmd; 162 delete fAl4Cmd; 163 delete fAl5Cmd; 163 delete fAl5Cmd; 164 delete fAl6Cmd; 164 delete fAl6Cmd; 165 delete fAUpdateCmd; 165 delete fAUpdateCmd; 166 delete fAtestemDir; 166 delete fAtestemDir; 167 delete fAaccCmd1; 167 delete fAaccCmd1; 168 delete fAaccCmd2; 168 delete fAaccCmd2; 169 delete fAaccCmd3; 169 delete fAaccCmd3; 170 } 170 } 171 171 172 //....oooOO0OOooo........oooOO0OOooo........oo 172 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 173 173 174 void DetectorMessenger::SetNewValue(G4UIcomman << 174 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 175 { 175 { 176 if (command == fAMaterCmd) { << 176 if( command == fAMaterCmd ) 177 fDetector->SetEcalMaterial(newValue); << 177 { fDetector->SetEcalMaterial(newValue);} 178 } << 178 179 << 179 if( command == fALBinCmd ) 180 if (command == fALBinCmd) { << 180 { fDetector->SetAbsMaterial(newValue);} 181 fDetector->SetAbsMaterial(newValue); << 181 182 } << 182 if( command == fAl1Cmd ) 183 << 183 { fDetector->SetEcalLength(fAl1Cmd->GetNewDoubleValue(newValue));} 184 if (command == fAl1Cmd) { << 184 185 fDetector->SetEcalLength(fAl1Cmd->GetNewDo << 185 if( command == fAl2Cmd ) 186 } << 186 { fDetector->SetEcalWidth(fAl2Cmd->GetNewDoubleValue(newValue));} 187 << 187 188 if (command == fAl2Cmd) { << 188 if( command == fAl3Cmd ) 189 fDetector->SetEcalWidth(fAl2Cmd->GetNewDou << 189 { fDetector->SetAbsLength(fAl3Cmd->GetNewDoubleValue(newValue));} 190 } << 190 191 << 191 if( command == fAl4Cmd ) 192 if (command == fAl3Cmd) { << 192 { fDetector->SetVertexLength(fAl4Cmd->GetNewDoubleValue(newValue));} 193 fDetector->SetAbsLength(fAl3Cmd->GetNewDou << 193 194 } << 194 if( command == fAl5Cmd ) 195 << 195 { fDetector->SetPadLength(fAl5Cmd->GetNewDoubleValue(newValue));} 196 if (command == fAl4Cmd) { << 196 197 fDetector->SetVertexLength(fAl4Cmd->GetNew << 197 if( command == fAl6Cmd ) 198 } << 198 { fDetector->SetPadWidth(fAl6Cmd->GetNewDoubleValue(newValue));} 199 << 199 200 if (command == fAl5Cmd) { << 200 if( command == fAUpdateCmd ) 201 fDetector->SetPadLength(fAl5Cmd->GetNewDou << 201 { fDetector->UpdateGeometry();} 202 } << 203 << 204 if (command == fAl6Cmd) { << 205 fDetector->SetPadWidth(fAl6Cmd->GetNewDoub << 206 } << 207 << 208 if (command == fAUpdateCmd) { << 209 fDetector->UpdateGeometry(); << 210 } << 211 202 212 HistoManager* histo = HistoManager::GetPoint 203 HistoManager* histo = HistoManager::GetPointer(); 213 if (command == fAaccCmd1) { << 204 if( command == fAaccCmd1 ) 214 histo->SetEdepAndRMS(0, fAaccCmd1->GetNew3 << 205 { histo->SetEdepAndRMS(0,fAaccCmd1->GetNew3VectorValue(newValue));} 215 } << 206 216 << 207 if( command == fAaccCmd2 ) 217 if (command == fAaccCmd2) { << 208 { histo->SetEdepAndRMS(1,fAaccCmd2->GetNew3VectorValue(newValue));} 218 histo->SetEdepAndRMS(1, fAaccCmd2->GetNew3 << 209 219 } << 210 if( command == fAaccCmd3 ) 220 << 211 { histo->SetEdepAndRMS(2,fAaccCmd3->GetNew3VectorValue(newValue));} 221 if (command == fAaccCmd3) { << 212 222 histo->SetEdepAndRMS(2, fAaccCmd3->GetNew3 << 213 223 } << 224 } 214 } 225 215 226 //....oooOO0OOooo........oooOO0OOooo........oo 216 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 217 227 218