]>
Commit | Line | Data |
---|---|---|
84bad6b8 | 1 | //#include "AliAnalysisTaskTriggerStudy.h" |
2 | ||
3 | Int_t GetNumberOfEventsWithBit(TH1 * hVenn, UInt_t bitMask, UInt_t excludeMask=0) ; | |
4 | ||
5ec1c2f5 | 5 | void TriggerStudyResults(const char * filename = "outTrigger/collection_136854.xml/trigger_study.root", TString trigger = "C0SM1-A-NOPF-ALL") { |
a82dc581 | 6 | |
7 | TFile * f = new TFile (filename); | |
8 | ||
9 | ||
10 | LoadLibs(); | |
11 | ||
12 | // Draw trigger venn diagram | |
5ec1c2f5 | 13 | // hTrigStat_All_C0OM2-A-NOPF-ALL |
14 | TString vennName = "hTrigStat_All"; | |
15 | if (trigger != "") vennName = vennName+"_"+trigger; | |
16 | cout << "Venn name: " << vennName.Data() << endl; | |
17 | ||
18 | TH1 * hVenn = (TH1*) f->Get(vennName); | |
52d405b5 | 19 | hVenn->Draw(); |
a82dc581 | 20 | Int_t colors[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15}; |
21 | TPie * pie = new TPie(hVenn); | |
22 | Int_t nbin = hVenn->GetNbinsX(); | |
23 | for(Int_t ibin = 0; ibin < nbin; ibin++){ | |
24 | pie->SetEntryLabel(ibin, Form("%s, %d (%1.2f%%)", pie->GetEntryLabel(ibin), (int) pie->GetEntryVal(ibin), pie->GetEntryVal(ibin)/hVenn->GetEntries()*100)); | |
25 | } | |
26 | ||
27 | pie->SortSlices(1,1); // Sort slices and merge the empty ones | |
28 | pie->SortSlices(0,0); // Sort in increasing order. Sorting in increasing order directly leads to segfault | |
29 | pie->SetRadius(.31); | |
30 | pie->SetX(.53); | |
31 | pie->SetY(.34); | |
32 | pie->SetLabelsOffset(.01); | |
33 | pie->SetLabelFormat("");//#splitline{%val (%perc)}{%txt}"); | |
34 | pie->SetFillColors(colors); | |
52d405b5 | 35 | // pie->SetTextSize(0.01); |
84bad6b8 | 36 | TCanvas * c = new TCanvas("c", "c", 1000,1000); |
a82dc581 | 37 | pie->Draw(""); |
38 | ||
5ec1c2f5 | 39 | pie->MakeLegend(0.224832, 0.66958, 0.833893, 0.97028, trigger.Data()); |
a82dc581 | 40 | cout << pie << endl; |
41 | ||
42 | // Make a table of trigger efficiencies for all histos results | |
84bad6b8 | 43 | // AliLatexTable table(2,"cc"); |
44 | // // table.InsertCustomRow("\\multicolumn{c}{2}{Integrated efficiency}"); | |
45 | // table.InsertCustomRow(Form("Trigger Name & Efficiency (%s)\\\\",trigger.Data())); | |
46 | // table.InsertHline(); | |
47 | // TList * l = gDirectory->GetListOfKeys(); | |
48 | // TIterator * iter = l->MakeIterator(); | |
49 | // TKey * key = 0; | |
50 | // TH1F * hall = (TH1F*) gDirectory->Get("hTracklets_all"); // FIXME: get the normalization for a given trigger? | |
51 | // while (key = (TKey*) iter->Next()){ | |
52 | // TString name = key->GetName(); | |
53 | // if(!name.Contains("Tracklets")) continue; | |
54 | // if(!name.Contains(trigger)) continue; | |
55 | // if(name.Contains("all")) continue; | |
56 | // TH1F * h = (TH1F*) gDirectory->Get(name); | |
57 | // TString label = name(name.Index("_")+1, name.Index("_",name.Index("_")+1)-name.Index("_")-1); | |
58 | // table.SetNextCol(label); | |
59 | // table.SetNextCol(h->GetEntries()/hall->GetEntries()); | |
60 | // table.InsertRow(); | |
61 | // } | |
62 | // cout << "Integrated trigger efficiency" << endl; | |
63 | // table.PrintTable("ASCII"); | |
64 | ||
65 | Int_t v0ANDOnline = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDV0ANDOnline) ; | |
66 | Int_t v0ANDOffline = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDV0ANDOffline | 0x1 << AliAnalysisTaskTriggerStudy::kVDPhysSel); | |
67 | Int_t recCandle = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDRecCandle | 0x1 << AliAnalysisTaskTriggerStudy::kVDPhysSel| 0x1 << AliAnalysisTaskTriggerStudy::kVDV0ANDOffline) ; | |
68 | // Int_t recCandlePS = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDRecCandle, 0x1 << AliAnalysisTaskTriggerStudy::kVDPhysSel) ; | |
69 | Int_t genCandle = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDGenCandle) ; | |
70 | Int_t genCandleAndV0 = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDGenCandle | 0x1 << AliAnalysisTaskTriggerStudy::kVDV0ANDOffline) ; | |
71 | ||
72 | Int_t physSel = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDPhysSel) ; | |
73 | ||
74 | cout << "V0AND Online " << v0ANDOnline << endl; | |
75 | cout << "V0AND Offline " << v0ANDOffline << endl; | |
76 | cout << "REC CANDLE " << recCandle <<endl; | |
77 | cout << "GEN CANDLE " << genCandle << endl; | |
78 | cout << "REC/GEN CANDLE " << (genCandle>0 ? Float_t(recCandle)/genCandle : genCandle) << endl; | |
79 | cout << "REC/GEN CANDLEV0 " << (genCandleAndV0>0 ? Float_t(recCandle)/genCandleAndV0 : genCandleAndV0) << endl; | |
80 | cout << "Phys Sel CINT1B " << physSel << endl; | |
81 | // cout << "Dummy " << GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDRecCandle, 0x1 << AliAnalysisTaskTriggerStudy::kVDV0ANDOffline) << endl; | |
82 | ||
83 | AliLatexTable table(5,"cc"); | |
84 | table.InsertCustomRow("V0AND online/offline & V0AND offline / after PS & V0AND online / after PS & candle / after PS & Candle / v0AND offline\\\\"); | |
85 | table.SetNextCol(Float_t(v0ANDOnline)/v0ANDOffline,-3); | |
86 | table.SetNextCol(Float_t(v0ANDOffline)/physSel ,-3); | |
87 | table.SetNextCol(Float_t(v0ANDOnline)/physSel ,-3); | |
88 | table.SetNextCol(Float_t(recCandle)/physSel ,-3); | |
89 | table.SetNextCol(Float_t(recCandle)/v0ANDOffline ,-3); | |
90 | table.InsertRow(); | |
a82dc581 | 91 | table.PrintTable("ASCII"); |
84bad6b8 | 92 | |
a82dc581 | 93 | } |
94 | ||
95 | LoadLibs() { | |
96 | ||
4070f709 | 97 | gSystem->Load("libCore"); |
98 | gSystem->Load("libGeom"); | |
99 | gSystem->Load("libPhysics"); | |
a82dc581 | 100 | gSystem->Load("libVMC"); |
101 | gSystem->Load("libTree"); | |
f07573a6 | 102 | gSystem->Load("libProof"); |
84bad6b8 | 103 | gSystem->Load("libMatrix"); |
a82dc581 | 104 | gSystem->Load("libSTEERBase"); |
105 | gSystem->Load("libESD"); | |
106 | gSystem->Load("libAOD"); | |
107 | gSystem->Load("libANALYSIS"); | |
84bad6b8 | 108 | gSystem->Load("libOADB"); |
a82dc581 | 109 | gSystem->Load("libANALYSISalice"); |
af472fff | 110 | gSystem->Load("libTender"); |
a82dc581 | 111 | gSystem->Load("libCORRFW"); |
84bad6b8 | 112 | gSystem->Load("libPWG0base"); |
a82dc581 | 113 | gSystem->Load("libMinuit"); |
84bad6b8 | 114 | gSystem->Load("libPWG2spectra"); |
115 | ||
a82dc581 | 116 | gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPbPb")); |
2bfe5463 | 117 | gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWGPP/background")); |
a82dc581 | 118 | // Load helper classes |
119 | // TODO: replace this by a list of TOBJStrings | |
84bad6b8 | 120 | TString taskName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisTaskTriggerStudy.cxx+"); |
a82dc581 | 121 | TString histoManName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.cxx+"); |
122 | TString centrName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx+"); | |
2bfe5463 | 123 | TString listName("$ALICE_ROOT/PWGPP/background/AliHistoListWrapper.cxx+"); |
a82dc581 | 124 | |
125 | gSystem->ExpandPathName(taskName); | |
84bad6b8 | 126 | // gSystem->ExpandPathName(histoManName); |
127 | // gSystem->ExpandPathName(centrName); | |
128 | // gSystem->ExpandPathName(listName); | |
a82dc581 | 129 | |
130 | Bool_t debug=0; | |
84bad6b8 | 131 | // gROOT->LoadMacro(listName +(debug?"+g":"")); |
132 | // gROOT->LoadMacro(histoManName+(debug?"+g":"")); | |
133 | // gROOT->LoadMacro(centrName +(debug?"+g":"")); | |
a82dc581 | 134 | gROOT->LoadMacro(taskName +(debug?"+g":"")); |
135 | ||
136 | // Histo fitter | |
f07573a6 | 137 | // gROOT->LoadMacro("/Users/mfloris/Work/ALICE/ANALYSIS/HistoFitter/fcn.cxx+g"); |
138 | // gROOT->LoadMacro("/Users/mfloris/Work/ALICE/ANALYSIS/HistoFitter/AliHistoFitter.cxx+g"); | |
a82dc581 | 139 | |
140 | ||
141 | } | |
84bad6b8 | 142 | |
143 | Int_t GetNumberOfEventsWithBit(TH1 * hVenn, UInt_t bitMask, UInt_t excludeMask) { | |
144 | // If more than 1 bit is on in bitMask, they are used in and | |
145 | Int_t nbins = hVenn->GetNbinsX(); | |
146 | // cout << "bitMask " << hex << bitMask << endl; | |
147 | ||
148 | Int_t nev = 0; | |
149 | for(Int_t ibins = 1; ibins <= nbins; ibins++){ | |
150 | Int_t x = Int_t(hVenn->GetBinCenter(ibins)); | |
151 | Bool_t useBin = x&bitMask; | |
152 | // printf("Bood 0x%x 0x%x %d\n", x, bitMask, useBin); | |
153 | for (Int_t i = 0; i < 4*sizeof(bitMask) ; i++){ | |
154 | UInt_t localMask = bitMask & (0x1 << i); | |
155 | // cout << "localMask " << localMask << endl; | |
156 | ||
157 | if(localMask && !(x & localMask)) useBin = kFALSE; | |
158 | } | |
159 | // cout << hex << x << " " << bitMask << endl; | |
160 | ||
161 | if (useBin && !(x&excludeMask)) { | |
162 | nev += hVenn->GetBinContent(ibins); | |
163 | // cout << "Using " << hVenn->GetXaxis()->GetBinLabel(ibins) << " " << hVenn->GetBinContent(ibins) << endl; | |
164 | } | |
165 | } | |
166 | ||
167 | return nev; | |
168 | } |