File indexing completed on 2025-01-18 09:58:24
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 #ifndef G4HnMessenger_h
0033 #define G4HnMessenger_h 1
0034
0035 #include "G4UImessenger.hh"
0036 #include "globals.hh"
0037
0038 #include <memory>
0039
0040 class G4HnManager;
0041 class G4UIcommand;
0042 class G4UIcmdWithABool;
0043 class G4UIcmdWithAString;
0044
0045 class G4HnMessenger : public G4UImessenger
0046 {
0047 public:
0048 explicit G4HnMessenger(G4HnManager& manager);
0049 G4HnMessenger() = delete;
0050 ~G4HnMessenger() override;
0051
0052
0053 void SetNewValue(G4UIcommand* command, G4String value) final;
0054
0055 private:
0056
0057 G4String GetObjectType() const;
0058 template <typename CMD>
0059 std::unique_ptr<CMD> CreateCommand(G4String name, G4String guidance);
0060 void AddIdParameter(G4UIcommand& command);
0061 void AddOptionParameter(G4UIcommand& command, G4String optionName);
0062
0063 void SetHnAsciiCmd();
0064 void SetHnActivationCmd();
0065 void SetHnActivationToAllCmd();
0066 void SetHnPlottingCmd();
0067 void SetHnPlottingToAllCmd();
0068 void SetHnFileNameCmd();
0069 void SetHnFileNameToAllCmd();
0070 std::unique_ptr<G4UIcommand> CreateSetAxisLogCommand(unsigned int ibin);
0071
0072
0073 static constexpr std::string_view fkClass { "G4HnMessenger" };
0074
0075
0076 G4HnManager& fManager;
0077 G4String fHnType;
0078 unsigned int fHnDimension;
0079 std::unique_ptr<G4UIcommand> fSetAsciiCmd;
0080 std::unique_ptr<G4UIcommand> fSetActivationCmd;
0081 std::unique_ptr<G4UIcmdWithABool> fSetActivationAllCmd;
0082 std::unique_ptr<G4UIcommand> fSetPlottingCmd;
0083 std::unique_ptr<G4UIcmdWithABool> fSetPlottingAllCmd;
0084 std::unique_ptr<G4UIcommand> fSetFileNameCmd;
0085 std::unique_ptr<G4UIcmdWithAString> fSetFileNameAllCmd;
0086 std::vector<std::unique_ptr<G4UIcommand>> fSetAxisLogCmd;
0087 };
0088
0089
0090 template <typename CMD>
0091 std::unique_ptr<CMD> G4HnMessenger::CreateCommand(
0092 G4String name, G4String guidance)
0093 {
0094 G4String fullName = "/analysis/" + fHnType + "/" + name;
0095 G4String fullGuidance = guidance + GetObjectType();
0096
0097 auto command = std::make_unique<CMD>(fullName, this);
0098 command->SetGuidance(fullGuidance);
0099 command->AvailableForStates(G4State_PreInit, G4State_Idle);
0100
0101 return command;
0102 }
0103
0104 #endif