33 #ifndef G4RootNtupleManager_h
34 #define G4RootNtupleManager_h 1
39 #include "tools/wroot/ntuple"
79 G4int nofMainManagers = 0);
84 using NtupleType = tools::wroot::ntuple;
90 void SetFileManager(std::shared_ptr<G4RootFileManager> fileManager);
94 virtual void CreateTNtuple(
97 virtual void CreateTNtupleFromBooking(
100 virtual void FinishTNtuple(
117 void SetCreateMode();
122 std::shared_ptr<G4RootFileManager> fFileManager;
123 tools::wroot::directory* fNtupleDirectory;
124 std::vector<G4RootMainNtupleManager*> fMainNtupleManagers;
130 G4RootNtupleManager::SetNtupleDirectory(tools::wroot::directory* directory)
131 { fNtupleDirectory = directory; }
134 G4RootNtupleManager::SetFileManager(std::shared_ptr<G4RootFileManager> fileManager)
135 { fFileManager = fileManager; }
137 inline const std::vector<G4TNtupleDescription<tools::wroot::ntuple>* >&
138 G4RootNtupleManager::GetNtupleDescriptionVector()
const
148 if ( ntupleDescription->
fNtuple ) {
149 if ( vector ==
nullptr ) {
150 ntupleDescription->
fNtuple->create_column_string(name);
154 description <<
"Column of vector<std::string> type is not supported";
155 G4Exception(
"G4RootNtupleManager::CreateTColumnInNtuple()",
172 auto ntuple = GetNtupleInFunction(ntupleId,
"FillNtupleTColumn");
173 if ( ! ntuple )
return false;
176 if ( index < 0 || index >=
G4int(ntuple->columns().size()) ) {
178 description <<
" " <<
"ntupleId " << ntupleId
179 <<
" columnId " << columnId <<
" does not exist.";
180 G4Exception(
"G4RootNtupleManager::FillNtupleTColumn()",
185 auto icolumn = ntuple->columns()[index];
186 auto column =
dynamic_cast<tools::wroot::ntuple::column_string*
>(icolumn);
189 description <<
" Column type does not match: "
190 <<
" ntupleId " << ntupleId
191 <<
" columnId " << columnId <<
" value " <<
value;
192 G4Exception(
"G4RootNtupleManager:FillNtupleColumn",
202 description <<
" ntupleId " << ntupleId
203 <<
" columnId " << columnId <<
" value " <<
value;
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
std::ostringstream G4ExceptionDescription
G4RootNtupleManager(const G4AnalysisManagerState &state, G4int nofMainManagers=0)
std::vector< G4TNtupleDescription< tools::wroot::ntuple > * > fNtupleDescriptionVector
void SetNtupleDirectory(tools::wroot::directory *directory)
virtual ~G4RootNtupleManager()
const XML_Char int const XML_Char * value
const G4AnalysisVerbose * GetVerboseL4() const
unsigned int GetBasketSize() const
virtual G4bool GetActivation(G4int ntupleId) const final
const std::vector< NtupleDescriptionType * > & GetNtupleDescriptionVector()
G4bool Reset(G4bool deleteNtuple)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4int fFirstNtupleColumnId
G4bool GetIsActivation() const
const G4AnalysisManagerState & fState