Geant4-11
G4RootNtupleFileManager.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 Root file output,
28// provides handling Root ntuple managers in parallel processing.
29
30// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
31
32#ifndef G4RootNtupleFileManager_h
33#define G4RootNtupleFileManager_h 1
34
36
37#include <string_view>
38
44
46 kNone,
47 kMain,
48 kSlave
49};
50
52{
54
55 public:
59
60 // MT/MPI
61 virtual void SetNtupleMerging(G4bool mergeNtuples,
62 G4int nofReducedNtupleFiles = 0) override;
63 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true) override;
64 virtual void SetBasketSize(unsigned int basketSize) override;
65 virtual void SetBasketEntries(unsigned int basketEntries) override;
66
67 // virtual methods from base class
68 virtual G4bool ActionAtOpenFile(const G4String& fileName) override;
69 virtual G4bool ActionAtWrite() override;
70 virtual G4bool ActionAtCloseFile(G4bool reset) override;
71 virtual G4bool Reset() override;
72 virtual G4bool IsNtupleMergingSupported() const override;
73
74 virtual std::shared_ptr<G4VNtupleManager> CreateNtupleManager() override;
75
76 void SetFileManager(std::shared_ptr<G4RootFileManager> fileManager);
77
79 std::shared_ptr<G4RootNtupleManager> GetNtupleManager() const;
80
81 private:
82 // Static data members
84
85 void SetNtupleMergingMode(G4bool mergeNtuples, G4int nofNtupleFiles);
88
89 // Static data members
90 static constexpr std::string_view fkClass { "G4RootNtupleFileManager" };
91
92 // data members
98 std::shared_ptr<G4RootNtupleManager> fNtupleManager { nullptr };
99 std::shared_ptr<G4RootPNtupleManager> fSlaveNtupleManager { nullptr };
100 std::shared_ptr<G4RootFileManager> fFileManager { nullptr };
101};
102
104 std::shared_ptr<G4RootFileManager> fileManager)
105{ fFileManager = fileManager; }
106
108{ return fNtupleMergeMode; }
109
111{ return true; }
112
113inline std::shared_ptr<G4RootNtupleManager> G4RootNtupleFileManager::GetNtupleManager() const
114{ return fNtupleManager; }
115
116#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual void SetNtupleMerging(G4bool mergeNtuples, G4int nofReducedNtupleFiles=0) override
virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode=true) override
virtual void SetBasketSize(unsigned int basketSize) override
static G4RootNtupleFileManager * fgMasterInstance
virtual std::shared_ptr< G4VNtupleManager > CreateNtupleManager() override
static constexpr std::string_view fkClass
virtual G4bool ActionAtCloseFile(G4bool reset) override
virtual G4bool ActionAtWrite() override
virtual G4bool IsNtupleMergingSupported() const override
std::shared_ptr< G4RootPNtupleManager > fSlaveNtupleManager
void SetNtupleMergingMode(G4bool mergeNtuples, G4int nofNtupleFiles)
G4NtupleMergeMode GetMergeMode() const
virtual void SetBasketEntries(unsigned int basketEntries) override
void SetFileManager(std::shared_ptr< G4RootFileManager > fileManager)
std::shared_ptr< G4RootNtupleManager > GetNtupleManager() const
virtual G4bool Reset() override
std::shared_ptr< G4RootNtupleManager > fNtupleManager
virtual G4bool ActionAtOpenFile(const G4String &fileName) override
G4RootNtupleFileManager()=delete
std::shared_ptr< G4RootFileManager > fFileManager