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