Geant4  10.01.p03
G4CsvAnalysisManager.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: G4CsvAnalysisManager.hh 85025 2014-10-23 09:57:57Z gcosmo $
27 
28 // The main manager for Csv 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 G4CsvAnalysisManager_h
34 #define G4CsvAnalysisManager_h 1
35 
36 
37 #include "G4VAnalysisManager.hh"
39 #include "globals.hh"
40 
41 #include "tools/histo/h1d"
42 #include "tools/histo/h2d"
43 #include "tools/histo/h3d"
44 #include "tools/histo/p1d"
45 #include "tools/histo/p2d"
46 #include "tools/wcsv_ntuple"
47 
48 #include <fstream>
49 #include <vector>
50 #include <map>
51 
52 class G4H1ToolsManager;
53 class G4H2ToolsManager;
54 class G4H3ToolsManager;
55 class G4P1ToolsManager;
56 class G4P2ToolsManager;
57 class G4CsvFileManager;
58 class G4CsvNtupleManager;
59 
61 {
62  public:
63  G4CsvAnalysisManager(G4bool isMaster = true);
65 
66  // static methods
68 
69  // Access methods
70  tools::histo::h1d* GetH1(G4int id, G4bool warn = true,
71  G4bool onlyIfActive = true) const;
72  tools::histo::h2d* GetH2(G4int id, G4bool warn = true,
73  G4bool onlyIfActive = true) const;
74  tools::histo::h3d* GetH3(G4int id, G4bool warn = true,
75  G4bool onlyIfActive = true) const;
76  tools::histo::p1d* GetP1(G4int id, G4bool warn = true,
77  G4bool onlyIfActive = true) const;
78  tools::histo::p2d* GetP2(G4int id, G4bool warn = true,
79  G4bool onlyIfActive = true) const;
80 
81  tools::wcsv::ntuple* GetNtuple() const;
82  tools::wcsv::ntuple* GetNtuple(G4int ntupleId) const;
83 
84  // Iterators
85  std::vector<tools::histo::h1d*>::iterator BeginH1();
86  std::vector<tools::histo::h1d*>::iterator EndH1();
87  std::vector<tools::histo::h1d*>::const_iterator BeginConstH1() const;
88  std::vector<tools::histo::h1d*>::const_iterator EndConstH1() const;
89 
90  std::vector<tools::histo::h2d*>::iterator BeginH2();
91  std::vector<tools::histo::h2d*>::iterator EndH2();
92  std::vector<tools::histo::h2d*>::const_iterator BeginConstH2() const;
93  std::vector<tools::histo::h2d*>::const_iterator EndConstH2() const;
94 
95  std::vector<tools::histo::h3d*>::iterator BeginH3();
96  std::vector<tools::histo::h3d*>::iterator EndH3();
97  std::vector<tools::histo::h3d*>::const_iterator BeginConstH3() const;
98  std::vector<tools::histo::h3d*>::const_iterator EndConstH3() const;
99 
100  std::vector<tools::histo::p1d*>::iterator BeginP1();
101  std::vector<tools::histo::p1d*>::iterator EndP1();
102  std::vector<tools::histo::p1d*>::const_iterator BeginConstP1() const;
103  std::vector<tools::histo::p1d*>::const_iterator EndConstP1() const;
104 
105  std::vector<tools::histo::p2d*>::iterator BeginP2();
106  std::vector<tools::histo::p2d*>::iterator EndP2();
107  std::vector<tools::histo::p2d*>::const_iterator BeginConstP2() const;
108  std::vector<tools::histo::p2d*>::const_iterator EndConstP2() const;
109 
110  std::vector<tools::wcsv::ntuple*>::iterator BeginNtuple();
111  std::vector<tools::wcsv::ntuple*>::iterator EndNtuple();
112  std::vector<tools::wcsv::ntuple*>::const_iterator BeginConstNtuple() const;
113  std::vector<tools::wcsv::ntuple*>::const_iterator EndConstNtuple() const;
114 
115  // Csv format specific option
116  void SetIsCommentedHeader(G4bool isCommentedHeader);
117  void SetIsHippoHeader(G4bool isHippoHeader);
118 
119  protected:
120  // virtual methods from base class
121  virtual G4bool OpenFileImpl(const G4String& fileName);
122  virtual G4bool WriteImpl();
123  virtual G4bool CloseFileImpl();
124 
125  private:
126  // static data members
127  //
130 
131  // methods
132  //
133  G4bool WriteH1();
134  G4bool WriteH2();
135  G4bool WriteH3();
136  G4bool WriteP1();
137  G4bool WriteP2();
139  G4bool Reset();
140 
141  // data members
142  //
150 };
151 
152 #include "G4CsvAnalysisManager.icc"
153 
154 #endif
155 
G4H3ToolsManager * fH3Manager
G4H2ToolsManager * fH2Manager
static G4ThreadLocal G4CsvAnalysisManager * fgInstance
G4CsvFileManager * fFileManager
G4P1ToolsManager * fP1Manager
std::vector< tools::histo::h2d * >::const_iterator BeginConstH2() const
virtual G4bool OpenFileImpl(const G4String &fileName)
std::vector< tools::histo::p1d * >::const_iterator EndConstP1() const
G4CsvAnalysisManager(G4bool isMaster=true)
std::vector< tools::histo::p2d * >::const_iterator BeginConstP2() const
std::vector< tools::histo::h2d * >::const_iterator EndConstH2() const
G4P2ToolsManager * fP2Manager
std::vector< tools::histo::p2d * >::iterator EndP2()
#define G4ThreadLocal
Definition: tls.hh:89
std::vector< tools::histo::p2d * >::const_iterator EndConstP2() const
tools::wcsv::ntuple * GetNtuple() const
int G4int
Definition: G4Types.hh:78
static G4CsvAnalysisManager * Instance()
std::vector< tools::histo::h1d * >::const_iterator EndConstH1() const
std::vector< tools::histo::h3d * >::const_iterator BeginConstH3() const
virtual G4bool CloseFileImpl()
std::vector< tools::wcsv::ntuple * >::iterator EndNtuple()
bool G4bool
Definition: G4Types.hh:79
std::vector< tools::wcsv::ntuple * >::const_iterator EndConstNtuple() const
std::vector< tools::histo::h3d * >::iterator EndH3()
G4CsvNtupleManager * fNtupleManager
std::vector< tools::wcsv::ntuple * >::const_iterator BeginConstNtuple() const
std::vector< tools::histo::h1d * >::const_iterator BeginConstH1() const
void SetIsCommentedHeader(G4bool isCommentedHeader)
std::vector< tools::histo::p2d * >::iterator BeginP2()
std::vector< tools::wcsv::ntuple * >::iterator BeginNtuple()
std::vector< tools::histo::p1d * >::const_iterator BeginConstP1() const
tools::histo::h2d * GetH2(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
std::vector< tools::histo::p1d * >::iterator BeginP1()
std::vector< tools::histo::h3d * >::iterator BeginH3()
std::vector< tools::histo::p1d * >::iterator EndP1()
tools::histo::h1d * GetH1(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
tools::histo::h3d * GetH3(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
std::vector< tools::histo::h2d * >::iterator EndH2()
std::vector< tools::histo::h1d * >::iterator BeginH1()
std::vector< tools::histo::h2d * >::iterator BeginH2()
tools::histo::p1d * GetP1(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
tools::histo::p2d * GetP2(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
std::vector< tools::histo::h3d * >::const_iterator EndConstH3() const
static G4CsvAnalysisManager * fgMasterInstance
std::vector< tools::histo::h1d * >::iterator EndH1()
G4H1ToolsManager * fH1Manager
void SetIsHippoHeader(G4bool isHippoHeader)