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