Geant4-11
G4HnManager.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// Class for management of G4HnInformation.
28// It implements functions handling the added H1/H2 information
29// (not available in g4tools).
30//
31// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
32
33#ifndef G4HnManager_h
34#define G4HnManager_h 1
35
37#include "G4HnInformation.hh"
38#include "globals.hh"
39
40#include <vector>
41#include <string_view>
42
43class G4VFileManager;
44
46{
47 public:
48 G4HnManager(const G4String& hnType,
49 const G4AnalysisManagerState& state);
50 G4HnManager() = delete;
51 virtual ~G4HnManager();
52
53 // Methods to manipulate additional information
54
55 G4HnInformation* AddHnInformation(const G4String& name, G4int nofDimensions);
56
57 void ClearData();
58
59 // Access methofd
61 std::string_view functionName,
62 G4bool warn = true) const;
63
65 G4int dimension,
66 std::string_view functionName,
67 G4bool warn = true) const;
68
69 const std::vector<G4HnInformation*>& GetHnVector() const;
70 G4int GetNofHns() const;
71 G4String GetHnType() const;
72
73 // Activation option
74
75 // Return false if activation is enabled and there is no object activated,
76 // return true otherwise
77 G4bool IsActive() const;
78
79 // ASCII option
80
81 // Return false if there is no object selected for ASCII output,
82 // return true otherwise
83 G4bool IsAscii() const;
84
85 // Plotting option
86
87 // Return false if there is no object selected for plotting,
88 // return true otherwise
89 G4bool IsPlotting() const;
90
91 // Return false if there is no object with a specific file name
92 G4bool IsFileName() const;
93
94 // Function implementing public analysis manager interface
95 //
96 void SetActivation(G4bool activation);
97 void SetActivation(G4int id, G4bool activation);
98 void SetAscii(G4int id, G4bool ascii);
99 void SetPlotting(G4int id, G4bool plotting);
100 void SetPlotting(G4bool plotting);
101 void SetFileName(G4int id, const G4String& fileName);
102 void SetFileName(const G4String& fileName);
103 G4bool SetXAxisIsLog(G4int id, G4bool isLogAxis);
104 G4bool SetYAxisIsLog(G4int id, G4bool isLogAxis);
105 G4bool SetZAxisIsLog(G4int id, G4bool isLogAxis);
106
107
108 // Access to Hn additional information
109 G4String GetName(G4int id) const;
110 G4double GetXUnit(G4int id) const;
111 G4double GetYUnit(G4int id) const;
112 G4double GetZUnit(G4int id) const;
113 G4bool GetXAxisIsLog(G4int id) const;
114 G4bool GetYAxisIsLog(G4int id) const;
115 G4bool GetZAxisIsLog(G4int id) const;
116 G4bool GetActivation(G4int id) const;
117 G4bool GetAscii(G4int id) const;
118 G4bool GetPlotting(G4int id) const;
119 G4String GetFileName(G4int id) const;
120
121 void SetFileManager(std::shared_ptr<G4VFileManager> fileManager);
122
123 private:
124 // Methods
125 void SetActivation(G4HnInformation* info, G4bool activation);
126 void SetPlotting(G4HnInformation* info, G4bool plotting);
127 void SetFileName(G4HnInformation* info, const G4String& fileName);
128
129 // Static data members
130 static constexpr std::string_view fkClass { "G4HnManager" };
131
132 // Data members
138
139 // Additional histograms/ntuple properties not included in tools
140 std::vector<G4HnInformation*> fHnVector;
141 std::shared_ptr<G4VFileManager> fFileManager { nullptr };
142};
143
145{ return G4int(fHnVector.size()); }
146
148{ return fHnType; }
149
150inline const std::vector<G4HnInformation*>& G4HnManager::GetHnVector() const
151{ return fHnVector; }
152
153inline void G4HnManager::SetFileManager(std::shared_ptr<G4VFileManager> fileManager)
154{ fFileManager = fileManager; }
155
156#endif
157
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4HnDimensionInformation * GetHnDimensionInformation(G4int id, G4int dimension, std::string_view functionName, G4bool warn=true) const
Definition: G4HnManager.cc:149
void ClearData()
Definition: G4HnManager.cc:124
virtual ~G4HnManager()
Definition: G4HnManager.cc:44
G4bool GetPlotting(G4int id) const
Definition: G4HnManager.cc:391
void SetActivation(G4bool activation)
Definition: G4HnManager.cc:196
G4int GetNofHns() const
Definition: G4HnManager.hh:144
void SetFileManager(std::shared_ptr< G4VFileManager > fileManager)
Definition: G4HnManager.hh:153
G4String GetFileName(G4int id) const
Definition: G4HnManager.cc:401
G4int fNofFileNameObjects
Definition: G4HnManager.hh:137
G4double GetYUnit(G4int id) const
Definition: G4HnManager.cc:321
G4int fNofPlottingObjects
Definition: G4HnManager.hh:136
std::shared_ptr< G4VFileManager > fFileManager
Definition: G4HnManager.hh:141
G4bool SetZAxisIsLog(G4int id, G4bool isLogAxis)
Definition: G4HnManager.cc:290
G4String fHnType
Definition: G4HnManager.hh:133
static constexpr std::string_view fkClass
Definition: G4HnManager.hh:130
G4bool SetYAxisIsLog(G4int id, G4bool isLogAxis)
Definition: G4HnManager.cc:279
G4String GetName(G4int id) const
Definition: G4HnManager.cc:301
G4bool SetXAxisIsLog(G4int id, G4bool isLogAxis)
Definition: G4HnManager.cc:268
G4bool IsAscii() const
Definition: G4HnManager.cc:166
G4bool IsPlotting() const
Definition: G4HnManager.cc:172
void SetFileName(G4int id, const G4String &fileName)
Definition: G4HnManager.cc:248
G4bool GetActivation(G4int id) const
Definition: G4HnManager.cc:371
G4bool GetZAxisIsLog(G4int id) const
Definition: G4HnManager.cc:361
const std::vector< G4HnInformation * > & GetHnVector() const
Definition: G4HnManager.hh:150
std::vector< G4HnInformation * > fHnVector
Definition: G4HnManager.hh:140
G4int fNofAsciiObjects
Definition: G4HnManager.hh:135
G4bool GetXAxisIsLog(G4int id) const
Definition: G4HnManager.cc:341
G4bool IsActive() const
Definition: G4HnManager.cc:160
void SetAscii(G4int id, G4bool ascii)
Definition: G4HnManager.cc:210
G4double GetZUnit(G4int id) const
Definition: G4HnManager.cc:331
G4bool GetYAxisIsLog(G4int id) const
Definition: G4HnManager.cc:351
G4String GetHnType() const
Definition: G4HnManager.hh:147
void SetPlotting(G4int id, G4bool plotting)
Definition: G4HnManager.cc:228
G4int fNofActiveObjects
Definition: G4HnManager.hh:134
G4HnInformation * GetHnInformation(G4int id, std::string_view functionName, G4bool warn=true) const
Definition: G4HnManager.cc:134
G4HnManager()=delete
G4double GetXUnit(G4int id) const
Definition: G4HnManager.cc:311
G4bool GetAscii(G4int id) const
Definition: G4HnManager.cc:381
G4bool IsFileName() const
Definition: G4HnManager.cc:178
G4HnInformation * AddHnInformation(const G4String &name, G4int nofDimensions)
Definition: G4HnManager.cc:114
const char * name(G4int ptype)