Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NtupleBookingManager.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// Manager class for ntuple booking for all output types.
28//
29// Author: Ivana Hrivnacova, 19/06/2015 ([email protected])
30
31#ifndef G4NtupleBookingManager_h
32#define G4NtupleBookingManager_h 1
33
36#include "globals.hh"
37
38#include "tools/ntuple_booking"
39
40#include <vector>
41#include <string_view>
42
44{
45 G4NtupleBooking() = default;
46 ~G4NtupleBooking() = default;
47
48 tools::ntuple_booking fNtupleBooking;
52};
53
55{
56 // Disable using the object managers outside G4VAnalysisManager and
57 // its messenger
58 friend class G4VAnalysisManager;
59
60 public:
63 ~G4NtupleBookingManager() override;
64
65 const std::vector<G4NtupleBooking*>& GetNtupleBookingVector() const;
66
67 // File type
68 // (only one output file type allowed for ntuples)
69 void SetFileType(const G4String& fileType);
71 G4bool IsEmpty() const;
72
73 protected:
74 // Methods to create ntuples
75 //
76 G4int CreateNtuple(const G4String& name, const G4String& title);
77
78 // Create columns in the last created ntuple (from base class)
79 // Create columns in the last created ntuple
81 std::vector<int>* vector);
83 std::vector<float>* vector) ;
85 std::vector<double>* vector);
87 std::vector<std::string>* vector);
89
90 // Create columns in the ntuple with given id
92 const G4String& name, std::vector<int>* vector);
94 const G4String& name, std::vector<float>* vector);
96 const G4String& name, std::vector<double>* vector);
98 const G4String& name, std::vector<std::string>* vector);
100
101 // The ntuple column ids are generated automatically starting from 0;
102 // with the following function it is possible to change it
103 // to start from another value
106
107 // Activation option
108 //
109 void SetActivation(G4bool activation);
110 void SetActivation(G4int ntupleId, G4bool activation);
111 G4bool GetActivation(G4int ntupleId) const;
112
113 // // File name option
114 void SetFileName(const G4String& fileName);
115 void SetFileName(G4int id, const G4String& fileName);
116 G4String GetFileName(G4int id) const;
117
118 // Access methods
120 // G4int GetNofNtuples() const;
121
122 // Clear data
123 void ClearData();
124
125 // Data members
126 std::vector<G4NtupleBooking*> fNtupleBookingVector;
127
128 private:
129 // Methods
130 // Common implementation
131 G4NtupleBooking* GetNtupleBookingInFunction(
132 G4int id,
133 std::string_view function,
134 G4bool warn = true) const;
135
136 G4bool CheckName(const G4String& name, const G4String& objectType) const;
137 template <typename T>
138 G4int CreateNtupleTColumn(G4int ntupleId,
139 const G4String& name, std::vector<T>* vector);
140 G4int GetCurrentNtupleId() const;
141
142 // Static data members
143 static constexpr std::string_view fkClass { "G4NtupleBookingManager" };
144
145 // Data members
146 G4String fFileType;
147 G4int fFirstNtupleColumnId { 0 };
148 G4bool fLockFirstNtupleColumnId { false };
149};
150
151#include "G4NtupleBookingManager.icc"
152
153#endif
G4double(*)(G4double) function
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4int GetFirstNtupleColumnId() const
G4bool GetActivation(G4int ntupleId) const
G4bool SetFirstNtupleColumnId(G4int firstId)
std::vector< G4NtupleBooking * > fNtupleBookingVector
G4String GetFileName(G4int id) const
G4int CreateNtupleSColumn(const G4String &name, std::vector< std::string > *vector)
G4NtupleBooking * FinishNtuple()
G4int CreateNtupleDColumn(const G4String &name, std::vector< double > *vector)
G4int CreateNtuple(const G4String &name, const G4String &title)
G4int CreateNtupleFColumn(const G4String &name, std::vector< float > *vector)
G4String GetFileType() const
const std::vector< G4NtupleBooking * > & GetNtupleBookingVector() const
G4NtupleBookingManager()=delete
G4int GetNofNtupleBookings() const
void SetFileName(const G4String &fileName)
G4int CreateNtupleIColumn(const G4String &name, std::vector< int > *vector)
void SetFileType(const G4String &fileType)
void SetActivation(G4bool activation)
constexpr G4int kInvalidId
~G4NtupleBooking()=default
tools::ntuple_booking fNtupleBooking
G4NtupleBooking()=default