Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TRNtupleManager.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 template for read ntuple managers for all output types.
28//
29// Author: Ivana Hrivnacova, 20/07/2017 ([email protected])
30
31#ifndef G4TRNtupleManager_h
32#define G4TRNtupleManager_h 1
33
36#include "globals.hh"
37
38#include <vector>
39#include <string_view>
40
41template <typename NT>
43{
44 public:
46
47 protected:
50
51 // Methods to manipulate ntuples
52 G4bool IsEmpty() const;
54
55 // Access methods
56 NT* GetNtuple() const;
57 NT* GetNtuple(G4int ntupleId) const;
58
59 // Functions independent from the output type
60 //
61 // Methods to read ntuple from a file
63
64 // Methods to bind ntuple (from base class)
69
70 // Methods to bind ntuple
71 G4bool SetNtupleIColumn(G4int ntupleId, const G4String& columnName, G4int& value) final;
72 G4bool SetNtupleFColumn(G4int ntupleId, const G4String& columnName, G4float& value) final;
73 G4bool SetNtupleDColumn(G4int ntupleId, const G4String& columnName, G4double& value) final;
74 G4bool SetNtupleSColumn(G4int ntupleId, const G4String& columnName, G4String& value) final;
75
76 // Bind the ntuple columns of vector type
78 G4int ntupleId, const G4String& columnName, std::vector<G4int>& vector) override;
80 G4int ntupleId, const G4String& columnName, std::vector<G4float>& vector) override;
82 G4int ntupleId, const G4String& columnName, std::vector<G4double>& vector) override;
84 G4int ntupleId, const G4String& columnName, std::vector<std::string>& vector) override;
85
87 G4bool GetNtupleRow(G4int ntupleId) final;
88
89 // Access methods
90 G4int GetNofNtuples() const final;
91
92 // Utility method
94 std::string_view function,
95 G4bool warn = true) const;
96
97 private:
98 // Fuctions which are specific to output type
99 //
100 virtual G4bool GetTNtupleRow(G4TRNtupleDescription<NT>* rntupleDescription) = 0;
101
102 // Common implementation
103 //
104 template <typename T>
105 G4bool SetNtupleTColumn(G4int ntupleId, const G4String& name,
106 T& value);
107
108 template <typename T>
109 G4bool SetNtupleTColumn(G4int ntupleId, const G4String& name,
110 std::vector<T>& vector);
111
112 // Static data members
113 static constexpr std::string_view fkClass { "G4TRNtupleManager<NT>" };
114
115 // Data members
116 std::vector<G4TRNtupleDescription<NT>*> fNtupleDescriptionVector;
117};
118
119#include "G4TRNtupleManager.icc"
120
121#endif
122
G4double(*)(G4double) function
float G4float
Definition G4Types.hh:84
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4bool SetNtupleSColumn(const G4String &columnName, G4String &value) final
G4bool SetNtupleFColumn(const G4String &columnName, G4float &value) final
G4bool SetNtupleDColumn(const G4String &columnName, G4double &value) final
G4bool SetNtupleIColumn(const G4String &columnName, G4int &value) final
G4TRNtupleManager(const G4AnalysisManagerState &state)
G4bool IsEmpty() const
NT * GetNtuple(G4int ntupleId) const
G4TRNtupleDescription< NT > * GetNtupleDescriptionInFunction(G4int id, std::string_view function, G4bool warn=true) const
G4bool SetNtupleSColumn(G4int ntupleId, const G4String &columnName, std::vector< std::string > &vector) override
G4bool SetNtupleIColumn(G4int ntupleId, const G4String &columnName, G4int &value) final
G4bool GetNtupleRow(G4int ntupleId) final
G4bool SetNtupleSColumn(G4int ntupleId, const G4String &columnName, G4String &value) final
G4bool SetNtupleFColumn(G4int ntupleId, const G4String &columnName, G4float &value) final
G4bool SetNtupleFColumn(G4int ntupleId, const G4String &columnName, std::vector< G4float > &vector) override
G4bool SetNtupleIColumn(G4int ntupleId, const G4String &columnName, std::vector< G4int > &vector) override
G4bool SetNtupleDColumn(G4int ntupleId, const G4String &columnName, std::vector< G4double > &vector) override
~G4TRNtupleManager() override
G4TRNtupleManager()=delete
G4bool SetNtupleDColumn(G4int ntupleId, const G4String &columnName, G4double &value) final
G4int GetNofNtuples() const final
NT * GetNtuple() const
G4int SetNtuple(G4TRNtupleDescription< NT > *rntupleDescription)