Geant4-11
G4RootAnalysisManager.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 main manager for Root analysis.
28// It delegates most of functions to the object specific managers.
29
30// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
31
32#ifndef G4RootAnalysisManager_h
33#define G4RootAnalysisManager_h 1
34
36#include "globals.hh"
37
38#include "tools/wroot/ntuple"
39#include "tools/histo/hmpi"
40
41#include <memory>
42#include <string_view>
43
47template <class T>
49
50namespace tools {
51namespace wroot {
52class directory;
53}
54}
55
57{
60
61 public:
62 virtual ~G4RootAnalysisManager();
63
64 // Static methods
66 static G4bool IsInstance();
67
68 // Access methods
69 tools::wroot::ntuple* GetNtuple() const;
70 tools::wroot::ntuple* GetNtuple(G4int ntupleId) const;
71
72 // Iterators
73 std::vector<tools::wroot::ntuple*>::iterator BeginNtuple();
74 std::vector<tools::wroot::ntuple*>::iterator EndNtuple();
75 std::vector<tools::wroot::ntuple*>::const_iterator BeginConstNtuple() const;
76 std::vector<tools::wroot::ntuple*>::const_iterator EndConstNtuple() const;
77
78 // MT/MPI
79 virtual void SetNtupleMerging(G4bool mergeNtuples,
80 G4int nofReducedNtupleFiles = 0) override;
81 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true) override;
82 virtual void SetBasketSize(unsigned int basketSize) override;
83 virtual void SetBasketEntries(unsigned int basketEntries) override;
84
85 protected:
86 // virtual methods from base class
87 virtual G4bool OpenFileImpl(const G4String& fileName) override;
88 virtual G4bool WriteImpl() override;
89 virtual G4bool CloseFileImpl(G4bool reset) override;
90 virtual G4bool ResetImpl() override;
91 virtual G4bool IsOpenFileImpl() const final;
92
93 private:
95
96 // Static data members
98 inline static G4ThreadLocal G4bool fgIsInstance { false };
99 static constexpr std::string_view fkClass { "G4RootAnalysisManager" };
100
101 // data members
102 std::shared_ptr<G4RootFileManager> fFileManager { nullptr };
103 std::shared_ptr<G4RootNtupleFileManager> fNtupleFileManager { nullptr };
104};
105
107
108#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
virtual void SetBasketSize(unsigned int basketSize) override
virtual void SetNtupleMerging(G4bool mergeNtuples, G4int nofReducedNtupleFiles=0) override
virtual G4bool CloseFileImpl(G4bool reset) override
tools::wroot::ntuple * GetNtuple(G4int ntupleId) const
static G4ThreadLocal G4bool fgIsInstance
std::shared_ptr< G4RootFileManager > fFileManager
static G4RootAnalysisManager * fgMasterInstance
std::shared_ptr< G4RootNtupleFileManager > fNtupleFileManager
tools::wroot::ntuple * GetNtuple() const
static G4RootAnalysisManager * Instance()
virtual G4bool WriteImpl() override
virtual G4bool OpenFileImpl(const G4String &fileName) override
static constexpr std::string_view fkClass
std::vector< tools::wroot::ntuple * >::iterator BeginNtuple()
virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode=true) override
std::vector< tools::wroot::ntuple * >::const_iterator EndConstNtuple() const
std::vector< tools::wroot::ntuple * >::const_iterator BeginConstNtuple() const
virtual G4bool IsOpenFileImpl() const final
std::vector< tools::wroot::ntuple * >::iterator EndNtuple()
virtual void SetBasketEntries(unsigned int basketEntries) override
virtual G4bool ResetImpl() override
#define inline
Definition: internal.h:71
#define G4ThreadLocal
Definition: tls.hh:77