// MACRO FOR DRAWING BANDS IN ROOT. // BY SIGVE HAUG SEPTEMBER 2001. // DrawBin draws the bin ibin of the histogram h in color Col. // BSAME means bar chart and upon the same picture. void DrawBin(TH1 *h,int ibin,int Col) { h->SetFillColor(Col); float binstart=h->GetXaxis()->GetBinLowEdge(ibin); float binend =binstart+h->GetXaxis()->GetBinWidth(ibin); h->SetAxisRange(binstart,binend); h->DrawCopy("BSAME"); } int main() { // Create and draw canvas with two pads gROOT->ProcessLine(".x ~/root/hnn/styles/style2.cc"); // Open histogram file and get histograms TFile hfile("~/ana/limits/hnn/Results/likemc.root1"); // NO STATISTICS NO HISTOGRAM TITELS gStyle->SetOptStat(0000000); h50140->SetTitle(); h50150->SetTitle(); // DEFINE MIN AND MAX HIGGS MASS ON X AXIS float xmax = 120.; float xmin = 60.; // DEFINE COLORS int backgrcol = 18; // off white int sigma2col = 46; // red int sigma1col = 30; // green // DRAW -2ln(Q) IN PAD 1 c1_1->cd(); // c1_1->SetLogy(); // Draw axis titels h50140->GetXaxis()->SetTitleOffset(1.5); h50140->GetXaxis()->SetTitle("m_{H} / GeV c^{-2}"); h50140->GetYaxis()->SetTitle("-2ln(Q_{b})"); // Set range for y and x axis h50140->SetMaximum(10.); h50140->SetMinimum(-5.); h50140->SetAxisRange(xmin,xmax); h50140->SetLineColor(backgrcol); // Draw the -2 -1 +1 +2 sigma bands h50140->DrawCopy(); for (int ibin=6;ibin<=h50140->GetNbinsX();ibin++) { if (h50140->GetBinContent(ibin)<0.){ DrawBin(h50144,ibin,sigma2col); DrawBin(h50143,ibin,sigma1col); DrawBin(h50141,ibin,sigma2col); DrawBin(h50140,ibin,backgrcol); } else{ DrawBin(h50140,ibin,sigma2col); if (h50141->GetBinContent(ibin)<0.){ DrawBin(h50144,ibin,sigma2col); DrawBin(h50143,ibin,sigma1col); DrawBin(h50141,ibin,sigma2col); } else{ DrawBin(h50141,ibin,sigma1col); if (h50143->GetBinContent(ibin)<0.){ cout << "ROOT IS BUGGY ? THEN THIS IS NEEDED "<GetBinContent(ibin)<0.){ DrawBin(h50144,ibin,sigma2col); } else{ DrawBin(h50144,ibin,backgrcol); } } } } } // Draw media of bkgd as dashed line h50142->SetAxisRange(xmin,xmax); h50142->SetLineColor (1); h50142->SetLineStyle(2); h50142->DrawCopy("SAME"); // Draw observed as solid line h50021->SetAxisRange(xmin,xmax); h50021->SetLineWidth(2); h50021->SetLineColor(1); h50021->DrawCopy("SAME"); // DRAW -2ln(Q_sig_pluss_bkg) IN PAD 2 c1_2->cd(); // c1_2->SetLogy(); // Draw axis titels h50150->GetXaxis()->SetTitleOffset(1.5); h50150->GetXaxis()->SetTitle("m_{H} / GeV c^{-2}"); h50150->GetYaxis()->SetTitle("-2ln(Q_{s+b})"); // Set range for y axis h50150->SetMaximum(6.); h50150->SetMinimum(-23.); h50150->SetLineColor(backgrcol); h50150->SetAxisRange(xmin,xmax); // Draw the -2 -1 +1 +2 sigma bands h50150->DrawCopy(); for (int ibin=6;ibin<=h50150->GetNbinsX();ibin++) { if (h50150->GetBinContent(ibin)<0.){ DrawBin(h50154,ibin,sigma2col); DrawBin(h50153,ibin,sigma1col); DrawBin(h50151,ibin,sigma2col); DrawBin(h50150,ibin,backgrcol); } else{ DrawBin(h50150,ibin,sigma2col); if (h50151->GetBinContent(ibin)<0.){ cout << "ROOT IS BUGGY ? THEN THIS IS NEEDED "<GetBinContent(ibin)<0.){ cout << "ROOT IS BUGGY ? THEN THIS IS NEEDED "<GetBinContent(ibin)<0.){ DrawBin(h50154,ibin,sigma2col); } else{ DrawBin(h50154,ibin,backgrcol); } } } } } // Draw media of bkgd pluss signal as dotted line h50152->SetAxisRange(xmin,xmax); h50152->SetLineColor (1); h50152->SetLineStyle(3); h50152->DrawCopy("SAME"); // Draw observed as solid line h50020->SetAxisRange(xmin,xmax); h50020->DrawCopy("SAME"); // Draw expected bkgd as dashed line h50142->SetAxisRange(xmin,xmax); h50142->SetLineStyle(2); h50142->DrawCopy("LSAME"); // CLOSE FILE AND EXIT hfile.Close(); c1->Update(); }