{ // we do not want canvases to be drawn on screen!!! gROOT->SetBatch(1); int histperline=2; int newpage=0; gSystem->mkdir("booklet"); FILE *texfile=fopen("booklet.tex","w"); fprintf(texfile,"%%Generated by MC-TESTER: BOOKLET.C\n"); fprintf(texfile,"%% to be included in tester.tex\n\n"); TFile *f=TFile::Open("mc-results.root"); f->cd(); TList *directories=f->GetListOfKeys(); TIter nextdir(directories); TKey *key_dir=0; char histname[128]; char dirname[128]; int histcnt=0; // loop over directories while (key_dir=(TKey*) nextdir() ) { TDirectory *subdir=(TDirectory*) f->Get(key_dir->GetName()); printf("We are in %s\n",subdir->GetName()); sprintf(dirname,"./booklet/%s",subdir->GetName()); //now replace all _ to @ for (int i=0;i" to "TO" for (int i=0;i' ) { dirname[i]='T'; dirname[i+1]='O'; } } gSystem->mkdir(dirname); if (strcmp(subdir->GetTitle(),"USER_HISTOGRAMS")==0) { if (subdir->GetList() && subdir->GetList()->GetSize() > 0) { fprintf(texfile,"\\section{User Histograms}\n"); } else { continue; } } else if(subdir->GetListOfKeys() && subdir->GetListOfKeys()->GetSize() > 1){ fprintf(texfile,"\\section{Decay Channel: $%s$}\n",subdir->GetTitle()); } TList *objects=subdir->GetListOfKeys(); // now we want to find TDecayMode object... TIter nextobj(objects); TKey *key_obj=0; TDecayResult *dr=0; int description_printed=0; // within subdirectory, loop over all objects: while (key_obj=(TKey*)nextobj()) { if (strcmp(key_obj->GetClassName(),"TDecayResult")==0 ){ dr=(TDecayResult*) key_obj->ReadObj(); dr->Draw(); dr->c->SetFillColor(10); histcnt++; sprintf(histname,"%s/%s.eps",dirname,dr->GetName()); ////now replace all _ to @ for (int i=0;ic->SaveAs(histname); if (!description_printed) { description_printed=1; fprintf(texfile,"Number of events from \\textcolor{red}{generator 1}: %li\n ",(long)dr->h1->GetEntries()); fprintf(texfile,"\\newline\n"); fprintf(texfile,"Number of events from \\textcolor{green}{generator 2}: %li\n ",(long)dr->h2->GetEntries()); fprintf(texfile,"\\newline\n"); fprintf(texfile,"\\newline\n"); } fprintf(texfile,"{ \\resizebox*{%4.2f\\textwidth}{!}{\\includegraphics{%s}} }\n",(1.0/histperline)-0.01,histname); } } if (newpage) fprintf(texfile,"\\newpage\n"); }; // end of loop over directories fclose(texfile); }