Geant4_10
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 74257 2013-10-02 14:24:55Z 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/wroot/ntuple"
42 
43 class G4RootFileManager;
44 class G4H1ToolsManager;
45 class G4H2ToolsManager;
47 
48 
50 {
51  public:
52  G4RootAnalysisManager(G4bool isMaster = true);
53  virtual ~G4RootAnalysisManager();
54 
55  // static methods
57 
58  // Access methods
59  tools::histo::h1d* GetH1(G4int id, G4bool warn = true,
60  G4bool onlyIfActive = true) const;
61  tools::histo::h2d* GetH2(G4int id, G4bool warn = true,
62  G4bool onlyIfActive = true) const;
63 
65  tools::wroot::ntuple* GetNtuple(G4int ntupleId) const;
66 
67  protected:
68  // virtual methods from base class
69  virtual G4bool OpenFileImpl(const G4String& fileName);
70  virtual G4bool WriteImpl();
71  virtual G4bool CloseFileImpl();
72 
73  private:
74  // static data members
75  static G4RootAnalysisManager* fgMasterInstance;
76  static G4ThreadLocal G4RootAnalysisManager* fgInstance;
77 
78  // methods
79  G4bool WriteH1();
80  G4bool WriteH2();
81  G4bool Reset();
82 
83  // data members
84  G4H1ToolsManager* fH1Manager;
85  G4H2ToolsManager* fH2Manager;
86  G4RootNtupleManager* fNtupleManager;
87  G4RootFileManager* fFileManager;
88 };
89 
90 #include "G4RootAnalysisManager.icc"
91 
92 #endif
93 
TTree * ntuple
Definition: macro.C:6
virtual G4bool OpenFileImpl(const G4String &fileName)
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
G4RootAnalysisManager(G4bool isMaster=true)
static G4RootAnalysisManager * Instance()
TH1D * h1d
Definition: berger.C:21
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
tools::wroot::ntuple * GetNtuple() const