21#include "TObjString.h"
44 ThrowError(66,0,
"!!! ERROR: Cannot open source %s!!!", GetName());
61 ThrowError(66,0,
"!!! ERROR: Cannot open source %s!!!", GetName());
91 if (!mask || (strlen(mask) == 0))
return nullptr;
93 TString dirname, basename(mask);
95 if (!basename.MaybeWildcard()) {
101 TList *lst =
new TList();
102 lst->SetOwner(kTRUE);
103 lst->Add(
new TObjString(basename));
107 Bool_t withdir = kFALSE;
108 Int_t slash = basename.Last(
'/');
111 if (slash < 0) slash = basename.Last(
'\\');
115 dirname = basename(0, slash);
116 basename.Remove(0, slash+1);
119 dirname = gSystem->WorkingDirectory();
122 void *dir = gSystem->OpenDirectory(gSystem->ExpandPathName(dirname.Data()));
124 if (!dir)
return nullptr;
126 TList *lst =
nullptr;
128 TRegexp re(basename, kTRUE);
129 const char *file =
nullptr;
130 while ((file = gSystem->GetDirEntry(dir)) !=
nullptr) {
131 if (!strcmp(file,
".") || !strcmp(file,
".."))
continue;
133 if ((basename != s) && (s.Index(re) == kNPOS))
continue;
136 lst->SetOwner(kTRUE);
139 lst->Add(
new TObjString(dirname +
"/" + file));
141 lst->Add(
new TObjString(file));
143 gSystem->FreeDirectory(dir);
145 if (lst) lst->Sort();
165 TIter iter(
fxFile->GetListOfKeys());
166 while (
auto kee =
dynamic_cast<TKey *
>(iter())) {
167 fxTree =
dynamic_cast<TTree *
>(kee->ReadObj());
171 ThrowError(77,0,
"!!! ERROR: Tree not found !!!");
201 if(!dest)
ThrowError(0,22,
"!!! ERROR BuildEvent: no destination event!!!");
The abstract base class for the data elements of which the unpacked events (or detector structure dat...
virtual void synchronizeWithTree(TTree *tree, TGo4EventElement **var_ptr=nullptr)
Use this method to map event structure with the Tree branch(es)
void ThrowError(Int_t creastat, Int_t errstat, const char *message,...)
Exception thrower.
void ThrowEOF(Int_t creastat, Int_t errstat, const char *message,...)
EOF thrower.
void SetCreateStatus(Int_t status)
Status value of event source init (file/server open).
Long64_t fiMaxEvents
Number of events stored in the Tree.
long int fiGlobalEvent
Global event number, starting from the first tree.
TList * fxFilesNames
list of files names
TGo4EventElement * fxTopEvent
pointer to top branch event
virtual ~TGo4FileSource()
Bool_t CloseCurrentFile()
Close currently open file.
Bool_t BuildEvent(TGo4EventElement *dest) override
Fill the destination event dest from the tree.
TString fxCurrentFileName
current name of the file
Bool_t fbActivated
This flag is used for lazy init of tree in Eventbuilding methods.
Bool_t OpenNextFile()
Open next file from the files list.
Long64_t fiCurrentEvent
Event number in current tree.
static TList * ProducesFilesList(const char *mask)
static const char * fgcFILESUF
Standard suffix for file name.
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.