#include #include void runone(int R, char fnam[], int MC){ char run[128]; sprintf(run,"0%d %d",R,MC); TFile *INF = new TFile(fnam); TTree *T = (TTree*)INF->Get("tof_eff"); T->Process("analtof1.C+",run); } bool File_exists_test(char name[]) { struct stat buffer; return (stat (name , &buffer) == 0); } void doit(int R, int MC){ char loc[128] = "./localdir/"; char fnam[256]; int k = R; sprintf(fnam,"%s/tree_tof_eff_%06d.root",loc,k); if (MC){ sprintf(fnam,"%s/tree_tof_eff_bggen_run%06d.root",loc,k); } if (File_exists_test(fnam)){ runone(k, fnam, MC); } }