void processfitresiduals2004(){ gROOT->LoadMacro("GetPlotInFiducial.C"); gROOT->LoadMacro("mygaus.C"); gStyle->SetTitleX(0.0); gStyle->SetPadTopMargin(0.25); gStyle->SetLabelSize(0.12,"X"); gStyle->SetLabelSize(0.12,"Y"); gStyle->SetTitleSize(0.12,"X"); gStyle->SetTitleSize(0.12,"Y"); gStyle->SetStatFontSize(0.12); gStyle->SetTitleSize(0.12,"T"); gStyle->SetTitleFontSize(0.12); f=new TFile("fitresiduals2004.root"); f->cd(); TString * snam[8]; TH2D* hs[8]; TH2D* hf[8]; c1->Draw(); c1_1->cd(); TH2D* hs[0] = (TH2D*)full_residuals2->Clone("hs30"); snam[0] = new TString("B2+5G A"); TH2D* hf[0] = GetPlotInFiducial(hs[0],"hf30"); c1_2->cd(); TH2D* hs[1] = (TH2D*)full_residuals2->Clone("hs31"); snam[1] = new TString("B2+5G B"); TH2D* hf[1] = GetPlotInFiducial(hs[1],"hf31"); c1_3->cd(); TH2D* hs[2] = (TH2D*)full_residuals2->Clone("hs32"); snam[2] = new TString("PC5 stop"); TH2D* hf[2] = GetPlotInFiducial(hs[2],"hf32"); c1_4->cd(); TH2D* hs[3] = (TH2D*)full_residuals2->Clone("hs35"); snam[3] = new TString("stop 1/2"); TH2D* hf[3] = GetPlotInFiducial(hs[3],"hf35"); c1_5->cd(); TH2D* hs[4] = (TH2D*)full_residuals2->Clone("hs36"); snam[4] = new TString("stop 3/4 A"); TH2D* hf[4] = GetPlotInFiducial(hs[4],"hf36"); c1_6->cd(); TH2D* hs[5] = (TH2D*)full_residuals2->Clone("hs37"); snam[5] = new TString("hi rate"); TH2D* hf[5] = GetPlotInFiducial(hs[5],"hf37"); c1_7->cd(); TH2D* hs[6] = (TH2D*)full_residuals2->Clone("hs38"); snam[6] = new TString("aperture"); TH2D* hf[6] = GetPlotInFiducial(hs[6],"hf38"); c1_8->cd(); TH2D* hs[7] = (TH2D*)full_residuals2->Clone("hs39"); snam[7] = new TString("stop 3/4 B"); TH2D* hf[7] = GetPlotInFiducial(hs[7],"hf39"); c=new TCanvas(); c->Divide(2,4); TH1D * hall[8]; TF1 * fgausa[8]; TH1D * hfid[8]; TF1 * fgausf[8]; TLegend * tl[8]; char hname[256]; char htitle[256]; for (Int_t i=0 ; i<8 ; i++ ){ c->cd(i+1); c->GetPad(i+1)->SetLogy(); sprintf(hname,"hall%1d",i+1); sprintf(htitle,"%s residual (Data-Fit)/#sigma",snam[i]->Data()); hall[i] = new TH1D(hname,htitle,20,-5.,5.); sprintf(hname,"hfid%1d",i+1); sprintf(htitle,"%s residual (Data-Fit) bins in fiducial",snam[i]->Data()); hfid[i] = new TH1D(hname,htitle,20,-5.,5.); for (int ix=1; ix<=hs[i]->GetNbinsX(); ix++) { for (int iy=1; iy<=hs[i]->GetNbinsY(); iy++) { hall[i]->Fill( hs[i]->GetBinContent(ix,iy) ); if ( hf[i]->GetBinContent(ix,iy) != 0. ){ hfid[i]->Fill( hf[i]->GetBinContent(ix,iy) ); } } } hall[i]->SetLineColor(4); hall[i]->SetLineStyle(2); hfid[i]->SetLineColor(2); sprintf(hname,"fgausa%1d",i+1); fgausa[i] = new TF1(hname,mygaus,-5.,5.,3); fgausa[i]->SetParNames("N","mean","sigma"); fgausa[i]->SetParameters(hall[i]->GetMaximum(),0.,1.); fgausa[i]->SetLineColor(4); fgausa[i]->SetLineStyle(2); fgausa[i]->SetLineWidth(1); hall[i]->Fit(fgausa[i]); sprintf(hname,"fgausf%1d",i+1); fgausf[i] = new TF1(hname,mygaus,-5.,5.,3); fgausf[i]->SetParNames("N","mean","sigma"); fgausf[i]->SetParameters(hfid[i]->GetMaximum(),0.,1.); fgausf[i]->SetLineColor(2); fgausf[i]->SetLineWidth(1); hfid[i]->Fit(fgausf[i]); hall[i]->Draw("hist"); hfid[i]->Draw("histsame"); fgausa[i]->Draw("same"); fgausf[i]->Draw("same"); tl[i] = new TLegend(0.45,0.75,0.95,0.95); tl[i]->SetFillColor(10); tl[i]->SetLineColor(10); tl[i]->SetTextSize(0.10); sprintf(hname,"All bins mean=%4.2f #sigma=%4.2f",fgausa[i]->GetParameter(1),fgausa[i]->GetParameter(2)); tl[i]->AddEntry(fgausa[i],hname,"l"); sprintf(hname,"Bins in fiducial mean=%4.2f #sigma=%4.2f",fgausf[i]->GetParameter(1),fgausf[i]->GetParameter(2)); tl[i]->AddEntry(fgausf[i],hname,"l"); tl[i]->Draw(); } gStyle->SetPadTopMargin(0.25); gStyle->SetLabelSize(0.06,"X"); gStyle->SetLabelSize(0.06,"Y"); gStyle->SetTitleSize(0.06,"X"); gStyle->SetTitleSize(0.06,"Y"); gStyle->SetStatFontSize(0.08); gStyle->SetTitleSize(0.08,"T"); gStyle->SetTitleFontSize(0.08); tl[3]->SetTextSize(0.08); c=new TCanvas(); c->Divide(2,1); c->cd(1); hs[3]->Draw("colz"); c->cd(2); hall[3]->Draw("hist"); hfid[3]->Draw("histsame"); fgausa[3]->Draw("same"); fgausf[3]->Draw("same"); tl[3]->Draw(); }