// This macro is to be used on a root file produced with the // event.C selector. #include "StandardLabels.C" void NdarkhitsSum3(void) { TColor::CreateColorWheel(); char fname[256]; sprintf(fname,"darkhits.root"); TFile *f = new TFile(fname); TH1D *NdarkhitsSum3 = (TH1D*)gROOT->FindObject("NdarkhitsSum3"); TCanvas *c1 = new TCanvas(); c1->SetTicks(); c1->SetGrid(); NdarkhitsSum3->SetStats(0); NdarkhitsSum3->GetXaxis()->SetRangeUser(-0.5, 30.5); NdarkhitsSum3->SetFillColor(kSpring-4); NdarkhitsSum3->SetFillStyle(3000); NdarkhitsSum3->SetLineColor(kBlack); NdarkhitsSum3->SetLineWidth(2.0); NdarkhitsSum3->Draw(); double xmean = NdarkhitsSum3->GetMean(); double ymax = NdarkhitsSum3->GetMaximum(); char str[256]; sprintf(str, "mean: %3.1f PE", xmean); TPaveText *txt = new TPaveText(20.0, 0.5*ymax, 30.0, 0.75*ymax); txt->AddText(str); txt->Draw(); TLine *l = new TLine(xmean, 0.0, xmean, 1.05*ymax); l->SetLineStyle(2); l->SetLineWidth(4); l->Draw(); StandardLabels1D(NdarkhitsSum3, "From mcsmear"); c1->SaveAs("NdarkhitsSum3.png"); c1->SaveAs("NdarkhitsSum3.pdf"); }