File indexing completed on 2026-05-04 08:07:40
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 #include "RE05StackingActionMessenger.hh"
0030
0031 #include "RE05StackingAction.hh"
0032
0033 #include "G4UIcmdWithADoubleAndUnit.hh"
0034 #include "G4UIcmdWithAnInteger.hh"
0035 #include "G4ios.hh"
0036
0037
0038
0039 RE05StackingActionMessenger::RE05StackingActionMessenger(RE05StackingAction* msa)
0040 : G4UImessenger(), fMyAction(msa), fMuonCmd(0), fIsoMuonCmd(0), fIsoCmd(0), fRoiCmd(0)
0041 {
0042 fMuonCmd = new G4UIcmdWithAnInteger("/mydet/reqmuon", this);
0043 fMuonCmd->SetGuidance("Number of muon for the trigger.");
0044 fMuonCmd->SetParameterName("N", true);
0045 fMuonCmd->SetDefaultValue(2);
0046 fMuonCmd->SetRange("N>=0");
0047
0048 fIsoMuonCmd = new G4UIcmdWithAnInteger("/mydet/isomuon", this);
0049 fIsoMuonCmd->SetGuidance("Number of isolated muon for the trigger.");
0050 fIsoMuonCmd->SetParameterName("N", true);
0051 fIsoMuonCmd->SetDefaultValue(2);
0052 fIsoMuonCmd->SetRange("N>=0");
0053
0054 fIsoCmd = new G4UIcmdWithAnInteger("/mydet/isolation", this);
0055 fIsoCmd->SetGuidance("Maximum allowed number of hits in tracker");
0056 fIsoCmd->SetGuidance(" for an isolated muon track (includes hits by muon)");
0057 fIsoCmd->SetParameterName("N", true);
0058 fIsoCmd->SetDefaultValue(10);
0059 fIsoCmd->SetRange("N>=0");
0060
0061 fRoiCmd = new G4UIcmdWithADoubleAndUnit("/mydet/RoIangle", this);
0062 fRoiCmd->SetGuidance("Define RoI angle");
0063 fRoiCmd->SetParameterName("theta", true, true);
0064 fRoiCmd->SetDefaultUnit("deg");
0065 }
0066
0067
0068
0069 RE05StackingActionMessenger::~RE05StackingActionMessenger()
0070 {
0071 delete fMuonCmd;
0072 delete fIsoMuonCmd;
0073 delete fIsoCmd;
0074 delete fRoiCmd;
0075 }
0076
0077
0078
0079 void RE05StackingActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0080 {
0081 if (command == fMuonCmd) {
0082 fMyAction->SetNRequestMuon(fMuonCmd->GetNewIntValue(newValue));
0083 }
0084 else if (command == fIsoMuonCmd) {
0085 fMyAction->SetNRequestIsoMuon(fIsoMuonCmd->GetNewIntValue(newValue));
0086 }
0087 else if (command == fIsoCmd) {
0088 fMyAction->SetNIsolation(fIsoCmd->GetNewIntValue(newValue));
0089 }
0090 else if (command == fRoiCmd) {
0091 fMyAction->SetRoIAngle(fRoiCmd->GetNewDoubleValue(newValue));
0092 }
0093 }
0094
0095
0096
0097 G4String RE05StackingActionMessenger::GetCurrentValue(G4UIcommand* command)
0098 {
0099 G4String cv;
0100
0101 if (command == fMuonCmd) {
0102 cv = fMuonCmd->ConvertToString(fMyAction->GetNRequestMuon());
0103 }
0104 else if (command == fIsoMuonCmd) {
0105 cv = fIsoMuonCmd->ConvertToString(fMyAction->GetNRequestIsoMuon());
0106 }
0107 else if (command == fIsoCmd) {
0108 cv = fIsoCmd->ConvertToString(fMyAction->GetNIsolation());
0109 }
0110 else if (command == fRoiCmd) {
0111 cv = fRoiCmd->ConvertToString(fMyAction->GetRoIAngle(), "deg");
0112 }
0113
0114 return cv;
0115 }
0116
0117