Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4RootMainNtupleManager.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 
28 // Class for Root main ntuple management.
29 //
30 // Author: Ivana Hrivnacova, 04/10/2016 (ivana@ipno.in2p3.fr)
31 
32 #ifndef G4RootMainNtupleManager_h
33 #define G4RootMainNtupleManager_h 1
34 
35 #include "G4BaseAnalysisManager.hh"
36 #include "G4TNtupleDescription.hh"
37 #include "G4RootNtupleManager.hh"
38 #include "globals.hh"
39 
40 #include <vector>
41 
43 
44 namespace tools {
45 namespace wroot {
46 class file;
47 class ntuple;
48 }
49 }
50 
52 {
53  friend class G4RootPNtupleManager;
54  friend class G4RootNtupleManager;
55 
56  public:
57  explicit G4RootMainNtupleManager(G4RootNtupleManager* ntupleBuilder,
58  const G4AnalysisManagerState& state);
60 
61  protected:
62  // Types alias
63  using NtupleType = tools::wroot::ntuple;
65 
66  // Methods to manipulate ntuples
67  void CreateNtuple(const tools::ntuple_booking& ntupleBooking, G4bool warn = true);
69  G4bool Merge();
70  G4bool Reset(G4bool deleteNtuple);
71 
72  // Set methods
73  void SetNtupleFile(std::shared_ptr<tools::wroot::file> rfile);
74  void SetNtupleDirectory(tools::wroot::directory* directory);
75  std::shared_ptr<tools::wroot::file> GetNtupleFile() const;
76  tools::wroot::directory* GetNtupleDirectory() const;
77 
78  // Access functions
79  const std::vector<NtupleDescriptionType*>& GetNtupleDescriptionVector()
80  { return fNtupleBuilder->GetNtupleDescriptionVector(); }
81  const std::vector<tools::wroot::ntuple*>& GetNtupleVector()
82  { return fNtupleVector; }
83  unsigned int GetBasketSize() const;
84 
85  private:
86  // Data members
87  G4RootNtupleManager* fNtupleBuilder;
88  std::shared_ptr<tools::wroot::file> fNtupleFile;
89  tools::wroot::directory* fNtupleDirectory;
90  std::vector<tools::wroot::ntuple*> fNtupleVector;
91 };
92 
93 inline void G4RootMainNtupleManager::SetNtupleFile(std::shared_ptr<tools::wroot::file> rfile)
94 { fNtupleFile = rfile; }
95 
96 inline void G4RootMainNtupleManager::SetNtupleDirectory(tools::wroot::directory* directory)
97 { fNtupleDirectory = directory; }
98 
99 inline std::shared_ptr<tools::wroot::file> G4RootMainNtupleManager::GetNtupleFile() const
100 { return fNtupleFile; }
101 
102 inline tools::wroot::directory* G4RootMainNtupleManager::GetNtupleDirectory() const
103 { return fNtupleDirectory; }
104 
105 #endif
106 
tools::wroot::ntuple NtupleType
std::shared_ptr< tools::wroot::file > GetNtupleFile() const
void CreateNtuple(const tools::ntuple_booking &ntupleBooking, G4bool warn=true)
void SetNtupleDirectory(tools::wroot::directory *directory)
const std::vector< tools::wroot::ntuple * > & GetNtupleVector()
unsigned int GetBasketSize() const
bool G4bool
Definition: G4Types.hh:79
void SetNtupleFile(std::shared_ptr< tools::wroot::file > rfile)
const std::vector< NtupleDescriptionType * > & GetNtupleDescriptionVector()
G4bool Reset(G4bool deleteNtuple)
tools::wroot::directory * GetNtupleDirectory() const
std::vector< tools::wroot::ntuple * > fNtupleVector
G4RootMainNtupleManager(G4RootNtupleManager *ntupleBuilder, const G4AnalysisManagerState &state)