Geant4 10.7.0
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// Class template for ntuple managers 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
35#include "globals.hh"
36
37#include "tools/ntuple_booking"
38
39#include <vector>
40
42{
45 fFileName(),
46 fActivation(true) {}
47
49
50 tools::ntuple_booking fNtupleBooking;
53};
54
56{
57 // Disable using the object managers outside G4VAnalysisManager and
58 // its messenger
59 friend class G4VAnalysisManager;
60
61 public:
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);
88
89 // Create columns in the ntuple with given id
91 const G4String& name, std::vector<int>* vector);
93 const G4String& name, std::vector<float>* vector);
95 const G4String& name, std::vector<double>* vector);
96 G4int CreateNtupleSColumn(G4int ntupleId, const G4String& name);
98
99 // The ntuple column ids are generated automatically starting from 0;
100 // with the following function it is possible to change it
101 // to start from another value
104
105 // Activation option
106 //
107 void SetActivation(G4bool activation);
108 void SetActivation(G4int ntupleId, G4bool activation);
109 G4bool GetActivation(G4int ntupleId) const;
110
111 // // File name option
112 void SetFileName(const G4String& fileName);
113 void SetFileName(G4int id, const G4String& fileName);
114 G4String GetFileName(G4int id) const;
115
116 // Access methods
118 // G4int GetNofNtuples() const;
119
120 // Data members
121 std::vector<G4NtupleBooking*> fNtupleBookingVector;
122
123 private:
124 // methods
125 // Common implementation
126 G4NtupleBooking* GetNtupleBookingInFunction(
127 G4int id,
129 G4bool warn = true) const;
130 template <typename T>
131 G4int CreateNtupleTColumn(G4int ntupleId,
132 const G4String& name, std::vector<T>* vector);
133 G4int GetCurrentNtupleId() const;
134
135 // data members
136 G4String fFileType;
137 G4int fFirstNtupleColumnId;
138 G4bool fLockFirstNtupleColumnId;
139};
140
141#include "G4NtupleBookingManager.icc"
142
143#endif
G4double(* function)(G4double)
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
G4int CreateNtupleSColumn(const G4String &name)
G4String GetFileName(G4int id) const
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
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)
tools::ntuple_booking fNtupleBooking