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 "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithAString.hh" 40 #include "G4UIcmdWithoutParameter.hh" 41 #include "G4UIdirectory.hh" 42 #include "globals.hh" 43 44 //....oooOO0OOooo........oooOO0OOooo........oo 45 46 DetectorMessenger::DetectorMessenger(DetectorC 47 { 48 fDetectorDir = new G4UIdirectory("/mydet/"); 49 fDetectorDir->SetGuidance("Detector control. 50 51 fMaterialTracker = new G4UIcmdWithAString("/ 52 fMaterialTracker->SetGuidance("Choice of the 53 fMaterialTracker->SetGuidance(" a Geant4 N 54 fMaterialTracker->SetParameterName("choiceMa 55 fMaterialTracker->SetDefaultValue("G4_Si"); 56 fMaterialTracker->AvailableForStates(G4State 57 58 fMaterialEmCalo = new G4UIcmdWithAString("/m 59 fMaterialEmCalo->SetGuidance("Choice of the 60 fMaterialEmCalo->SetGuidance(" a Geant4 NI 61 fMaterialEmCalo->SetParameterName("choiceMat 62 fMaterialEmCalo->SetDefaultValue("G4_Pb"); 63 fMaterialEmCalo->AvailableForStates(G4State_ 64 65 fMaterialHadCalo = new G4UIcmdWithAString("/ 66 fMaterialHadCalo->SetGuidance("Choice of the 67 fMaterialHadCalo->SetGuidance(" a Geant4 N 68 fMaterialHadCalo->SetParameterName("choiceMa 69 fMaterialHadCalo->SetDefaultValue("G4_Fe"); 70 fMaterialHadCalo->AvailableForStates(G4State 71 72 fInnerRadiusTracker = new G4UIcmdWithADouble 73 fInnerRadiusTracker->SetParameterName("choic 74 fInnerRadiusTracker->SetGuidance("Inner radi 75 fInnerRadiusTracker->SetDefaultValue(100.0); 76 fInnerRadiusTracker->AvailableForStates(G4St 77 78 fOuterRadiusTracker = new G4UIcmdWithADouble 79 fOuterRadiusTracker->SetParameterName("choic 80 fOuterRadiusTracker->SetGuidance("Outer radi 81 fOuterRadiusTracker->SetDefaultValue(200.0); 82 fOuterRadiusTracker->AvailableForStates(G4St 83 84 fInnerRadiusEmCalo = new G4UIcmdWithADoubleA 85 fInnerRadiusEmCalo->SetParameterName("choice 86 fInnerRadiusEmCalo->SetGuidance("Inner radiu 87 fInnerRadiusEmCalo->SetDefaultValue(300.0); 88 fInnerRadiusEmCalo->AvailableForStates(G4Sta 89 90 fOuterRadiusEmCalo = new G4UIcmdWithADoubleA 91 fOuterRadiusEmCalo->SetParameterName("choice 92 fOuterRadiusEmCalo->SetGuidance("Outer radiu 93 fOuterRadiusEmCalo->SetDefaultValue(600.0); 94 fOuterRadiusEmCalo->AvailableForStates(G4Sta 95 96 fInnerRadiusHadCalo = new G4UIcmdWithADouble 97 fInnerRadiusHadCalo->SetParameterName("choic 98 fInnerRadiusHadCalo->SetGuidance("Inner radi 99 fInnerRadiusHadCalo->SetDefaultValue(700.0); 100 fInnerRadiusHadCalo->AvailableForStates(G4St 101 102 fOuterRadiusHadCalo = new G4UIcmdWithADouble 103 fOuterRadiusHadCalo->SetParameterName("choic 104 fOuterRadiusHadCalo->SetGuidance("Outer radi 105 fOuterRadiusHadCalo->SetDefaultValue(1700.0) 106 fOuterRadiusHadCalo->AvailableForStates(G4St 107 108 fUpdateCommand = new G4UIcmdWithoutParameter 109 fUpdateCommand->SetGuidance("Update geometry 110 fUpdateCommand->SetGuidance("This command MU 111 fUpdateCommand->SetGuidance("if you changed 112 fUpdateCommand->AvailableForStates(G4State_I 113 } 114 115 //....oooOO0OOooo........oooOO0OOooo........oo 116 117 DetectorMessenger::~DetectorMessenger() 118 { 119 delete fDetectorDir; 120 delete fMaterialTracker; 121 delete fMaterialEmCalo; 122 delete fMaterialHadCalo; 123 delete fInnerRadiusTracker; 124 delete fOuterRadiusTracker; 125 delete fInnerRadiusEmCalo; 126 delete fOuterRadiusEmCalo; 127 delete fInnerRadiusHadCalo; 128 delete fOuterRadiusHadCalo; 129 delete fUpdateCommand; 130 } 131 132 //....oooOO0OOooo........oooOO0OOooo........oo 133 134 void DetectorMessenger::SetNewValue(G4UIcomman 135 { 136 if (command == fMaterialTracker) { 137 fDetector->SetMaterialTracker(newValue); 138 } 139 if (command == fMaterialEmCalo) { 140 fDetector->SetMaterialEmCalo(newValue); 141 } 142 if (command == fMaterialHadCalo) { 143 fDetector->SetMaterialHadCalo(newValue); 144 } 145 if (command == fInnerRadiusTracker) { 146 fDetector->SetInnerRadiusTracker(fInnerRad 147 } 148 if (command == fOuterRadiusTracker) { 149 fDetector->SetOuterRadiusTracker(fOuterRad 150 } 151 if (command == fInnerRadiusEmCalo) { 152 fDetector->SetInnerRadiusEmCalo(fInnerRadi 153 } 154 if (command == fOuterRadiusEmCalo) { 155 fDetector->SetOuterRadiusEmCalo(fOuterRadi 156 } 157 if (command == fInnerRadiusHadCalo) { 158 fDetector->SetInnerRadiusHadCalo(fInnerRad 159 } 160 if (command == fOuterRadiusHadCalo) { 161 fDetector->SetOuterRadiusHadCalo(fOuterRad 162 } 163 if (command == fUpdateCommand) { 164 fDetector->UpdateGeometry(); 165 } 166 } 167 168 //....oooOO0OOooo........oooOO0OOooo........oo 169