]>
Commit | Line | Data |
---|---|---|
22d1b439 | 1 | ////////////////////////////////////////////////////////////////////////////////// |
2 | // CheckMatchingEfficiency.C (called by AODQAChecks.C) // | |
3 | // // | |
4 | // written by John Groh // | |
5 | ////////////////////////////////////////////////////////////////////////////////// | |
6 | ||
7 | void CheckMatchingEfficiency(AliSpectraAODTrackCuts * tcuts, | |
8 | TH1F*& MatchEffPos, | |
9 | TH1F*& MatchEffNeg, | |
10 | Float_t FixedPtMatchEff, | |
11 | Int_t runs[], | |
12 | Int_t irun, | |
13 | Int_t nRuns, | |
14 | Bool_t useMC) | |
15 | { | |
16 | ||
17 | // get matching efficiency histograms | |
18 | TH1F * hMatchEffPos = (TH1F*)tcuts->GetHistoNMatchedPos(); | |
19 | hMatchEffPos->Sumw2(); | |
20 | hMatchEffPos->Divide(hMatchEffPos,(TH1F*)tcuts->GetHistoNSelectedPos()->Clone(),1,1,"B"); // binomial error! | |
21 | TH1F * hMatchEffNeg = (TH1F*)tcuts->GetHistoNMatchedNeg(); | |
22 | hMatchEffNeg->Sumw2(); | |
23 | hMatchEffNeg->Divide(hMatchEffNeg,(TH1F*)tcuts->GetHistoNSelectedNeg()->Clone(),1,1,"B"); // binomial error! | |
24 | ||
25 | // get values for a fixed pt | |
26 | Int_t nMatchedPos = hMatchEffPos->GetBinContent(hMatchEffPos->FindBin(FixedPtMatchEff)); | |
27 | Int_t nSelectedPos = tcuts->GetHistoNSelectedPos()->GetBinContent(tcuts->GetHistoNSelectedPos()->FindBin(FixedPtMatchEff)); | |
28 | Int_t nMatchedNeg = tcuts->GetHistoNMatchedNeg()->GetBinContent(tcuts->GetHistoNMatchedNeg()->FindBin(FixedPtMatchEff)); | |
29 | Int_t nSelectedNeg = tcuts->GetHistoNSelectedNeg()->GetBinContent(tcuts->GetHistoNSelectedNeg()->FindBin(FixedPtMatchEff)); | |
30 | ||
31 | // fill matching eff vs. run number histograms | |
32 | MatchEffPos->SetBinContent(irun+1, hMatchEffPos->GetBinContent(hMatchEffPos->FindBin(FixedPtMatchEff))); | |
33 | MatchEffPos->SetBinError(irun+1, hMatchEffPos->GetBinError(hMatchEffPos->FindBin(FixedPtMatchEff))); | |
34 | MatchEffNeg->SetBinContent(irun+1, hMatchEffNeg->GetBinContent(hMatchEffNeg->FindBin(FixedPtMatchEff))); | |
35 | MatchEffNeg->SetBinError(irun+1, hMatchEffNeg->GetBinError(hMatchEffNeg->FindBin(FixedPtMatchEff))); | |
36 | ||
37 | // plot individual runs temporarily before saving to a pdf | |
38 | TCanvas * cMatchEffIndiv = new TCanvas("cMatchEffIndiv","cMatchEffIndiv"); | |
39 | TH2F * hAxesMatchEffIndiv = new TH2F("hAxesMatchEffIndiv","",100,0,5,100,0,1); | |
40 | hAxesMatchEffIndiv->GetXaxis()->SetTitle("p_{T} (GeV/c)"); | |
41 | hAxesMatchEffIndiv->GetYaxis()->SetTitle("TOF Matching Efficiency"); | |
42 | hAxesMatchEffIndiv->SetStats(kFALSE); | |
43 | hAxesMatchEffIndiv->DrawCopy(); | |
44 | // Pos | |
45 | hMatchEffPos->SetStats(kFALSE); | |
46 | hMatchEffPos->SetLineColor(kBlue); | |
47 | hMatchEffPos->SetMarkerColor(kBlue); | |
48 | hMatchEffPos->SetMarkerStyle(20); | |
49 | hMatchEffPos->SetMarkerSize(0.2); | |
50 | hMatchEffPos->DrawCopy("E1PSame"); | |
51 | // Neg | |
52 | hMatchEffNeg->SetStats(kFALSE); | |
53 | hMatchEffNeg->SetLineColor(kRed); | |
54 | hMatchEffNeg->SetMarkerColor(kRed); | |
55 | hMatchEffNeg->SetMarkerStyle(21); | |
56 | hMatchEffNeg->SetMarkerSize(0.2); | |
57 | hMatchEffNeg->DrawCopy("E1PSame"); | |
58 | TLegend * lMatchEffIndiv = new TLegend(.65,.15,.85,.35); | |
59 | lMatchEffIndiv->AddEntry(hMatchEffPos,"Pos","pe"); | |
60 | lMatchEffIndiv->AddEntry(hMatchEffNeg,"Neg","pe"); | |
61 | lMatchEffIndiv->AddEntry(hMatchEffPos,Form("Run %i",runs[irun]),""); | |
62 | if (useMC) lMatchEffIndiv->AddEntry(hMatchEffPos,"MC",""); | |
63 | else lMatchEffIndiv->AddEntry(hMatchEffPos,"DATA",""); | |
64 | lMatchEffIndiv->SetFillColor(0); | |
65 | lMatchEffIndiv->DrawClone(); | |
66 | ||
67 | // save to a pdf and close the temporary canvas | |
68 | if (useMC) | |
69 | { | |
70 | if (irun == 0) cMatchEffIndiv->SaveAs("Plots/MC/AODMatchingEfficiencies.pdf(","pdf"); | |
71 | else if (irun < nRuns-1) cMatchEffIndiv->SaveAs("Plots/MC/AODMatchingEfficiencies.pdf","pdf"); | |
72 | else if (irun == nRuns-1) cMatchEffIndiv->SaveAs("Plots/MC/AODMatchingEfficiencies.pdf)","pdf"); | |
73 | cMatchEffIndiv->Close(); | |
74 | } | |
75 | else | |
76 | { | |
77 | if (irun == 0) cMatchEffIndiv->SaveAs("Plots/DATA/AODMatchingEfficiencies.pdf(","pdf"); | |
78 | else if (irun < nRuns-1) cMatchEffIndiv->SaveAs("Plots/DATA/AODMatchingEfficiencies.pdf","pdf"); | |
79 | else if (irun == nRuns-1) cMatchEffIndiv->SaveAs("Plots/DATA/AODMatchingEfficiencies.pdf)","pdf"); | |
80 | cMatchEffIndiv->Close(); | |
81 | } | |
82 | } | |
83 | ||
84 | ||
85 | ||
86 | ||
87 |