File indexing completed on 2025-10-29 08:01:35
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 #include "ExGflashMessenger.hh"
0034
0035 #include "ExGflashDetectorConstruction.hh"
0036
0037 #include "G4UIcmdWith3Vector.hh"
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithAString.hh"
0040 #include "G4UIcmdWithAnInteger.hh"
0041 #include "G4UIcmdWithoutParameter.hh"
0042 #include "G4UIdirectory.hh"
0043
0044
0045
0046 ExGflashMessenger::ExGflashMessenger(ExGflashDetectorConstruction* Det) : fDetector(Det)
0047 {
0048 fExGflashDir = new G4UIdirectory("/exgflash/");
0049 fExGflashDir->SetGuidance(" Gflash example commands.");
0050
0051 fVerbose = new G4UIcmdWithAnInteger("/exgflash/verbose", this);
0052 fVerbose->SetGuidance("set exglash verbosity");
0053 fVerbose->SetGuidance("0- silent, 1 - init, 2 - run, 3 - event");
0054 fVerbose->SetParameterName("ver", false);
0055 fVerbose->SetRange("ver >= 0");
0056 fVerbose->AvailableForStates(G4State_PreInit, G4State_Idle);
0057 fVerbose->SetToBeBroadcasted(false);
0058
0059 fDetDir = new G4UIdirectory("/exgflash/det/");
0060 fDetDir->SetGuidance("detector construction commands");
0061
0062 fLBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setLbin", this);
0063 fLBinCmd->SetGuidance("set longitudinal bining");
0064 fLBinCmd->SetGuidance("nLtot - nb of bins; bin thickness (in Radl)");
0065 fLBinCmd->SetGuidance("dLradl - bin thickness (in fraction of Radl)");
0066 fLBinCmd->SetGuidance("LStart - dummy");
0067 fLBinCmd->SetParameterName("nLtot", "dLradl", "LStart", true);
0068 fLBinCmd->SetDefaultValue(G4ThreeVector{100.0, 0.25, 0.0});
0069 fLBinCmd->SetRange("nLtot>=1 && dLradl>0");
0070 fLBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0071 fLBinCmd->SetToBeBroadcasted(false);
0072
0073 fRBinCmd = new G4UIcmdWith3Vector("/exgflash/det/setRbin", this);
0074 fRBinCmd->SetGuidance("set radial bining");
0075 fRBinCmd->SetGuidance("nRtot - nb of bins; bin thickness (in Rm)");
0076 fRBinCmd->SetGuidance("dRradl - bin thickness (in fraction of Rm)");
0077 fRBinCmd->SetGuidance("RStart - dummy");
0078 fRBinCmd->SetParameterName("nRtot", "dRradl", "RStart", true);
0079 fRBinCmd->SetDefaultValue(G4ThreeVector{80.0, 0.05, 0.0});
0080 fRBinCmd->SetRange("nRtot>=1 && dRradl>0");
0081 fRBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0082 fRBinCmd->SetToBeBroadcasted(false);
0083
0084 fMaterCmd = new G4UIcmdWithAString("/exgflash/det/setMat", this);
0085 fMaterCmd->SetGuidance("Select Material.");
0086 fMaterCmd->SetParameterName("material", false);
0087 fMaterCmd->AvailableForStates(G4State_PreInit);
0088 fMaterCmd->SetToBeBroadcasted(false);
0089
0090 fNbCrysCmd = new G4UIcmdWithAnInteger("/exgflash/det/setNbCrys", this);
0091 fNbCrysCmd->SetGuidance("set numbber of crystals in row/col");
0092 fNbCrysCmd->SetGuidance("ncrys - number of crystals ");
0093 fNbCrysCmd->SetParameterName("ncrys", false);
0094 fNbCrysCmd->SetRange("ncrys > 0");
0095 fNbCrysCmd->AvailableForStates(G4State_PreInit);
0096 fNbCrysCmd->SetToBeBroadcasted(false);
0097
0098 fWCrysCmd = new G4UIcmdWithADoubleAndUnit("/exgflash/det/setCrysWidth", this);
0099 fWCrysCmd->SetGuidance("set crystal width (cm)");
0100 fWCrysCmd->SetGuidance("wcrys - width of crystal ");
0101 fWCrysCmd->SetParameterName("wcrys", false);
0102 fWCrysCmd->SetRange("wcrys > 0");
0103 fWCrysCmd->SetUnitCategory("Length");
0104 fWCrysCmd->SetDefaultUnit("cm");
0105 fWCrysCmd->AvailableForStates(G4State_PreInit);
0106 fWCrysCmd->SetToBeBroadcasted(false);
0107
0108 fLCrysCmd = new G4UIcmdWithADoubleAndUnit("/exgflash/det/setCrysLength", this);
0109 fLCrysCmd->SetGuidance("set crystal length (cm)");
0110 fLCrysCmd->SetGuidance("lcrys - crystal length ");
0111 fLCrysCmd->SetParameterName("lcrys", false);
0112 fLCrysCmd->SetRange("lcrys > 0");
0113 fLCrysCmd->SetUnitCategory("Length");
0114 fLCrysCmd->SetDefaultUnit("cm");
0115 fLCrysCmd->AvailableForStates(G4State_PreInit);
0116 fLCrysCmd->SetToBeBroadcasted(false);
0117 }
0118
0119
0120
0121 ExGflashMessenger::~ExGflashMessenger()
0122 {
0123 delete fLCrysCmd;
0124 delete fWCrysCmd;
0125 delete fNbCrysCmd;
0126 delete fMaterCmd;
0127 delete fRBinCmd;
0128 delete fLBinCmd;
0129 delete fDetDir;
0130 delete fVerbose;
0131 delete fExGflashDir;
0132 }
0133
0134
0135
0136 void ExGflashMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0137 {
0138 if (command == fMaterCmd) {
0139 fDetector->SetMaterial(newValue);
0140 }
0141
0142 if (command == fNbCrysCmd) {
0143 fDetector->SetNbOfCrystals(fNbCrysCmd->GetNewIntValue(newValue));
0144 }
0145
0146 if (command == fWCrysCmd) {
0147 fDetector->SetCrystalWidth(fWCrysCmd->GetNewDoubleValue(newValue));
0148 }
0149
0150 if (command == fLCrysCmd) {
0151 fDetector->SetCrystalLength(fLCrysCmd->GetNewDoubleValue(newValue));
0152 }
0153
0154 if (command == fVerbose) {
0155 fDetector->SetVerbose(fVerbose->GetNewIntValue(newValue));
0156 }
0157
0158 if (command == fLBinCmd) {
0159 fDetector->SetLBining(fLBinCmd->GetNew3VectorValue(newValue));
0160 }
0161
0162 if (command == fRBinCmd) {
0163 fDetector->SetRBining(fRBinCmd->GetNew3VectorValue(newValue));
0164 }
0165 }
0166
0167