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