AliAnalysisTaskTriggerStudy: Added code for trigger overlap (venn-like) and loop...
[u/mrichter/AliRoot.git] / PWG0 / multPbPb / TriggerStudyResults.C
1 void TriggerStudyResults(const char * filename = "outTrigger/LHC10g1f_130844/trigger_study.root") {
2
3   TFile * f = new TFile (filename);
4
5   
6   LoadLibs();
7
8   // Draw trigger venn diagram
9   TH1 * hVenn = (TH1*) f->Get("hTrigStat_All");
10   Int_t colors[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15};
11   TPie * pie = new TPie(hVenn);
12   Int_t nbin = hVenn->GetNbinsX();
13   for(Int_t ibin = 0; ibin < nbin; ibin++){
14     pie->SetEntryLabel(ibin, Form("%s, %d (%1.2f%%)", pie->GetEntryLabel(ibin), (int) pie->GetEntryVal(ibin), pie->GetEntryVal(ibin)/hVenn->GetEntries()*100));
15   }
16   
17   pie->SortSlices(1,1); // Sort slices and merge the empty ones
18   pie->SortSlices(0,0); // Sort in increasing order. Sorting in increasing order directly leads to segfault
19   pie->SetRadius(.31);
20   pie->SetX(.53);
21   pie->SetY(.34);
22   pie->SetLabelsOffset(.01);
23   pie->SetLabelFormat("");//#splitline{%val (%perc)}{%txt}");
24   pie->SetFillColors(colors);
25   pie->SetTextSize(0.01)
26   pie->Draw("");
27   
28   pie->MakeLegend(0.224832, 0.66958, 0.833893, 0.97028);
29   cout << pie << endl;
30   
31   // Make a table of trigger efficiencies for all histos results
32   // FIXME: select on trigger class here?
33   AliLatexTable table(2,"cc");
34   //  table.InsertCustomRow("\\multicolumn{c}{2}{Integrated efficiency}");
35   table.InsertCustomRow("Trigger Name & Efficiency\\\\");
36   table.InsertHline();
37   TList * l = gDirectory->GetListOfKeys();
38   TIterator * iter = l->MakeIterator();
39   TKey * key = 0;
40   TH1F * hall = (TH1F*) gDirectory->Get("hTracklets_all"); 
41   while (key = (TKey*) iter->Next()){
42     TString name = key->GetName();
43     if(!name.Contains("Tracklets")) continue;
44     if(name.Contains("all")) continue;
45     TH1F * h = (TH1F*) gDirectory->Get(name);
46     TString label = name(name.Index("_")+1, name.Index("_",name.Index("_")+1)-name.Index("_")-1);
47     table.SetNextCol(label);
48     table.SetNextCol(h->GetEntries()/hall->GetEntries());
49     table.InsertRow();
50   }
51   cout << "Integrated trigger efficiency" << endl;
52   table.PrintTable("ASCII");
53 }
54
55 LoadLibs() {
56
57   gSystem->Load("libVMC");
58   gSystem->Load("libTree");
59   gSystem->Load("libSTEERBase");
60   gSystem->Load("libESD");
61   gSystem->Load("libAOD");
62   gSystem->Load("libANALYSIS");
63   gSystem->Load("libANALYSISalice");
64   gSystem->Load("libCORRFW");
65   gSystem->Load("libMinuit");
66   gSystem->Load("libPWG2Spectra");
67   gSystem->Load("libPWG0base"); 
68    
69   gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG0/multPbPb"));
70   gROOT->ProcessLine(gSystem->ExpandPathName(".include $ALICE_ROOT/PWG1/background"));
71   // Load helper classes
72   // TODO: replace this by a list of TOBJStrings
73   TString taskName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisTaskMultPbTracks.cxx+");
74   TString histoManName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbTrackHistoManager.cxx+");
75   TString centrName("$ALICE_ROOT/PWG0/multPbPb/AliAnalysisMultPbCentralitySelector.cxx+");
76   TString listName("$ALICE_ROOT/PWG1/background/AliHistoListWrapper.cxx+");
77
78   gSystem->ExpandPathName(taskName);
79   gSystem->ExpandPathName(histoManName);
80   gSystem->ExpandPathName(centrName);
81   gSystem->ExpandPathName(listName);
82
83   Bool_t debug=0;
84   gROOT->LoadMacro(listName    +(debug?"+g":""));   
85   gROOT->LoadMacro(histoManName+(debug?"+g":""));
86   gROOT->LoadMacro(centrName   +(debug?"+g":""));   
87   gROOT->LoadMacro(taskName    +(debug?"+g":""));   
88
89   // Histo fitter
90   gROOT->LoadMacro("/Users/mfloris/Work/ALICE/ANALYSIS/HistoFitter/fcn.cxx+g");
91   gROOT->LoadMacro("/Users/mfloris/Work/ALICE/ANALYSIS/HistoFitter/AliHistoFitter.cxx+g");
92
93
94 }