Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 ([email protected])
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
45
46namespace tools {
47namespace wroot {
48class directory;
49}
50}
51
53{
55
56 public:
57 explicit G4RootAnalysisManager(G4bool isMaster = true);
58 virtual ~G4RootAnalysisManager();
59
60 // static methods
62 static G4bool IsInstance();
63
64 // Access methods
65 tools::wroot::ntuple* GetNtuple() const;
66 tools::wroot::ntuple* GetNtuple(G4int ntupleId) const;
67
68 // Iterators
69 std::vector<tools::wroot::ntuple*>::iterator BeginNtuple();
70 std::vector<tools::wroot::ntuple*>::iterator EndNtuple();
71 std::vector<tools::wroot::ntuple*>::const_iterator BeginConstNtuple() const;
72 std::vector<tools::wroot::ntuple*>::const_iterator EndConstNtuple() const;
73
74 // MT/MPI
75 virtual void SetNtupleMerging(G4bool mergeNtuples,
76 G4int nofReducedNtupleFiles = 0) override;
77 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true) override;
78 virtual void SetBasketSize(unsigned int basketSize) override;
79 virtual void SetBasketEntries(unsigned int basketEntries) override;
80
81 protected:
82 // virtual methods from base class
83 virtual G4bool OpenFileImpl(const G4String& fileName) override;
84 virtual G4bool WriteImpl() override;
85 virtual G4bool CloseFileImpl(G4bool reset) override;
86 virtual G4bool IsOpenFileImpl() const final;
87
88 // virtual functions (overriden in MPI implementation)
89 virtual G4bool Reset();
90
91 private:
92 // static data members
93 static G4RootAnalysisManager* fgMasterInstance;
94 static G4ThreadLocal G4RootAnalysisManager* fgInstance;
95
96 // methods
97 template <typename T>
98 G4bool WriteT(const std::vector<T*>& htVector,
99 const std::vector<G4HnInformation*>& hnVector,
100 const G4String& hnType);
101 G4bool WriteH1();
102 G4bool WriteH2();
103 G4bool WriteH3();
104 G4bool WriteP1();
105 G4bool WriteP2();
106
107 // data members
108 std::shared_ptr<G4RootFileManager> fFileManager;
109 std::shared_ptr<G4RootNtupleFileManager> fNtupleFileManager;
110};
111
112#include "G4RootAnalysisManager.icc"
113
114#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
tools::wroot::ntuple * GetNtuple() const
static G4RootAnalysisManager * Instance()
virtual G4bool WriteImpl() override
virtual G4bool OpenFileImpl(const G4String &fileName) override
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
#define G4ThreadLocal
Definition: tls.hh:77