Geant4  10.03
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 // $Id: G4AnalysisMessengerHelper.hh 66310 2012-12-17 11:56:35Z ihrivnac $
27 
28 // The helper class for histogram and profiles messengers.
29 // It implements reusable commands in /analysis/[hn|pn] directory.
30 //
31 // Author: Ivana Hrivnacova, 05/05/2015 (ivana@ipno.in2p3.fr)
32 
33 #ifndef G4AnalysisMessengerHelper_h
34 #define G4AnalysisMessengerHelper_h 1
35 
36 #include "G4UImessenger.hh"
37 #include "globals.hh"
38 
39 #include <memory>
40 
41 class G4VAnalysisManager;
42 class G4UIdirectory;
43 class G4UIcommand;
44 
46 {
47  public:
48  // types
49  struct BinData {
50  BinData() :
51  fNbins(0),
52  fVmin(0.),
53  fVmax(0.),
54  fSunit(""),
55  fSfcn(""),
56  fSbinScheme("") {}
63  };
64  // types
65  struct ValueData {
66  ValueData() :
67  fVmin(0.),
68  fVmax(0.),
69  fSunit(""),
70  fSfcn("") {}
75  };
76 
77  public:
78  // Make available utility Update method
79  friend class G4HnMessenger;
80 
81  public:
82  explicit G4AnalysisMessengerHelper(const G4String& hnType);
84 
85  // methods to create commands
86  std::unique_ptr<G4UIdirectory> CreateHnDirectory() const;
87 
88  std::unique_ptr<G4UIcommand> CreateSetTitleCommand(
89  G4UImessenger* messenger) const;
90  std::unique_ptr<G4UIcommand> CreateSetBinsCommand(const G4String& axis,
91  G4UImessenger* messenger) const;
92  std::unique_ptr<G4UIcommand> CreateSetValuesCommand(const G4String& axis,
93  G4UImessenger* messenger) const;
94  std::unique_ptr<G4UIcommand> CreateSetAxisCommand(const G4String& axis,
95  G4UImessenger* messenger) const;
96 
97  // methods to read command paremeters
98  void GetBinData(BinData& data, std::vector<G4String>& parameters,
99  G4int& counter) const;
100  void GetValueData(ValueData& data, std::vector<G4String>& parameters,
101  G4int& counter) const;
102 
103  // warnings
104  void WarnAboutParameters(G4UIcommand* command, G4int nofParameters) const;
105  void WarnAboutSetCommands() const;
106 
107  private:
108  // methods
109  G4String Update(const G4String& str, const G4String& axis = "") const;
110 
111  // data members
113 };
114 
115 #endif
116 
G4String Update(const G4String &str, const G4String &axis="") const
void WarnAboutParameters(G4UIcommand *command, G4int nofParameters) const
std::unique_ptr< G4UIcommand > CreateSetValuesCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetAxisCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetBinsCommand(const G4String &axis, G4UImessenger *messenger) const
int G4int
Definition: G4Types.hh:78
std::unique_ptr< G4UIcommand > CreateSetTitleCommand(G4UImessenger *messenger) const
G4AnalysisMessengerHelper(const G4String &hnType)
void GetBinData(BinData &data, std::vector< G4String > &parameters, G4int &counter) const
double G4double
Definition: G4Types.hh:76
void GetValueData(ValueData &data, std::vector< G4String > &parameters, G4int &counter) const
std::unique_ptr< G4UIdirectory > CreateHnDirectory() const