3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 14:07:10 2011
6 * @brief Script to visualise the dN/deta
8 * This script is independent of any AliROOT code - and should stay
12 * @ingroup pwg2_forward_dndeta
16 #include <TGraphErrors.h>
17 #include <TGraphAsymmErrors.h>
18 #include <TMultiGraph.h>
30 #include <TLegendEntry.h>
35 * Class to draw dN/deta results
37 * @ingroup pwg2_forward_tasks_dndeta
38 * @ingroup pwg2_forward_dndeta
43 * POD of data for range zooming
47 TAxis* fMasterAxis; // Master axis
48 TAxis* fSlave1Axis; // First slave axis
49 TVirtualPad* fSlave1Pad; // First slave pad
50 TAxis* fSlave2Axis; // Second slave axis
51 TVirtualPad* fSlave2Pad; // Second slave pad
53 //__________________________________________________________________
59 : fShowOthers(false), // Bool_t
60 fShowAlice(false), // Bool_t
61 fShowRatios(false), // Bool_t
62 fShowLeftRight(false), // Bool_t
63 fRebin(5), // UShort_t
64 fCutEdges(false), // Bool_t
65 fTitle(""), // TString
66 fTrigString(0), // TNamed*
67 fNormString(0), // TNamed*
68 fSNNString(0), // TNamed*
69 fSysString(0), // TNamed*
70 fVtxAxis(0), // TAxis*
71 fCentAxis(0), // TAxis*
76 fRangeParam = new RangeParam;
77 fRangeParam->fMasterAxis = 0;
78 fRangeParam->fSlave1Axis = 0;
79 fRangeParam->fSlave1Pad = 0;
80 fRangeParam->fSlave2Axis = 0;
81 fRangeParam->fSlave2Pad = 0;
83 //__________________________________________________________________
84 virtual ~dNdetaDrawer()
86 if (fRatios && fRatios->GetHists()) fRatios->GetHists()->Delete();
87 if (fResults && fResults->GetHists()) fResults->GetHists()->Delete();
89 if (fTrigString) { delete fTrigString; fTrigString = 0; }
90 if (fSNNString) { delete fSNNString; fSNNString = 0; }
91 if (fSysString) { delete fSysString; fSysString = 0; }
92 if (fVtxAxis) { delete fVtxAxis; fVtxAxis = 0; }
93 if (fCentAxis) { delete fCentAxis; fCentAxis = 0; }
94 if (fResults) { delete fResults; fResults = 0; }
95 if (fRatios) { delete fRatios; fRatios = 0; }
96 if (fOthers) { delete fOthers; fOthers = 0; }
97 if (fTriggers) { delete fTriggers; fTriggers = 0; }
101 //==================================================================
104 * @name Set parameters
107 * Show other (UA5, CMS, ...) data
109 * @param x Whether to show or not
111 void SetShowOthers(Bool_t x) { fShowOthers = x; }
112 //__________________________________________________________________
114 * Show ALICE published data
116 * @param x Wheter to show or not
118 void SetShowAlice(Bool_t x) { fShowAlice = x; }
119 //__________________________________________________________________
121 * Whether to show ratios or not. If there's nothing to compare to,
122 * the ratio panel will be implicitly disabled
124 * @param x Whether to show or not
126 void SetShowRatios(Bool_t x) { fShowRatios = x; }
127 //__________________________________________________________________
130 * Whether to show the left/right asymmetry
132 * @param x To show or not
134 void SetShowLeftRight(Bool_t x) { fShowLeftRight = x; }
135 //__________________________________________________________________
137 * Set the rebinning factor
139 * @param x Rebinning factor (must be a divisor in the number of bins)
141 void SetRebin(UShort_t x) { fRebin = x; }
142 //__________________________________________________________________
144 * Wheter to cut away the edges
146 * @param x Whether or not to cut away edges
148 void SetCutEdges(Bool_t x) { fCutEdges = x; }
149 //__________________________________________________________________
151 * Set the title of the plot
155 void SetTitle(TString x) { fTitle = x; }
157 //==================================================================
160 * @name Override settings from input
163 * Override setting from file
165 * @param sNN Center of mass energy per nucleon pair (GeV)
167 void SetSNN(UShort_t sNN)
169 fSNNString = new TNamed("sNN", Form("%04dGeV", sNN));
170 fSNNString->SetUniqueID(sNN);
172 //__________________________________________________________________
174 * Set the collision system
178 * @param sys collision system
180 void SetSys(UShort_t sys)
182 fSysString = new TNamed("sys", (sys == 1 ? "pp" :
183 sys == 2 ? "PbPb" : "unknown"));
184 fSysString->SetUniqueID(sys);
186 //__________________________________________________________________
188 * Set the vertex range in centimeters
190 * @param vzMin Min @f$ v_z@f$
191 * @param vzMax Max @f$ v_z@f$
193 void SetVertexRange(Double_t vzMin, Double_t vzMax)
195 fVtxAxis = new TAxis(10, vzMin, vzMax);
196 fVtxAxis->SetName("vtxAxis");
197 fVtxAxis->SetTitle(Form("v_{z}#in[%+5.1f,%+5.1f]cm", vzMin, vzMax));
199 //__________________________________________________________________
200 void SetTrigger(UShort_t trig)
202 fTrigString = new TNamed("trigString", (trig & 0x1 ? "INEL" :
203 trig & 0x2 ? "INEL>0" :
206 fTrigString->SetUniqueID(trig);
210 //==================================================================
213 * @name Main steering functions
216 * Run the code to produce the final result.
218 * @param filename File containing the data
220 void Run(const char* filename="forward_dndeta.root")
222 Double_t max = 0, rmax=0, amax=0;
224 gStyle->SetPalette(1);
226 // --- Open input file -------------------------------------------
227 TFile* file = TFile::Open(filename, "READ");
229 Error("Open", "Cannot open %s", filename);
232 // --- Get forward list ------------------------------------------
233 TList* forward = static_cast<TList*>(file->Get("ForwardResults"));
235 Error("Open", "Couldn't find list ForwardResults");
238 // --- Get information on the run --------------------------------
239 FetchInformation(forward);
240 // --- Set the macro pathand load other data script --------------
241 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2",
242 gROOT->GetMacroPath()));
243 gROOT->LoadMacro("OtherData.C");
245 // --- Get the central results -----------------------------------
246 TList* clusters = static_cast<TList*>(file->Get("CentralResults"));
247 if (!clusters) Warning("Open", "Couldn't find list CentralResults");
249 // --- Make our containtes ---------------------------------------
250 fResults = new THStack("results", "Results");
251 fRatios = new THStack("ratios", "Ratios");
252 fLeftRight = new THStack("asymmetry", "Left-right asymmetry");
253 fOthers = new TMultiGraph();
255 // --- Loop over input data --------------------------------------
256 FetchResults(forward, "Forward", max, rmax, amax);
257 FetchResults(clusters, "Central", max, rmax, amax);
259 // --- Get trigger information -----------------------------------
260 TList* sums = static_cast<TList*>(file->Get("ForwardSums"));
262 TList* all = static_cast<TList*>(sums->FindObject("all"));
264 fTriggers = FetchResult(all, "triggers");
265 if (!fTriggers) all->ls();
268 Warning("Run", "List all not found in ForwardSums");
273 Warning("Run", "No ForwardSums directory found in %s", file->GetName());
277 // --- Check our stacks ------------------------------------------
278 if (!fResults->GetHists() ||
279 fResults->GetHists()->GetEntries() <= 0) {
280 Error("Run", "No histograms in result stack!");
283 if (!fOthers->GetListOfGraphs() ||
284 fOthers->GetListOfGraphs()->GetEntries() <= 0) {
285 Warning("Run", "No other data found - disabling that");
288 if (!fRatios->GetHists() ||
289 fRatios->GetHists()->GetEntries() <= 0) {
290 Warning("Run", "No ratio data found - disabling that");
294 if (!fLeftRight->GetHists() ||
295 fLeftRight->GetHists()->GetEntries() <= 0) {
296 Warning("Run", "No left/right data found - disabling that");
298 fShowLeftRight = false;
301 // --- Close the input file --------------------------------------
306 // --- Plot results ----------------------------------------------
307 Plot(max, rmax, amax);
310 //__________________________________________________________________
312 * Fetch the information on the run from the results list
314 * @param results Results list
316 void FetchInformation(const TList* results)
319 fTrigString = static_cast<TNamed*>(results->FindObject("trigger"));
321 fNormString = static_cast<TNamed*>(results->FindObject("scheme"));
323 fSNNString = static_cast<TNamed*>(results->FindObject("sNN"));
325 fSysString = static_cast<TNamed*>(results->FindObject("sys"));
327 fVtxAxis = static_cast<TAxis*>(results->FindObject("vtxAxis"));
329 fCentAxis = static_cast<TAxis*>(results->FindObject("centAxis"));
330 if (!fTrigString) fTrigString = new TNamed("trigger", "unknown");
331 if (!fNormString) fNormString = new TNamed("scheme", "unknown");
332 if (!fSNNString) fSNNString = new TNamed("sNN", "unknown");
333 if (!fSysString) fSysString = new TNamed("sys", "unknown");
335 fVtxAxis = new TAxis(1,0,0);
336 fVtxAxis->SetName("vtxAxis");
337 fVtxAxis->SetTitle("v_{z} range unspecified");
340 TString centTxt("none");
342 Int_t nCent = fCentAxis->GetNbins();
343 centTxt = Form("%d bins", nCent);
344 for (Int_t i = 0; i <= nCent; i++)
345 centTxt.Append(Form("%c%d", i == 0 ? ' ' : '-',
346 int(fCentAxis->GetXbins()->At(i))));
348 Info("FetchInformation",
350 " Trigger: %-30s (%d)\n"
351 " sqrt(sNN): %-30s (%dGeV)\n"
352 " System: %-30s (%d)\n"
353 " Vz range: %-30s (%f,%f)\n"
354 " Normalization: %-30s (%d)\n"
356 fTrigString->GetTitle(), fTrigString->GetUniqueID(),
357 fSNNString->GetTitle(), fSNNString->GetUniqueID(),
358 fSysString->GetTitle(), fSysString->GetUniqueID(),
359 fVtxAxis->GetTitle(), fVtxAxis->GetXmin(), fVtxAxis->GetXmax(),
360 fNormString->GetTitle(), fNormString->GetUniqueID(),
363 //__________________________________________________________________
364 TMultiGraph* FetchOthers(UShort_t centLow, UShort_t centHigh)
366 TMultiGraph* thisOther = 0;
367 if (!fShowOthers && !fShowAlice) return 0;
369 Bool_t onlya = (fShowOthers ? false : true);
370 UShort_t sys = (fSysString ? fSysString->GetUniqueID() : 0);
371 UShort_t trg = (fTrigString ? fTrigString->GetUniqueID() : 0);
372 UShort_t snn = (fSNNString ? fSNNString->GetUniqueID() : 0);
373 Long_t ret = gROOT->ProcessLine(Form("GetData(%d,%d,%d,%d,%d,%d);",
375 centLow,centHigh,onlya));
377 Warning("FetchResults", "No other data found for sys=%d, sNN=%d, "
378 "trigger=%d %d%%-%d%% central %s",
379 sys, snn, trg, centLow, centHigh,
380 onlya ? " (ALICE results)" : "all");
383 thisOther = reinterpret_cast<TMultiGraph*>(ret);
387 //__________________________________________________________________
389 * Get the results from the top-level list
393 * @param max On return, maximum of data
394 * @param rmax On return, maximum of ratios
395 * @param amax On return, maximum of left-right comparisons
397 void FetchResults(const TList* list,
403 UShort_t n = fCentAxis ? fCentAxis->GetNbins() : 0;
405 TList* all = static_cast<TList*>(list->FindObject("all"));
407 Error("FetchResults", "Couldn't find list 'all' in %s",
410 FetchResults(all, name, FetchOthers(0,0), -1, 0, max, rmax, amax);
414 Int_t nCol = gStyle->GetNumberOfColors();
415 for (UShort_t i = 0; i < n; i++) {
416 UShort_t centLow = fCentAxis->GetXbins()->At(i);
417 UShort_t centHigh = fCentAxis->GetXbins()->At(i+1);
418 TString lname = Form("cent%03d_%03d", centLow, centHigh);
419 TList* thisCent = static_cast<TList*>(list->FindObject(lname));
421 Float_t fc = (centLow+double(centHigh-centLow)/2) / 100;
422 Int_t icol = TMath::Min(nCol-1,int(fc * nCol + .5));
423 Int_t col = gStyle->GetColorPalette(icol);
424 Info("FetchResults","Centrality %d-%d color index %d (=%d*%f) -> %d",
425 centLow, centHigh, icol, nCol, fc, col);
427 TString centTxt = Form("%3d%%-%3d%% central", centLow, centHigh);
429 Error("FetchResults", "Couldn't find list '%s' in %s",
430 lname.Data(), list->GetName());
432 FetchResults(thisCent, name, FetchOthers(centLow, centHigh),
433 col, centTxt.Data(), max, rmax, amax);
436 //__________________________________________________________________
437 void SetAttributes(TH1* h, Int_t color)
440 if (color < 0) return;
441 // h->SetLineColor(color);
442 h->SetMarkerColor(color);
443 // h->SetFillColor(color);
445 //__________________________________________________________________
446 void SetAttributes(TGraph* g, Int_t color)
449 if (color < 0) return;
450 // g->SetLineColor(color);
451 g->SetMarkerColor(color);
452 // g->SetFillColor(color);
454 //__________________________________________________________________
455 void ModifyTitle(TNamed* h, const char* centTxt)
457 if (!centTxt || !h) return;
458 h->SetTitle(Form("%s, %s", h->GetTitle(), centTxt));
461 //__________________________________________________________________
463 * Fetch results for a particular centrality bin
467 * @param thisOther Other graphs
469 * @param centTxt Centrality text
470 * @param max On return, data maximum
471 * @param rmax On return, ratio maximum
472 * @param amax On return, left-right maximum
474 void FetchResults(const TList* list,
476 TMultiGraph* thisOther,
483 TH1* dndeta = FetchResult(list, Form("dndeta%s", name));
484 TH1* dndetaMC = FetchResult(list, Form("dndeta%sMC", name));
485 TH1* dndetaTruth = FetchResult(list, "dndetaTruth");
487 TH1* dndetaMCSym = 0;
488 TH1* tracks = FetchResult(list, "tracks");
489 if (tracks) tracks->SetTitle("ALICE Tracks");
490 SetAttributes(dndeta, color);
491 SetAttributes(dndetaMC, color+2);
492 SetAttributes(dndetaTruth,color);
493 SetAttributes(dndetaSym, color);
494 SetAttributes(dndetaMCSym,color+2);
495 SetAttributes(tracks, color+3);
496 ModifyTitle(dndeta, centTxt);
497 ModifyTitle(dndetaMC, centTxt);
498 ModifyTitle(dndetaTruth,centTxt);
499 ModifyTitle(dndetaSym, centTxt);
500 ModifyTitle(dndetaMCSym,centTxt);
501 ModifyTitle(tracks, centTxt);
504 max = TMath::Max(max, AddHistogram(fResults, dndetaTruth, "e5 p"));
505 max = TMath::Max(max, AddHistogram(fResults, dndetaMC, dndetaMCSym));
506 max = TMath::Max(max, AddHistogram(fResults, dndeta, dndetaSym));
507 max = TMath::Max(max, AddHistogram(fResults, tracks));
509 // Info("FetchResults", "Got %p, %p, %p from %s with name %s, max=%f",
510 // dndeta, dndetaMC, dndetaTruth, list->GetName(), name, max);
512 if (fShowLeftRight) {
513 fLeftRight->Add(Asymmetry(dndeta, amax));
514 fLeftRight->Add(Asymmetry(dndetaMC, amax));
515 fLeftRight->Add(Asymmetry(tracks, amax));
519 TIter next(thisOther->GetListOfGraphs());
521 while ((g = static_cast<TGraph*>(next()))) {
522 fRatios->Add(Ratio(dndeta, g, rmax));
523 fRatios->Add(Ratio(dndetaSym, g, rmax));
524 SetAttributes(g, color);
525 ModifyTitle(g, centTxt);
526 if (!fOthers->GetListOfGraphs() ||
527 !fOthers->GetListOfGraphs()->FindObject(g->GetName())) {
528 max = TMath::Max(max,TMath::MaxElement(g->GetN(), g->GetY()));
532 // fOthers->Add(thisOther);
535 if (!fRatios->GetHists() ||
536 !fRatios->GetHists()->FindObject(tracks->GetName()))
537 fRatios->Add(Ratio(dndeta, tracks, rmax));
541 fRatios->Add(Ratio(dndeta, dndetaTruth, rmax));
542 fRatios->Add(Ratio(dndetaSym, dndetaTruth, rmax));
543 fRatios->Add(Ratio(dndetaMC, dndetaTruth, rmax));
544 fRatios->Add(Ratio(dndetaMCSym, dndetaTruth, rmax));
547 //__________________________________________________________________
550 * @param max Max value
551 * @param rmax Maximum diviation from 1 of ratios
552 * @param amax Maximum diviation from 1 of asymmetries
554 void Plot(Double_t max,
558 gStyle->SetOptTitle(0);
559 gStyle->SetTitleFont(132, "xyz");
560 gStyle->SetLabelFont(132, "xyz");
563 Int_t w = 800; // h / TMath::Sqrt(2);
567 if (!fShowRatios) w *= 1.4;
569 if (!fShowLeftRight) w *= 1.4;
572 y1 = (y11 > 0.0001 ? 0.4 : 0.2);
573 y2 = (y11 > 0.0001 ? 0.2 : 0.3);
575 TCanvas* c = new TCanvas("Results", "Results", w, h);
581 Info("Plot", "y1=%f, y2=%f, y3=%f extra: %s %s",
582 y1, y2, y2, (fShowRatios ? "ratios" : ""),
583 (fShowLeftRight ? "right/left" : ""));
584 Info("Plot", "Maximum is %f", max);
586 PlotResults(max, y1);
589 PlotRatios(rmax, y2, y1);
592 PlotLeftRight(amax, y3, y2);
596 Int_t vMin = fVtxAxis->GetXmin();
597 Int_t vMax = fVtxAxis->GetXmax();
598 TString trg(fTrigString->GetTitle());
600 if (fTriggers) nev = fTriggers->GetBinContent(1);
601 trg = trg.Strip(TString::kBoth);
602 TString base(Form("dndeta_%s_%s_%s_%c%02d%c%02dcm_%09dev",
603 fSysString->GetTitle(),
604 fSNNString->GetTitle(),
606 vMin < 0 ? 'm' : 'p', TMath::Abs(vMin),
607 vMax < 0 ? 'm' : 'p', TMath::Abs(vMax),
609 c->SaveAs(Form("%s.png", base.Data()));
610 c->SaveAs(Form("%s.root", base.Data()));
611 c->SaveAs(Form("%s.C", base.Data()));
613 //__________________________________________________________________
617 * @param stack Stack to include
618 * @param mg (optional) Multi graph to include
619 * @param x1 Lower X coordinate in the range [0,1]
620 * @param y1 Lower Y coordinate in the range [0,1]
621 * @param x2 Upper X coordinate in the range [0,1]
622 * @param y2 Upper Y coordinate in the range [0,1]
624 void BuildLegend(THStack* stack, TMultiGraph* mg,
625 Double_t x1, Double_t y1, Double_t x2, Double_t y2)
627 TLegend* l = new TLegend(x1,y1,x2,y2);
634 TIter next(stack->GetHists());
636 while ((hist = next())) {
637 TString n(hist->GetTitle());
638 if (n.Contains("mirrored")) continue;
639 l->AddEntry(hist, hist->GetTitle(), "pl");
642 TIter nexto(mg->GetListOfGraphs());
643 while ((hist = nexto())) {
644 TString n(hist->GetTitle());
645 if (n.Contains("mirrored")) continue;
646 l->AddEntry(hist, hist->GetTitle(), "pl");
649 TLegendEntry* d1 = l->AddEntry("d1", "Data", "lp");
650 d1->SetLineColor(kBlack);
651 d1->SetMarkerColor(kBlack);
652 d1->SetMarkerStyle(20);
653 TLegendEntry* d2 = l->AddEntry("d2", "Mirrored data", "lp");
654 d2->SetLineColor(kBlack);
655 d2->SetMarkerColor(kBlack);
656 d2->SetMarkerStyle(24);
660 //__________________________________________________________________
665 * @param yd Bottom position of pad
667 void PlotResults(Double_t max, Double_t yd)
669 // Make a sub-pad for the result itself
670 TPad* p1 = new TPad("p1", "p1", 0, yd, 1.0, 1.0, 0, 0, 0);
671 p1->SetTopMargin(0.05);
672 p1->SetBorderSize(0);
673 p1->SetBorderMode(0);
674 p1->SetBottomMargin(yd > 0.001 ? 0.001 : 0.1);
675 p1->SetRightMargin(0.05);
682 // Info("PlotResults", "Plotting results with max=%f", max);
683 fResults->SetMaximum(1.15*max);
684 fResults->SetMinimum(yd > 0.00001 ? -0.1 : 0);
686 FixAxis(fResults, 1/(1-yd)/1.7, "#frac{1}{N} #frac{dN_{ch}}{d#eta}");
689 fResults->DrawClone("nostack e1");
691 fRangeParam->fSlave1Axis = fResults->GetXaxis();
692 fRangeParam->fSlave1Pad = p1;
695 if (fShowOthers || fShowAlice) {
696 TGraphAsymmErrors* o = 0;
697 TIter nextG(fOthers->GetListOfGraphs());
698 while ((o = static_cast<TGraphAsymmErrors*>(nextG())))
699 o->DrawClone("same p");
702 // Make a legend in the main result pad
703 BuildLegend(fResults, fOthers, .15,p1->GetBottomMargin()+.01,.90,.35);
705 TLegend* l = p1->BuildLegend(.15,p1->GetBottomMargin()+.01,.90,.35);
713 // Put a title on top
714 fTitle.ReplaceAll("@", " ");
715 TLatex* tit = new TLatex(0.10, 0.95, fTitle.Data());
717 tit->SetTextFont(132);
718 tit->SetTextSize(0.05);
721 // Put a nice label in the plot
723 UShort_t snn = fSNNString->GetUniqueID();
724 const char* sys = fSysString->GetTitle();
725 if (snn > 1000) eS = Form("%4.2fTeV", float(snn)/1000);
726 else eS = Form("%3dGeV", snn);
727 TLatex* tt = new TLatex(.93, .93, Form("%s #sqrt{s}=%s, %s",
730 fTrigString->GetTitle()));
732 tt->SetTextFont(132);
733 tt->SetTextAlign(33);
736 // Put number of accepted events on the plot
738 if (fTriggers) nev = fTriggers->GetBinContent(1);
739 TLatex* et = new TLatex(.93, .83, Form("%d events", nev));
741 et->SetTextFont(132);
742 et->SetTextAlign(33);
745 // Put number of accepted events on the plot
747 TLatex* vt = new TLatex(.93, .88, fVtxAxis->GetTitle());
749 vt->SetTextFont(132);
750 vt->SetTextAlign(33);
753 // results->Draw("nostack e1 same");
755 fRangeParam->fSlave1Axis = FindXAxis(p1, fResults->GetName());
756 fRangeParam->fSlave1Pad = p1;
759 // Mark the plot as preliminary
760 TLatex* pt = new TLatex(.12, .93, "Preliminary");
763 pt->SetTextSize(0.07);
764 pt->SetTextColor(kRed+1);
765 pt->SetTextAlign(13);
768 if (!gSystem->AccessPathName("ALICE.png")) {
769 TPad* logo = new TPad("logo", "logo", .12, .65, .25, .85, 0, 0, 0);
770 logo->SetFillStyle(0);
773 TImage* i = TImage::Create();
774 i->ReadImage("ALICE.png");
779 //__________________________________________________________________
783 * @param max Maximum diviation from 1
784 * @param y1 Lower y coordinate of pad
785 * @param y2 Upper y coordinate of pad
787 void PlotRatios(Double_t max, Double_t y1, Double_t y2)
789 if (!fShowRatios) return;
791 bool isBottom = (y1 < 0.0001);
792 Double_t yd = y2 - y1;
793 // Make a sub-pad for the result itself
794 TPad* p2 = new TPad("p2", "p2", 0, y1, 1.0, y2, 0, 0, 0);
795 p2->SetTopMargin(0.001);
796 p2->SetRightMargin(0.05);
797 p2->SetBottomMargin(isBottom ? 1/yd * 0.07 : 0.0001);
805 FixAxis(fRatios, 1/yd/1.7, "Ratios", 7);
807 fRatios->SetMaximum(1+TMath::Max(.22,1.05*max));
808 fRatios->SetMinimum(1-TMath::Max(.32,1.05*max));
810 fRatios->DrawClone("nostack e1");
814 BuildLegend(fRatios, 0, .15,p2->GetBottomMargin()+.01,.9,
817 TLegend* l2 = p2->BuildLegend(.15,p2->GetBottomMargin()+.01,.9,
822 l2->SetBorderSize(0);
823 l2->SetTextFont(132);
825 // Make a nice band from 0.9 to 1.1
826 TGraphErrors* band = new TGraphErrors(2);
827 band->SetPoint(0, fResults->GetXaxis()->GetXmin(), 1);
828 band->SetPoint(1, fResults->GetXaxis()->GetXmax(), 1);
829 band->SetPointError(0, 0, .1);
830 band->SetPointError(1, 0, .1);
831 band->SetFillColor(kYellow+2);
832 band->SetFillStyle(3002);
833 band->SetLineStyle(2);
834 band->SetLineWidth(1);
835 band->Draw("3 same");
836 band->DrawClone("X L same");
838 // Replot the ratios on top
839 fRatios->DrawClone("nostack e1 same");
842 fRangeParam->fMasterAxis = FindXAxis(p2, fRatios->GetName());
843 p2->AddExec("range", Form("RangeExec((dNdetaDrawer::RangeParam*)%p)",
847 fRangeParam->fSlave2Axis = FindXAxis(p2, fRatios->GetName());
848 fRangeParam->fSlave2Pad = p2;
851 //__________________________________________________________________
853 * Plot the asymmetries
855 * @param max Maximum diviation from 1
856 * @param y1 Lower y coordinate of pad
857 * @param y2 Upper y coordinate of pad
859 void PlotLeftRight(Double_t max, Double_t y1, Double_t y2)
861 if (!fShowLeftRight) return;
863 bool isBottom = (y1 < 0.0001);
864 Double_t yd = y2 - y1;
865 // Make a sub-pad for the result itself
866 TPad* p3 = new TPad("p3", "p3", 0, y1, 1.0, y2, 0, 0, 0);
867 p3->SetTopMargin(0.001);
868 p3->SetRightMargin(0.05);
869 p3->SetBottomMargin(isBottom ? 1/yd * 0.07 : 0.0001);
877 FixAxis(fLeftRight, 1/yd/1.7, "Right/Left", 4);
879 fLeftRight->SetMaximum(1+TMath::Max(.12,1.05*max));
880 fLeftRight->SetMinimum(1-TMath::Max(.15,1.05*max));
882 fLeftRight->DrawClone("nostack e1");
886 TLegend* l2 = p3->BuildLegend(.15,p3->GetBottomMargin()+.01,.9,.5);
890 l2->SetBorderSize(0);
891 l2->SetTextFont(132);
893 // Make a nice band from 0.9 to 1.1
894 TGraphErrors* band = new TGraphErrors(2);
895 band->SetPoint(0, fResults->GetXaxis()->GetXmin(), 1);
896 band->SetPoint(1, fResults->GetXaxis()->GetXmax(), 1);
897 band->SetPointError(0, 0, .05);
898 band->SetPointError(1, 0, .05);
899 band->SetFillColor(kYellow+2);
900 band->SetFillStyle(3002);
901 band->SetLineStyle(2);
902 band->SetLineWidth(1);
903 band->Draw("3 same");
904 band->DrawClone("X L same");
906 fLeftRight->DrawClone("nostack e1 same");
908 fRangeParam->fMasterAxis = FindXAxis(p3, fLeftRight->GetName());
909 p3->AddExec("range", Form("RangeExec((dNdetaDrawer::RangeParam*)%p)",
913 fRangeParam->fSlave2Axis = FindXAxis(p3, fLeftRight->GetName());
914 fRangeParam->fSlave2Pad = p3;
918 //==================================================================
921 * @name Data utility functions
924 * Get a result from the passed list
926 * @param list List to search
927 * @param name Object name to search for
931 TH1* FetchResult(const TList* list, const char* name) const
935 TH1* ret = static_cast<TH1*>(list->FindObject(name));
938 Warning("GetResult", "Histogram %s not found", name);
943 //__________________________________________________________________
945 * Add a histogram to the stack after possibly rebinning it
947 * @param stack Stack to add to
948 * @param hist histogram
949 * @param option Draw options
951 * @return Maximum of histogram
953 Double_t AddHistogram(THStack* stack, TH1* hist, Option_t* option="") const
955 // Check if we have input
961 // Info("AddHistogram", "Adding %s to %s",
962 // hist->GetName(), stack->GetName());
963 stack->Add(hist, option);
965 return hist->GetMaximum();
967 //__________________________________________________________________
969 * Add a histogram to the stack after possibly rebinning it
971 * @param stack Stack to add to
972 * @param hist histogram
973 * @param option Draw options
974 * @param sym On return, the data symmetriced (added to stack)
976 * @return Maximum of histogram
978 Double_t AddHistogram(THStack* stack, TH1* hist, TH1*& sym,
979 Option_t* option="") const
981 // Check if we have input
986 stack->Add(hist, option);
988 // Now symmetrice the histogram
989 sym = Symmetrice(hist);
990 stack->Add(sym, option);
992 // Info("AddHistogram", "Adding %s and %s to %s",
993 // hist->GetName(), sym->GetName(), stack->GetName());
994 return hist->GetMaximum();
997 //__________________________________________________________________
1001 * @param h Histogram to rebin
1005 virtual void Rebin(TH1* h) const
1007 if (fRebin <= 1) return;
1009 Int_t nBins = h->GetNbinsX();
1010 if(nBins % fRebin != 0) {
1011 Warning("Rebin", "Rebin factor %d is not a devisor of current number "
1012 "of bins %d in the histogram %s", fRebin, nBins, h->GetName());
1017 TH1* tmp = static_cast<TH1*>(h->Clone("tmp"));
1019 tmp->SetDirectory(0);
1021 // The new number of bins
1022 Int_t nBinsNew = nBins / fRebin;
1023 for(Int_t i = 1;i<= nBinsNew; i++) {
1024 Double_t content = 0;
1028 for(Int_t j = 1; j<=fRebin;j++) {
1029 Int_t bin = (i-1)*fRebin + j;
1030 Double_t c = h->GetBinContent(bin);
1032 if (c <= 0) continue;
1035 if (h->GetBinContent(bin+1)<=0 ||
1036 h->GetBinContent(bin-1)) {
1037 Warning("Rebin", "removing bin %d=%f of %s (%d=%f,%d=%f)",
1038 bin, c, h->GetName(),
1039 bin+1, h->GetBinContent(bin+1),
1040 bin-1, h->GetBinContent(bin-1));
1044 Double_t e = h->GetBinError(bin);
1045 Double_t w = 1 / (e*e); // 1/c/c
1052 if(content > 0 && nbins > 1 ) {
1053 tmp->SetBinContent(i, wsum / sumw);
1054 tmp->SetBinError(i,1./TMath::Sqrt(sumw));
1058 // Finally, rebin the histogram, and set new content
1061 for(Int_t i = 1; i<= nBinsNew; i++) {
1062 h->SetBinContent(i,tmp->GetBinContent(i));
1063 h->SetBinError(i, tmp->GetBinError(i));
1068 //__________________________________________________________________
1070 * Make an extension of @a h to make it symmetric about 0
1072 * @param h Histogram to symmertrice
1074 * @return Symmetric extension of @a h
1076 TH1* Symmetrice(const TH1* h) const
1078 Int_t nBins = h->GetNbinsX();
1079 TH1* s = static_cast<TH1*>(h->Clone(Form("%s_mirror", h->GetName())));
1080 s->SetTitle(Form("%s (mirrored)", h->GetTitle()));
1082 s->SetBins(nBins, -h->GetXaxis()->GetXmax(), -h->GetXaxis()->GetXmin());
1083 s->SetMarkerColor(h->GetMarkerColor());
1084 s->SetMarkerSize(h->GetMarkerSize());
1085 s->SetMarkerStyle(h->GetMarkerStyle()+4);
1086 s->SetFillColor(h->GetFillColor());
1087 s->SetFillStyle(h->GetFillStyle());
1090 // Find the first and last bin with data
1091 Int_t first = nBins+1;
1093 for (Int_t i = 1; i <= nBins; i++) {
1094 if (h->GetBinContent(i) <= 0) continue;
1095 first = TMath::Min(first, i);
1096 last = TMath::Max(last, i);
1099 Double_t xfirst = h->GetBinCenter(first-1);
1100 Int_t f1 = h->GetXaxis()->FindBin(-xfirst);
1101 Int_t l2 = s->GetXaxis()->FindBin(xfirst);
1102 for (Int_t i = f1, j=l2; i <= last; i++,j--) {
1103 s->SetBinContent(j, h->GetBinContent(i));
1104 s->SetBinError(j, h->GetBinError(i));
1106 // Fill in overlap bin
1107 s->SetBinContent(l2+1, h->GetBinContent(first));
1108 s->SetBinError(l2+1, h->GetBinError(first));
1111 //__________________________________________________________________
1113 * Calculate the left-right asymmetry of input histogram
1115 * @param h Input histogram
1116 * @param max On return, the maximum distance from 1 of the histogram
1120 TH1* Asymmetry(TH1* h, Double_t& max)
1124 TH1* ret = static_cast<TH1*>(h->Clone(Form("%s_leftright", h->GetName())));
1125 // Int_t oBins = h->GetNbinsX();
1126 // Double_t high = h->GetXaxis()->GetXmax();
1127 // Double_t low = h->GetXaxis()->GetXmin();
1128 // Double_t dBin = (high - low) / oBins;
1129 // Int_t tBins = Int_t(2*high/dBin+.5);
1130 // ret->SetBins(tBins, -high, high);
1131 ret->SetDirectory(0);
1133 ret->SetTitle(Form("%s (+/-)", h->GetTitle()));
1134 ret->SetYTitle("Right/Left");
1135 Int_t nBins = h->GetNbinsX();
1136 for (Int_t i = 1; i <= nBins; i++) {
1137 Double_t x = h->GetBinCenter(i);
1140 Double_t c1 = h->GetBinContent(i);
1141 Double_t e1 = h->GetBinError(i);
1142 if (c1 <= 0) continue;
1144 Int_t j = h->FindBin(-x);
1145 if (j <= 0 || j > nBins) continue;
1147 Double_t c2 = h->GetBinContent(j);
1148 Double_t e2 = h->GetBinError(j);
1150 Double_t c12 = c1*c1;
1151 Double_t e = TMath::Sqrt((e2*e2*c1*c1+e1*e1*c2*c2)/(c12*c12));
1153 Int_t k = ret->FindBin(x);
1154 ret->SetBinContent(k, c2/c1);
1155 ret->SetBinError(k, e);
1157 max = TMath::Max(max, RatioMax(ret));
1161 //__________________________________________________________________
1163 * Transform a graph into a histogram
1169 TH1* Graph2Hist(const TGraphAsymmErrors* g) const
1171 Int_t nBins = g->GetN();
1172 TArrayF bins(nBins+1);
1174 for (Int_t i = 0; i < nBins; i++) {
1175 Double_t x = g->GetX()[i];
1176 Double_t exl = g->GetEXlow()[i];
1177 Double_t exh = g->GetEXhigh()[i];
1178 bins.fArray[i] = x-exl;
1179 bins.fArray[i+1] = x+exh;
1180 Double_t dxi = exh+exl;
1181 if (i == 0) dx = dxi;
1182 else if (dxi != dx) dx = 0;
1184 TString name(g->GetName());
1185 TString title(g->GetTitle());
1188 h = new TH1D(name.Data(), title.Data(), nBins, bins[0], bins[nBins]);
1191 h = new TH1D(name.Data(), title.Data(), nBins, bins.fArray);
1193 h->SetMarkerStyle(g->GetMarkerStyle());
1194 h->SetMarkerColor(g->GetMarkerColor());
1195 h->SetMarkerSize(g->GetMarkerSize());
1200 //==================================================================
1203 * @name Ratio utility functions
1206 * Get the maximum diviation from 1 in the passed ratio
1208 * @param h Ratio histogram
1210 * @return Max diviation from 1
1212 Double_t RatioMax(TH1* h) const
1214 Int_t nBins = h->GetNbinsX();
1216 for (Int_t i = 1; i <= nBins; i++) {
1217 Double_t c = h->GetBinContent(i);
1218 if (c == 0) continue;
1219 Double_t e = h->GetBinError(i);
1220 Double_t d = TMath::Abs(1-c-e);
1221 ret = TMath::Max(d, ret);
1225 //__________________________________________________________________
1227 * Make the ratio of h1 to h2
1229 * @param o1 First object (numerator)
1230 * @param o2 Second object (denominator)
1231 * @param max Maximum diviation from 1
1235 TH1* Ratio(const TObject* o1, const TObject* o2, Double_t& max) const
1237 if (!o1 || !o2) return 0;
1240 const TH1* h1 = dynamic_cast<const TH1*>(o1);
1242 // Info("Ratio", "First is a TH1");
1243 const TH1* h2 = dynamic_cast<const TH1*>(o2);
1245 // Info("Ratio", "Second is a TH1");
1246 r = RatioHH(h1,h2,max);
1249 const TGraph* g2 = dynamic_cast<const TGraph*>(o2);
1251 // Info("Ratio", "Second os a TGraph");
1252 r = RatioHG(h1,g2,max);
1257 const TGraphAsymmErrors* g1 = dynamic_cast<const TGraphAsymmErrors*>(o1);
1259 // Info("Ratio", "First is a TGraphAsymmErrors");
1260 const TGraphAsymmErrors* g2 =
1261 dynamic_cast<const TGraphAsymmErrors*>(o2);
1263 // Info("Ratio", "Second is a TGraphAsymmErrors");
1264 r = RatioGG(g1, g2, max);
1269 Warning("Ratio", "Don't know how to divide a %s (%s) with a %s (%s)",
1270 o1->ClassName(), o1->GetName(), o2->ClassName(), o2->GetName());
1273 // Check that the histogram isn't empty
1274 if (r->GetEntries() <= 0) {
1278 // for (Int_t bin = 1; bin <= r->GetNbinsX(); bin++)
1279 // if (r->GetBinContent(bin) != 0) return r;
1283 //__________________________________________________________________
1285 * Compute the ratio of @a h to @a g. @a g is evaluated at the bin
1288 * @param h Numerator
1290 * @param max Maximum diviation from 1
1294 TH1* RatioHG(const TH1* h, const TGraph* g, Double_t& max) const
1296 if (!h || !g) return 0;
1298 TH1* ret = static_cast<TH1*>(h->Clone("tmp"));
1299 ret->SetName(Form("%s_over_%s", h->GetName(), g->GetName()));
1300 ret->SetTitle(Form("%s / %s", h->GetTitle(), g->GetTitle()));
1302 ret->SetMarkerStyle(h->GetMarkerStyle());
1303 ret->SetMarkerColor(g->GetMarkerColor());
1304 ret->SetMarkerSize(0.9*h->GetMarkerSize());
1305 // ret->SetMarkerStyle(g->GetMarkerStyle());
1306 // ret->SetMarkerColor(h->GetMarkerColor());
1307 // ret->SetMarkerSize(0.9*g->GetMarkerSize());
1308 ret->SetDirectory(0);
1309 Double_t xlow = g->GetX()[0];
1310 Double_t xhigh = g->GetX()[g->GetN()-1];
1311 if (xlow > xhigh) { Double_t t = xhigh; xhigh = xlow; xlow = t; }
1313 for (Int_t i = 1; i <= h->GetNbinsX(); i++) {
1314 Double_t c = h->GetBinContent(i);
1315 if (c <= 0) continue;
1317 Double_t x = h->GetBinCenter(i);
1318 if (x < xlow || x > xhigh) continue;
1320 Double_t f = g->Eval(x);
1321 if (f <= 0) continue;
1323 ret->SetBinContent(i, c / f);
1324 ret->SetBinError(i, h->GetBinError(i) / f);
1326 if (ret->GetEntries() > 0)
1327 max = TMath::Max(RatioMax(ret), max);
1330 //__________________________________________________________________
1332 * Make the ratio of h1 to h2
1334 * @param h1 First histogram (numerator)
1335 * @param h2 Second histogram (denominator)
1336 * @param max Maximum diviation from 1
1340 TH1* RatioHH(const TH1* h1, const TH1* h2, Double_t& max) const
1342 if (!h1 || !h2) return 0;
1343 TH1* t1 = static_cast<TH1*>(h1->Clone(Form("%s_%s",
1346 t1->SetTitle(Form("%s / %s", h1->GetTitle(), h2->GetTitle()));
1348 // t1->SetMarkerColor(h1->GetMarkerColor());
1349 // t1->SetMarkerStyle(h2->GetMarkerStyle());
1350 t1->SetMarkerColor(h2->GetMarkerColor());
1351 t1->SetMarkerStyle(h1->GetMarkerStyle());
1352 t1->SetMarkerSize(0.9*h1->GetMarkerSize());
1353 t1->SetDirectory(0);
1354 max = TMath::Max(RatioMax(t1), max);
1357 //__________________________________________________________________
1359 * Calculate the ratio of two graphs - g1 / g2
1361 * @param g1 Numerator
1362 * @param g2 Denominator
1363 * @param max Maximum diviation from 1
1365 * @return g1 / g2 in a histogram
1367 TH1* RatioGG(const TGraphAsymmErrors* g1,
1368 const TGraphAsymmErrors* g2, Double_t& max) const
1370 Int_t nBins = g1->GetN();
1371 TArrayF bins(nBins+1);
1373 for (Int_t i = 0; i < nBins; i++) {
1374 Double_t x = g1->GetX()[i];
1375 Double_t exl = g1->GetEXlow()[i];
1376 Double_t exh = g1->GetEXhigh()[i];
1377 bins.fArray[i] = x-exl;
1378 bins.fArray[i+1] = x+exh;
1379 Double_t dxi = exh+exl;
1380 if (i == 0) dx = dxi;
1381 else if (dxi != dx) dx = 0;
1383 TString name(Form("%s_%s", g1->GetName(), g2->GetName()));
1384 TString title(Form("%s / %s", g1->GetTitle(), g2->GetTitle()));
1387 h = new TH1F(name.Data(), title.Data(), nBins, bins[0], bins[nBins]);
1390 h = new TH1F(name.Data(), title.Data(), nBins, bins.fArray);
1392 h->SetMarkerStyle(g1->GetMarkerStyle());
1393 h->SetMarkerColor(g2->GetMarkerColor());
1394 h->SetMarkerSize(0.9*g1->GetMarkerSize());
1395 // h->SetMarkerStyle(g2->GetMarkerStyle());
1396 // h->SetMarkerColor(g1->GetMarkerColor());
1397 // h->SetMarkerSize(0.9*g2->GetMarkerSize());
1400 Double_t low = g2->GetX()[0];
1401 Double_t high = g2->GetX()[g2->GetN()-1];
1402 if (low > high) { Double_t t = low; low = high; high = t; }
1403 for (Int_t i = 0; i < nBins; i++) {
1404 Double_t x = g1->GetX()[i];
1405 if (x < low-dx || x > high+dx) continue;
1406 Double_t c1 = g1->GetY()[i];
1407 Double_t e1 = g1->GetErrorY(i);
1408 Double_t c2 = g2->Eval(x);
1410 h->SetBinContent(i+1, c1 / c2);
1411 h->SetBinError(i+1, e1 / c2);
1413 max = TMath::Max(RatioMax(h), max);
1417 //==================================================================
1420 * @name Graphics utility functions
1423 * Find an X axis in a pad
1426 * @param name Histogram to find axis for
1428 * @return Found axis or null
1430 TAxis* FindXAxis(TVirtualPad* p, const char* name)
1432 TObject* o = p->GetListOfPrimitives()->FindObject(name);
1434 Warning("FindXAxis", "%s not found in pad", name);
1437 THStack* stack = dynamic_cast<THStack*>(o);
1439 Warning("FindXAxis", "%s is not a THStack", name);
1442 if (!stack->GetHistogram()) {
1443 Warning("FindXAxis", "%s has no histogram", name);
1446 TAxis* ret = stack->GetHistogram()->GetXaxis();
1450 //__________________________________________________________________
1452 * Fix the apperance of the axis in a stack
1454 * @param stack stack of histogram
1455 * @param s Scaling factor
1456 * @param ytitle Y axis title
1457 * @param force Whether to draw the stack first or not
1458 * @param ynDiv Divisions on Y axis
1460 void FixAxis(THStack* stack, Double_t s, const char* ytitle,
1461 Int_t ynDiv=210, Bool_t force=true)
1464 Warning("FixAxis", "No stack passed for %s!", ytitle);
1467 if (force) stack->Draw("nostack e1");
1469 TH1* h = stack->GetHistogram();
1471 Warning("FixAxis", "Stack %s has no histogram", stack->GetName());
1475 h->SetXTitle("#eta");
1476 h->SetYTitle(ytitle);
1477 TAxis* xa = h->GetXaxis();
1478 TAxis* ya = h->GetYaxis();
1480 xa->SetTitle("#eta");
1481 // xa->SetTicks("+-");
1482 xa->SetTitleSize(s*xa->GetTitleSize());
1483 xa->SetLabelSize(s*xa->GetLabelSize());
1484 xa->SetTickLength(s*xa->GetTickLength());
1486 if (stack != fResults) {
1487 TAxis* rxa = fResults->GetXaxis();
1488 xa->Set(rxa->GetNbins(), rxa->GetXmin(), rxa->GetXmax());
1492 ya->SetTitle(ytitle);
1494 // ya->SetTicks("+-");
1495 ya->SetNdivisions(ynDiv);
1496 ya->SetTitleSize(s*ya->GetTitleSize());
1497 ya->SetTitleOffset(ya->GetTitleOffset()/s);
1498 ya->SetLabelSize(s*ya->GetLabelSize());
1505 //__________________________________________________________________
1506 Bool_t fShowOthers; // Show other data
1507 Bool_t fShowAlice; // Show ALICE published data
1508 Bool_t fShowRatios; // Show ratios
1509 Bool_t fShowLeftRight;// Show asymmetry
1510 UShort_t fRebin; // Rebinning factor
1511 Bool_t fCutEdges; // Whether to cut edges
1512 TString fTitle; // Title on plot
1513 TNamed* fTrigString; // Trigger string (read, or set)
1514 TNamed* fNormString; // Normalisation string (read, or set)
1515 TNamed* fSNNString; // Energy string (read, or set)
1516 TNamed* fSysString; // Collision system string (read or set)
1517 TAxis* fVtxAxis; // Vertex cuts (read or set)
1518 TAxis* fCentAxis; // Centrality axis
1519 THStack* fResults; // Stack of results
1520 THStack* fRatios; // Stack of ratios
1521 THStack* fLeftRight; // Left-right asymmetry
1522 TMultiGraph* fOthers; // Older data
1523 TH1* fTriggers; // Number of triggers
1524 RangeParam* fRangeParam; // Parameter object for range zoom
1528 //=== Stuff for auto zooming =========================================
1529 void UpdateRange(dNdetaDrawer::RangeParam* p)
1532 Warning("UpdateRange", "No parameters %p", p);
1535 if (!p->fMasterAxis) {
1536 Warning("UpdateRange", "No master axis %p", p->fMasterAxis);
1539 Int_t first = p->fMasterAxis->GetFirst();
1540 Int_t last = p->fMasterAxis->GetLast();
1541 Double_t x1 = p->fMasterAxis->GetBinCenter(first);
1542 Double_t x2 = p->fMasterAxis->GetBinCenter(last);
1543 //Info("UpdateRange", "Range set to [%3d,%3d]->[%f,%f]", first, last, x1,x2);
1545 if (p->fSlave1Axis) {
1546 Int_t i1 = p->fSlave1Axis->FindBin(x1);
1547 Int_t i2 = p->fSlave1Axis->FindBin(x2);
1548 p->fSlave1Axis->SetRange(i1, i2);
1549 p->fSlave1Pad->Modified();
1550 p->fSlave1Pad->Update();
1552 if (p->fSlave2Axis) {
1553 Int_t i1 = p->fSlave2Axis->FindBin(x1);
1554 Int_t i2 = p->fSlave2Axis->FindBin(x2);
1555 p->fSlave2Axis->SetRange(i1, i2);
1556 p->fSlave2Pad->Modified();
1557 p->fSlave2Pad->Update();
1559 TCanvas* c = gPad->GetCanvas();
1563 //____________________________________________________________________
1564 void RangeExec(dNdetaDrawer::RangeParam* p)
1571 // 11: Mouse release
1572 // dNdetaDrawer::RangeParam* p =
1573 // reinterpret_cast<dNdetaDrawer::RangeParam*>(addr);
1574 Int_t event = gPad->GetEvent();
1575 TObject *select = gPad->GetSelected();
1580 if (event != 11 || !select || select != p->fMasterAxis) return;
1584 //=== Steering function ==============================================
1586 * Draw @f$ dN/d\eta@f$
1588 * @param filename File name
1589 * @param flags Flags
1590 * @param title Title
1591 * @param rebin Rebinning factor
1592 * @param cutEdges Whether to cut edges when rebinning
1593 * @param sNN (optional) Collision energy [GeV]
1594 * @param sys (optional) Collision system (1: pp, 2: PbPb)
1595 * @param trg (optional) Trigger (1: INEL, 2: INEL>0, 4: NSD)
1596 * @param vzMin Least @f$ v_z@f$
1597 * @param vzMax Largest @f$ v_z@f$
1599 * @ingroup pwg2_forward_dndeta
1602 DrawdNdeta(const char* filename="forward_dndeta.root",
1604 const char* title="",
1606 Bool_t cutEdges=false,
1613 dNdetaDrawer* pd = new dNdetaDrawer;
1614 dNdetaDrawer& d = *pd;
1616 d.SetCutEdges(cutEdges);
1618 d.SetShowOthers(flags & 0x1);
1619 d.SetShowAlice(flags & 0x2);
1620 d.SetShowRatios(flags & 0x4);
1621 d.SetShowLeftRight(flags & 0x8);
1622 // Do the below if your input data does not contain these settings
1623 if (sNN > 0) d.SetSNN(sNN); // Collision energy per nucleon pair (GeV)
1624 if (sys > 0) d.SetSys(sys); // Collision system (1:pp, 2:PbPB)
1625 if (trg > 0) d.SetTrigger(trg); // Collision trigger (1:INEL, 2:INEL>0, 4:NSD)
1626 if (vzMin < 999 && vzMax > -999)
1627 d.SetVertexRange(vzMin,vzMax); // Collision vertex range (cm)
1630 //____________________________________________________________________