Geant4-11
G4AnalysisMessengerHelper.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27// The helper class for histogram and profiles messengers.
28// It implements reusable commands in /analysis/[hn|pn] directory.
29//
30// Author: Ivana Hrivnacova, 05/05/2015 (ivana@ipno.in2p3.fr)
31
32#ifndef G4AnalysisMessengerHelper_h
33#define G4AnalysisMessengerHelper_h 1
34
35#include "G4UImessenger.hh"
36#include "globals.hh"
37
38#include <memory>
39#include <string_view>
40
42class G4UIdirectory;
43class G4UIcommand;
44
46{
47 public:
48 // types
49 struct BinData {
57 };
58 // types
59 struct ValueData {
65 };
66
67 public:
68 // Make available utility Update method
69 friend class G4HnMessenger;
70
71 public:
72 explicit G4AnalysisMessengerHelper(const G4String& hnType);
75
76 // Methods to create commands
77 std::unique_ptr<G4UIdirectory> CreateHnDirectory() const;
78
79 std::unique_ptr<G4UIcommand> CreateGetCommand(
80 G4UImessenger* messenger) const;
81
82 std::unique_ptr<G4UIcommand> CreateSetTitleCommand(
83 G4UImessenger* messenger) const;
84 std::unique_ptr<G4UIcommand> CreateSetBinsCommand(const G4String& axis,
85 G4UImessenger* messenger) const;
86 std::unique_ptr<G4UIcommand> CreateSetValuesCommand(const G4String& axis,
87 G4UImessenger* messenger) const;
88 std::unique_ptr<G4UIcommand> CreateSetAxisCommand(const G4String& axis,
89 G4UImessenger* messenger) const;
90 std::unique_ptr<G4UIcommand> CreateSetAxisLogCommand(const G4String& axis,
91 G4UImessenger* messenger) const;
92
93 // Methods to read command paremeters
94 void GetBinData(BinData& data, std::vector<G4String>& parameters,
95 G4int& counter) const;
96 void GetValueData(ValueData& data, std::vector<G4String>& parameters,
97 G4int& counter) const;
98
99 // Set methods
100 void SetHnType(const G4String& hnType);
101
102 // warnings
103 void WarnAboutParameters(G4UIcommand* command, G4int nofParameters) const;
104 void WarnAboutSetCommands() const;
105
106 private:
107 // Methods
108 G4String Update(const G4String& str, const G4String& axis = "") const;
109
110 // Static data members
111 static constexpr std::string_view fkClass { "G4AnalysisMessengerHelper" };
112
113 // Data members
115};
116
117// inline functions
118
120{ fHnType = hnType; }
121
122#endif
123
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4String Update(const G4String &str, const G4String &axis="") const
~G4AnalysisMessengerHelper()=default
std::unique_ptr< G4UIdirectory > CreateHnDirectory() const
static constexpr std::string_view fkClass
std::unique_ptr< G4UIcommand > CreateSetBinsCommand(const G4String &axis, G4UImessenger *messenger) const
void GetBinData(BinData &data, std::vector< G4String > &parameters, G4int &counter) const
void SetHnType(const G4String &hnType)
void GetValueData(ValueData &data, std::vector< G4String > &parameters, G4int &counter) const
std::unique_ptr< G4UIcommand > CreateSetAxisLogCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateGetCommand(G4UImessenger *messenger) const
void WarnAboutParameters(G4UIcommand *command, G4int nofParameters) const
std::unique_ptr< G4UIcommand > CreateSetAxisCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetValuesCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetTitleCommand(G4UImessenger *messenger) const