#include "StandardLabels.C" #include "filelist.h" void eff_vs_theta_compare(void) { gROOT->Reset(); TH1D *h1 = GetResHisto("with_muls_no_eloss", "h1", kRed); TH1D *h2 = GetResHisto("with_muls_no_eloss_spoiled", "h2", kBlack); TH1D *h3 = GetResHisto("no_muls_no_eloss", "h3", kMagenta); TH1D *h4 = GetResHisto("no_muls_no_eloss_spoiled", "h4", kBlue); TCanvas *c1 = new TCanvas("c1"); c1->SetFillColor(kWhite); c1->SetTicks(); c1->SetGrid(); TH2D *axes = new TH2D("axes","Momentum Resolution vs. #theta", 100, 0.0, 40.0, 100, 0.9, 1.05); axes->SetStats(0); axes->SetYTitle("Tracking Efficiency"); axes->SetXTitle("#theta (degrees)"); axes->Draw(); h1->Draw("same"); h2->Draw("same"); h3->Draw("same"); h4->Draw("same"); TLegend *leg = new TLegend(0.50, 0.15, 0.85, 0.55); leg->SetFillColor(kWhite); leg->AddEntry(h1, "Nominal field with MULS"); leg->AddEntry(h2, "Spoiled field with MULS"); leg->AddEntry(h3, "Nominal field w/o MULS"); leg->AddEntry(h4, "Spoiled field w/o MULS"); leg->Draw(); AddStandardLabels(axes); c1->SaveAs("eff_vs_theta_compare.gif"); c1->SaveAs("eff_vs_theta_compare.pdf"); } TH1D* GetResHisto(string nam, const char *hname, int color) { TChain *trkeff = new TChain("TRACKING/trkeff", "track"); if(nam=="with_muls_no_eloss") AddFilesToChain_with_muls_no_eloss(trkeff); else if(nam=="with_muls_no_eloss_spoiled") AddFilesToChain_with_muls_no_eloss_spoiled(trkeff); else if(nam=="no_muls_no_eloss") AddFilesToChain_no_muls_no_eloss(trkeff); else if(nam=="no_muls_no_eloss_spoiled") AddFilesToChain_no_muls_no_eloss_spoiled(trkeff); else return NULL; TH1D *eff_numerator = new TH1D("eff_numerator", "", 39, 1.5, 40.5); TH1D *eff_denominator = (TH1D*)eff_numerator->Clone("eff_denominator"); trkeff->Project("eff_numerator", "E.pthrown.Theta()*TMath::RadToDeg()", "trk_Ndof>0 && trk_chisq/trk_Ndof<=20.0"); trkeff->Project("eff_denominator", "E.pthrown.Theta()*TMath::RadToDeg()"); TH1D *eff_vs_theta = (TH1D*)eff_numerator->Clone("eff_vs_theta"); eff_vs_theta->Divide(eff_denominator); TH1D *h = eff_vs_theta->Clone(hname); h->SetLineColor(color); h->SetMarkerColor(color); h->SetLineWidth(2); delete eff_numerator; delete eff_denominator; delete eff_vs_theta; return h; }