{ /* I will make for plots for six variables. Each set of four plots go to a different canvas. The fourth plot (hd_py) is the Y-projection of the 3rd one. */ gROOT.Reset("a"); TFile *ff = TFile::Open("nugen_numu.000159.000006.root"); int nvar=6; //char variable[50]="hitsclean_perEvent.nstrings"; char variable[6][50]; strcpy(variable[0],"hitsclean_perEvent.nstrings"); strcpy(variable[1],"hitsclean_perEvent.nchan"); strcpy(variable[2],"hitsclean_perEvent.nchan_1hit"); strcpy(variable[3],"hitsclean_perEvent.nhit"); strcpy(variable[4],"hitsclean_perEvent.first_time"); strcpy(variable[5],"hitsclean_perEvent.tot_charge"); //TProfile *h1p = new TProfile("h1p","",50,2,8); //TProfile *h1p = new TProfile("h1p","",50,2,8); TCanvas *ca[10]; char line1[300]; char line2[300]; char cname[20]; char varname[50]; int i=0; for(int i=0; i<=nvar-1; i++) { sprintf(cname,"canvas_%i",i); ca[i]=new TCanvas(cname,"",10,10,600,500); ca[i].Divide(2,2); ca[i]->cd(1); sprintf(line1,"%s:log10(NuMu.energy_)>>hc",&variable[i]); sprintf(line2,"%s:log10(NuMuBar.energy_)>>+hc",&variable[i]); tree.Draw(line1,"","colz"); tree.Draw(line2,"","colz"); hc->DrawCopy("colz"); ca[i]->cd(2); sprintf(line1,"%s:log10(NuMu.energy_)>>hp",&variable[i]); sprintf(line2,"%s:log10(NuMuBar.energy_)>>+hp",&variable[i]); tree.Draw(line1,"","prof"); tree.Draw(line2,"","prof"); hp.DrawCopy(); hp.Fit("pol1","Q"); float par0=pol1.GetParameter(0); float par1=pol1.GetParameter(1); float delta=pol1.Eval(8)-pol1.Eval(2); ca[i]->cd(3); sprintf(line1,"(%s-(%f+%f*log10(NuMu.energy_)))/%f:log10(NuMu.energy_)>>hd",&variable[i],par0,par1,delta); sprintf(line2,"(%s-(%f+%f*log10(NuMu.energy_)))/%f:log10(NuMuBar.energy_)>>+hd",&variable[i],par0,par1,delta); tree.Draw(line1,"",""); tree.Draw(line2,"",""); hd->DrawCopy(); hd.ProjectionY(); ca[i]->cd(4); hd_py.Draw(); hd_py->DrawCopy(); cout << variable[i] <<": "<< hd_py.GetRMS() << endl; ca[i].Modified(); ca[i].Update(); hc=0; hp=0; hd=0; hd_py=0; } }