Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 92972 2015-09-23 14:36:03Z 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 
37 #include "globals.hh"
38 
39 #include "tools/wcsv_ntuple"
40 
41 #include <memory>
42 
43 class G4CsvFileManager;
44 class G4CsvNtupleManager;
45 
47 {
48  public:
49  explicit G4CsvAnalysisManager(G4bool isMaster = true);
51 
52  // static methods
54  static G4bool IsInstance();
55 
56  // Access methods
57  tools::wcsv::ntuple* GetNtuple() const;
58  tools::wcsv::ntuple* GetNtuple(G4int ntupleId) const;
59 
60  // Iterators
61  std::vector<tools::wcsv::ntuple*>::iterator BeginNtuple();
62  std::vector<tools::wcsv::ntuple*>::iterator EndNtuple();
63  std::vector<tools::wcsv::ntuple*>::const_iterator BeginConstNtuple() const;
64  std::vector<tools::wcsv::ntuple*>::const_iterator EndConstNtuple() const;
65 
66  // Csv format specific option
67  void SetIsCommentedHeader(G4bool isCommentedHeader);
68  void SetIsHippoHeader(G4bool isHippoHeader);
69 
70  protected:
71  // virtual methods from base class
72  virtual G4bool OpenFileImpl(const G4String& fileName) final;
73  virtual G4bool WriteImpl() final;
74  virtual G4bool CloseFileImpl() final;
75  virtual G4bool IsOpenFileImpl() const final;
76 
77  private:
78  // static data members
79  //
80  static G4CsvAnalysisManager* fgMasterInstance;
81  static G4ThreadLocal G4CsvAnalysisManager* fgInstance;
82 
83  // methods
84  //
85  template <typename T>
86  G4bool WriteT(const std::vector<T*>& htVector,
87  const std::vector<G4HnInformation*>& hnVector,
88  const G4String& hnType);
89  G4bool WriteH1();
90  G4bool WriteH2();
91  G4bool WriteH3();
92  G4bool WriteP1();
93  G4bool WriteP2();
94  G4bool CloseNtupleFiles();
95  G4bool Reset();
96 
97  // data members
98  G4CsvNtupleManager* fNtupleManager;
99  std::shared_ptr<G4CsvFileManager> fFileManager;
100 };
101 
102 #include "G4CsvAnalysisManager.icc"
103 
104 #endif
105 
virtual G4bool IsOpenFileImpl() const final
G4CsvAnalysisManager(G4bool isMaster=true)
virtual G4bool WriteImpl() final
#define G4ThreadLocal
Definition: tls.hh:89
tools::wcsv::ntuple * GetNtuple() const
int G4int
Definition: G4Types.hh:78
static G4CsvAnalysisManager * Instance()
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::wcsv::ntuple * >::const_iterator BeginConstNtuple() const
void SetIsCommentedHeader(G4bool isCommentedHeader)
std::vector< tools::wcsv::ntuple * >::iterator BeginNtuple()
virtual G4bool OpenFileImpl(const G4String &fileName) final
virtual G4bool CloseFileImpl() final
void SetIsHippoHeader(G4bool isHippoHeader)