Geant4  10.00.p02
ExG4HbookAnalysisManager.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$
27 //
30 
31 // Author: Ivana Hrivnacova, 15/06/2011 (ivana@ipno.in2p3.fr)
32 
33 #ifdef G4_USE_HBOOK
34 
35 #ifndef ExG4HbookAnalysisManager_h
36 #define ExG4HbookAnalysisManager_h 1
37 
38 #include "G4VAnalysisManager.hh"
39 #include "globals.hh"
40 
41 #include <tools/hbook/wfile>
42 #include <tools/hbook/h1>
43 #include <tools/hbook/h2>
44 #include <tools/hbook/wntuple>
45 
46 #include <vector>
47 #include <map>
48 
49 #define setpawc setpawc_
50 #define setntuc setntuc_
51 //#define ntuc ntuc_
52 
53 class ExG4HbookAnalysisManager;
54 
55 namespace G4Hbook {
56 
57  typedef tools::hbook::h1 G4AnaH1;
58  typedef ExG4HbookAnalysisManager G4AnalysisManager;
59 }
60 
61 class ExG4HbookFileManager;
62 class ExG4HbookH1Manager;
63 class ExG4HbookH2Manager;
64 class ExG4HbookNtupleManager;
65 
71 
72 class ExG4HbookAnalysisManager : public G4VAnalysisManager
73 {
74  public:
75  ExG4HbookAnalysisManager();
76  virtual ~ExG4HbookAnalysisManager();
77 
78  // static methods
79  static ExG4HbookAnalysisManager* Create(G4bool isMaster = true);
80  static ExG4HbookAnalysisManager* Instance();
81 
82  // HBOOK does not allow IDs the same IDs for H1 and H2,
83  // and also IDs starting from 0; thats why there is defined an offset
84  // with respect to the G4AnalysisManager generic Ids.
85  // The default values of these offsets can be changed by the user.
86  //
87  // Set the offset of HBOOK ID for H1
88  // ( default value = firstHistoID if firstHistoID > 0; otherwise = 1)
89  G4bool SetH1HbookIdOffset(G4int offset);
90  G4int GetH1HbookIdOffset() const;
91 
92  // Set the offset of HBOOK ID for H2
93  // ( default value = firstHistoID + 100 if firstHistoID > 0;
94  // otherwise = 101 )
95  G4bool SetH2HbookIdOffset(G4int offset);
96  G4int GetH2HbookIdOffset() const;
97 
98  // Set the offset of NTUPLE ID for ntuples
99  // ( default value = firstNtupleID if firstNtupleID > 0; otherwise = 1)
100  G4bool SetNtupleHbookIdOffset(G4int offset);
101  G4int GetNtupleHbookIdOffset() const;
102 
103  // Access methods
104  //
105  tools::hbook::h1* GetH1(G4int id, G4bool warn = true,
106  G4bool onlyIfActive = true) const;
107  tools::hbook::h2* GetH2(G4int id, G4bool warn = true,
108  G4bool onlyIfActive = true) const;
109  tools::hbook::wntuple* GetNtuple() const;
110  tools::hbook::wntuple* GetNtuple(G4int ntupleId) const;
111 
112 
113  protected:
114  // virtual methods from base class
115  virtual G4bool OpenFileImpl(const G4String& fileName);
116  virtual G4bool WriteImpl();
117  virtual G4bool CloseFileImpl();
118 
119  private:
120  // static data members
121  //
122  static ExG4HbookAnalysisManager* fgInstance;
123 
124  // methods
125  //
126  void Reset();
127 
128  ExG4HbookH1Manager* fH1Manager;
129  ExG4HbookH2Manager* fH2Manager;
130  ExG4HbookNtupleManager* fNtupleManager;
131  ExG4HbookFileManager* fFileManager;
132 };
133 
135 
136 #endif
137 
138 #endif
virtual G4bool WriteImpl()=0
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
virtual G4bool OpenFileImpl(const G4String &fileName)=0
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:46
tools::hbook::h1 G4AnaH1
Definition: g4hbook_defs.hh:43
virtual G4bool CloseFileImpl()=0