1 //#include "AliAnalysisTaskTriggerStudy.h"
3 Int_t GetNumberOfEventsWithBit(TH1 * hVenn, UInt_t bitMask, UInt_t excludeMask=0) ;
5 void TriggerStudyResults(const char * filename = "outTrigger/collection_136854.xml/trigger_study.root", TString trigger = "C0SM1-A-NOPF-ALL") {
7 TFile * f = new TFile (filename);
12 // Draw trigger venn diagram
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;
18 TH1 * hVenn = (TH1*) f->Get(vennName);
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));
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
32 pie->SetLabelsOffset(.01);
33 pie->SetLabelFormat("");//#splitline{%val (%perc)}{%txt}");
34 pie->SetFillColors(colors);
35 // pie->SetTextSize(0.01);
36 TCanvas * c = new TCanvas("c", "c", 1000,1000);
39 pie->MakeLegend(0.224832, 0.66958, 0.833893, 0.97028, trigger.Data());
42 // Make a table of trigger efficiencies for all histos results
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();
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());
62 // cout << "Integrated trigger efficiency" << endl;
63 // table.PrintTable("ASCII");
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) ;
72 Int_t physSel = GetNumberOfEventsWithBit(hVenn,0x1 <<AliAnalysisTaskTriggerStudy::kVDPhysSel) ;
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;
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);
91 table.PrintTable("ASCII");
97 gSystem->Load("libCore.so");
98 gSystem->Load("libGeom.so");
99 gSystem->Load("libPhysics.so");
100 gSystem->Load("libVMC");
101 gSystem->Load("libTree");
102 gSystem->Load("libProof");
103 gSystem->Load("libMatrix");
104 gSystem->Load("libSTEERBase");
105 gSystem->Load("libESD");
106 gSystem->Load("libAOD");
107 gSystem->Load("libANALYSIS");
108 gSystem->Load("libOADB");
109 gSystem->Load("libANALYSISalice");
110 gSystem->Load("libTENDER");
111 gSystem->Load("libCORRFW");
112 gSystem->Load("libPWG0base");
113 gSystem->Load("libMinuit");
114 gSystem->Load("libPWG2spectra");
116 gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPbPb"));
117 gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWGPP/background"));
118 // Load helper classes
119 // TODO: replace this by a list of TOBJStrings
120 TString taskName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisTaskTriggerStudy.cxx+");
121 TString histoManName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.cxx+");
122 TString centrName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx+");
123 TString listName("$ALICE_ROOT/PWGPP/background/AliHistoListWrapper.cxx+");
125 gSystem->ExpandPathName(taskName);
126 // gSystem->ExpandPathName(histoManName);
127 // gSystem->ExpandPathName(centrName);
128 // gSystem->ExpandPathName(listName);
131 // gROOT->LoadMacro(listName +(debug?"+g":""));
132 // gROOT->LoadMacro(histoManName+(debug?"+g":""));
133 // gROOT->LoadMacro(centrName +(debug?"+g":""));
134 gROOT->LoadMacro(taskName +(debug?"+g":""));
137 // gROOT->LoadMacro("/Users/mfloris/Work/ALICE/ANALYSIS/HistoFitter/fcn.cxx+g");
138 // gROOT->LoadMacro("/Users/mfloris/Work/ALICE/ANALYSIS/HistoFitter/AliHistoFitter.cxx+g");
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;
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;
157 if(localMask && !(x & localMask)) useBin = kFALSE;
159 // cout << hex << x << " " << bitMask << endl;
161 if (useBin && !(x&excludeMask)) {
162 nev += hVenn->GetBinContent(ibins);
163 // cout << "Using " << hVenn->GetXaxis()->GetBinLabel(ibins) << " " << hVenn->GetBinContent(ibins) << endl;