File indexing completed on 2025-04-04 08:05:04
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 "HistoManagerMessenger.hh"
0044
0045 #include "HistoManager.hh"
0046
0047 #include "G4UIcmdWith3Vector.hh"
0048 #include "G4UIcmdWithABool.hh"
0049 #include "G4UIcmdWithADoubleAndUnit.hh"
0050 #include "G4UIcmdWithAString.hh"
0051 #include "G4UIcmdWithAnInteger.hh"
0052 #include "G4UIcmdWithoutParameter.hh"
0053 #include "G4UIdirectory.hh"
0054
0055
0056
0057 HistoManagerMessenger::HistoManagerMessenger(HistoManager* p) : G4UImessenger(), fHisto(p)
0058 {
0059 fbinCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE", this);
0060 fbinCmd->SetGuidance("Set number of bins for energy");
0061 fbinCmd->SetParameterName("NEbins", false);
0062 fbinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0063
0064 fnOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP", this);
0065 fnOfAbsCmd->SetGuidance("Set number of bins for momentum");
0066 fnOfAbsCmd->SetParameterName("NPbins", false);
0067 fnOfAbsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0068
0069 fpartCmd = new G4UIcmdWithAString("/testhadr/particle", this);
0070 fpartCmd->SetGuidance("Set particle name");
0071 fpartCmd->SetParameterName("Particle", false);
0072 fpartCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0073
0074 fcsCmd = new G4UIcmdWithAString("/testhadr/targetElm", this);
0075 fcsCmd->SetGuidance("Set element name");
0076 fcsCmd->SetParameterName("Elm", false);
0077 fcsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0078
0079 fe1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy", this);
0080 fe1Cmd->SetGuidance("Set min kinetic energy");
0081 fe1Cmd->SetParameterName("eMin", false);
0082 fe1Cmd->SetUnitCategory("Energy");
0083 fe1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0084
0085 fe2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy", this);
0086 fe2Cmd->SetGuidance("Set max kinetic energy");
0087 fe2Cmd->SetParameterName("eMax", false);
0088 fe2Cmd->SetUnitCategory("Energy");
0089 fe2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0090
0091 fp1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum", this);
0092 fp1Cmd->SetGuidance("Set min momentum");
0093 fp1Cmd->SetParameterName("pMin", false);
0094 fp1Cmd->SetUnitCategory("Energy");
0095 fp1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0096
0097 fp2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum", this);
0098 fp2Cmd->SetGuidance("Set max momentum");
0099 fp2Cmd->SetParameterName("pMax", false);
0100 fp2Cmd->SetUnitCategory("Energy");
0101 fp2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0102
0103 fverbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose", this);
0104 fverbCmd->SetGuidance("Set verbose for ");
0105 fverbCmd->SetParameterName("verb", false);
0106 fverbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0107
0108 fFCmd = new G4UIcmdWithAString("/testhadr/fileName", this);
0109 fFCmd->SetGuidance("set name for the histograms file");
0110 }
0111
0112
0113
0114 HistoManagerMessenger::~HistoManagerMessenger()
0115 {
0116 delete fbinCmd;
0117 delete fnOfAbsCmd;
0118 delete fpartCmd;
0119 delete fcsCmd;
0120 delete fe1Cmd;
0121 delete fe2Cmd;
0122 delete fp1Cmd;
0123 delete fp2Cmd;
0124 delete fverbCmd;
0125 delete fFCmd;
0126 }
0127
0128
0129
0130 void HistoManagerMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0131 {
0132 if (command == fbinCmd) {
0133 fHisto->SetNumberOfBinsE(fbinCmd->GetNewIntValue(newValue));
0134 }
0135 else if (command == fnOfAbsCmd) {
0136 fHisto->SetNumberOfBinsP(fnOfAbsCmd->GetNewIntValue(newValue));
0137 }
0138 else if (command == fverbCmd) {
0139 fHisto->SetVerbose(fverbCmd->GetNewIntValue(newValue));
0140 }
0141 else if (command == fpartCmd) {
0142 fHisto->SetParticleName(newValue);
0143 }
0144 else if (command == fcsCmd) {
0145 fHisto->SetElementName(newValue);
0146 }
0147 else if (command == fe1Cmd) {
0148 fHisto->SetMinKinEnergy(fe1Cmd->GetNewDoubleValue(newValue));
0149 }
0150 else if (command == fe2Cmd) {
0151 fHisto->SetMaxKinEnergy(fe2Cmd->GetNewDoubleValue(newValue));
0152 }
0153 else if (command == fp1Cmd) {
0154 fHisto->SetMinMomentum(fp1Cmd->GetNewDoubleValue(newValue));
0155 }
0156 else if (command == fp2Cmd) {
0157 fHisto->SetMaxMomentum(fp2Cmd->GetNewDoubleValue(newValue));
0158 }
0159 else if (command == fFCmd) {
0160 fHisto->SetHistoName(newValue);
0161 }
0162 }
0163
0164