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