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