33 #ifndef G4RootNtupleManager_h
34 #define G4RootNtupleManager_h 1
39 #include "tools/wroot/ntuple"
69 G4int ntupleId,
G4int columnId,
const std::string& value);
79 G4int nofMainManagers = 0);
90 void SetFileManager(std::shared_ptr<G4RootFileManager> fileManager);
137 inline const std::vector<G4TNtupleDescription<tools::wroot::ntuple>* >&
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()",
165 G4int ntupleId,
G4int columnId,
const std::string& value)
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
G4bool FillNtupleTColumn(G4int ntupleId, G4int columnId, const T &value)
std::shared_ptr< G4RootFileManager > fFileManager
std::vector< G4RootMainNtupleManager * > fMainNtupleManagers
std::ostringstream G4ExceptionDescription
G4RootNtupleManager(const G4AnalysisManagerState &state, G4int nofMainManagers=0)
void SetFileManager(std::shared_ptr< G4RootFileManager > fileManager)
tools::wroot::directory * fNtupleDirectory
std::vector< G4TNtupleDescription< tools::wroot::ntuple > * > fNtupleDescriptionVector
const char * name(G4int ptype)
tools::wroot::ntuple NtupleType
virtual void CreateTNtupleFromBooking(NtupleDescriptionType *ntupleDescription) final
virtual ~G4RootNtupleManager()
G4RootMainNtupleManager * GetMainNtupleManager(G4int index) const
const G4AnalysisVerbose * GetVerboseL4() const
virtual G4bool GetActivation(G4int ntupleId) const final
G4NtupleCreateMode fCreateMode
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4bool Reset(G4bool deleteNtuple)
virtual void FinishTNtuple(NtupleDescriptionType *ntupleDescription) final
void CreateTColumnInNtuple(G4TNtupleDescription< TNTUPLE > *ntupleDescription, const G4String &name, std::vector< T > *vector)
virtual void CreateTNtuple(NtupleDescriptionType *ntupleDescription, const G4String &name, const G4String &title) final
G4int fFirstNtupleColumnId
TNTUPLE * GetNtupleInFunction(G4int id, G4String function, G4bool warn=true) const
unsigned int GetBasketSize() const
G4bool GetIsActivation() const
const G4AnalysisManagerState & fState
void SetNtupleDirectory(tools::wroot::directory *directory)
const std::vector< NtupleDescriptionType * > & GetNtupleDescriptionVector() const