Geant4  10.02
G4XmlAnalysisManager.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: G4XmlAnalysisManager.hh 92972 2015-09-23 14:36:03Z gcosmo $
27 
28 // The main manager for Xml 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 G4XmlAnalysisManager_h
34 #define G4XmlAnalysisManager_h 1
35 
37 #include "globals.hh"
38 
39 #include "tools/waxml/ntuple"
40 
41 #include <memory>
42 
43 class G4XmlFileManager;
44 class G4XmlNtupleManager;
45 
47 {
48  public:
49  explicit G4XmlAnalysisManager(G4bool isMaster = true);
51 
52  // static methods
54  static G4bool IsInstance();
55 
56  // Access methods
57  tools::waxml::ntuple* GetNtuple() const;
58  tools::waxml::ntuple* GetNtuple(G4int ntupleId) const;
59 
60  // Iterators
61  std::vector<tools::waxml::ntuple*>::iterator BeginNtuple();
62  std::vector<tools::waxml::ntuple*>::iterator EndNtuple();
63  std::vector<tools::waxml::ntuple*>::const_iterator BeginConstNtuple() const;
64  std::vector<tools::waxml::ntuple*>::const_iterator EndConstNtuple() const;
65 
66  protected:
67  // virtual methods from base class
68  virtual G4bool OpenFileImpl(const G4String& fileName) final;
69  virtual G4bool WriteImpl() final;
70  virtual G4bool CloseFileImpl() final;
71  virtual G4bool IsOpenFileImpl() const final;
72 
73  private:
74  // static data members
77 
78  // methods
79  template <typename T>
80  G4bool WriteT(const std::vector<T*>& htVector,
81  const std::vector<G4HnInformation*>& hnVector,
82  const G4String& directoryName,
83  const G4String& hnType);
84  G4bool WriteH1();
85  G4bool WriteH2();
86  G4bool WriteH3();
87  G4bool WriteP1();
88  G4bool WriteP2();
91  G4bool Reset();
92 
93  // data members
95  std::shared_ptr<G4XmlFileManager> fFileManager;
96 };
97 
98 #include "G4XmlAnalysisManager.icc"
99 
100 #endif
101 
static G4XmlAnalysisManager * fgMasterInstance
std::vector< tools::waxml::ntuple * >::iterator EndNtuple()
virtual G4bool OpenFileImpl(const G4String &fileName) final
static G4XmlAnalysisManager * Instance()
std::vector< tools::waxml::ntuple * >::const_iterator EndConstNtuple() const
G4bool WriteT(const std::vector< T * > &htVector, const std::vector< G4HnInformation * > &hnVector, const G4String &directoryName, const G4String &hnType)
G4XmlAnalysisManager(G4bool isMaster=true)
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
static G4ThreadLocal G4XmlAnalysisManager * fgInstance
tools::waxml::ntuple * GetNtuple() const
bool G4bool
Definition: G4Types.hh:79
std::vector< tools::waxml::ntuple * >::const_iterator BeginConstNtuple() const
G4XmlNtupleManager * fNtupleManager
virtual G4bool WriteImpl() final
std::shared_ptr< G4XmlFileManager > fFileManager
virtual G4bool IsOpenFileImpl() const final
std::vector< tools::waxml::ntuple * >::iterator BeginNtuple()
virtual G4bool CloseFileImpl() final