]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/macros/MakeEfficiencyReport.C
Moving some macros
[u/mrichter/AliRoot.git] / PWG3 / dielectron / macros / MakeEfficiencyReport.C
1 void SetupStyle();
2
3 void MakeEfficiencyReport(const char* outputFile="JpsiEffReport.pdf",
4                           const char* histos="jpsi_HistosSE.root",
5                           const char* cf="jpsi_CF.root")
6 {
7   //
8   // Make a pdf file with the efficiency report
9   //
10
11   SetupStyle();
12   
13   AliDielectronCFdraw d(cf);
14   d.SetRangeUser("PairType",1,1);
15   d.SetRangeUser("Y",-.89,.9,"0");
16   
17   
18   TFile f("jpsi_HistosSE.root");
19   
20   AliDielectronHistos h;
21   TIter nextHists((TList*)f.Get("Dielectron_Histos"));
22   
23   TPaveText pt(.02,.6,.98,.8);
24   TText *t1=pt.AddText("");
25   TText *t2=pt.AddText("");
26   
27   TCanvas *c1=new TCanvas;
28   
29   TPDF p(outputFile);
30
31   //
32   // Efficiency plots
33   //
34   t1->SetTitle("Efficiency plots");
35   t2->SetTitle("Pair");
36   pt.Draw();
37   c1->Update();
38   
39 //   d.DrawEfficiency("Pt","1;2;4;10;16;8",0);
40   d.DrawEfficiency("Pt","4;16;22",0);
41   c1->Update();
42   
43
44   //
45   // Efficiency as a function of the impact parameter
46   //
47 //   c1->Clear();
48   Int_t refStep=16;
49   const Int_t impSteps=5;
50   Double_t impMax[impSteps]={.05,.04,.03,.02,.01};
51   TString title=d.GetCFContainer()->GetStepTitle(refStep);
52 //   d.DrawEfficiency("Pt:Y","1;2;4;10;16;8",0);
53   d.DrawEfficiency("Pt",Form("%d",refStep),0,"sameleg2");
54 //   c1->Update();
55   
56   for (Int_t i=0; i<impSteps;++i){
57     d.SetRangeUser("Leg1_ImpactParXY",-1*impMax[i],impMax[i]);
58     d.SetRangeUser("Leg2_ImpactParXY",-1*impMax[i],impMax[i]);
59     d.GetCFContainer()->SetStepTitle(refStep, (title+Form(" |leg dXY|<%.2f",impMax[i])).Data());
60     d.DrawEfficiency("Pt",Form("%d",refStep),0,"same+leg2");
61   }
62
63   d.UnsetRangeUser("Leg1_ImpactParXY");
64   d.UnsetRangeUser("Leg2_ImpactParXY");
65   d.GetCFContainer()->SetStepTitle(refStep, title.Data());
66   ((TH1*)gPad->GetListOfPrimitives()->FindObject("eff_16/00"))->SetMaximum(1.);
67
68   c1->Update();
69
70
71   c1->Clear();
72   d.SetRangeUser("Y",-.89,.9);
73 //   d.DrawEfficiency("Pt:Y","1;2;4;10;16;8",0,"colz2");
74   d.DrawEfficiency("Pt:Y","4;16;22",0,"colz2");
75   c1->Update();
76   c1->Clear();
77
78   //
79   // Inv mass plots
80   //
81 //   t1->SetTitle("Invariant Mass plots");
82 //   t2->SetTitle("");
83 //   pt.Draw();
84 //   c1->Update();
85   
86   
87   //
88   // Make QA info
89   //
90   
91   t1->SetTitle("QA summary plots for");
92   THashList *list=0x0;
93   while ( (list=(THashList*)nextHists()) ){
94     h.SetHistogramList(*list);
95     t2->SetTitle(list->GetName());
96     pt.Draw();
97     c1->Update();
98     h.Draw();
99     c1->Clear();
100   }
101   p.Close();
102   delete c1;
103 }
104
105 void SetupStyle()
106 {
107   const Int_t NCont=255;
108   
109   TStyle *st = new TStyle("mystyle","mystyle");
110   gROOT->GetStyle("Plain")->Copy((*st));
111   st->SetTitleX(0.1);
112   st->SetTitleW(0.8);
113   st->SetTitleH(0.08);
114   st->SetStatX(.9);
115   st->SetStatY(.9);
116   st->SetNumberContours(NCont);
117   st->SetPalette(1,0);
118   st->SetOptStat("erm");
119   st->SetOptFit(0);
120   st->SetGridColor(kGray+1);
121   st->SetPadGridX(kTRUE);
122   st->SetPadGridY(kTRUE);
123   st->SetPadTickX(kTRUE);
124   st->SetPadTickY(kTRUE);
125   st->cd();
126   
127   const Int_t NRGBs = 5;
128   Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
129   Double_t red[NRGBs]   = { 0.00, 0.00, 0.87, 1.00, 0.51 };
130   Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
131   Double_t blue[NRGBs]  = { 0.51, 1.00, 0.12, 0.00, 0.00 };
132   
133   TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
134   
135 }