AliPhysics  5a28df1 (5a28df1)
Drawer.C
Go to the documentation of this file.
1 #ifndef DRAWER_C
2 #define DRAWER_C
3 #ifndef __CINT__
4 # include <TROOT.h>
5 # include <TSystem.h>
6 # include <TInterpreter.h>
7 # include <TString.h>
8 # include <THStack.h>
9 # include <TMultiGraph.h>
10 # include <TGraph.h>
11 # include <TGraphErrors.h>
12 # include <TGraphAsymmErrors.h>
13 # include <TList.h>
14 # include <TError.h>
15 # include <TMath.h>
16 # include <TLegend.h>
17 # include <TLegendEntry.h>
18 # include <TCanvas.h>
19 # include <TClass.h>
20 # include <TFile.h>
21 # include <TParameter.h>
22 # include <TColor.h>
23 # include <TStyle.h>
24 # include <TLatex.h>
25 # include <TMap.h>
26 # include <map>
27 # include <vector>
28 # include "Combiner.C"
29 #else
30 class TLatex;
31 class TCanvas;
32 class THStack;
33 class TMultiGraph;
34 class TGraph;
35 class TGraphErrors;
36 class TGraphAsymmErrors;
37 class TLegend;
38 class TH1;
39 class TPair;
40 class TString;
41 #endif
42 
48 struct Drawer {
49  static const char* PlotPrefix() { return "plots"; }
54  static void LoadOther() {
55 #if 0
56  if (gROOT->GetClass("RefData")) return;
57  const char* fwd = 0;
58  if (gSystem->Getenv("FWD"))
59  fwd = gSystem->Getenv("FWD");
60  else
61  fwd = gSystem->ExpandPathName("$ALICE_PHYSICS/PWGLF/FORWARD/analysis2");
62  gROOT->SetMacroPath(Form("%s:%s", gROOT->GetMacroPath(),fwd));
63  TString path(gROOT->GetMacroPath());
64  // if (!path.Contains(fwd)) {
65  path.Append(Form(":%s", fwd));
66  gROOT->SetMacroPath(path);
67  // }
68  gROOT->LoadMacro("OtherData.C+");
69 #endif
70  }
81  static TMultiGraph* GetOther(UShort_t sys,
82  UShort_t sNN,
83  UShort_t trg,
84  UShort_t exps=0xf,
85  Int_t verbose=3)
86  {
87  return 0;
88 #if 0
89  UShort_t c1 = 0;
90  UShort_t c2 = 0;
91  switch (trg) {
92  case 0x004: if (sys == 3) exps = 0x4; break;
93  case 0x010:
94  case 0x020:
95  case 0x040:
96  case 0x080:
97  case 0x100:
98  case 0x200: c2 = 100; break;
99  }
100 
101  LoadOther();
102  gROOT->ProcessLine(Form("RefData::Verbose(%d);", verbose));
103  ::Info("", "sys=%d sNN=%d trg=0x%x c1=%d c2=%d exp=0x%x",
104  sys, sNN, trg, c1, c2, exps);
105  Long_t ret =
106  gROOT->ProcessLine(Form("RefData::GetData(%d,%d,%d,%d,%d,%d);",
107  sys,sNN,trg,c1,c2,exps));
108  if (!ret) {
109  if (verbose)
110  Warning("", "RefData::GetData(%d,%d,0x%x,%d,%d,0x%x); failed",
111  sys,sNN,trg,c1,c2,exps);
112  return 0;
113  }
114 
115  TMultiGraph* mg = reinterpret_cast<TMultiGraph*>(ret);
116 
117  return mg;
118 #endif
119  }
130  static TMultiGraph* GetOther(const TString& system,
131  UShort_t sNN,
132  const TString& trigger,
133  Int_t verbose=0)
134  {
135  return GetOther(system, sNN, trigger, "ALICE WIP", verbose);
136  }
148  static TMultiGraph* GetOther(const TString& system,
149  UShort_t sNN,
150  const TString& trigger,
151  const TString& exps,
152  Int_t verbose=0)
153  {
154  TString s(system);
155  s.ToUpper();
156 
157  UShort_t sys = 0;
158  if (s.EqualTo("PP")) sys = 1;
159  else if (s.EqualTo("PPB")) sys = 3;
160  else if (s.EqualTo("PBPB")) sys = 2;
161  else if (s.EqualTo("PBP")) sys = 4;
162 
163  TString e(exps);
164  e.ToUpper();
165  UShort_t exp = 0x0;
166  if (e.Contains("UA5")) exp |= 0x01;
167  if (e.Contains("CMS")) exp |= 0x02;
168  if (e.Contains("ALICE")) exp |= 0x04;
169  if (e.Contains("WIP")) exp |= 0x08;
170  if (e.Contains("EG")) exp |= 0x10;
171 
172  TString t(trigger);
173  t.ToUpper();
174  UShort_t trg = 0;
175  if (t.EqualTo("INEL")) trg = 0x1;
176  else if (t.EqualTo("INELGT0") || t.EqualTo("INEL>0")) trg = 0x2;
177  else if (t.EqualTo("NSD") || t.EqualTo("V0AND")) trg = 0x4;
178  else if (t.BeginsWith("CENT")) {
179  if (t.EndsWith("V0M")) trg |= 0x010;
180  else if (t.EndsWith("V0A")) trg |= 0x020;
181  else if (t.EndsWith("V0X")) trg |= (sys == 3 ? 0x020 : 0x100);
182  else if (t.EndsWith("ZNA")) trg |= 0x040;
183  else if (t.EndsWith("ZNC")) trg |= 0x080;
184  else if (t.EndsWith("V0C")) trg |= 0x100;
185  else if (t.EndsWith("ZNX")) trg |= (sys == 3 ? 0x040 : 0x80);
186  else if (t.EndsWith("MB")) { trg = 0x4; exp = 0x4; }
187  }
188 
189  ::Info("", "sys=%d sNN=%d trg=0x%x exp=0x%x", sys, sNN, trg, exp);
190  TMultiGraph* mg = GetOther(sys, sNN, trg, exp, verbose);
191  if (!mg)
192  Warning("GetOthers",
193  "No other data for %s %s %d (%s)",
194  system.Data(), trigger.Data(), sNN, exps.Data());
195  return mg;
196  }
202  static Int_t AliceBlue()
203  {
204  return TColor::GetColor(40, 58, 68);
205  }
211  static Int_t AliceRed()
212  {
213  return TColor::GetColor(226, 0, 26);
214  }
221  {
222  return TColor::GetColor(202, 71, 67);
223  }
230  {
231  return TColor::GetColor(238, 125, 17);
232  }
233  static Color_t Brighten(Color_t origNum, Int_t nTimes=2)
234  {
235  Int_t origR, origG, origB;
236  TColor::Pixel2RGB(TColor::Number2Pixel(origNum), origR, origG, origB);
237  Int_t off = nTimes*0x33;
238  Int_t newR = TMath::Min((origR+off),0xff);
239  Int_t newG = TMath::Min((origG+off),0xff);
240  Int_t newB = TMath::Min((origB+off),0xff);
241  Int_t newNum = TColor::GetColor(newR, newG, newB);
242  return newNum;
243  }
244  static TString SNNString(const TString& system, UShort_t sNN)
245  {
246  TString e(system.EqualTo("pp", TString::kIgnoreCase)
247  ? "#sqrt{s}=" : "#sqrt{s_{NN}}=");
248  if (sNN < 1000) e.Append(Form("%dGeV", sNN));
249  else if (sNN % 1000 == 0) e.Append(Form("%dTeV", sNN/1000));
250  else e.Append(Form("%.2fTeV", float(sNN)/1000));
251  return e;
252  }
253 
263  static TGraphErrors* H2G(TH1* h, Double_t xOff, Int_t sign=1)
264  {
265  TGraphErrors* g = new TGraphErrors();
266  g->SetMarkerStyle(h->GetMarkerStyle());
267  g->SetMarkerColor(h->GetMarkerColor());
268  g->SetLineColor(h->GetLineColor());
269  g->SetName(h->GetName());
270  g->SetTitle(h->GetTitle());
271 
272  Int_t iP = 0;
273  Int_t nX = h->GetNbinsX();
274  for (Int_t iX = 1; iX <= nX; iX++) {
275  Double_t y = h->GetBinContent(iX);
276  if (y < 1e-6) continue;
277  Double_t x = h->GetXaxis()->GetBinCenter(iX) - xOff;
278  Double_t ex = h->GetXaxis()->GetBinWidth(iX)/2;
279  Double_t ey = h->GetBinError(iX);
280 
281  g->SetPoint(iP, sign * x, y);
282  g->SetPointError(iP++, ex, ey);
283  }
284  return g;
285  }
286 
296  static TGraphAsymmErrors* H2GA(TH1* h, TH1* sA, TH1* sC)
297  {
299  g->SetMarkerStyle(h->GetMarkerStyle());
300  g->SetMarkerColor(h->GetMarkerColor());
301  g->SetLineColor(h->GetLineColor());
302  g->SetName(h->GetName());
303  g->SetTitle(h->GetTitle());
304 
305  Int_t iP = 0;
306  Int_t nX = h->GetNbinsX();
307  for (Int_t iX = 1; iX <= nX; iX++) {
308  Double_t y = h->GetBinContent(iX);
309  if (y < 1e-6) continue;
310  Double_t x = h->GetXaxis()->GetBinCenter(iX);
311  Double_t ex = h->GetXaxis()->GetBinWidth(iX)/2;
312  Double_t ec = 0;
313  Double_t ee = 0;
314  if (x < 0) {
315  ec = sC->GetBinContent(iX);
316  ee = sC->GetBinError(iX);
317  }
318  else {
319  ec = sA->GetBinContent(iX);
320  ee = sA->GetBinError(iX);
321  }
322  Double_t eyl = y-(ec-ee);
323  Double_t eyh = (ec+ee)-y;
324 
325  g->SetPoint(iP, x, y);
326  g->SetPointError(iP++, ex, ex, eyl, eyh);
327  }
328  return g;
329  }
337  static void ErrorGraphs(const TGraph* g, TGraph*& low, TGraph*& up)
338  {
339  Warning("ErrorGraphs", "Called with vanila TGraph (%s)",
340  g->IsA()->GetName());
341  Int_t n = g->GetN();
342  low = new TGraph(n);
343  up = new TGraph(n);
344  for (Int_t i = 0; i < n; i++) {
345  low->SetPoint(i, 0, 0);
346  up->SetPoint(i, 0, 0);
347  }
348  }
352  static void ErrorGraphs(const TGraphErrors* g, TGraph*& low, TGraph*& up)
353  {
354  // Info("ErrorGraphs", "Called with TGraphErrors");
355  Int_t n = g->GetN();
356  low = new TGraph(n);
357  up = new TGraph(n);
358  for (Int_t i = 0; i < n; i++) {
359  low->SetPoint(i, g->GetX()[i], g->GetY()[i] - g->GetEY()[i]);
360  up->SetPoint(i, g->GetX()[i], g->GetY()[i] + g->GetEY()[i]);
361  }
362  }
366  static void ErrorGraphs(const TGraphAsymmErrors* g, TGraph*& low, TGraph*& up)
367  {
368  // Info("ErrorGraphs", "Called with TGraphAsymmErrors");
369  Int_t n = g->GetN();
370  low = new TGraph(n);
371  up = new TGraph(n);
372  for (Int_t i = 0; i < n; i++) {
373  low->SetPoint(i, g->GetX()[i], g->GetY()[i] - g->GetEYlow()[i]);
374  up->SetPoint(i, g->GetX()[i], g->GetY()[i] + g->GetEYhigh()[i]);
375  }
376  }
386  static TH1* ErrorHist(const TH1* h, Bool_t aSide, Double_t factor=0.076)
387  {
388  TString nm(h->GetName());
389  nm.ReplaceAll("Forward", "SysError");
390  nm.Append(aSide ? "_a" : "_c");
391  TH1* ret = static_cast<TH1*>(h->Clone(nm.Data()));
392  ret->SetDirectory(0);
393  for (Int_t i = 1; i <= ret->GetNbinsX(); i++) {
394  Double_t x = ret->GetXaxis()->GetBinCenter(i);
395  if (aSide && x < 0) {
396  ret->SetBinContent(i,0);
397  ret->SetBinError(i,0);
398  continue;
399  }
400  if (!aSide && x >= 0) {
401  ret->SetBinContent(i,0);
402  ret->SetBinError(i,0);
403  }
404  ret->SetBinError(i, ret->GetBinContent(i)*factor);
405  }
406  return ret;
407  }
408 
409 
421  static TH1* HOverG(const TH1* h,
422  const TGraph* g,
423  const TGraph* l,
424  const TGraph* u,
425  Bool_t err=false)
426  {
427  TH1* ret = static_cast<TH1*>(h->Clone());
428 
429  for (Int_t i = 1; i <= ret->GetNbinsX(); i++) {
430  Double_t c = h->GetBinContent(i);
431  if (c < 1e-6) continue;
432 
433  Double_t e = ret->GetBinError(i);
434  Double_t x = ret->GetXaxis()->GetBinCenter(i);;
435  Double_t y = g->Eval(x);
436  Double_t yl = l->Eval(x);
437  Double_t yu = u->Eval(x);
438  Double_t ye = TMath::Max(y-yl,yu-yl);
439  if (y < 1e-6) {
440  c = 0;
441  e = 0;
442  }
443  else if (err) {
444  c /= y;
445  e /= y;
446  }
447  else {
448  c /= y;
449  e = TMath::Sqrt(e*e*y*y+ye*ye*c*c);
450  }
451  ret->SetBinContent(i,c);
452  ret->SetBinError(i,e);
453  }
454  return ret;
455  }
467  static TGraph* GOverG(const TGraph* num,
468  const TGraph* den,
469  const TGraph* dlow,
470  const TGraph* dup,
471  Double_t dx=0)
472  {
473  TGraph* g = static_cast<TGraph*>(num->Clone());
474  g->SetMarkerStyle(den->GetMarkerStyle());
475  g->SetMarkerColor(num->GetMarkerColor());
476  g->SetLineColor(num->GetLineColor());
477  g->SetName(num->GetName());
478  g->SetTitle(num->GetTitle());
479  g->Set(0);
480 
481  const TGraphAsymmErrors* nga = 0;
482  const TGraphErrors* nge = 0;
483  TGraphAsymmErrors* ga = 0;
484  TGraphErrors* ge = 0;
485  if (g->IsA()->InheritsFrom(TGraphAsymmErrors::Class())) {
486  nga = static_cast<const TGraphAsymmErrors*>(num);
487  ga = static_cast<TGraphAsymmErrors*>(g);
488  }
489  else if (g->IsA()->InheritsFrom(TGraphErrors::Class())) {
490  nge = static_cast<const TGraphErrors*>(num);
491  ge = static_cast<TGraphErrors*>(g);
492  }
493 
494  TGraph* nlow = 0;
495  TGraph* nup = 0;
496  // Info("", "Get other numerator error bands");
497  if (nga) ErrorGraphs(nga, nlow, nup);
498  else if (nge) ErrorGraphs(nge, nlow, nup);
499 
500  Double_t dMin = den->GetX()[0];
501  Double_t dMax = den->GetX()[den->GetN()-1];
502  Int_t iP = 0;
503  Int_t n = num->GetN();
504  for (Int_t i = 0; i < n; i++) {
505  Double_t x = num->GetX()[i];
506  if (x < dMin || x > dMax) continue;
507 
508  Double_t yn = num->GetY()[i];
509  Double_t ynl = (nlow ? yn-nlow->Eval(x) : 0);
510  Double_t ynu = (nup ? nup->Eval(x)-yn : 0);
511  Double_t yd = den->Eval(x-dx);
512  Double_t ydl = (dlow ? yd-dlow->Eval(x-dx) : 0);
513  Double_t ydu = (dup ? dup->Eval(x-dx)-yd : 0);
514  if (yd < 1e-6 || yn < 1e-6) continue;
515 
516  g->SetPoint(iP, x, yn/yd);
517  if (ga && nga) {
518  // Printf("iP=%d yn=%f ynl=%f ynu=%f yd=%f ydl=%f ydu=%f",
519  // iP, yn, ynl, ynu, yd, ydl, ydu);
520  Double_t el = TMath::Sqrt(ydl*ydl*yn*yn+ynl*ynl*yd*yd) / yd;
521  Double_t eu = TMath::Sqrt(ydu*ydu*yn*yn+ynu*ynu*yd*yd) / yd;
522  el = ynl / yd;
523  eu = ynu / yd;
524  ga->SetPointError(iP, nga->GetEXlow()[i], nga->GetEXhigh()[i], el, eu);
525  }
526  else if (ge && nge) {
527  Double_t yne = TMath::Max(ynl,ynu);
528  Double_t yde = TMath::Max(ydl,ydu);
529  // Printf("iP=%d yn=%f yne=%f yd=%f yde=%f", iP, yn, yne, yd, yde);
530  Double_t e = TMath::Sqrt(yde*yde*yn*yn+yne*yne*yd*yd) / yd;
531  e = yne / yd;
532  ge->SetPointError(iP, nge->GetEX()[i], e);
533  }
534  iP++;
535  }
536  delete nlow;
537  delete nup;
538 
539  return g;
540  }
554  static THStack* GetStack(TLegend* legend,
555  const TString& system,
556  UShort_t sNN,
557  const TString& trigger,
558  Bool_t rebinned=true,
559  Bool_t empirical=true,
560  Int_t marker=20)
561  {
562  TString sys(system); sys.ToUpper();
563  TString trg(trigger); trg.ToUpper();
564  if (trg.EqualTo("NSD")) trg = "V0AND";
565 
566  if (sys.EqualTo("PP")) {
567  sys = "pp";
568  if (trg.EqualTo("INEL")) trg = "INEL";
569  else if (trg.EqualTo("INELGT0") || trg.EqualTo("INEL>0")) trg = "INELGt0";
570  else if (trg.EqualTo("V0AND")) trg = "V0AND";
571  else trg = "";
572  }
573  else if (sys.EqualTo("PPB")) {
574  sys = "pPb";
575  if (trg.EqualTo("CENTMB") || trg.EqualTo("V0AND")) trg = "CENTMB";
576  else if (trg.EqualTo("CENTV0A")) trg = "CENTV0A";
577  else if (trg.EqualTo("CENTV0X")) trg = "CENTV0A";
578  else if (trg.EqualTo("CENTV0M")) trg = "CENTV0M";
579  else if (trg.EqualTo("CENTZNA")) trg = "CENTZNA";
580  else if (trg.EqualTo("CENTZNX")) trg = "CENTZNA";
581  else trg = "";
582  }
583  else if (sys.EqualTo("PBP")) {
584  sys = "Pbp";
585  if (trg.EqualTo("CENTMB") || trg.EqualTo("V0AND")) trg = "CENTMB";
586  else if (trg.EqualTo("CENTV0C")) trg = "CENTV0C";
587  else if (trg.EqualTo("CENTV0X")) trg = "CENTV0C";
588  else if (trg.EqualTo("CENTV0M")) trg = "CENTV0M";
589  else if (trg.EqualTo("CENTZNC")) trg = "CENTZNC";
590  else if (trg.EqualTo("CENTZNX")) trg = "CENTZNC";
591  else trg = "";
592  }
593  else if (sys.EqualTo("PBPB")) {
594  sys = "PbPb";
595  if (trg.EqualTo("CENT")) trg = "CENT";
596  else if (trg.EqualTo("CENTV0M")) trg = "CENT";
597  else trg = "";
598  }
599  else {
600  Error("", "Unknown system: %s", system.Data());
601  return 0;
602  }
603  if (trg.IsNull()) {
604  Error("", "Unknown trigger %s for system %s",
605  trigger.Data(), system.Data());
606  return 0;
607  }
608 
609  TString path(Form("%s/%s/%04d/%s/%s.C",
610  (empirical ? "nosec" : "normal"),
611  sys.Data(), sNN, trg.Data(),
612  (rebinned ? "rebin" : "full")));
613  if (gSystem->AccessPathName(path.Data())) {
614  Error("", "Script %s does not exist", path.Data());
615  Error("", "sys=%s, sNN=%d, trg=%s, %d",
616  sys.Data(), sNN, trg.Data(), rebinned);
617  return 0;
618  }
619 
620  THStack* stack = new THStack("stack", "");
621  if (legend)
622  gROOT->Macro(Form("%s((THStack*)%p,(TLegend*)%p,%d)",
623  path.Data(), stack, legend, marker));
624  else
625  gROOT->Macro(Form("%s((THStack*)%p,0,%d)",
626  path.Data(), stack, marker));
627 
628  gInterpreter->UnloadFile(path.Data());
629  if (!stack->GetHists() || stack->GetHists()->GetEntries() <= 0) {
630  Error("", "Got no histograms in stack from %s",
631  path.Data());
632  delete stack;
633  return 0;
634  }
635 
636  return stack;
637  }
649  static TCanvas* MakeCanvas(const TString& system,
650  UShort_t sNN,
651  const TString& trigger,
652  Bool_t rebinned=true,
653  Bool_t empirical=true)
654  {
655  TString e = SNNString(system, sNN);
656  TString t(Form("%s %s %s", system.Data(), e.Data(), trigger.Data()));
657  TCanvas* canvas = new TCanvas(Form("%s_%04d_%s_%s_%s",
658  system.Data(), sNN, trigger.Data(),
659  (rebinned ? "coarse" : "full"),
660  (empirical ? "empirical" : "mc")),
661  t.Data(),
662  1200, 1200);
663  canvas->SetTopMargin(0.01);
664  canvas->SetRightMargin(0.01);
665  canvas->SetFillColor(0);
666  canvas->SetFillStyle(0);
667  canvas->SetBorderMode(0);
668  canvas->SetBorderSize(0);
669 
670  return canvas;
671  }
678  static void PrintCanvas(TCanvas* canvas, const TString& types)
679  {
680  if (types.IsNull()) return;
681 
682  canvas->Modified();
683  canvas->Update();
684  canvas->cd();
685 
686  TObjArray* tokens = types.Tokenize(" ,");
687  TObject* token = 0;
688  TIter next(tokens);
689  while ((token = next())) {
690  canvas->Print(Form("%s/%s.%s", PlotPrefix(), canvas->GetName(),
691  token->GetName()));
692  }
693  tokens->Delete();
694  delete tokens;
695  }
696  static Double_t* FixTriggerEff(const TString& sys,
697  UShort_t sNN,
698  TString& trigger)
699  {
700  if (sNN != 8000 || !sys.EqualTo("pp", TString::kIgnoreCase))
701  return 0;
702 
703  Double_t* ret = new Double_t[2];
704  ret[1] = 0;
705  if (trigger.EqualTo("INEL",TString::kIgnoreCase)) {
706  ret[0] = 0.85;
707  return ret;
708  }
709  if (trigger.EqualTo("NSD", TString::kIgnoreCase) ||
710  trigger.EqualTo("V0AND", TString::kIgnoreCase)) {
711  trigger = "NSD";
712  ret[0] = 0.93;
713  return ret;
714  }
715  return 0;
716  }
717 
728  static void Draw(const TString& system,
729  UShort_t sNN,
730  const TString& trigger,
731  const Option_t* option="e3",
732  Bool_t rebinned=true,
733  Bool_t empirical=true)
734  {
735  TCanvas* canvas = MakeCanvas(system,sNN,trigger,rebinned, empirical);
736 
737  TString trg = trigger;
738  Double_t* effs = FixTriggerEff(system,sNN,trg);
739  const char* trigs[] = { trigger, 0 };
740  const char* exps[] = { "ALICE", "WIP", 0 };
741 
742  TLegend* l = 0;
743  TObjArray u;
744  TPair* dataOther = GetDataOther(l, u, system, sNN, trigs, exps, option,
745  rebinned, empirical, effs);
746  if (effs) delete [] effs;
747  if (!dataOther || !dataOther->Key()) {
748  Error("", "No data found %s", canvas->GetTitle());
749  return;
750  }
751  THStack* data = static_cast<THStack*>(dataOther->Key());
752  TMultiGraph* other = static_cast<TMultiGraph*>(dataOther->Value());
753 
754  data->Draw("nostack");
755  if (other) other->Draw("p");
756 
757  canvas->cd();
758  data->SetTitle(Form("%s %s %s", system.Data(), data->GetTitle(), trigs[0]));
759  data->SetMaximum(data->GetMaximum("nostack")*1.2);
760  data->GetXaxis()->SetTitle("#eta");
761  data->GetYaxis()->SetTitle("1/#it{N} d#it{N}_{ch}/d#it{#eta}");
762 
763  PrintCanvas(canvas, "pdf png");
764  }
772  static TGraphAsymmErrors* Combine(TMultiGraph* mg)
773  {
774  typedef std::map<double,std::vector<double> > ValueMap;
775  ValueMap m;
776  mg->GetListOfGraphs()->ls();
777  TIter next(mg->GetListOfGraphs());
778  TGraph* g = 0;
779  while ((g = static_cast<TGraph*>(next()))) {
780  TGraphErrors* ge = 0;
781  TGraphAsymmErrors* ga = 0;
782  if (g->IsA()->InheritsFrom(TGraphErrors::Class()))
783  ge = static_cast<TGraphErrors*>(g);
784  else if (g->IsA()->InheritsFrom(TGraphAsymmErrors::Class()))
785  ga = static_cast<TGraphAsymmErrors*>(g);
786 
787  Int_t n = g->GetN();
788  for (Int_t i = 0; i < n; i++) {
789  Double_t x = g->GetX()[i];
790  Double_t y = g->GetY()[i];
791  Double_t eyl = (ge ? ge->GetEY()[i] :
792  ga ? ga->GetEYlow()[i] : 0);
793  Double_t eyh = (ge ? ge->GetEY()[i] :
794  ga ? ga->GetEYhigh()[i] : 0);
795  // Double_t data[] = { y, eyl, eyh };
796 
797  ValueMap::iterator j = m.begin();
798  for (; j != m.end(); ++j) {
799  ValueMap::iterator k = j;
800  k++;
801  if (TMath::Abs(x-j->first)<1e-1 && (k != m.end() && x < k->first)) {
802  break;
803  }
804  }
805  if (j != m.end()) {
806  j->second.push_back(y);
807  j->second.push_back(eyl);
808  j->second.push_back(eyh);
809  }
810  else {
811  m[x].push_back(y);
812  m[x].push_back(eyl);
813  m[x].push_back(eyh);
814  }
815  }
816  }
818 
819  TGraphAsymmErrors* ret = new TGraphAsymmErrors(m.size());
820 
821  ValueMap::iterator j = m.begin();
822  Int_t i = 0;
823  for (; j != m.end(); ++j) {
824  // printf("%7f (%d):", j->first, int(j->second.size()));
825  if (j->second.size() == 3) {
826  // Signular point
827  ret->SetPoint(i, j->first, j->second[0]);
828  ret->SetPointError(i, 0, 0, j->second[1], j->second[2]);
829  i++;
830  continue;
831  }
832  Combiner::List l;
833  for (size_t k = 0; k < j->second.size(); k += 3) {
834  l.Add(j->second[k],j->second[k+1],j->second[k+2]);
835  // std::cout << (k/3)+1 << ": " << l.fData.back() << std::endl;
836  }
839 
840  Combiner::Final f = sc.Calculate(b,e);
841  // std::cout << "Final: " << f << std::endl;
842  ret->SetPoint(i, j->first, f.fX);
843  ret->SetPointError(i, 0, 0, f.fEl, f.fEh);
844  i++;
845  // printf("\n");
846  }
847  return ret;
848  }
849  static Int_t FindCentBin(Color_t c)
850  {
851  // colors in decreasing cenrtality
852  Color_t cols[] = { 96, 86, 76, 66, 59, 55, 52, 0 };
853  Color_t *pc = cols;
854  Int_t idx = 0;
855  while (*pc) {
856  if (c == *pc) return idx;
857  pc++;
858  idx++;
859  }
860  return -1;
861  }
862 
872  static void Export(const TString& system,
873  UShort_t sNN,
874  const TString& trigger,
875  Bool_t rebinned=false,
876  Bool_t empirical=true)
877  {
878  TString e = SNNString(system, sNN);
879  TString n(Form("%s_%04d_%s_%s_%s.root",
880  system.Data(), sNN, trigger.Data(),
881  (rebinned ? "coarse" : "full"),
882  (empirical ? "empirical" : "mc")));
883  TFile* f = TFile::Open(n, "RECREATE");
884  THStack* s = GetStack(0, system, sNN, trigger, rebinned, empirical);
885 
886  TString trg = trigger;
887  Double_t* effs = FixTriggerEff(system, sNN, trg);
888  Double_t eff = (effs? effs[0] : 1);
889  TDirectory* fmd = f->mkdir("fmd");
890 
891  TMultiGraph* gf = new TMultiGraph("all","All Graphs");
892  TList* listH = s->GetHists();
893  TIter nextH(listH);
894  TH1* oH = 0;
895  TObjArray* byCent = (trigger.Contains("CENT") ? new TObjArray : 0);
896  while ((oH = static_cast<TH1*>(nextH()))) {
897  TString nm(oH->GetName());
898  if (nm.Contains("syserror", TString::kIgnoreCase)) continue;
899  // if (!nm.EndsWith("_all")) continue;
900 
901  oH->Scale(eff);
902  TString sys(nm);
903  sys.ReplaceAll("Forward", "SysError");
904  TH1* sA = static_cast<TH1*>(listH->FindObject(Form("%s_a", sys.Data())));
905  TH1* sC = static_cast<TH1*>(listH->FindObject(Form("%s_c", sys.Data())));
906  if (!sA) {
907  //Printf("W: Export - no A-side systematic error for %s",nm.Data());
908  sA = ErrorHist(oH, true);
909  }
910  else
911  sA->Scale(eff);
912  if (!sC) {
913  //Printf("W: Export - no C-side systematic error for %s",nm.Data());
914  sC = ErrorHist(oH, false);
915  }
916  else
917  sC->Scale(eff);
918 
919  TGraph* g = H2GA(oH, sA, sC);
920  fmd->cd();
921  g->Write();
922  gf->Add(g, "p1");
923 
924  if (!byCent) continue;
925  Int_t cBin = FindCentBin(g->GetMarkerColor());
926  if (cBin < 0) {
927  Printf("W: Export - didn't find centrality bin for %s (%d)",
928  oH->GetName(), g->GetMarkerColor());
929  continue;
930  }
931  TMultiGraph* cGraph = static_cast<TMultiGraph*>(byCent->At(cBin));
932  if (!cGraph) {
933  nm.ReplaceAll("dndetForward_","");
934  cGraph = new TMultiGraph;
935  cGraph->SetName(nm); // Form("c%03d", cBin));
936  byCent->AddAtAndExpand(cGraph, cBin);
937  }
938  cGraph->Add(g, "p1");
939  }
940  // s->Write();
941 
942 
943  TMultiGraph* other = GetOther(system, sNN, trigger);
944  if (other) {
945  TDirectory* spd = f->mkdir("spd");
946  spd->cd();
947  TIter nextG(other->GetListOfGraphs());
948  TGraph* oG = 0;
949  while ((oG = static_cast<TGraph*>(nextG()))) {
950  spd->cd();
951  oG->Write();
952  gf->Add(oG, "p1");
953 
954  if (!byCent) continue;
955  Int_t cBin = FindCentBin(oG->GetMarkerColor());
956  if (cBin < 0) {
957  Printf("W: Export - didn't find centrality bin for %s (%d)",
958  oG->GetName(), oG->GetMarkerColor());
959  continue;
960  }
961  TMultiGraph* cGraph = static_cast<TMultiGraph*>(byCent->At(cBin));
962  if (!cGraph) {
963  cGraph = new TMultiGraph;
964  byCent->AddAtAndExpand(cGraph, cBin);
965  }
966  cGraph->Add(oG, "p1");
967  }
968  // other->Write();
969  }
970  else
971  Warning("", "No other data for %s,%d,%s",
972  system.Data(),sNN,trigger.Data());
973  f->cd();
974  gf->Write();
975  gf->Draw("alp");
976 
977  if (!byCent) {
978  // TMultiGraph* tmp = new TMultiGraph();
979  // tmp->Add(gf);
980  // if (other) tmp->Add(other);
981  TGraphAsymmErrors* cf = Combine(gf);
982  cf->SetName("combined");
983  cf->SetTitle("Combined");
984  cf->SetMarkerStyle(24);
985  cf->SetMarkerColor(kGreen+2);
986  gf->Add(cf, "p");
987  cf->Write();
988  } else {
989  TMultiGraph* com = new TMultiGraph;
990  com->SetName("combined");
991  TIter next(byCent);
992  TMultiGraph* mg = 0;
993  while ((mg = static_cast<TMultiGraph*>(next()))) {
994  mg->ls();
995  TGraphAsymmErrors* cf = Combine(mg);
996  cf->SetName(Form("combined_%s",mg->GetName()));
997  cf->SetTitle("Combined");
998  cf->SetMarkerStyle(24);
999  cf->SetMarkerColor(static_cast<TGraph*>(mg->GetListOfGraphs()->At(0))
1000  ->GetMarkerColor());
1001  gf->Add(cf, "p");
1002  com->Add(cf, "p");
1003  cf->Write();
1004  }
1005  byCent->Write("bycent", TObject::kSingleKey);
1006  com->Write();
1007  }
1008 
1009 
1010  f->Write();
1011  Info("Export", "Exported data to %s", f->GetName());
1012  }
1019  static void AddSystematics(THStack* stack, Double_t sys)
1020  {
1021  TIter next(stack->GetHists());
1022  TH1* hist = 0;
1023  while ((hist = static_cast<TH1*>(next()))) {
1024  Int_t nBins = hist->GetNbinsX();
1025  for (Int_t bin = 1; bin <= nBins; bin++) {
1026  Double_t c = hist->GetBinContent(bin);
1027  if (c < 1e-6) continue;
1028  hist->SetBinError(bin, sys*c);
1029  }
1030  }
1031  }
1040  static THStack* Symmetrice(THStack* s1, THStack* s2)
1041  {
1042 
1043  THStack* res = new THStack("Result", "Result");
1044 
1045  Int_t nHist = s1->GetHists()->GetEntries();
1046  for (Int_t i = 0; i < nHist; i++) {
1047  TH1* h1 = static_cast<TH1*>(s1->GetHists()->At(i));
1048  TH1* h2 = static_cast<TH1*>(s2->GetHists()->At(i));
1049  Int_t nb = h1->GetNbinsX();
1050  Double_t x1 = h1->GetXaxis()->GetXmin();
1051  Double_t x2 = h1->GetXaxis()->GetXmax();
1052  Double_t dx = (x2-x1)/nb;
1053 
1054  Int_t hb = (x2+x2) / dx;
1055  TH1* h = new TH1D(h1->GetName(), h1->GetTitle(), hb, -x2, x2);
1056  h->SetMarkerStyle(h1->GetMarkerStyle());
1057  h->SetMarkerColor(h1->GetMarkerColor());
1058  h->SetMarkerSize(h1->GetMarkerSize());
1059  h->SetFillStyle(kGray); // h1->GetFillStyle());
1060  h->SetFillColor(1001); // h1->GetFillColor());
1061  h->SetLineColor(h1->GetLineColor());
1062 
1063  for (Int_t j = 1; j <= hb; j++) {
1064  Double_t x = h->GetXaxis()->GetBinCenter(j);
1065  Int_t b1 = h1->GetXaxis()->FindBin(x);
1066  Int_t b2 = h2->GetXaxis()->FindBin(-x);
1067  Double_t xx1 = h1->GetXaxis()->GetBinCenter(b1);
1068  Double_t xx2 = -h2->GetXaxis()->GetBinCenter(b2);
1069  Double_t c1 = h1->GetBinContent(b1);
1070  Double_t c2 = h2->GetBinContent(b2);
1071  Double_t e1 = 0.08*c1; // h1->GetBinError(b1);
1072  Double_t e2 = 0.08*c2; // h2->GetBinError(b2);
1073 
1074  if (TMath::Abs(xx1+xx2) < 1e-6) {
1075  Double_t cc = .5 * (c1+c2);
1076  Double_t ee = TMath::Sqrt(e1*e1+e2*e2);
1077  // Info("", "@ %f, fill with mean %f+/-%f", x, cc, ee);
1078  h->SetBinContent(j, cc);
1079  h->SetBinError(j, ee);
1080  }
1081  else if (c1 > 0) {
1082  // Info("", "@ %f fill with %f+/-%f (1)", x, c1, e1);
1083  h->SetBinContent(j, c1);
1084  h->SetBinError(j, e1);
1085  }
1086  else if (c2 > 0) {
1087  // Info("", "@ %f fill with %f+/-%f (2)", x, c2, e2);
1088  h->SetBinContent(j, c2);
1089  h->SetBinError(j, e2);
1090  }
1091  } // for j
1092  res->Add(h);
1093  } // for i
1094 
1095  return res;
1096  }
1104  static THStack* Symmetrice(THStack* s)
1105  {
1106  THStack* res = new THStack("res", s->GetTitle());
1107 
1108  Int_t nHist = s->GetHists()->GetEntries();
1109  for (Int_t i = 0; i < nHist; i++) {
1110  TH1* h1 = static_cast<TH1*>(s->GetHists()->At(i));
1111  Int_t nb = h1->GetNbinsX();
1112  Double_t x1 = h1->GetXaxis()->GetXmin();
1113  Double_t x2 = h1->GetXaxis()->GetXmax();
1114  Double_t dx = (x2-x1)/nb;
1115 
1116  Int_t hb = (x2+x2) / dx;
1117  TH1* h = new TH1D(h1->GetName(), h1->GetTitle(), hb, -x2, x2);
1118  h->SetMarkerStyle(h1->GetMarkerStyle());
1119  h->SetMarkerColor(h1->GetMarkerColor());
1120  h->SetMarkerSize(h1->GetMarkerSize());
1121  h->SetFillStyle(kGray); // h1->GetFillStyle());
1122  h->SetFillColor(1001); // h1->GetFillColor());
1123  h->SetLineColor(h1->GetLineColor());
1124 
1125  for (Int_t j = 1; j <= hb; j++) {
1126  Double_t x = h->GetXaxis()->GetBinCenter(j);
1127  Int_t b1 = h1->GetXaxis()->FindBin(x);
1128  Int_t b2 = h1->GetXaxis()->FindBin(-x);
1129  Double_t c1 = h1->GetBinContent(b1);
1130  Double_t c2 = h1->GetBinContent(b2);
1131  Double_t e1 = 0.08*c1; // h1->GetBinError(b1);
1132  Double_t e2 = 0.08*c2; // h2->GetBinError(b2);
1133 
1134  if (c1 > 0 && c2 > 0) {
1135  Double_t cc = .5 * (c1+c2);
1136  Double_t ee = TMath::Sqrt(e1*e1+e2*e2);
1137  // Info("", "@ %f, fill with mean %f+/-%f", x, cc, ee);
1138  h->SetBinContent(j, cc);
1139  h->SetBinError(j, ee);
1140  }
1141  else if (c1 > 0) {
1142  // Info("", "@ %f fill with %f+/-%f (1)", x, c1, e1);
1143  h->SetBinContent(j, c1);
1144  h->SetBinError(j, e1);
1145  }
1146  else if (c2 > 0) {
1147  // Info("", "@ %f fill with %f+/-%f (2)", x, c2, e2);
1148  h->SetBinContent(j, c2);
1149  h->SetBinError(j, e2);
1150  }
1151  } // for j
1152  res->Add(h);
1153  } // for i
1154  return res;
1155  }
1164  static void pPbSym(const TString& trigger,
1165  const Option_t* option="e3",
1166  Bool_t rebinned=true,
1167  Bool_t empirical=true)
1168  {
1169  TString system("pPb");
1170  TString system2("Pbp");
1171  UShort_t sNN = 5023;
1172  TString e = SNNString(system, sNN);
1173  TCanvas* canvas = MakeCanvas(system, sNN, trigger);
1174 
1175  TString t1(trigger); t1.ReplaceAll("X", "A");
1176  TString t2(trigger); t2.ReplaceAll("X", "C");
1177  THStack* s1 = GetStack(0, system, sNN, t1, rebinned, empirical);
1178  THStack* s2 = GetStack(0, system2, sNN, t2, rebinned, empirical);
1179 
1180  if (!s1 || !s2) {
1181  delete canvas;
1182  return;
1183  }
1184  s1->SetTitle(canvas->GetTitle());
1185  s2->SetTitle(canvas->GetTitle());
1186 
1187  THStack* res = Symmetrice(s1, s2);
1188  res->Draw(Form("nostack %s", option));
1189 
1190  TMultiGraph* other = GetOther(system, sNN, t1);
1191  if (other) {
1192  TIter next(other->GetListOfGraphs());
1193  TGraph* g = 0;
1194  while ((g = static_cast<TGraph*>(next()))) {
1195  g->SetFillColor(kGray);
1196  g->SetFillStyle(3001);
1197  g->Draw(Form("p same %s", option));
1198  }
1199  }
1200  else
1201  Warning("", "No other data for %s,%d,%s",
1202  system.Data(),sNN,trigger.Data());
1203 
1204 
1205  PrintCanvas(canvas, "pdf png");
1206  }
1220  static void ScaleBypp(const TString& system,
1221  UShort_t sNN,
1222  UShort_t ppsNN,
1223  const TString& trigger,
1224  const TString& ppTrigger,
1225  Double_t etaShift=0,
1226  Bool_t rebinned=true,
1227  Bool_t empirical=true,
1228  Bool_t write=false)
1229  {
1230  THStack* pp = GetStack(0, "pp", ppsNN, ppTrigger, rebinned, empirical);
1231  if (!pp) return;
1232 
1233  THStack* tgt = GetStack(0, system, sNN, trigger, rebinned, empirical);
1234  if (!tgt) return;
1235 
1236  TH1* ref = static_cast<TH1*>(pp->GetHists()
1237  ->FindObject("dndetaForward_all"));
1238  TGraphErrors* g = H2G(ref, etaShift);
1239  if (!g) return;
1240 
1241  TGraph* low = 0;
1242  TGraph* up = 0;
1243  // Info("", "Get denominator error bands");
1244  ErrorGraphs(g, low, up);
1245 
1246  TMultiGraph* outRatio = (write ? new TMultiGraph("fwd","") : 0);
1247  TMultiGraph* outPP = (write ? new TMultiGraph("pp","") : 0);
1248  THStack* ratios = new THStack("ratios", tgt->GetTitle());
1249  TIter next(tgt->GetHists());
1250  TH1* h = 0;
1251 
1252  while ((h = static_cast<TH1*>(next()))) {
1253  TH1* r = HOverG(h, g, low, up);
1254  ratios->Add(r);
1255  if (outRatio) {
1256  TGraph* rg = H2G(r, 0);
1257  rg->SetLineColor(h->GetLineColor());
1258  rg->SetLineStyle(h->GetLineStyle());
1259  rg->SetFillColor(kBlue-10);
1260  rg->SetFillStyle(0);
1261  outRatio->Add(rg, "p");
1262  }
1263  }
1264  if (outPP) outPP->Add(g, "p");
1265  delete low;
1266  delete up;
1267 
1268  TString eTgt = SNNString(system, sNN);
1269  TString epp = SNNString("pp", ppsNN);
1270 
1271  TString tTgt(Form("%s %s %s", system.Data(), eTgt.Data(), trigger.Data()));
1272  TString tpp(Form("pp %s %s", epp.Data(), ppTrigger.Data()));
1273  TString t(Form("%s scaled by %s", tTgt.Data(), tpp.Data()));
1274  ratios->SetTitle(t);
1275 
1276  TCanvas* canvas = MakeCanvas(system, sNN, trigger);
1277  canvas->SetName(Form("%s_%04d_%s_pp_%04d_%s",
1278  system.Data(), sNN, trigger.Data(),
1279  ppsNN, ppTrigger.Data()));
1280  canvas->SetTitle(t);
1281 
1282  ratios->Draw("nostack");
1283  ratios->GetXaxis()->SetTitle(Form("#eta%s",
1284  (TMath::Abs(etaShift) < 1e-6
1285  ? "" : "-#eta_{MC}")));
1286  const char* dNdeta = "1/#it{N} d#it{N}_{ch}/d#it{#eta}";
1287  ratios->GetYaxis()->SetTitle(Form("#frac{%s|_{%s}}{%s|_{%s}}",
1288  dNdeta, tTgt.Data(), dNdeta, tpp.Data()));
1289  ratios->GetYaxis()->SetTitleOffset(1.5);
1290 
1291  TMultiGraph* other = GetOther(system, sNN, trigger);
1292  TMultiGraph* ppOther = GetOther("pp", ppsNN, ppTrigger);
1293  TMultiGraph* outOther = (write ? new TMultiGraph("cen", "") : 0);
1294  if (other && ppOther && ppOther->GetListOfGraphs()) {
1295  // Info("", "Got %d others", other->GetListOfGraphs()->GetEntries());
1296  TGraph* otherRef =
1297  static_cast<TGraph*>(ppOther->GetListOfGraphs()->At(0));
1298  TGraph* dlow = 0;
1299  TGraph* dup = 0;
1300  // Info("", "Get other denominator error bands");
1301  if (otherRef->IsA()->InheritsFrom(TGraphAsymmErrors::Class()))
1302  ErrorGraphs(static_cast<TGraphAsymmErrors*>(otherRef), dlow, dup);
1303  else if (otherRef->IsA()->InheritsFrom(TGraphErrors::Class()))
1304  ErrorGraphs(static_cast<TGraphErrors*>(otherRef), dlow, dup);
1305  else
1306  ErrorGraphs(otherRef, dlow, dup);
1307 
1308  if (otherRef) {
1309  outPP->Add(otherRef, "p");
1310  TIter nextG(other->GetListOfGraphs());
1311  TGraph* g1 = 0;
1312  while ((g1 = static_cast<TGraph*>(nextG()))) {
1313  TGraph* rg = GOverG(g1, otherRef, dlow, dup, etaShift);
1314  if (rg) rg->Draw("p same");
1315  outOther->Add(rg, "p");
1316  }
1317  }
1318  delete dlow;
1319  delete dup;
1320  }
1321  else
1322  Warning("", "No other data for %s,%d,%s",
1323  system.Data(),sNN,trigger.Data());
1324 
1325  PrintCanvas(canvas,"pdf png");
1326 
1327  if (!write) return;
1328  TFile* out = TFile::Open(Form("%s/%s.root", PlotPrefix(),
1329  canvas->GetName()), "RECREATE");
1330  outRatio->Write();
1331  outOther->Write();
1332  outPP->Write();
1333  out->Write();
1334  }
1346  static void SymScaleBypp(UShort_t ppsNN,
1347  const TString& trigger,
1348  const TString& ppTrigger,
1349  const Option_t* option="e2",
1350  Bool_t rebinned=true,
1351  Bool_t empirical=true,
1352  Bool_t write=false)
1353  {
1354  TString system("pPb");
1355  TString system2("Pbp");
1356  UShort_t sNN = 5023;
1357  TString e = SNNString(system, sNN);
1358 
1359  TString t1(trigger); t1.ReplaceAll("X", "A");
1360  TString t2(trigger); t2.ReplaceAll("X", "C");
1361  THStack* s1 = GetStack(0, system, sNN, t1, rebinned, empirical);
1362  THStack* s2 = GetStack(0, system2, sNN, t2, rebinned, empirical);
1363 
1364  if (!s1 || !s2) return;
1365  THStack* tgt = Symmetrice(s1, s2);
1366  THStack* pp = Symmetrice(GetStack(0, "pp", ppsNN, ppTrigger,
1367  rebinned, empirical));
1368  if (!pp) return;
1369 
1370  TH1* ref = static_cast<TH1*>(pp->GetHists()
1371  ->FindObject("dndetaForward_all"));
1372  TGraphErrors* g = H2G(ref, 0);
1373  if (!g) return;
1374 
1375  TGraph* low = 0;
1376  TGraph* up = 0;
1377  // Info("", "Get denominator error bands");
1378  ErrorGraphs(g, low, up);
1379 
1380  THStack* ratios = new THStack("ratios", tgt->GetTitle());
1381  TMultiGraph* outRatio = (write ? new TMultiGraph("fwd","") : 0);
1382  TMultiGraph* outPP = (write ? new TMultiGraph("pp","") : 0);
1383  TMultiGraph* outdNdeta = (write ? new TMultiGraph("dNdeta","") : 0);
1384  TIter next(tgt->GetHists());
1385  TH1* h = 0;
1386  while ((h = static_cast<TH1*>(next()))) {
1387  TH1* r = HOverG(h, g, low, up, true);
1388  r->SetFillStyle(0);
1389  r->SetFillColor(kBlue-10);
1390  Info("", "Adding %s to stack", r->GetName());
1391  ratios->Add(r, "p");
1392  if (outRatio) {
1393  TGraph* rg = H2G(r, 0);
1394  rg->SetLineColor(h->GetLineColor());
1395  rg->SetLineStyle(h->GetLineStyle());
1396  rg->SetFillColor(kBlue-10);
1397  rg->SetFillStyle(0);
1398  outRatio->Add(rg, "p");
1399  }
1400  if (outdNdeta) {
1401  TGraph* hg = H2G(h, 0);
1402  hg->SetLineColor(h->GetMarkerColor());
1403  outdNdeta->Add(hg, "p");
1404  }
1405  }
1406  if (outPP) {
1407  outPP->Add(g, "p1");
1408  }
1409  delete low;
1410  delete up;
1411 
1412  TString eTgt = SNNString(system, sNN);
1413  TString epp = SNNString("pp", ppsNN);
1414  TString tTgt(Form("%s %s %s", system.Data(), eTgt.Data(), trigger.Data()));
1415  TString tpp(Form("pp %s %s", epp.Data(), ppTrigger.Data()));
1416  TString t(Form("%s scaled by %s", tTgt.Data(), tpp.Data()));
1417  ratios->SetTitle(t);
1418 
1419  TCanvas* canvas = MakeCanvas(system, sNN, trigger);
1420  canvas->SetName(Form("%s_%04d_%s_pp_%04d_%s_sym",
1421  system.Data(), sNN, trigger.Data(),
1422  ppsNN, ppTrigger.Data()));
1423  canvas->SetTitle(t.Data());
1424 
1425  ratios->Draw(Form("nostack %s", option));
1426  ratios->GetXaxis()->SetTitle("#eta");
1427  const char* dNdeta = "1/#it{N} d#it{N}_{ch}/d#it{#eta}";
1428  ratios->GetYaxis()->SetTitle(Form("#frac{%s|_{%s}}{%s|_{%s}}",
1429  dNdeta, tTgt.Data(), dNdeta, tpp.Data()));
1430  ratios->GetYaxis()->SetTitleOffset(1.5);
1431  if (outRatio && outRatio->GetHistogram()) {
1432  outRatio->GetHistogram()->SetXTitle(ratios->GetXaxis()->GetTitle());
1433  outRatio->GetHistogram()->SetYTitle(ratios->GetYaxis()->GetTitle());
1434  }
1435 
1436  TMultiGraph* other = GetOther(system, sNN, t1);
1437  TMultiGraph* ppOther = GetOther("pp", ppsNN, ppTrigger);
1438  TMultiGraph* outOther = (write ? new TMultiGraph("cen", "") : 0);
1439  if (other && ppOther && ppOther->GetListOfGraphs()) {
1440  // Info("", "Got %d others", other->GetListOfGraphs()->GetEntries());
1441  TGraph* otherRef =
1442  static_cast<TGraph*>(ppOther->GetListOfGraphs()->At(0));
1443  TGraph* dlow = 0;
1444  TGraph* dup = 0;
1445  if (outPP) {
1446  outPP->Add(otherRef, "p1");
1447  }
1448  // Info("", "Get other denominator error bands");
1449  if (otherRef->IsA()->InheritsFrom(TGraphAsymmErrors::Class()))
1450  ErrorGraphs(static_cast<TGraphAsymmErrors*>(otherRef), dlow, dup);
1451  else if (otherRef->IsA()->InheritsFrom(TGraphErrors::Class()))
1452  ErrorGraphs(static_cast<TGraphErrors*>(otherRef), dlow, dup);
1453  else
1454  ErrorGraphs(otherRef, dlow, dup);
1455 
1456  if (otherRef) {
1457  TIter nextG(other->GetListOfGraphs());
1458  TGraph* g1 = 0;
1459  while ((g1 = static_cast<TGraph*>(nextG()))) {
1460  TGraph* rg = GOverG(g1, otherRef, dlow, dup, 0);
1461  rg->SetLineColor(g1->GetLineColor());
1462  rg->SetLineStyle(g1->GetLineStyle());
1463  rg->SetFillColor(kBlue-10);
1464  rg->SetFillStyle(0);
1465  if (rg) rg->Draw(Form("p same %s", option));
1466  if (outOther) outOther->Add(rg, "p1");
1467  if (outdNdeta) {
1468  g1->SetLineColor(g1->GetMarkerColor());
1469  outdNdeta->Add(g1, "p");
1470  }
1471  }
1472  }
1473  delete dlow;
1474  delete dup;
1475  }
1476  else
1477  Warning("", "No other data for %s,%d,%s",
1478  system.Data(),sNN,trigger.Data());
1479  if (outOther && outOther->GetHistogram()) {
1480  outOther->GetHistogram()->SetXTitle(ratios->GetXaxis()->GetTitle());
1481  outOther->GetHistogram()->SetYTitle(ratios->GetYaxis()->GetTitle());
1482  }
1483 
1484  PrintCanvas(canvas, "png pdf");
1485 
1486  if (!write) return;
1487  TFile* out = TFile::Open(Form("%s/%s.root",PlotPrefix(),
1488  canvas->GetName()), "RECREATE");
1489  out->cd();
1490  outRatio->Write();
1491  outOther->Write();
1492  outdNdeta->Write();
1493  outPP->Write();
1494  out->Write();
1495 
1496  }
1503  static void Add2Out(TString& out, const char* what)
1504  {
1505  if (!out.IsNull()) out.Append("_");
1506  out.Append(what);
1507  }
1514  static void Add2Out(TString& out, UShort_t sNN)
1515  {
1516  if (!out.IsNull()) out.Append("_");
1517  out.Append(Form("%04d", sNN));
1518  }
1527  static void DrawAll(const char** syss,
1528  UShort_t* sNNs,
1529  const char** trgS,
1530  UShort_t flags=0x0)
1531  {
1532  Int_t nSys = 0;
1533  Int_t nSNN = 0;
1534  Int_t nTrg = 0;
1535  const char** pSys = syss;
1536  UShort_t* pSNN = sNNs;
1537  const char** pTrg = trgS;
1538  const char* exps[] = { "ALICE", "CMS", "WIP", 0 };
1539  TString out;
1540  while (*pSys) { nSys++; Add2Out(out, *pSys); pSys++; }
1541  while (*pSNN) { nSNN++; Add2Out(out, *pSNN); pSNN++; }
1542  while (*pTrg) { nTrg++; Add2Out(out, *pTrg); pTrg++; }
1543  if (nSys <= 0) {
1544  ::Warning("DrawAll", "No systems specified");
1545  return;
1546  }
1547  if (nSNN <= 0) {
1548  ::Warning("DrawAll", "No energies specified");
1549  return;
1550  }
1551  if (nTrg <= 0) {
1552  ::Warning("DrawAll", "No triggers specified");
1553  return;
1554  }
1555 
1556  if (nSys != 1 && nSNN != 1 && nTrg != 1) {
1557  ::Warning("DrawAll", "At least one of sys (%d), sNN (%d), "
1558  "or trg (%d) must be singular", nSys, nSNN, nTrg);
1559  return;
1560  }
1561  Int_t nHoriz = 0;
1562  Int_t nVert = 1;
1563  if (nSys == 1) { nHoriz = nSNN; }
1564  if (nSNN == 1) { nHoriz = nSys; }
1565 
1566  const Color_t kAliceBlue = AliceBlue();
1567  // const Color_t kAliceRed = AliceRed();
1568 
1569  Bool_t collapse = (flags & 0x1);
1570  TCanvas* c = new TCanvas("all", out, nHoriz*500, nVert*500);
1571  c->SetTopMargin(0.01);
1572  c->SetRightMargin(0.01);
1573  if (collapse)
1574  c->Divide(nHoriz, nVert, 0, 0);
1575  else
1576  c->Divide(nHoriz, nVert);
1577 
1578  // --- Loop over specs -------------------------------------------
1579  TList stacks;
1580  Double_t max = 0;
1581  TObjArray unique;
1582  const Double_t pp8000e[] = { 0.85, 0.93, 1, 0 };
1583  Double_t lw = (nSNN == 1 ? .6 : .83);
1584  Double_t ly1 = (nSNN == 1 ? .7 : .15);
1585  Double_t ly2 = (nSNN == 1 ? .95 : .35);
1586 
1587  Int_t iPad = 1;
1588  pSys = syss;
1589  while (*pSys) {
1590  pSNN = sNNs;
1591  while (*pSNN) {
1592  TVirtualPad* q = c->cd(iPad++);
1593  TLegend* leg = 0;
1594  if (pSys == syss && pSNN == sNNs) {
1595  Double_t lx1 = .15;
1596  leg = new TLegend(lx1,
1597  ly1 /*0.24*/, lx1+lw, ly2); // , stit);
1598  leg->SetNColumns(nTrg == 1 ? 2 : nTrg);
1599  leg->SetFillColor(0);
1600  leg->SetFillStyle(0);
1601  leg->SetBorderSize(0);
1602  leg->SetTextColor(kAliceBlue);
1603  leg->SetTextFont(42);
1604  }
1605  const Double_t* effs = ((((*pSys)[0] == (*pSys)[1]) && *pSNN == 8000)
1606  ? pp8000e : 0);
1607 
1608  TPair* p = GetDataOther(leg, unique, *pSys, *pSNN, trgS, exps,
1609  "e5", true, true, effs);
1610  if (!p) {
1611  Warning("", "No data for pad %d", iPad-1);
1612  pSNN++;
1613  continue;
1614  }
1615  if (!p->Key()) {
1616  Warning("", "No data for pad %d", iPad-1);
1617  pSNN++;
1618  continue;
1619  }
1620  THStack* stack = static_cast<THStack*>(p->Key());
1621  stacks.Add(stack);
1622  if (nSNN == 1) stack->SetTitle(*pSys);
1623  if (nTrg == 1) stack->SetTitle(Form("%s - %s", *pSys, trgS[0]));
1624  Double_t lFac = (TString("Pbp").EqualTo(*pSys) ? 1.5 : 1.2);
1625  Double_t lMax = lFac*stack->GetMaximum("nostack");
1626  stack->SetMaximum(lMax);
1627  stack->SetMinimum(.3);
1628  stack->Draw("nostack");
1629  stack->GetHistogram()->SetXTitle("#eta");
1630  stack->GetHistogram()->SetYTitle("1/#it{N} d#it{N}_{ch}/d#it{#eta}");
1631  max = TMath::Max(lMax, max);
1632  // Info("", "Maximum: %f (%f)", lMax, max);
1633  if (p->Value()) {
1634  p->Value()->Draw("p");
1635  }
1636  if (leg) leg->Draw();
1637 
1638  q->Modified();
1639  q->Update();
1640  q->cd();
1641 
1642  pSNN++;
1643  }
1644  pSys++;
1645  }
1646 
1647  Int_t nPad = nHoriz * nVert;
1648  if (collapse) {
1649  // ::Info("", "Maximum is %f", max);
1650  TIter iStack(&stacks);
1651  THStack* stack = 0;
1652  while ((stack = static_cast<THStack*>(iStack())))
1653  stack->SetMaximum(max);
1654  for (iPad = 1; iPad <= nPad; iPad++) {
1655  TVirtualPad* q = c->cd(iPad);
1656  q->Modified();
1657  q->Update();
1658  q->cd();
1659  }
1660  }
1661 
1662  // --- Make legend of unique names -------------------------------
1663  TParameter<int>* u =
1664  new TParameter<int>("PWG-LF/GEO - work in progress", 20);
1665  u->SetUniqueID(nSNN == 1 ? kBlack : kRed+2);
1666  unique.Add(u);
1667 
1668  Double_t lx1 = 1-lw-.02;
1669  ly2 = TMath::Max(ly2,0.5);
1670  if (nPad == 1) {
1671  ly2 = ly1;
1672  ly1 = 0.5;
1673  }
1674 
1675  TLegend* uleg = MakeUniqueLegend(lx1,ly1,lx1+lw,ly2,unique, nSNN);
1676  TVirtualPad* q = c->cd(nPad);
1677  q->SetRightMargin(0.01);
1678  uleg->Draw();
1679 
1680  PrintCanvas(c, "pdf png");
1681  c->SaveAs(Form("%s/%s.root", PlotPrefix(), out.Data()));
1682 
1683  }
1684  static TLatex* MakeTitle(Double_t x, Double_t y,
1685  const TString& system,
1686  UShort_t sNN,
1687  const TString& trigger)
1688  {
1689  TString e = SNNString(system, sNN);
1690  TString t = trigger;
1691  if (t.Contains("CENT")) {
1692  t.ReplaceAll("CENT", "by centrality (");
1693  t.Append(")");
1694  }
1695  TString txt(Form("%s @ %s %s",
1696  system.Data(), e.Data(), t.Data()));
1697  TLatex* ltx = new TLatex(x, y, txt);
1698  ltx->SetTextFont(42);
1699  ltx->SetTextColor(AliceBlue());
1700  ltx->SetNDC();
1701 
1702  ltx->Draw();
1703 
1704  return ltx;
1705  }
1706  static TLegend* MakeUniqueLegend(Double_t x1,
1707  Double_t y1,
1708  Double_t x2,
1709  Double_t y2,
1710  TObjArray& unique,
1711  Int_t nSNN)
1712  {
1713  const Color_t kAliceBlue = AliceBlue();
1714 
1715  TLegend* uleg = new TLegend(x1, y1, x2, y2 /*0.23*/);
1716  uleg->SetNColumns(1 /*2*/);
1717  uleg->SetFillColor(0);
1718  uleg->SetFillStyle(0);
1719  uleg->SetBorderSize(0);
1720  uleg->SetTextColor(kAliceBlue);
1721  uleg->SetTextFont(42);
1722 
1723  return MakeUniqueLegend(uleg, unique, nSNN);
1724  }
1725  static TLegend* MakeUniqueLegend(TLegend* uleg, TObjArray& unique, Int_t nSNN)
1726  {
1727  TIter nextU(&unique);
1728  TLegendEntry* e = 0;
1729  TParameter<int>* u = 0;
1730  while ((u = static_cast<TParameter<int>*>(nextU()))) {
1731  e = uleg->AddEntry("dummy", u->GetName(), nSNN == 1 ? "p" : "f");
1732  e->SetMarkerStyle(u->GetVal());
1733  e->SetMarkerSize(1.7);
1734  e->SetMarkerColor(u->GetUniqueID());
1735  e->SetFillColor(u->GetUniqueID());
1736  e->SetFillStyle(1001);
1737  e->SetLineColor(kBlack); // u->GetUniqueID());
1738  }
1739  return uleg;
1740  }
1748  static Float_t MarkerSize(Int_t style)
1749  {
1750  switch (style) {
1751  case 20: return 1.6;
1752  case 21: return 1.5;
1753  case 22: return 1.7;
1754  }
1755  ::Warning("", "Marker style %d maps to default", style);
1756  return 1.6;
1757  }
1758  static const char* CentLimitName(Bool_t isMult, Float_t v)
1759  {
1760  if (isMult) return Form("%3d", Int_t(v));
1761  if ((Int_t(v*100) % 100) == 0) return Form("%3d%%", Int_t(v));
1762  if ((Int_t(v*100) % 10) == 0) return Form("%5.1f%%", v);
1763  return Form("%6.2f%%", v);
1764  }
1781  static TPair* GetDataOther(TLegend* leg,
1782  TObjArray& unique,
1783  const TString& system,
1784  UShort_t sNN,
1785  const char** trigs,
1786  const char** exps,
1787  Option_t* errOpt="e5",
1788  Bool_t rebinned=false,
1789  Bool_t empirical=true,
1790  const Double_t* effs=0)
1791  {
1792 
1793  TPair* ret = 0;
1794  TString stit = SNNString(system, sNN);
1795  THStack* stack = new THStack("stack", stit.Data());
1796  TList points;
1797  Int_t marker = 20;
1798  Bool_t seSeen = false;
1799  Int_t fill = 0;
1800  Int_t style = 3001;
1801  TLegendEntry* e = 0;
1802  const char** ptrig = trigs;
1803  const Double_t* peff = effs;
1804  TString allT = "";
1805  Int_t verbose= 0;
1806  // if (leg) leg->SetHeader(stit);
1807  points.SetOwner(false);
1808  while ((*ptrig)) {
1809  if (!allT.IsNull()) allT = ",";
1810  allT.Append(*ptrig);
1811 
1812  TString trg(*ptrig);
1813  Bool_t isCent = trg.BeginsWith("CENT");
1814  THStack* tmp = GetStack(0, system, sNN, *ptrig,
1815  rebinned, empirical, isCent ? 20 : marker);
1816  if (!tmp) {
1817  Warning("", "No data for %s %d %s", system.Data(), sNN, *ptrig);
1818  ptrig++;
1819  marker++;
1820  if (peff) peff++;
1821  continue;
1822  }
1823  Double_t eff = (sNN == 8000 && peff ? *peff : 1);
1824  TList* lst = tmp->GetHists();
1825  TIter next(lst);
1826  TObject* o = 0;
1827  while ((o = next())) {
1828  TString n(o->GetName());
1829  if (n.Contains("mirror")) continue;
1830  TH1* h = static_cast<TH1*>(o->Clone());
1831  if (isCent) {
1832  Color_t cOld = h->GetMarkerColor();
1833  Color_t cNew = Brighten(cOld);
1834  h->SetMarkerColor(Brighten(h->GetMarkerColor()));
1835  h->SetFillColor(Brighten(h->GetFillColor()));
1836  h->SetLineColor(Brighten(h->GetLineColor()));
1837  Printf("%s: old=%d new=%d real=%d",n.Data(),
1838  cOld,cNew,h->GetMarkerColor());
1839  }
1840  h->SetDirectory(0);
1841  h->Scale(eff);
1842  if (n.Contains("SysError")) {
1843  seSeen = true;
1844  fill = h->GetFillColor();
1845  style = h->GetFillStyle();
1846  TH1* hc = static_cast<TH1*>(h->Clone(Form("%s_syserror_C",*ptrig)));
1847  TH1* ha = h;
1848  ha->SetName(Form("%s_syserror_A", *ptrig));
1849  for (Int_t j = 1; j < h->GetNbinsX(); j++) {
1850  Double_t x = h->GetXaxis()->GetBinCenter(j);
1851  TH1* z = (x < 0 ? ha : hc);
1852  z->SetBinContent(j, 0);
1853  z->SetBinError(j, 0);
1854  }
1855 
1856  stack->Add(ha, errOpt);
1857  stack->Add(hc, errOpt);
1858  continue;
1859  } // SysError
1860  if (!isCent) h->SetName(*ptrig);
1861  h->SetMarkerSize(MarkerSize(h->GetMarkerStyle()));
1862  points.Add(h);
1863 
1864  if (leg) {
1865  TString nm(*ptrig);
1866  if (isCent) {
1867  TString ct(h->GetName());
1868  // Info("", "Centralty %s", ct.Data());
1869  Int_t idx = ct.Index("cent");
1870  if (idx != kNPOS) {
1871  ct.Remove(0,idx+4);
1872  TObjArray* tokens = ct.Tokenize("_");
1873  TString t1 = tokens->At(0)->GetName();
1874  TString t2 = tokens->At(1)->GetName();
1875  TString s1 = t1.Strip(TString::kLeading, '0');
1876  TString s2 = t2.Strip(TString::kLeading, '0');
1877  s1.ReplaceAll("d", ".");
1878  s2.ReplaceAll("d", ".");
1879  TString c1 = CentLimitName(false, s1.Atof());
1880  TString c2 = CentLimitName(false, s2.Atof());
1881  nm = Form("%s-%s", c1.Data(), c2.Data());
1882  // Printf("Got name=%s t1=%s t2=%s c1=%s c2=%s -> %s",
1883  // ct.Data(), t1.Data(), t2.Data(), s1.Data(), s2.Data(),
1884  // nm.Data());
1885  tokens->Delete();
1886  // Printf("%s (%s %s -> %s %s)", nm.Data(),
1887  // t1.Data(), c1.Data(),
1888  // t2.Data(), c2.Data());
1889 
1890  }
1891  }
1892  e = leg->AddEntry("dummy", nm, "pl");
1893  e->SetMarkerStyle(h->GetMarkerStyle());
1894  e->SetMarkerSize(h->GetMarkerSize());
1895  if (isCent) {
1896  e->SetLineColor(h->GetLineColor());
1897  e->SetMarkerColor(h->GetMarkerColor());
1898  }
1899  }
1900  }
1901 
1902  delete tmp;
1903  ptrig++;
1904  marker++;
1905  if (peff) peff++;
1906  }
1907  if (points.GetEntries() <= 0) {
1908  ::Warning("", "No data for %s %d %s", system.Data(), sNN, allT.Data());
1909  delete stack;
1910  return ret;
1911  }
1912 
1913  if (leg) {
1914  leg->SetTextFont(42);
1915  leg->SetTextColor(AliceBlue());
1916  }
1917  if (false && seSeen && leg) {
1918  e = leg->AddEntry("dummy", "7.6% sys. error", "f");
1919  e->SetFillColor(fill);
1920  e->SetFillStyle(style);
1921  leg->SetNColumns(leg->GetNColumns()+1);
1922  }
1923  TIter nextP(&points);
1924  TH1* data = 0;
1925  while ((data = static_cast<TH1*>(nextP())))
1926  stack->Add(data);
1927 
1928  stack->SetMaximum(1.2*stack->GetMaximum("nostack"));
1929  stack->SetMinimum(.3);
1930 
1931  ptrig = trigs;
1932  marker = 20;
1933  TParameter<int>* u = 0;
1934  TMultiGraph* other = new TMultiGraph("others","Others");
1935  TString allE = "";
1936  while ((*ptrig)) {
1937  const char** pexp = exps;
1938  TString trg(*ptrig);
1939  Bool_t isCent = (trg.BeginsWith("CENT"));
1940 
1941  while ((*pexp)) {
1942  if (ptrig == trigs) {
1943  if (!allE.IsNull()) allE.Append(",");
1944  allE.Append(*pexp);
1945  }
1946  Info("", "System=%s sNN=%d Trigger=%s Exp=%s", system.Data(),
1947  sNN, *ptrig, *pexp);
1948  TMultiGraph* mg = GetOther(system, sNN, *ptrig, *pexp, verbose);
1949  if (!mg) {
1950  pexp++;
1951  continue;
1952  }
1953  TIter nextG(mg->GetListOfGraphs());
1954  TGraph* g = 0;
1955  while ((g = static_cast<TGraph*>(nextG()))) {
1956  // g->Draw("p same");
1957  other->Add(g, "p");
1958  if (!isCent) {
1959  g->SetMarkerStyle(marker);
1960  g->SetMarkerSize(MarkerSize(marker));
1961  }
1962  if (isCent) {
1963  Color_t cOld = g->GetMarkerColor();
1964  Color_t cNew = Brighten(cOld);
1965  g->SetMarkerColor(Brighten(g->GetMarkerColor()));
1966  g->SetFillColor(Brighten(g->GetFillColor()));
1967  g->SetLineColor(Brighten(g->GetLineColor()));
1968  Printf("%s: old=%d new=%d real=%d",g->GetName(),
1969  cOld,cNew,g->GetMarkerColor());
1970  }
1971  TString ut(g->GetTitle());
1972  if (ut.BeginsWith("PWG-UD/MULT - "))
1973  ut = "PWG-UD/MULT - work in progress";
1974 
1975  if (unique.FindObject(ut)) continue;
1976 
1977  u = new TParameter<int>(ut,g->GetMarkerStyle());
1978  u->SetUniqueID(isCent ? Int_t(kBlack) : g->GetMarkerColor());
1979  unique.Add(u);
1980 
1981  }
1982  pexp++;
1983  }
1984  marker++;
1985  ptrig++;
1986  }
1987  if (!other ||
1988  !other->GetListOfGraphs() ||
1989  other->GetListOfGraphs()->GetEntries() < 0) {
1990  ::Warning("", "No data for %s %d %s %s",
1991  system.Data(), sNN, allT.Data(), allE.Data());
1992  if (other) delete other;
1993  other = 0;
1994  }
1995  // ::Info("", "Making pair of data (%p) and other (%p)", stack, other);
1996  ret = new TPair(stack, other);
1997 
1998  return ret;
1999  }
2000 };
2001 
2002 #endif
const Color_t cc[]
Definition: DrawKs.C:1
static const char * CentLimitName(Bool_t isMult, Float_t v)
Definition: Drawer.C:1758
double Double_t
Definition: External.C:58
iterator begin()
Definition: Combiner.C:178
static TPair * GetDataOther(TLegend *leg, TObjArray &unique, const TString &system, UShort_t sNN, const char **trigs, const char **exps, Option_t *errOpt="e5", Bool_t rebinned=false, Bool_t empirical=true, const Double_t *effs=0)
Definition: Drawer.C:1781
static TString SNNString(const TString &system, UShort_t sNN)
Definition: Drawer.C:244
static Double_t * FixTriggerEff(const TString &sys, UShort_t sNN, TString &trigger)
Definition: Drawer.C:696
TCanvas * canvas
Definition: DrawAnaELoss.C:28
static void Export(const TString &system, UShort_t sNN, const TString &trigger, Bool_t rebinned=false, Bool_t empirical=true)
Definition: Drawer.C:872
static Int_t FindCentBin(Color_t c)
Definition: Drawer.C:849
Final Calculate(const_iterator &begin, const_iterator &end, unsigned short nIter=50)
Definition: Combiner.C:407
static void Draw(const TString &system, UShort_t sNN, const TString &trigger, const Option_t *option="e3", Bool_t rebinned=true, Bool_t empirical=true)
Definition: Drawer.C:728
TSystem * gSystem
static Int_t AlicePurple()
Definition: Drawer.C:220
static void Add2Out(TString &out, const char *what)
Definition: Drawer.C:1503
static void DrawAll(const char **syss, UShort_t *sNNs, const char **trgS, UShort_t flags=0x0)
Definition: Drawer.C:1527
TCanvas * c
Definition: TestFitELoss.C:172
Int_t types
AliStack * stack
static TGraphErrors * H2G(TH1 *h, Double_t xOff, Int_t sign=1)
Definition: Drawer.C:263
static TH1 * HOverG(const TH1 *h, const TGraph *g, const TGraph *l, const TGraph *u, Bool_t err=false)
Definition: Drawer.C:421
static Int_t AliceBlue()
Definition: Drawer.C:202
static TLatex * MakeTitle(Double_t x, Double_t y, const TString &system, UShort_t sNN, const TString &trigger)
Definition: Drawer.C:1684
List::const_iterator const_iterator
Definition: Combiner.C:224
static THStack * GetStack(TLegend *legend, const TString &system, UShort_t sNN, const TString &trigger, Bool_t rebinned=true, Bool_t empirical=true, Int_t marker=20)
Definition: Drawer.C:554
int Int_t
Definition: External.C:63
static TGraph * GOverG(const TGraph *num, const TGraph *den, const TGraph *dlow, const TGraph *dup, Double_t dx=0)
Definition: Drawer.C:467
Definition: Drawer.C:48
float Float_t
Definition: External.C:68
static TGraphAsymmErrors * Combine(TMultiGraph *mg)
Definition: Drawer.C:772
static void ErrorGraphs(const TGraph *g, TGraph *&low, TGraph *&up)
Definition: Drawer.C:337
static void ErrorGraphs(const TGraphErrors *g, TGraph *&low, TGraph *&up)
Definition: Drawer.C:352
static TGraphAsymmErrors * H2GA(TH1 *h, TH1 *sA, TH1 *sC)
Definition: Drawer.C:296
Definition: External.C:212
iterator end()
Definition: Combiner.C:190
static void LoadOther()
Definition: Drawer.C:54
static TH1 * ErrorHist(const TH1 *h, Bool_t aSide, Double_t factor=0.076)
Definition: Drawer.C:386
static TMultiGraph * GetOther(const TString &system, UShort_t sNN, const TString &trigger, Int_t verbose=0)
Definition: Drawer.C:130
static void pPbSym(const TString &trigger, const Option_t *option="e3", Bool_t rebinned=true, Bool_t empirical=true)
Definition: Drawer.C:1164
static TMultiGraph * GetOther(UShort_t sys, UShort_t sNN, UShort_t trg, UShort_t exps=0xf, Int_t verbose=3)
Definition: Drawer.C:81
static void Add2Out(TString &out, UShort_t sNN)
Definition: Drawer.C:1514
static Int_t AliceRed()
Definition: Drawer.C:211
static THStack * Symmetrice(THStack *s)
Definition: Drawer.C:1104
const char * fwd
static Float_t MarkerSize(Int_t style)
Definition: Drawer.C:1748
static Color_t Brighten(Color_t origNum, Int_t nTimes=2)
Definition: Drawer.C:233
static void AddSystematics(THStack *stack, Double_t sys)
Definition: Drawer.C:1019
static void ScaleBypp(const TString &system, UShort_t sNN, UShort_t ppsNN, const TString &trigger, const TString &ppTrigger, Double_t etaShift=0, Bool_t rebinned=true, Bool_t empirical=true, Bool_t write=false)
Definition: Drawer.C:1220
static TMultiGraph * GetOther(const TString &system, UShort_t sNN, const TString &trigger, const TString &exps, Int_t verbose=0)
Definition: Drawer.C:148
static void PrintCanvas(TCanvas *canvas, const TString &types)
Definition: Drawer.C:678
static const char * PlotPrefix()
Definition: Drawer.C:49
static THStack * Symmetrice(THStack *s1, THStack *s2)
Definition: Drawer.C:1040
unsigned short UShort_t
Definition: External.C:28
static void SymScaleBypp(UShort_t ppsNN, const TString &trigger, const TString &ppTrigger, const Option_t *option="e2", Bool_t rebinned=true, Bool_t empirical=true, Bool_t write=false)
Definition: Drawer.C:1346
const char Option_t
Definition: External.C:48
static Int_t AliceYellow()
Definition: Drawer.C:229
bool Bool_t
Definition: External.C:53
static TCanvas * MakeCanvas(const TString &system, UShort_t sNN, const TString &trigger, Bool_t rebinned=true, Bool_t empirical=true)
Definition: Drawer.C:649
Definition: External.C:196
static TLegend * MakeUniqueLegend(Double_t x1, Double_t y1, Double_t x2, Double_t y2, TObjArray &unique, Int_t nSNN)
Definition: Drawer.C:1706
static void ErrorGraphs(const TGraphAsymmErrors *g, TGraph *&low, TGraph *&up)
Definition: Drawer.C:366
void Add(const Result &r)
Definition: Combiner.C:203
static TLegend * MakeUniqueLegend(TLegend *uleg, TObjArray &unique, Int_t nSNN)
Definition: Drawer.C:1725