Geant4-11
G4CsvNtupleManager.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 CSV ntuples.
28//
29// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
30
31#ifndef G4CsvNtupleManager_h
32#define G4CsvNtupleManager_h 1
33
34#include "G4TNtupleManager.hh"
35#include "globals.hh"
36
37#include "tools/wcsv_ntuple"
38
39#include <memory>
40#include <string_view>
41
42// Types alias
44
46
47class G4CsvNtupleManager : public G4TNtupleManager<tools::wcsv::ntuple,
48 std::ofstream>
49{
52
53 public:
54 explicit G4CsvNtupleManager(const G4AnalysisManagerState& state);
56 virtual ~G4CsvNtupleManager() = default;
57
58 private:
59 // Functions specific to the output type
60
61 // Set methods
62 void SetFileManager(std::shared_ptr<G4CsvFileManager> fileManager);
63
64 // Access to ntuple vector (needed for Write())
65 const std::vector<CsvNtupleDescription*>& GetNtupleDescriptionVector() const;
66
67 void SetIsCommentedHeader(G4bool isCommentedHeader);
68 void SetIsHippoHeader(G4bool isHippoHeader);
69
70 // Methods from the templated base class
71 //
72 virtual void CreateTNtupleFromBooking(
73 CsvNtupleDescription* ntupleDescription) final;
74
75 virtual void FinishTNtuple(
76 CsvNtupleDescription* ntupleDescription,
77 G4bool fromBooking) final;
78
79 G4bool WriteHeader(tools::wcsv::ntuple* ntuple) const;
80
81 // Static data members
82 static constexpr std::string_view fkClass { "G4CsvNtupleManager" };
83
84 // data members
85 std::shared_ptr<G4CsvFileManager> fFileManager { nullptr };
88};
89
90// inline functions
91
92inline void
93G4CsvNtupleManager::SetFileManager(std::shared_ptr<G4CsvFileManager> fileManager)
94{ fFileManager = fileManager; }
95
96inline const std::vector<G4TNtupleDescription<tools::wcsv::ntuple, std::ofstream>*>&
99
101{ fIsCommentedHeader = isCommentedHeader; }
102
104{ fIsHippoHeader = isHippoHeader; }
105
106#endif
bool G4bool
Definition: G4Types.hh:86
virtual ~G4CsvNtupleManager()=default
virtual void FinishTNtuple(CsvNtupleDescription *ntupleDescription, G4bool fromBooking) final
G4CsvNtupleManager()=delete
G4bool WriteHeader(tools::wcsv::ntuple *ntuple) const
std::shared_ptr< G4CsvFileManager > fFileManager
virtual void CreateTNtupleFromBooking(CsvNtupleDescription *ntupleDescription) final
void SetIsHippoHeader(G4bool isHippoHeader)
const std::vector< CsvNtupleDescription * > & GetNtupleDescriptionVector() const
void SetIsCommentedHeader(G4bool isCommentedHeader)
static constexpr std::string_view fkClass
void SetFileManager(std::shared_ptr< G4CsvFileManager > fileManager)
std::vector< G4TNtupleDescription< tools::wcsv::ntuple, std::ofstream > * > fNtupleDescriptionVector