Geant4  10.02
G4RootNtupleManager.cc
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: G4RootNtupleManager.cc 70604 2013-06-03 11:27:06Z ihrivnac $
27 
28 // Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
29 
30 #include "G4RootNtupleManager.hh"
32 #include "G4AnalysisUtilities.hh"
33 
34 #include "tools/wroot/file"
35 
36 using namespace G4Analysis;
37 
38 //_____________________________________________________________________________
40  : G4TNtupleManager<tools::wroot::ntuple>(state),
41  fNtupleDirectory(nullptr)
42 {}
43 
44 //_____________________________________________________________________________
46 {}
47 
48 //
49 // private methods
50 //
51 
52 //_____________________________________________________________________________
55  const G4String& name, const G4String& title)
56 {
57  // Create ntuple if the file is open
58  if ( fNtupleDirectory ) {
59  ntupleDescription->fNtuple
60  = new tools::wroot::ntuple(*fNtupleDirectory, name, title);
61  ntupleDescription->fIsNtupleOwner = false;
62  // ntuple object is deleted automatically when closing a file
63  fNtupleVector.push_back(ntupleDescription->fNtuple);
64  }
65 }
66 
67 //_____________________________________________________________________________
70 {
71  ntupleDescription->fNtuple
72  = new tools::wroot::ntuple(
73  *fNtupleDirectory, ntupleDescription->fNtupleBooking);
74  ntupleDescription->fIsNtupleOwner = false;
75  // ntuple object is deleted automatically when closing a file
76  fNtupleVector.push_back(ntupleDescription->fNtuple);
77 }
78 
79 //_____________________________________________________________________________
81  G4TNtupleDescription<tools::wroot::ntuple>* /*ntupleDescription*/)
82 {
83  // nothing to be done here
84 }
G4String name
Definition: TRTMaterials.hh:40
tools::wroot::directory * fNtupleDirectory
virtual void CreateTNtupleFromBooking(NtupleDescriptionType *ntupleDescription) final
std::vector< tools::wroot::ntuple * > fNtupleVector
virtual void FinishTNtuple(NtupleDescriptionType *ntupleDescription) final
virtual void CreateTNtuple(NtupleDescriptionType *ntupleDescription, const G4String &name, const G4String &title) final
G4RootNtupleManager(const G4AnalysisManagerState &state)
tools::ntuple_booking fNtupleBooking