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 "PhysicsListMessenger.hh"
0044
0045 #include "PhysicsList.hh"
0046 #include "TestParameters.hh"
0047
0048 #include "G4UIcmdWithADouble.hh"
0049 #include "G4UIcmdWithADoubleAndUnit.hh"
0050 #include "G4UIcmdWithAString.hh"
0051 #include "G4UIcmdWithAnInteger.hh"
0052 #include "G4UIdirectory.hh"
0053
0054
0055
0056 PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys) : fPhysicsList(pPhys)
0057 {
0058 fPhysDir = new G4UIdirectory("/testem/phys/");
0059 fPhysDir->SetGuidance("physics list commands");
0060
0061 fECmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setMaxE", this);
0062 fECmd->SetGuidance("Set max energy deposit");
0063 fECmd->SetParameterName("Emax", false);
0064 fECmd->SetUnitCategory("Energy");
0065 fECmd->SetRange("Emax>0.0");
0066 fECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067
0068 fEBCmd = new G4UIcmdWithAnInteger("/testem/phys/setNbinsE", this);
0069 fEBCmd->SetGuidance("Set number of bins in energy.");
0070 fEBCmd->SetParameterName("Ebins", false);
0071 fEBCmd->SetRange("Ebins>0");
0072 fEBCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0073
0074 fCBCmd = new G4UIcmdWithAnInteger("/testem/phys/setNbinsCl", this);
0075 fCBCmd->SetGuidance("Set number of bins of clusters.");
0076 fCBCmd->SetParameterName("Cbins", false);
0077 fCBCmd->SetRange("Cbins>0");
0078 fCBCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0079
0080 fCMCmd = new G4UIcmdWithAnInteger("/testem/phys/setMaxCl", this);
0081 fCMCmd->SetGuidance("Set max number of clusters.");
0082 fCMCmd->SetParameterName("Cmax", false);
0083 fCMCmd->SetRange("Cmax>0");
0084 fCMCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0085
0086 fListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics", this);
0087 fListCmd->SetGuidance("Add modula physics list.");
0088 fListCmd->SetParameterName("PList", false);
0089 fListCmd->AvailableForStates(G4State_PreInit);
0090
0091 fADCCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setEnergyPerChannel", this);
0092 fADCCmd->SetGuidance("Set energy per ADC channel");
0093 fADCCmd->SetParameterName("enadc", false, false);
0094 fADCCmd->SetUnitCategory("Energy");
0095 fADCCmd->SetDefaultUnit("keV");
0096 fADCCmd->SetRange("enadc>0.");
0097 fADCCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0098
0099 fNorCmd = new G4UIcmdWithADouble("/testem/phys/setNormFactor", this);
0100 fNorCmd->SetGuidance("Set factor for histogram normalisation");
0101 fNorCmd->SetParameterName("nfac", false, false);
0102 fNorCmd->SetRange("nfac>0.");
0103 fNorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0104
0105 fSmCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setEnergySmear", this);
0106 fSmCmd->SetGuidance("Set intrinsic width of detector response");
0107 fSmCmd->SetParameterName("sm", false, false);
0108 fSmCmd->SetDefaultUnit("keV");
0109 fSmCmd->SetRange("sm>0.");
0110 fSmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0111 }
0112
0113
0114
0115 PhysicsListMessenger::~PhysicsListMessenger()
0116 {
0117 delete fECmd;
0118 delete fEBCmd;
0119 delete fCBCmd;
0120 delete fCMCmd;
0121 delete fListCmd;
0122 delete fADCCmd;
0123 delete fNorCmd;
0124 delete fSmCmd;
0125 delete fPhysDir;
0126 }
0127
0128
0129
0130 void PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0131 {
0132 TestParameters* man = TestParameters::GetPointer();
0133
0134 if (command == fECmd) {
0135 man->SetMaxEnergy(fECmd->GetNewDoubleValue(newValue));
0136 }
0137 if (command == fEBCmd) {
0138 man->SetNumberBins(fEBCmd->GetNewIntValue(newValue));
0139 }
0140 if (command == fCBCmd) {
0141 man->SetNumberBinsCluster(fCBCmd->GetNewIntValue(newValue));
0142 }
0143 if (command == fCMCmd) {
0144 man->SetMaxCluster(fCMCmd->GetNewIntValue(newValue));
0145 }
0146 if (command == fListCmd) {
0147 fPhysicsList->AddPhysicsList(newValue);
0148 }
0149 if (command == fADCCmd) {
0150 man->SetEnergyPerChannel(fADCCmd->GetNewDoubleValue(newValue));
0151 }
0152 if (command == fNorCmd) {
0153 man->SetNormFactor(fNorCmd->GetNewDoubleValue(newValue));
0154 }
0155 if (command == fSmCmd) {
0156 man->SetEnergySmear(fSmCmd->GetNewDoubleValue(newValue));
0157 }
0158 }
0159
0160