hypeMerge(char *filename="") { /* Author: G. Bonomi Date: 9 June 2005 This macro open a data file containing a list of runs (one run x line) and merge the h126 ntuples in a new ROOT file called: hype_fromXXX_toYYY.root in the $HIS directory (where XXX and YYY are the first and last run) Input: filename (file containing a list of runs (one run x line)) Output: $HIS/hype_fromXXX_toYYY.root */ FILE *rdat; int nrun=0,runs[2000],check,sl; char name[100],comando[100]; if (!strcmp(filename,"")) { printf("Please pass a filename as an argument:\n [0].x merge.C(\"exam.dat\")\n"); return; } /* It opens the file with the list of runs to be analyzed */ rdat=fopen(filename,"r"); if(rdat==NULL) { printf("File doesn't exist\n"); return; } while(check=fscanf(rdat,"%d",&runs[nrun])>-1){ nrun++; } fclose(rdat); /* ---> <--- */ TChain *bChain=new TChain("bChain"); char bntp[100]; //Default max size 1900000000 TTree::SetMaxTreeSize(2146000000); //TTree::SetMaxTreeSize(3000000000); for(int i=0; iAdd(bntp); } /* for(int i=0; iAdd(bntp); } */ sprintf(bntp,"../histos/hype_from%d_to%d.root",runs[0],runs[nrun-1]); printf("Creating %s file\n",bntp); bChain->Merge(bntp); }