#include "TROOT.h" #include "TObjString.h" #include "TString.h" #include "TFile.h" #include "TTree.h" #include "TSystem.h" #include "htool.h" #include #include using namespace std; Int_t check(TString name,Int_t nevents,TString& msg) { TFile* in = new TFile(name.Data(),"READ"); if(!in){ msg = Form("%s : ERROR : Could not open file",name.Data()); cout<Close(); delete in; return 2; } TTree* T = (TTree*)in->Get("T"); if(!T){ msg = Form("%s : ERROR : Could not find Tree",name.Data()); cout<Close(); delete in; return 3; } TKey* hades = in->FindKey("Hades"); if(!hades){ msg = Form("%s : ERROR : Could not find Hades object",name.Data()); cout<Close(); delete in; return 4; } if(nevents!=-1){ Int_t n = T->GetEntries(); if(nClose(); delete in; return 5; } } in->Close(); return 0; } Int_t testFiles(TString file,Int_t nevents,TString outFile = "") { TString msg; if(file.Contains(",")) { // comma separated list cout<<"input comma separate list"<GetEntries(); i++){ TObjString* sn = (TObjString*) a->At(i); TString name = sn->GetString(); Int_t ret = check(name,nevents,msg); if(ret == 0) msg = Form("Check : file \" %s \" is OK!",name.Data()); if(outFile != "" && msg != "" )out<AccessPathName(file.Data()) !=0 ){ cout<<"Error : file \""<>name; if(input.good()) { total++; } } input.close(); TString outname = file; TString indir = gSystem->DirName(file.Data()); TString infile = gSystem->BaseName(file.Data()); input.open(file.Data()); ofstream out; if(outFile != ""){ out.open(outFile.Data()); } Int_t ct = 0; while(!input.eof()){ input>>name; ct++; HTool::printProgress(ct,total, 1,"") ; Int_t ret = check(name,nevents,msg); if(ret == 0) msg = Form("Check : file \" %s \" is OK!",name.Data()); if(outFile != "" && msg != "" ) out<GetEntries(); if(n == 0) { cout<<"Error : No file matching expression "<At(i))->GetString(); Int_t ret = check(name,nevents,msg); if(ret == 0) { msg = Form("Check : file \" %s \" is OK!",name.Data()); if(n == 1) cout< 0 (CORRUPT)"<