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
G4Hdf5NtupleManager.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4Hdf5NtupleManager.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, 20/07/2017 (ivana@ipno.in2p3.fr)
28
29
#include "
G4Hdf5NtupleManager.hh
"
30
#include "
G4Hdf5FileManager.hh
"
31
#include "
G4AnalysisManagerState.hh
"
32
#include "
G4AnalysisUtilities.hh
"
33
#include "
G4UnitsTable.hh
"
34
35
#include "tools/ntuple_booking"
36
37
#include <iostream>
38
//#include <cstdio>
39
40
using namespace
G4Analysis;
41
42
//_____________________________________________________________________________
43
G4Hdf5NtupleManager::G4Hdf5NtupleManager
(
const
G4AnalysisManagerState
& state)
44
:
G4TNtupleManager
<tools::hdf5::
ntuple
>(state),
45
fFileManager(nullptr)
46
{}
47
48
//_____________________________________________________________________________
49
G4Hdf5NtupleManager::~G4Hdf5NtupleManager
()
50
{}
51
52
//
53
// private methods
54
//
55
//_____________________________________________________________________________
56
void
G4Hdf5NtupleManager::CreateTNtuple
(
57
NtupleDescriptionType
* ntupleDescription,
G4bool
warn)
58
{
59
// Ntuple will be created from ntupleDescription if file is open,
60
// return with or without warning otherwise
61
62
// create a file for this ntuple
63
// if ( ! fFileManager->CreateNtupleFile(ntupleDescription) ) return;
64
65
// Check ntuple directory
66
if
(
fFileManager
->GetNtupleDirectory() < 0 ) {
67
if
( warn ) {
68
G4String
inFunction =
"G4Hdf5NtupleManager::::CreateTNtupleFromBooking"
;
69
G4ExceptionDescription
description;
70
description <<
" "
71
<<
"Cannot create ntuple. Ntuple directory does not exist."
<<
G4endl
;
72
G4Exception
(inFunction,
"Analysis_W002"
,
JustWarning
, description);
73
}
74
return
;
75
}
76
77
auto
basketSize =
fFileManager
->GetBasketSize();
78
// auto compressionLevel = fState.GetCompressionLevel();
79
auto
compressionLevel = 0;
80
81
// create ntuple
82
ntupleDescription->
fNtuple
83
=
new
tools::hdf5::ntuple
(
84
G4cout
,
fFileManager
->GetNtupleDirectory(), ntupleDescription->
fNtupleBooking
,
85
compressionLevel, basketSize);
86
87
fNtupleVector
.push_back(ntupleDescription->
fNtuple
);
88
}
89
90
//_____________________________________________________________________________
91
void
G4Hdf5NtupleManager::CreateTNtuple
(
92
G4TNtupleDescription<tools::hdf5::ntuple>
*
/*ntupleDescription*/
,
93
const
G4String
&
/*name*/
,
const
G4String
&
/*title*/
)
94
{
95
// Ntuple will be created at finish ntuple from ntuple_booking
96
}
97
98
//_____________________________________________________________________________
99
void
G4Hdf5NtupleManager::CreateTNtupleFromBooking
(
100
G4TNtupleDescription<tools::hdf5::ntuple>
* ntupleDescription)
101
{
102
// Create ntuple from booking and print a warning if file is not open
103
CreateTNtuple
(ntupleDescription,
true
);
104
}
105
106
//_____________________________________________________________________________
107
void
G4Hdf5NtupleManager::FinishTNtuple
(
108
G4TNtupleDescription<tools::hdf5::ntuple>
* ntupleDescription,
109
G4bool
/*fromBooking*/
)
110
{
111
if
( ! ntupleDescription->
fNtuple
) {
112
// Create ntuple from booking if file is open, do nothing otherwise
113
CreateTNtuple
(ntupleDescription,
false
);
114
}
115
116
fFileManager
->LockNtupleDirectoryName();
117
}
118
geant4
tree
geant4-10.6-release
source
analysis
hdf5
src
G4Hdf5NtupleManager.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:11
using
1.8.2 with
ECCE GitHub integration