Hi Alex,
I don't know that is the "g" object in your statement g.Open !
To test if a file exist, you can use
gSystem->AccessPathname(fileName);
This will return kTRUE if the file can be accessed, kFALSE otherwise.
Rene Brun
"Olivas, Alexander Raymond" wrote:
>
> I'm not sure if this is the correct place to post this question,
> but here it goes.
>
> I have many jobs currently creating quite a few root files.
> I have the files numbered so I can read them using a simple
> for loop. However, some jobs haven't started yet and some
> are still running. I would like to read only the files that
> exist and are closed.
>
> I've tried something like...
>
> Int_t i_last=272;
> for(Int_t i=1;i<=i_last;i++){
> char fileName[60];
> sprintf(fileName,"$NTUPLE_DIR/B/BJpsiSkimFeb14%s_%d.root",name,i);
> if(g.Open(fileName)){
> TFile f(fileName);
> ksMassNoCuts->Add((TH1F*)f.Get("h1d3"));
> }
> }
>
> g.Open(fileName) still returns true if the file does not exist.
> I've searched through the root page and have had trouble finding
> anything that will allow me to assess the state of a file without
> explicity trying to open it.
>
> Any help would be greatly appreciated.
> Thanks,
> Alex.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET