1 #include "SummaryDrawer.C"
3 #include <TMultiGraph.h>
5 class SummaryMultDistsDrawer : public SummaryDrawer
11 SummaryMultDistsDrawer()
14 //____________________________________________________________________
15 void Run(const char* fname="forward_multdists.root", UShort_t flags=kNormal)
17 // --- Open the file -----------------------------------------------
18 TString filename(fname);
19 TFile* file = TFile::Open(filename.Data(), "READ");
21 Error("Run", "Failed to open \"%s\"", filename.Data());
24 fPause = flags & kPause;
26 // --- Make our canvas ---------------------------------------------
27 TString pdfName(filename);
28 pdfName.ReplaceAll(".root", ".pdf");
29 CreateCanvas(pdfName, flags & kLandscape);
31 // --- Force MB for pp ---------------------------------------------
32 TCollection* c = GetCollection(file, "ForwardMultSums");
34 // --- Make a Title page -------------------------------------------
37 // --- Overview plots ----------------------------------------------
39 DrawInPad(fBody, 1, GetH1(c, "triggers"), "hist text30");
40 DrawInPad(fBody, 2, GetH1(c, "status"), "hist text30");
41 DrawInPad(fBody, 3, GetH1(c, "diagnostics"),"colz text");
42 PrintCanvas("Overview");
44 DrawSumCollection(c, "symmetric");
45 DrawSumCollection(c, "negative");
46 DrawSumCollection(c, "positive");
47 DrawSumCollection(c, "other");
49 c = GetCollection(file, "ForwardMultResults");
55 DrawResCollection(c, "symmetric");
56 DrawResCollection(c, "negative");
57 DrawResCollection(c, "positive");
58 DrawResCollection(c, "other");
64 TCollection* GetEtaBin(TObject* o, Double_t& etaMin, Double_t& etaMax)
66 const char* re = "[pm][0-9]*d[0-9]*_[pm][0-9]*d[0-9]*";
69 if (!o->IsA()->InheritsFrom(TCollection::Class())) {
70 // Warning("GetEtaBin", "Don't know how to deal with %s - a %s",
71 // o->GetName(), o->ClassName());
74 TString oN(o->GetName());
75 if (oN.Index(check) == kNPOS) {
76 // Warning("GetEtaBin", "Collection %s does not match %s",
80 Int_t ul = oN.Index("_");
81 TString sMin = oN(0, ul);
82 TString sMax = oN(ul+1, oN.Length()-ul-1);
83 sMin.ReplaceAll("p", "+");
84 sMin.ReplaceAll("m", "-");
85 sMin.ReplaceAll("d", ".");
86 sMax.ReplaceAll("p", "+");
87 sMax.ReplaceAll("m", "-");
88 sMax.ReplaceAll("d", ".");
92 return static_cast<TCollection*>(o);
94 //____________________________________________________________________
95 void DrawSumCollection(TCollection* top, const TString& name)
97 TCollection* c = GetCollection(top, name, false);
100 PrintCanvas(Form("Sums - %s", name.Data()));
104 while ((o = next())) {
105 Double_t etaMin = 999;
106 Double_t etaMax = 999;
107 TCollection* bin = GetEtaBin(o, etaMin, etaMax);
111 DrawInPad(fBody, 1, GetH1(bin, "rawDist"), "", kLogy);
112 DrawInPad(fBody, 1, GetH1(bin, "truthAccepted",false),"same",
114 DrawInPad(fBody, 1, GetH1(bin, "truth",false), "same",
115 kLogy|kLegend|kSilent);
116 DrawInPad(fBody, 2, GetH1(bin, "coverage"));
117 DrawInPad(fBody, 3, GetH2(bin, "corr"), "colz");
118 DrawInPad(fBody, 4, GetH2(bin, "response",false), "colz",kLogz|kSilent);
120 PrintCanvas(Form("%+5.1f < #eta < %+5.1f", etaMin, etaMax));
123 //____________________________________________________________________
124 void DrawResCollection(TCollection* top, const TString& name)
126 TCollection* c = GetCollection(top, name, false);
129 THStack* s = GetStack(c, "all");
131 DrawInPad(fBody, 0, s, "nostack", kLogy);
132 TLegend* l = new TLegend(.5, .75, .98, .98, "P(#it{N}_{ch})");
134 // l->SetBorderMode(0);
137 TIter next(s->GetHists());
139 Bool_t hasTrue = false;
140 while ((h = static_cast<TH1*>(next()))) {
141 TString n(h->GetTitle());
142 if (n.BeginsWith("True")) { hasTrue = true; continue; }
143 n.ReplaceAll("Raw P(#it{N}_{ch}) in ", "");
144 TLegendEntry* e = l->AddEntry("dummy", n, "p");
145 e->SetMarkerStyle(h->GetMarkerStyle());
148 TLegendEntry* e = l->AddEntry("dummy", "Raw", "p");
149 e->SetMarkerStyle(20);
150 e->SetMarkerColor(kRed+1);
151 e = l->AddEntry("dummy", "MC truth", "p");
152 e->SetMarkerStyle(24);
153 e->SetMarkerColor(kBlue+1);
154 e = l->AddEntry("dummy", "MC truth selected", "p");
155 e->SetMarkerStyle(24);
156 e->SetMarkerColor(kOrange+1);
161 PrintCanvas(Form("%s results", name.Data()));
167 while ((o = nextO())) {
168 Double_t etaMin = 999;
169 Double_t etaMax = 999;
170 TCollection* bin = GetEtaBin(o, etaMin, etaMax);
174 DrawInPad(fBody, 1, GetH1(bin, "rawDist"), "", kLogy);
175 DrawInPad(fBody, 1, GetH1(bin, "truthAccepted", false),
177 DrawInPad(fBody, 1, GetH1(bin, "truth", false),"same", kSilent|kLegend);
178 DrawInPad(fBody, 2, GetH1(bin, "coverage"));
179 DrawInPad(fBody, 3, GetH2(bin, "corr"), "colz");
180 DrawInPad(fBody, 4, GetH2(bin, "response", false), "colz", kLogz|kSilent);
181 DrawInPad(fBody, 5, GetH1(bin, "triggerVertex", false), "", kSilent);
183 PrintCanvas(Form("%+5.1f < #eta < %+5.1f", etaMin, etaMax));
186 //____________________________________________________________________
187 void DrawTitlePage(const TCollection* c)
192 TLatex* ltx = new TLatex(.5, y, "AOD #rightarrow P(#it{N}_{ch} )");
193 ltx->SetTextSize(0.07);
194 ltx->SetTextFont(62);
195 ltx->SetTextAlign(22);
199 Bool_t mc = GetObject(c, "mcVertex", false) != 0;
202 TLatex* sub = new TLatex(.5, y, "(Simulation input)");
203 sub->SetTextSize(0.04);
204 sub->SetTextFont(42);
205 sub->SetTextAlign(22);
210 Double_t save = fParName->GetTextSize();
211 fParName->SetTextSize(0.03);
212 fParVal->SetTextSize(0.03);
220 GetParameter(c, "sys", sys);
221 GetParameter(c, "sNN", sNN);
222 GetParameter(c, "trigger", trig);
223 GetParameter(c, "minIpZ", minIpZ);
224 GetParameter(c, "maxIpZ", maxIpZ);
226 TString tT; TriggerString(trig, tT); DrawParameter(y, "Trigger", tT);
227 TString tS; SysString(sys, tS); DrawParameter(y, "System", tS);
228 TString tE; SNNString(sNN, tE); DrawParameter(y, "#sqrt{s_{NN}}", tE);
229 DrawParameter(y, "IP_{z} range", Form("%+5.2fcm - %+5.2fcm",
232 PrintCanvas("Title page");
233 fParName->SetTextSize(save);
234 fParVal->SetTextSize(save);