Geant4-11
G4VH1Manager.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// Base class for H1 manager.
28//
29// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
30
31#ifndef G4VH1Manager_h
32#define G4VH1Manager_h 1
33
34#include "globals.hh"
35
36#include <vector>
37#include <memory>
38
39class G4HnManager;
40
42{
43 // Disable using the object managers outside
44 friend class G4VAnalysisManager;
45 friend class G4VAnalysisReader;
46
47 public:
48 G4VH1Manager() = default;
49 virtual ~G4VH1Manager() = default;
50
51 // deleted copy constructor & assignment operator
52 G4VH1Manager(const G4VH1Manager& rhs) = delete;
53 G4VH1Manager& operator=(const G4VH1Manager& rhs) = delete;
54
55 protected:
56 // Methods for handling histograms
57 virtual G4int CreateH1(const G4String& name, const G4String& title,
58 G4int nbins, G4double xmin, G4double xmax,
59 const G4String& unitName = "none",
60 const G4String& fcnName = "none",
61 const G4String& binSchemeName = "linear") = 0;
62 virtual G4int CreateH1(const G4String& name, const G4String& title,
63 const std::vector<G4double>& edges,
64 const G4String& unitName = "none",
65 const G4String& fcnName = "none") = 0;
66
67 virtual G4bool SetH1(G4int id,
68 G4int nbins, G4double xmin, G4double xmax,
69 const G4String& unitName = "none",
70 const G4String& fcnName = "none",
71 const G4String& binSchemeName = "linear") = 0;
72 virtual G4bool SetH1(G4int id,
73 const std::vector<G4double>& edges,
74 const G4String& unitName = "none",
75 const G4String& fcnName = "none") = 0;
76
77 virtual G4bool ScaleH1(G4int id, G4double factor) = 0;
78
79 // Methods to fill histograms
80 virtual G4bool FillH1(G4int id, G4double value, G4double weight = 1.0) = 0;
81
82 // Access methods
83 virtual G4int GetH1Id(const G4String& name, G4bool warn = true) const = 0;
84
85 // Access to H1 parameters
86 virtual G4int GetH1Nbins(G4int id) const = 0;
87 virtual G4double GetH1Xmin(G4int id) const = 0;
88 virtual G4double GetH1Xmax(G4int id) const = 0;
89 virtual G4double GetH1Width(G4int id) const = 0;
90
91 // Setters for attributes for plotting
92 virtual G4bool SetH1Title(G4int id, const G4String& title) = 0;
93 virtual G4bool SetH1XAxisTitle(G4int id, const G4String& title) = 0;
94 virtual G4bool SetH1YAxisTitle(G4int id, const G4String& title) = 0;
95
96 // Access attributes for plotting
97 virtual G4String GetH1Title(G4int id) const = 0;
98 virtual G4String GetH1XAxisTitle(G4int id) const = 0;
99 virtual G4String GetH1YAxisTitle(G4int id) const = 0;
100
101 // Methods to manipulate histograms
102 virtual G4bool WriteOnAscii(std::ofstream& output) = 0;
103
104 // Access to Hn manager
105 virtual std::shared_ptr<G4HnManager> GetHnManager() = 0;
106};
107
108#endif
109
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual G4bool SetH1XAxisTitle(G4int id, const G4String &title)=0
virtual G4double GetH1Width(G4int id) const =0
virtual G4int CreateH1(const G4String &name, const G4String &title, const std::vector< G4double > &edges, const G4String &unitName="none", const G4String &fcnName="none")=0
virtual G4bool SetH1Title(G4int id, const G4String &title)=0
virtual G4bool SetH1(G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")=0
virtual G4double GetH1Xmin(G4int id) const =0
virtual G4bool WriteOnAscii(std::ofstream &output)=0
virtual G4bool ScaleH1(G4int id, G4double factor)=0
virtual ~G4VH1Manager()=default
virtual G4double GetH1Xmax(G4int id) const =0
virtual G4String GetH1Title(G4int id) const =0
virtual G4bool SetH1(G4int id, const std::vector< G4double > &edges, const G4String &unitName="none", const G4String &fcnName="none")=0
virtual G4String GetH1YAxisTitle(G4int id) const =0
virtual G4bool SetH1YAxisTitle(G4int id, const G4String &title)=0
G4VH1Manager & operator=(const G4VH1Manager &rhs)=delete
virtual G4bool FillH1(G4int id, G4double value, G4double weight=1.0)=0
virtual G4String GetH1XAxisTitle(G4int id) const =0
G4VH1Manager(const G4VH1Manager &rhs)=delete
virtual G4int CreateH1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")=0
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
G4VH1Manager()=default
virtual G4int GetH1Nbins(G4int id) const =0
virtual G4int GetH1Id(const G4String &name, G4bool warn=true) const =0
const char * name(G4int ptype)