34#include "tools/wroot/file"
35#include "tools/wroot/ntuple"
45 fNtupleBuilder(ntupleBuilder),
46 fBookingManager(bookingManager),
47 fFileManager(nullptr),
49 fFileNumber(fileNumber),
51 fNtupleDescriptionVector()
71 auto ntupleFile = fFileManager->CreateNtupleFile(ntupleDescription, fFileNumber);
76 <<
"Ntuple file must be defined first." <<
G4endl
77 <<
"Cannot create main ntuple.";
78 G4Exception(
"G4RootMainAnalysisManager::CreateNtuple",
90 ->
Message(
"create",
"main ntuple", ntupleBooking.name());
94 auto ntuple =
new tools::wroot::ntuple(*std::get<2>(*ntupleFile), ntupleBooking, fRowWise);
96 auto basketSize = fNtupleBuilder->GetBasketSize();
97 ntuple->set_basket_size(basketSize);
99 fNtupleVector.push_back(ntuple);
100 fNtupleDescriptionVector.push_back(ntupleDescription);
105 ->
Message(
"create",
"main ntuple", ntupleBooking.name());
112 std::size_t counter = 0;
114 for (
auto ntuple : fNtupleVector ) {
115 ntuple->merge_number_of_entries();
118 if ( ntuple->entries() ) {
119 auto ntupleDescription = fNtupleDescriptionVector.at(counter);
120 ntupleDescription->fHasFill =
true;
131 for (
auto ntuple : fNtupleVector ) {
132 if ( deleteNtuple ) {
137 fNtupleVector.clear();
138 fNtupleDescriptionVector.clear();
144std::shared_ptr<G4RootFile>
147 auto perThread =
false;
148 return fFileManager->GetNtupleFile(ntupleDescription, perThread, fFileNumber);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4AnalysisVerbose * GetVerboseL3() const
const G4AnalysisVerbose * GetVerboseL4() const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
const G4AnalysisManagerState & fState
G4bool Reset(G4bool deleteNtuple)
G4RootMainNtupleManager(G4RootNtupleManager *ntupleBuilder, G4NtupleBookingManager *bookingManager, G4bool rowWise, G4int fileNumber, const G4AnalysisManagerState &state)
std::shared_ptr< G4RootFile > GetNtupleFile(RootNtupleDescription *ntupleDescription) const
void CreateNtuple(RootNtupleDescription *ntupleDescription, G4bool warn=true)
~G4RootMainNtupleManager()
tools::ntuple_booking fNtupleBooking