// This macro is to be used on a root file produced with the // event.C selector. #include "StandardLabels.C" void Ndarkhits(void) { char fname[256]; sprintf(fname,"darkhits.root"); TFile *f = new TFile(fname); TH1D *Ndarkhits = (TH1D*)gROOT->FindObject("Ndarkhits"); TCanvas *c1 = new TCanvas(); c1->SetTicks(); c1->SetGrid(); Ndarkhits->SetStats(0); Ndarkhits->GetXaxis()->SetRangeUser(-0.5, 30.5); Ndarkhits->SetFillColor(kGreen); Ndarkhits->SetFillStyle(3000); Ndarkhits->SetLineColor(kBlack); Ndarkhits->SetLineWidth(2.0); Ndarkhits->Draw(); double xmean = Ndarkhits->GetMean(); double ymax = Ndarkhits->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(Ndarkhits, "From mcsmear"); c1->SaveAs("Ndarkhits.png"); c1->SaveAs("Ndarkhits.pdf"); }