Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4VTBaseHnManager.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 common implementation for histograms managers.
28//
29// Author: Ivana Hrivnacova, 10/08/2022 (ivana@ipno.in2p3.fr)
30
31#ifndef G4VTBaseHnManager_h
32#define G4VTBaseHnManager_h 1
33
34#include "G4HnInformation.hh"
35#include "globals.hh"
36
37#include <vector>
38#include <memory>
39#include <array>
40
41class G4HnManager;
42
43template <unsigned int DIM>
45{
46 // Disable using the object managers outside
47 friend class G4VAnalysisManager;
48 friend class G4VAnalysisReader;
49
50 public:
51 G4VTBaseHnManager() = default;
52 virtual ~G4VTBaseHnManager() = default;
53
54 // deleted copy constructor & assignment operator
57
58 // Methods for handling histograms
59 virtual G4int Create(const G4String& name, const G4String& title,
60 const std::array<G4HnDimension, DIM>& bins,
61 const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
62
63 // virtual G4int Create(const G4String& name, const G4String& title,
64 // const std::array<std::vector<G4double>, DIM> edges,
65 // const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
66
67 virtual G4bool Set(G4int id,
68 const std::array<G4HnDimension, DIM>& bins,
69 const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
70
71 // virtual G4bool Set(G4int id,
72 // const std::array<std::vector<G4double>, DIM>& edges,
73 // const std::array<G4HnDimensionInformation, DIM>& hnInfo) = 0;
74
75 virtual G4bool Scale(G4int id, G4double factor) = 0;
76
77 // Methods to fill histograms
78 virtual G4bool Fill(G4int id, std::array<G4double, DIM> value, G4double weight = 1.0) = 0;
79
80 // Access methods
81 virtual G4int GetId(const G4String& name, G4bool warn = true) const = 0;
82
83 // Access to bins parameters
84 virtual G4int GetNbins(unsigned int idim, G4int id) const = 0;
85 virtual G4double GetMinValue(unsigned int idim, G4int id) const = 0;
86 virtual G4double GetMaxValue(unsigned int idim, G4int id) const = 0;
87 virtual G4double GetWidth(unsigned int idim, G4int id) const = 0;
88
89 // Setters for attributes for plotting
90 virtual G4bool SetTitle(G4int id, const G4String& title) = 0;
91 virtual G4bool SetAxisTitle(unsigned int idim, G4int id, const G4String& title) = 0;
92
93 // Access attributes for plotting
94 virtual G4String GetTitle(G4int id) const = 0;
95 virtual G4String GetAxisTitle(unsigned int idim, G4int id) const = 0;
96
97 // Methods to list/print histograms
98 virtual G4bool WriteOnAscii(std::ofstream& output) = 0;
99 virtual G4bool List(std::ostream& output, G4bool onlyIfActive = true) = 0;
100
101 virtual std::shared_ptr<G4HnManager> GetHnManager() = 0;
102 virtual const std::shared_ptr<G4HnManager> GetHnManager() const = 0;
103};
104
105#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
virtual G4bool SetTitle(G4int id, const G4String &title)=0
virtual G4int GetNbins(unsigned int idim, G4int id) const =0
virtual G4bool Fill(G4int id, std::array< G4double, DIM > value, G4double weight=1.0)=0
virtual const std::shared_ptr< G4HnManager > GetHnManager() const =0
virtual G4bool Scale(G4int id, G4double factor)=0
G4VTBaseHnManager(const G4VTBaseHnManager &rhs)=delete
virtual G4String GetTitle(G4int id) const =0
virtual G4int GetId(const G4String &name, G4bool warn=true) const =0
virtual G4bool Set(G4int id, const std::array< G4HnDimension, DIM > &bins, const std::array< G4HnDimensionInformation, DIM > &hnInfo)=0
virtual G4bool List(std::ostream &output, G4bool onlyIfActive=true)=0
G4VTBaseHnManager()=default
virtual G4double GetMaxValue(unsigned int idim, G4int id) const =0
virtual G4String GetAxisTitle(unsigned int idim, G4int id) const =0
virtual G4int Create(const G4String &name, const G4String &title, const std::array< G4HnDimension, DIM > &bins, const std::array< G4HnDimensionInformation, DIM > &hnInfo)=0
virtual ~G4VTBaseHnManager()=default
virtual G4double GetWidth(unsigned int idim, G4int id) const =0
virtual G4bool SetAxisTitle(unsigned int idim, G4int id, const G4String &title)=0
virtual G4bool WriteOnAscii(std::ofstream &output)=0
G4VTBaseHnManager & operator=(const G4VTBaseHnManager &rhs)=delete
virtual G4double GetMinValue(unsigned int idim, G4int id) const =0