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