File indexing completed on 2025-02-23 09:21:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #include "DetectorMessenger.hh"
0046
0047 #include "DetectorConstruction.hh"
0048 #include "HistoManager.hh"
0049
0050 #include "G4UIcmdWith3Vector.hh"
0051 #include "G4UIcmdWithADoubleAndUnit.hh"
0052 #include "G4UIcmdWithAString.hh"
0053 #include "G4UIcmdWithoutParameter.hh"
0054 #include "G4UIdirectory.hh"
0055
0056
0057
0058 DetectorMessenger::DetectorMessenger(DetectorConstruction* det)
0059 : G4UImessenger(),
0060 fDetector(det),
0061 fAtestemDir(0),
0062 fAMaterCmd(0),
0063 fALBinCmd(0),
0064 fAl1Cmd(0),
0065 fAl2Cmd(0),
0066 fAl3Cmd(0),
0067 fAl4Cmd(0),
0068 fAl5Cmd(0),
0069 fAl6Cmd(0),
0070 fAUpdateCmd(0),
0071 fAaccCmd1(0),
0072 fAaccCmd2(0),
0073 fAaccCmd3(0)
0074 {
0075 fAtestemDir = new G4UIdirectory("/testem/");
0076 fAtestemDir->SetGuidance(" detector control.");
0077
0078 fAMaterCmd = new G4UIcmdWithAString("/testem/det/CalMat", this);
0079 fAMaterCmd->SetGuidance("Select Material for calorimeter");
0080 fAMaterCmd->SetParameterName("calMaterial", false);
0081 fAMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0082
0083 fALBinCmd = new G4UIcmdWithAString("/testem/det/AbsMat", this);
0084 fALBinCmd->SetGuidance("Select Material for absorber");
0085 fALBinCmd->SetParameterName("absMarerial", false);
0086 fALBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0087
0088 fAl1Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalLength", this);
0089 fAl1Cmd->SetGuidance("Set length of Ecal");
0090 fAl1Cmd->SetParameterName("lEcal", false);
0091 fAl1Cmd->SetUnitCategory("Length");
0092 fAl1Cmd->SetRange("lEcal>0");
0093 fAl1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0094
0095 fAl2Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/EcalWidth", this);
0096 fAl2Cmd->SetGuidance("Set width of Ecal crystal");
0097 fAl2Cmd->SetParameterName("wEcal", false);
0098 fAl2Cmd->SetUnitCategory("Length");
0099 fAl2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0100
0101 fAl3Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/AbsLength", this);
0102 fAl3Cmd->SetGuidance("Set length of the absorber");
0103 fAl3Cmd->SetParameterName("lAbs", false);
0104 fAl3Cmd->SetUnitCategory("Length");
0105 fAl3Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0106
0107 fAl4Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/VertexLength", this);
0108 fAl4Cmd->SetGuidance("Set length of the vertex region");
0109 fAl4Cmd->SetParameterName("lVert", false);
0110 fAl4Cmd->SetUnitCategory("Length");
0111 fAl4Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0112
0113 fAl5Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadLength", this);
0114 fAl5Cmd->SetGuidance("Set length of vertex detector");
0115 fAl5Cmd->SetParameterName("lPad", false);
0116 fAl5Cmd->SetUnitCategory("Length");
0117 fAl5Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0118
0119 fAl6Cmd = new G4UIcmdWithADoubleAndUnit("/testem/det/PadWidth", this);
0120 fAl6Cmd->SetGuidance("Set width of a vertex pad");
0121 fAl6Cmd->SetParameterName("wPad", false);
0122 fAl6Cmd->SetUnitCategory("Length");
0123 fAl6Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0124
0125 fAUpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update", this);
0126 fAUpdateCmd->SetGuidance("Update geometry.");
0127 fAUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0128 fAUpdateCmd->SetGuidance("if you changed geometrical value(s)");
0129 fAUpdateCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0130
0131 fAaccCmd1 = new G4UIcmdWith3Vector("/testem/det/acceptance1", this);
0132 fAaccCmd1->SetGuidance("set Edep and RMS");
0133 fAaccCmd1->SetGuidance("acceptance values for central cell");
0134 fAaccCmd1->SetParameterName("edep", "rms", "limit", true);
0135 fAaccCmd1->SetRange("edep>0 && edep<1 && rms>0");
0136 fAaccCmd1->AvailableForStates(G4State_PreInit, G4State_Idle);
0137
0138 fAaccCmd2 = new G4UIcmdWith3Vector("/testem/det/acceptance9", this);
0139 fAaccCmd2->SetGuidance("set Edep and RMS");
0140 fAaccCmd2->SetGuidance("acceptance values for 3x3 matrix");
0141 fAaccCmd2->SetParameterName("edep", "rms", "limit", true);
0142 fAaccCmd2->SetRange("edep>0 && edep<1 && rms>0");
0143 fAaccCmd2->AvailableForStates(G4State_PreInit, G4State_Idle);
0144
0145 fAaccCmd3 = new G4UIcmdWith3Vector("/testem/det/acceptance25", this);
0146 fAaccCmd3->SetGuidance("set Edep and RMS");
0147 fAaccCmd3->SetGuidance("acceptance values for 5x5 matrix");
0148 fAaccCmd3->SetParameterName("edep", "rms", "limit", true);
0149 fAaccCmd3->SetRange("edep>0 && edep<1 && rms>0");
0150 fAaccCmd3->AvailableForStates(G4State_PreInit, G4State_Idle);
0151 }
0152
0153
0154
0155 DetectorMessenger::~DetectorMessenger()
0156 {
0157 delete fAMaterCmd;
0158 delete fALBinCmd;
0159 delete fAl1Cmd;
0160 delete fAl2Cmd;
0161 delete fAl3Cmd;
0162 delete fAl4Cmd;
0163 delete fAl5Cmd;
0164 delete fAl6Cmd;
0165 delete fAUpdateCmd;
0166 delete fAtestemDir;
0167 delete fAaccCmd1;
0168 delete fAaccCmd2;
0169 delete fAaccCmd3;
0170 }
0171
0172
0173
0174 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0175 {
0176 if (command == fAMaterCmd) {
0177 fDetector->SetEcalMaterial(newValue);
0178 }
0179
0180 if (command == fALBinCmd) {
0181 fDetector->SetAbsMaterial(newValue);
0182 }
0183
0184 if (command == fAl1Cmd) {
0185 fDetector->SetEcalLength(fAl1Cmd->GetNewDoubleValue(newValue));
0186 }
0187
0188 if (command == fAl2Cmd) {
0189 fDetector->SetEcalWidth(fAl2Cmd->GetNewDoubleValue(newValue));
0190 }
0191
0192 if (command == fAl3Cmd) {
0193 fDetector->SetAbsLength(fAl3Cmd->GetNewDoubleValue(newValue));
0194 }
0195
0196 if (command == fAl4Cmd) {
0197 fDetector->SetVertexLength(fAl4Cmd->GetNewDoubleValue(newValue));
0198 }
0199
0200 if (command == fAl5Cmd) {
0201 fDetector->SetPadLength(fAl5Cmd->GetNewDoubleValue(newValue));
0202 }
0203
0204 if (command == fAl6Cmd) {
0205 fDetector->SetPadWidth(fAl6Cmd->GetNewDoubleValue(newValue));
0206 }
0207
0208 if (command == fAUpdateCmd) {
0209 fDetector->UpdateGeometry();
0210 }
0211
0212 HistoManager* histo = HistoManager::GetPointer();
0213 if (command == fAaccCmd1) {
0214 histo->SetEdepAndRMS(0, fAaccCmd1->GetNew3VectorValue(newValue));
0215 }
0216
0217 if (command == fAaccCmd2) {
0218 histo->SetEdepAndRMS(1, fAaccCmd2->GetNew3VectorValue(newValue));
0219 }
0220
0221 if (command == fAaccCmd3) {
0222 histo->SetEdepAndRMS(2, fAaccCmd3->GetNew3VectorValue(newValue));
0223 }
0224 }
0225
0226