File indexing completed on 2025-01-18 09:57:53
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 #ifndef G4AnalysisMessenger_h
0044 #define G4AnalysisMessenger_h 1
0045
0046 #include "G4UImessenger.hh"
0047 #include "globals.hh"
0048
0049 #include <memory>
0050
0051 class G4VAnalysisManager;
0052 class G4NtupleMessenger;
0053
0054 class G4UIdirectory;
0055 class G4UIcmdWithABool;
0056 class G4UIcmdWithAnInteger;
0057 class G4UIcmdWithAString;
0058 class G4UIcmdWithoutParameter;
0059
0060 class G4AnalysisMessenger : public G4UImessenger
0061 {
0062 public:
0063 explicit G4AnalysisMessenger(G4VAnalysisManager* manager);
0064 G4AnalysisMessenger() = delete;
0065 ~G4AnalysisMessenger() override;
0066
0067
0068 void SetNewValue(G4UIcommand* command, G4String value) final;
0069
0070 private:
0071 template <typename CMD>
0072 std::unique_ptr<CMD> CreateCommand(
0073 G4String name, G4String guidance, G4String paremeterName,
0074 G4bool ommitable = false);
0075 std::unique_ptr<G4UIcmdWithoutParameter> CreateCommandWithoutParameter(
0076 G4String name, G4String guidance);
0077
0078
0079 G4VAnalysisManager* fManager { nullptr };
0080 std::unique_ptr<G4NtupleMessenger> fNtupleMessenger;
0081
0082 std::unique_ptr<G4UIdirectory> fAnalysisDir;
0083 std::unique_ptr<G4UIcmdWithAString> fOpenFileCmd;
0084 std::unique_ptr<G4UIcmdWithoutParameter> fWriteCmd;
0085 std::unique_ptr<G4UIcmdWithoutParameter> fResetCmd;
0086
0087
0088 std::unique_ptr<G4UIcmdWithABool> fCloseFileCmd;
0089 std::unique_ptr<G4UIcmdWithABool> fListCmd;
0090 std::unique_ptr<G4UIcmdWithAString> fSetDefaultFileTypeCmd;
0091 std::unique_ptr<G4UIcmdWithABool> fSetActivationCmd;
0092 std::unique_ptr<G4UIcmdWithAnInteger> fVerboseCmd;
0093 std::unique_ptr<G4UIcmdWithAnInteger> fCompressionCmd;
0094 std::unique_ptr<G4UIcmdWithAString> fSetFileNameCmd;
0095 std::unique_ptr<G4UIcmdWithAString> fSetHistoDirNameCmd;
0096 std::unique_ptr<G4UIcmdWithAString> fSetNtupleDirNameCmd;
0097 };
0098
0099
0100 template <typename CMD>
0101 std::unique_ptr<CMD> G4AnalysisMessenger::CreateCommand(
0102 G4String name, G4String guidance, G4String paremeterName, G4bool ommitable)
0103 {
0104 G4String fullName = "/analysis/" + name;
0105
0106 auto command = std::make_unique<CMD>(fullName, this);
0107 command->SetGuidance(guidance.c_str());
0108 command->SetParameterName(paremeterName.c_str(), ommitable);
0109 command->AvailableForStates(G4State_PreInit, G4State_Idle);
0110
0111 return command;
0112 }
0113
0114 #endif