Geant4  10.01.p01
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 // $Id: G4RootAnalysisManager.hh 83432 2014-08-21 15:51:10Z gcosmo $
27 
28 // The main manager for Root analysis.
29 // It delegates most of functions to the object specific managers.
30 
31 // Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
32 
33 #ifndef G4RootAnalysisManager_h
34 #define G4RootAnalysisManager_h 1
35 
36 #include "G4VAnalysisManager.hh"
37 #include "globals.hh"
38 
39 #include "tools/histo/h1d"
40 #include "tools/histo/h2d"
41 #include "tools/histo/h3d"
42 #include "tools/histo/p1d"
43 #include "tools/histo/p2d"
44 #include "tools/wroot/ntuple"
45 
46 class G4RootFileManager;
47 class G4H1ToolsManager;
48 class G4H2ToolsManager;
49 class G4H3ToolsManager;
50 class G4P1ToolsManager;
51 class G4P2ToolsManager;
53 
54 
56 {
57  public:
58  G4RootAnalysisManager(G4bool isMaster = true);
59  virtual ~G4RootAnalysisManager();
60 
61  // static methods
63 
64  // Access methods
65  tools::histo::h1d* GetH1(G4int id, G4bool warn = true,
66  G4bool onlyIfActive = true) const;
67  tools::histo::h2d* GetH2(G4int id, G4bool warn = true,
68  G4bool onlyIfActive = true) const;
69  tools::histo::h3d* GetH3(G4int id, G4bool warn = true,
70  G4bool onlyIfActive = true) const;
71  tools::histo::p1d* GetP1(G4int id, G4bool warn = true,
72  G4bool onlyIfActive = true) const;
73  tools::histo::p2d* GetP2(G4int id, G4bool warn = true,
74  G4bool onlyIfActive = true) const;
75 
76  tools::wroot::ntuple* GetNtuple() const;
77  tools::wroot::ntuple* GetNtuple(G4int ntupleId) const;
78 
79  // Iterators
80  std::vector<tools::histo::h1d*>::iterator BeginH1();
81  std::vector<tools::histo::h1d*>::iterator EndH1();
82  std::vector<tools::histo::h1d*>::const_iterator BeginConstH1() const;
83  std::vector<tools::histo::h1d*>::const_iterator EndConstH1() const;
84 
85  std::vector<tools::histo::h2d*>::iterator BeginH2();
86  std::vector<tools::histo::h2d*>::iterator EndH2();
87  std::vector<tools::histo::h2d*>::const_iterator BeginConstH2() const;
88  std::vector<tools::histo::h2d*>::const_iterator EndConstH2() const;
89 
90  std::vector<tools::histo::h3d*>::iterator BeginH3();
91  std::vector<tools::histo::h3d*>::iterator EndH3();
92  std::vector<tools::histo::h3d*>::const_iterator BeginConstH3() const;
93  std::vector<tools::histo::h3d*>::const_iterator EndConstH3() const;
94 
95  std::vector<tools::histo::p1d*>::iterator BeginP1();
96  std::vector<tools::histo::p1d*>::iterator EndP1();
97  std::vector<tools::histo::p1d*>::const_iterator BeginConstP1() const;
98  std::vector<tools::histo::p1d*>::const_iterator EndConstP1() const;
99 
100  std::vector<tools::histo::p2d*>::iterator BeginP2();
101  std::vector<tools::histo::p2d*>::iterator EndP2();
102  std::vector<tools::histo::p2d*>::const_iterator BeginConstP2() const;
103  std::vector<tools::histo::p2d*>::const_iterator EndConstP2() const;
104 
105  std::vector<tools::wroot::ntuple*>::iterator BeginNtuple();
106  std::vector<tools::wroot::ntuple*>::iterator EndNtuple();
107  std::vector<tools::wroot::ntuple*>::const_iterator BeginConstNtuple() const;
108  std::vector<tools::wroot::ntuple*>::const_iterator EndConstNtuple() const;
109 
110  protected:
111  // virtual methods from base class
112  virtual G4bool OpenFileImpl(const G4String& fileName);
113  virtual G4bool WriteImpl();
114  virtual G4bool CloseFileImpl();
115 
116  private:
117  // static data members
120 
121  // methods
122  G4bool WriteH1();
123  G4bool WriteH2();
124  G4bool WriteH3();
125  G4bool WriteP1();
126  G4bool WriteP2();
127  G4bool Reset();
128 
129  // data members
137 };
138 
139 #include "G4RootAnalysisManager.icc"
140 
141 #endif
142 
static G4RootAnalysisManager * fgMasterInstance
tools::histo::p1d * GetP1(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
tools::histo::h3d * GetH3(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
G4RootFileManager * fFileManager
std::vector< tools::wroot::ntuple * >::const_iterator BeginConstNtuple() const
std::vector< tools::histo::h2d * >::iterator EndH2()
std::vector< tools::histo::p2d * >::const_iterator EndConstP2() const
std::vector< tools::histo::h3d * >::iterator BeginH3()
std::vector< tools::histo::h3d * >::iterator EndH3()
std::vector< tools::histo::h1d * >::iterator BeginH1()
std::vector< tools::histo::p2d * >::const_iterator BeginConstP2() const
static G4ThreadLocal G4RootAnalysisManager * fgInstance
virtual G4bool OpenFileImpl(const G4String &fileName)
std::vector< tools::histo::h1d * >::const_iterator EndConstH1() const
std::vector< tools::histo::p2d * >::iterator EndP2()
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
G4RootNtupleManager * fNtupleManager
G4H2ToolsManager * fH2Manager
std::vector< tools::histo::p1d * >::const_iterator BeginConstP1() const
bool G4bool
Definition: G4Types.hh:79
G4RootAnalysisManager(G4bool isMaster=true)
std::vector< tools::wroot::ntuple * >::const_iterator EndConstNtuple() const
std::vector< tools::histo::h1d * >::iterator EndH1()
std::vector< tools::histo::h2d * >::const_iterator EndConstH2() const
std::vector< tools::histo::h2d * >::iterator BeginH2()
G4H1ToolsManager * fH1Manager
std::vector< tools::histo::h3d * >::const_iterator EndConstH3() const
tools::histo::p2d * GetP2(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
std::vector< tools::histo::p1d * >::const_iterator EndConstP1() const
std::vector< tools::histo::p1d * >::iterator BeginP1()
static G4RootAnalysisManager * Instance()
G4P2ToolsManager * fP2Manager
std::vector< tools::histo::h3d * >::const_iterator BeginConstH3() const
std::vector< tools::histo::h1d * >::const_iterator BeginConstH1() const
G4P1ToolsManager * fP1Manager
std::vector< tools::wroot::ntuple * >::iterator EndNtuple()
std::vector< tools::wroot::ntuple * >::iterator BeginNtuple()
std::vector< tools::histo::p2d * >::iterator BeginP2()
std::vector< tools::histo::h2d * >::const_iterator BeginConstH2() const
tools::histo::h1d * GetH1(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
tools::histo::h2d * GetH2(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
G4H3ToolsManager * fH3Manager
tools::wroot::ntuple * GetNtuple() const
std::vector< tools::histo::p1d * >::iterator EndP1()