void make_prob_hists(void) { TFile *f = new TFile("janaroot.root"); TTree *t = (TTree*)gROOT->FindObject("DL3Trigger"); TFile *of = new TFile("l3_probs.root", "RECREATE"); TCut cut("Ephoton_truth>7.0 && Ephoton_truth<10.0"); MakeHist(t, "Ntagger", 0.0, 400.0, cut); MakeHist(t, "Ntof", 0.0, 200.0, cut); MakeHist(t, "Ncdc_layers", 0.0, 30.0, cut, 31); MakeHist(t, "Nfdc_planes", 0.0, 25.0, cut, 26); MakeHist(t, "Nfdc", 0.0, 2000.0, cut, 2001, true); MakeHist(t, "Nfdc_pseudo", 0.0, 200.0, cut, 201, true); MakeHist(t, "Ncdc", 0.0, 200.0, cut, 201); MakeHist(t, "Ntrack_candidates", 0.0, 20.0, cut, 21, true); MakeHist(t, "Ntrack_wb", 0.0, 20.0, cut, 21, true); MakeHist(t, "Ptot_tracks_wb", 0.0, 20.0, cut, 200, true); MakeHist(t, "Nbcal_clusters", 0.0, 30.0, cut, 31, true); MakeHist(t, "Nfcal_clusters", 0.0, 30.0, cut, 31, true); MakeHist(t, "Ebcal", 0.0, 12.0, cut, 240, true); MakeHist(t, "Efcal", 0.0, 12.0, cut, 240, true); of->Write(); of->Close(); delete of; } void MakeHist(TTree *t, const char *what, double hlo, double hhi, TCut &cut, int Nbins=200, bool logy=false) { TH1D *h = new TH1D(what, what, Nbins, hlo, hhi); t->Project(what, what); char hname[256]; sprintf(hname, "%s_cut", what); TH1D *h_cut = (TH1D*)h->Clone(hname); t->Project(hname, what, cut); TCanvas *c1 = new TCanvas("c1"); c1->SetTicks(); c1->SetGridy(); if(logy){ c1->SetLogy(); h->GetYaxis()->SetRangeUser(1.0, 2.0*h->GetMaximum()); } h->SetLineColor(kRed); h_cut->SetLineColor(kBlue); h->SetLineWidth(2); h_cut->SetLineWidth(2); h->Draw(); h_cut->Draw("same"); char fname[256]; sprintf(fname, "%s.png", what); c1->SaveAs(fname); sprintf(fname, "%s.pdf", what); c1->SaveAs(fname); delete c1; }