Geant4-11
G4VNtupleFileManager.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// The abstract base class for ntuple file output.
28//
29// Author: Ivana Hrivnacova, 15/09/2020 (ivana@ipno.in2p3.fr)
30
31#ifndef G4VNtupleFileManager_h
32#define G4VNtupleFileManager_h 1
33
35#include "globals.hh"
36
37#include <memory>
38#include <string_view>
39
42
44{
45 // Disable using the object managers outside G4VAnalysisManager and
46 // its messenger
47 friend class G4VAnalysisManager;
48
49 public:
51 const G4String& fileType);
53 virtual ~G4VNtupleFileManager() = default;
54
55 // deleted copy constructor & assignment operator
58
59 // MT/MPI
60 virtual void SetNtupleMerging(G4bool mergeNtuples,
61 G4int nofReducedNtupleFiles = 0);
62 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true);
63 virtual void SetBasketSize(unsigned int basketSize);
64 virtual void SetBasketEntries(unsigned int basketEntries);
65
66 virtual std::shared_ptr<G4VNtupleManager> CreateNtupleManager() = 0;
67 virtual void SetBookingManager(std::shared_ptr<G4NtupleBookingManager> bookingManager);
68
69 // Methods to be performed at file management
70 virtual G4bool ActionAtOpenFile(const G4String& /*fileName*/) = 0;
71 virtual G4bool ActionAtWrite() = 0;
72 virtual G4bool ActionAtCloseFile(G4bool /*reset*/) = 0;
73 virtual G4bool Reset() = 0;
74 virtual G4bool IsNtupleMergingSupported() const;
75
76 // Get methods
77 G4String GetFileType() const;
78
79 protected:
80 // Methods for verbose
81 void Message(G4int level,
82 const G4String& action,
83 const G4String& objectType,
84 const G4String& objectName = "",
85 G4bool success = true) const;
86
87 // Static data members
90 std::shared_ptr<G4NtupleBookingManager> fBookingManager { nullptr };
91
92 private:
93 // Static data members
94 static constexpr std::string_view fkClass { "G4VNtupleFileManager" };
95};
96
97// inline functions
98
100 std::shared_ptr<G4NtupleBookingManager> bookingManager)
101{ fBookingManager = bookingManager; }
102
104 return false;
105}
106
108 return fFileType;
109}
110
112 G4int level, const G4String& action, const G4String& objectType,
113 const G4String& objectName, G4bool success) const
114{
115 fState.Message(level, action, objectType, objectName, success);
116}
117
118#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
G4VNtupleFileManager & operator=(const G4VNtupleFileManager &rhs)=delete
virtual void SetNtupleMerging(G4bool mergeNtuples, G4int nofReducedNtupleFiles=0)
virtual G4bool IsNtupleMergingSupported() const
G4VNtupleFileManager(const G4VNtupleFileManager &rhs)=delete
virtual G4bool ActionAtWrite()=0
virtual G4bool ActionAtCloseFile(G4bool)=0
virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode=true)
virtual void SetBookingManager(std::shared_ptr< G4NtupleBookingManager > bookingManager)
virtual std::shared_ptr< G4VNtupleManager > CreateNtupleManager()=0
virtual void SetBasketSize(unsigned int basketSize)
virtual void SetBasketEntries(unsigned int basketEntries)
std::shared_ptr< G4NtupleBookingManager > fBookingManager
static constexpr std::string_view fkClass
G4String GetFileType() const
virtual G4bool ActionAtOpenFile(const G4String &)=0
virtual G4bool Reset()=0
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
virtual ~G4VNtupleFileManager()=default
G4VNtupleFileManager()=delete
const G4AnalysisManagerState & fState