ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4XmlNtupleManager.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4XmlNtupleManager.cc
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
27
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
28
29
#include "
G4XmlNtupleManager.hh
"
30
#include "
G4XmlFileManager.hh
"
31
#include "
G4AnalysisManagerState.hh
"
32
#include "
G4AnalysisUtilities.hh
"
33
#include "
G4Threading.hh
"
34
#include "
G4UnitsTable.hh
"
35
36
#include "tools/ntuple_booking"
37
38
#include <iostream>
39
//#include <cstdio>
40
41
using namespace
G4Analysis;
42
43
//_____________________________________________________________________________
44
G4XmlNtupleManager::G4XmlNtupleManager
(
const
G4AnalysisManagerState
& state)
45
:
G4TNtupleManager
<tools::waxml::
ntuple
>(state),
46
fFileManager(nullptr)
47
{}
48
49
//_____________________________________________________________________________
50
G4XmlNtupleManager::~G4XmlNtupleManager
()
51
{}
52
53
//
54
// private methods
55
//
56
57
//_____________________________________________________________________________
58
void
G4XmlNtupleManager::CreateTNtuple
(
59
G4TNtupleDescription<tools::waxml::ntuple>
* ntupleDescription,
60
const
G4String
&
/*name*/
,
const
G4String
&
/*title*/
)
61
{
62
// Create ntuple if the file is open (what means here that
63
// a filename was already set)
64
if
(
fFileManager
->GetFileName().size() ) {
65
if
(
fFileManager
->CreateNtupleFile(ntupleDescription) ) {
66
ntupleDescription->
fNtuple
67
=
new
tools::waxml::ntuple
(*(ntupleDescription->
fFile
));
68
// ntuple object is deleted when closing a file
69
fNtupleVector
.push_back(ntupleDescription->
fNtuple
);
70
}
71
}
72
}
73
74
//_____________________________________________________________________________
75
void
G4XmlNtupleManager::CreateTNtupleFromBooking
(
76
G4TNtupleDescription<tools::waxml::ntuple>
* ntupleDescription)
77
{
78
// create a file for this ntuple
79
if
( !
fFileManager
->CreateNtupleFile(ntupleDescription) )
return
;
80
81
// create ntuple
82
ntupleDescription->
fNtuple
83
=
new
tools::waxml::ntuple
(
84
*(ntupleDescription->
fFile
),
G4cerr
, ntupleDescription->
fNtupleBooking
);
85
fNtupleVector
.push_back(ntupleDescription->
fNtuple
);
86
}
87
88
//_____________________________________________________________________________
89
void
G4XmlNtupleManager::FinishTNtuple
(
90
G4TNtupleDescription<tools::waxml::ntuple>
* ntupleDescription,
91
G4bool
/*fromBooking*/
)
92
93
{
94
// Do nothing if the base file name was not yet defined
95
if
( !
fFileManager
->GetFileName().size() )
return
;
96
97
// Create ntuple from booking
98
if
( ! ntupleDescription->
fNtuple
) {
99
CreateTNtupleFromBooking
(ntupleDescription);
100
}
101
102
// Write header
103
G4String
path =
"/"
;
104
path.
append
(
fFileManager
->GetNtupleDirectoryName());
105
ntupleDescription->
fNtuple
106
->write_header(path, ntupleDescription->
fNtupleBooking
.name(),
107
ntupleDescription->
fNtupleBooking
.title());
108
fFileManager
->LockNtupleDirectoryName();
109
}
geant4
tree
geant4-10.6-release
source
analysis
xml
src
G4XmlNtupleManager.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:12
using
1.8.2 with
ECCE GitHub integration