Re: reading zillions of files

Valery Fine (fine@bnl.gov)
Tue, 22 Sep 1998 16:35:57 -0500


On 22 Sep 98 at 13:22, Richard Dubois wrote:

> Is there a non-labour-intensive way to chain zillions of root files
> together to read them? I have collections of ~250 files each I want
> to read...
>
> What is gROOT->GetListOfFiles()->FindObject good for? It sounds
> right
> up my alley if I could use it with a wildcard...
>
> Otherwise I can make a (big) list of files to TChain together

May be the methods

void *TSystem::OpenDirectory(const char *name);
const char *TSystem::GetDirEntry(void *dirp);
void TSystem::FreeDirectory(void *dirp);

may help you ?

// Open directory
if (!(dirhandle = gSystem->OpenDirectory(sourcedir))) return;

. . .
// Scan directory
while (n = gSystem->GetDirEntry(dirhandle)) {
Char_t *name = StrDup(n);
// test "something" ( the prefix, for instance)
if (strstr(name,"St_") == name) {
. . .
"do something" (read and plot histograms for example)
. . . }
}

Valery
=================================================================
Dr. Valeri Faine (Fine)
------------------- Phone: +1 516 344 7806
Brookhaven National Laboratory FAX : +1 516 344 4206
Bldg. 510A /STAR mailto:fine@bnl.gov
Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
USA

Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su