24#include "TObjString.h"
26#include "TDataMember.h"
43 ThrowError(66,0,
"!!! ERROR: Cannot open source %s !!!", GetName());
53 ThrowError(66,0,
"!!! ERROR: Cannot open source %s!!!", GetName());
75 if (!mask || (strlen(mask) == 0))
return nullptr;
77 TString dirname, basename(mask);
79 if (!basename.MaybeWildcard()) {
85 TList *lst =
new TList();
87 lst->Add(
new TObjString(basename));
91 Bool_t withdir = kFALSE;
92 Int_t slash = basename.Last(
'/');
95 if (slash < 0) slash = basename.Last(
'\\');
99 dirname = basename(0, slash);
100 basename.Remove(0, slash+1);
103 dirname = gSystem->WorkingDirectory();
106 void *dir = gSystem->OpenDirectory(gSystem->ExpandPathName(dirname.Data()));
108 if (!dir)
return nullptr;
110 TList *lst =
nullptr;
112 TRegexp re(basename, kTRUE);
113 while (
const char *file = gSystem->GetDirEntry(dir)) {
114 if (!strcmp(file,
".") || !strcmp(file,
".."))
continue;
116 if ((basename != s) && (s.Index(re) == kNPOS))
continue;
119 lst->SetOwner(kTRUE);
122 lst->Add(
new TObjString(dirname +
"/" + file));
124 lst->Add(
new TObjString(file));
126 gSystem->FreeDirectory(dir);
128 if (lst) lst->Sort();
156 }
catch (H5::Exception &ex) {
157 TString msg = TString::Format(
"Close File %s with HDF5 exception in %s : %s\n",
fxCurrentFileName.Data(),
158 ex.getCFuncName(), ex.getCDetailMsg());
167 TString buffer(fname);
173 fxFile =
new H5::H5File(buffer.Data(), H5F_ACC_RDONLY);
174 TGo4Log::Info(
"TGo4HDF5Source %s: Open file %s for reading", GetName(), buffer.Data());
175 }
catch (H5::Exception &ex) {
176 TString msg = TString::Format(
"OpenFile with HDF5 exception in %s : %s\n", ex.getCFuncName(), ex.getCDetailMsg());
198 catch (H5::Exception &ex) {
200 TString::Format(
"BuildDataSet with HDF5 exception in %s : %s\n", ex.getCFuncName(), ex.getCDetailMsg());
217 ThrowError(0, 22,
"!!! ERROR BuildEvent: no destination event!!!");
225 printf(
"TGo4HDF5Source: fxEvent=0x%lx\n", (
unsigned long)
fxEvent);
226 printf(
"TGo4HDF5Source: Eventname:%s\n",
fxEvent->GetName());
227 printf(
"TGo4HDF5Source: is valid:%d\n",
fxEvent->IsValid());
228 printf(
"Go4 event has eventsource pointer 0x%lx \n",(
long)
fxEvent->GetEventSource());
229 printf(
"TGo4HDF5Source: Event printout:\n");
238 printf(
"Go4 event has eventsource pointer 0x%lx \n",(
long)
fxEvent->GetEventSource());
239 printf(
"Go4 event has identifier 0x%lx \n",(
long)
fxEvent->getId());
243 }
catch (H5::Exception &ex) {
245 TString::Format(
"BuildEvent() with HDF5 exception in %s : %s\n", ex.getCFuncName(), ex.getCDetailMsg());
The abstract base class for the data elements of which the unpacked events (or detector structure dat...
void SetErrMess(const char *txt)
To be used for modification of the message by the event source implementation.
void ThrowError(Int_t creastat, Int_t errstat, const char *message,...)
Exception thrower.
void BuildDataType(TGo4EventElement *event, TGo4HDF5DataHandle *parent=nullptr, Int_t index=0)
Prepare data type from event structure for hdf5.
Bool_t fbDataSetExists
True if branch already exists.
TGo4HDF5DataHandle * fxHandle
handle object to recursively treat the io of nested event components
hsize_t fiFillCount
counter of filled events.
virtual void DeleteDataSet()
delete dataset resource
virtual void CloseFile()
opens the hdf5 file depending on the setup
TGo4EventElement * fxEvent
Points to event structure to be filled into dataset.
static const char * fgcFILESUF
Standard suffix for file name.
H5::H5File * fxFile
the currently open hdf5 file
Char_t * fxReadBuffer
read buffer for hdf5
void BuildDataSet(TGo4EventElement *event) override
initialize dataset from event structure
static TList * ProducesFilesList(const char *mask)
void OpenFile(const char *fname) override
opens the hdf5 file of given name for reading
Bool_t CloseCurrentFile()
Close currently open file.
void DeleteDataSet() override
delete dataset resource
size_t fiReadOffset
begin of real eventdata payload after event object pointer
virtual ~TGo4HDF5Source()
TString fxCurrentFileName
current name of the file
Bool_t OpenNextFile()
Open next file from the files list.
TList * fxFilesNames
list of files names
Bool_t BuildEvent(TGo4EventElement *dest) override
Fill the destination event dest from the tree.
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.