Geant4 10.7.0
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
40template <typename TNTUPLE>
42{
43 protected:
46
47 // Methods to manipulate ntuples
48 G4bool IsEmpty() const;
50
51 // Access methods
52 TNTUPLE* GetNtuple() const;
53 TNTUPLE* GetNtuple(G4int ntupleId) const;
54
55 // Functions independent from the output type
56 //
57 // Methods to read ntuple from a file
59
60 // Methods to bind ntuple (from base class)
65
66 // Methods to bind ntuple
67 virtual G4bool SetNtupleIColumn(G4int ntupleId,
68 const G4String& columnName, G4int& value) final;
69 virtual G4bool SetNtupleFColumn(G4int ntupleId,
70 const G4String& columnName, G4float& value) final;
71 virtual G4bool SetNtupleDColumn(G4int ntupleId,
72 const G4String& columnName, G4double& value) final;
73 virtual G4bool SetNtupleSColumn(G4int ntupleId,
74 const G4String& columnName, G4String& value) final;
75
76 // Bind the ntuple columns of vector type
77 virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String& columnName,
78 std::vector<G4int>& vector) override;
79 virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String& columnName,
80 std::vector<G4float>& vector) override;
81 virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String& columnName,
82 std::vector<G4double>& vector) override;
83
85 virtual G4bool GetNtupleRow(G4int ntupleId) final;
86
87 // Access methods
88 virtual G4int GetNofNtuples() const final;
89
90 // Utility method
93 G4bool warn = true) const;
94
95 private:
96 // Fuctions which are specific to output type
97 //
98 virtual G4bool GetTNtupleRow(G4TRNtupleDescription<TNTUPLE>* rntupleDescription) = 0;
99
100 // Common implementation
101 //
102 template <typename T>
103 G4bool SetNtupleTColumn(G4int ntupleId, const G4String& name,
104 T& value);
105
106 template <typename T>
107 G4bool SetNtupleTColumn(G4int ntupleId, const G4String& name,
108 std::vector<T>& vector);
109
110 // data members
111 std::vector<G4TRNtupleDescription<TNTUPLE>*> fNtupleDescriptionVector;
112};
113
114#include "G4TRNtupleManager.icc"
115
116#endif
117
G4double(* function)(G4double)
float G4float
Definition: G4Types.hh:84
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual G4bool SetNtupleSColumn(const G4String &columnName, G4String &value) final
virtual G4bool GetNtupleRow() final
virtual G4bool SetNtupleFColumn(const G4String &columnName, G4float &value) final
virtual G4bool SetNtupleDColumn(const G4String &columnName, G4double &value) final
virtual G4bool SetNtupleIColumn(const G4String &columnName, G4int &value) final
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String &columnName, std::vector< G4double > &vector) override
TNTUPLE * GetNtuple(G4int ntupleId) const
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String &columnName, G4double &value) final
virtual ~G4TRNtupleManager()
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String &columnName, G4float &value) final
virtual G4bool SetNtupleSColumn(G4int ntupleId, const G4String &columnName, G4String &value) final
virtual G4bool GetNtupleRow(G4int ntupleId) final
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String &columnName, std::vector< G4int > &vector) override
G4TRNtupleManager(const G4AnalysisManagerState &state)
G4int SetNtuple(G4TRNtupleDescription< TNTUPLE > *rntupleDescription)
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String &columnName, std::vector< G4float > &vector) override
virtual G4int GetNofNtuples() const final
G4TRNtupleDescription< TNTUPLE > * GetNtupleDescriptionInFunction(G4int id, G4String function, G4bool warn=true) const
TNTUPLE * GetNtuple() const
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String &columnName, G4int &value) final
G4bool IsEmpty() const