1 #ifndef ALITRACKLETDNDETAPOST_H
2 #define ALITRACKLETDNDETAPOST_H
11 #include <TParameter.h>
14 #include <TLegendEntry.h>
17 #include <TGraphAsymmErrors.h>
19 #include <TFitResult.h>
407 const char*
ObsTitle()
const {
return "d#it{N}_{ch}/d#eta"; }
524 Color_t
color=kBlack,
544 THStack*
stack=0, TDirectory* out=0);
556 const char* dataName =
"data.root",
557 const char* simName =
"sim.root");
576 fCombinatoricsScale(1.3),
577 fCombinatoricsScaleMode(kPerEtaCent),
587 save = gErrorIgnoreLevel;
588 gErrorIgnoreLevel = lvl;
592 gErrorIgnoreLevel =
save;
602 fTop->SetFillStyle(1001);
603 fTop->SetBorderSize(0);
604 fTop->SetBorderMode(0);
608 fBody->SetFillColor(0);
609 fBody->SetFillStyle(0);
610 fBody->SetBorderSize(0);
611 fBody->SetBorderMode(0);
612 fBody->SetTopMargin(0.01);
613 fBody->SetRightMargin(0.01);
614 fBody->SetBottomMargin(0.10);
615 fBody->SetLeftMargin(0.10);
623 gStyle->SetOptStat(0);
624 gStyle->SetOptTitle(0);
627 Int_t w = h / TMath::Sqrt(2);
634 fCanvas =
new TCanvas(
"c",outputName,w,h);
641 fCanvas->Print(Form(
"%s[", outputName.Data()),
642 Form(
"pdf %s",
fLandscape ?
"Landscape" :
""));
645 fCanvas->SetRightMargin (0.05);
647 fCanvas->SetBottomMargin(0.10);
650 fTop =
new TPad(
"top",
"Top",0,1-dy,1,1,0,0);
658 fBody =
new TPad(
"body",
"Body",0,0,1,1-dy,0,0);
669 fHeader =
new TLatex(.5, .5,
"Title");
684 Form(
"pdf %s Title:%s",
687 Printf(
"PDF %s written",
fCanvas->GetTitle());
699 fHeader->DrawLatex(.5,.5,title);
707 tit.Form(
"pdf %s Title:%s",
720 TFile*
file = TFile::Open(filename,
"READ");
722 Warning(
"OpenFile",
"Failed to open \"%s\"", filename);
736 h->SetMarkerColor(color);
737 h->SetMarkerStyle(marker);
738 h->SetMarkerSize(size);
739 h->SetFillColor(color);
740 h->SetFillStyle(fill);
741 h->SetLineColor(color);
742 h->SetLineStyle(line);
743 h->SetLineWidth(width);
744 h->GetXaxis()->SetNdivisions(210);
745 h->GetYaxis()->SetNdivisions(210);
755 Warning(
"",
"Nothing to draw in pad %d", pad);
759 TVirtualPad* p = c->cd(pad);
762 if (option.Contains(
"logx")) { p->SetLogx(); option.ReplaceAll(
"logx",
""); }
763 if (option.Contains(
"logy")) { p->SetLogy(); option.ReplaceAll(
"logy",
""); }
764 if (option.Contains(
"logz")) { p->SetLogz(); option.ReplaceAll(
"logz",
""); }
765 if (option.Contains(
"grid")) { p->SetGridx(); p->SetGridy();
766 option.ReplaceAll(
"grid",
""); }
768 if (option.Contains(
"leg2")) { leg = 2; option.ReplaceAll(
"leg2",
""); }
769 if (option.Contains(
"leg")) { leg = 1; option.ReplaceAll(
"leg",
""); }
772 l = p->BuildLegend(0.5, 0.73, .98, .98);
775 TIter next(l->GetListOfPrimitives());
776 TLegendEntry* ent = 0;
777 while ((ent = static_cast<TLegendEntry*>(next()))) {
778 if (
TString(ent->GetLabel()).EqualTo(
"frame")) frame = ent;
780 if (frame) l->GetListOfPrimitives()->Remove(frame);
793 TLatex* ln =
new TLatex(.49, y, name);
794 ln->SetTextAlign(31);
795 ln->SetTextSize(0.02/gPad->GetHNDC());
798 TLatex* lv =
new TLatex(.51, y, val);
799 lv->SetTextAlign(11);
800 lv->SetTextSize(0.02/gPad->GetHNDC());
803 y -= 0.025/gPad->GetHNDC();
833 TLatex* latex =
new TLatex(.5, y, title);
834 latex->SetTextAlign(21);
835 latex->SetTextSize(0.023/gPad->GetHNDC());
838 y -= 0.028/gPad->GetHNDC();
843 (mode & 0x2 ?
"recon" :
""),
844 (mode & 0x4 ?
" inj" :
""),
845 (mode & 0x8 ?
" rot" :
"")));
846 DrawParam(
"Scale by sin^{2}(#it{#theta})",y,
847 bool(
GetB(pars,
"ScaleDTheta")));
850 y,
GetD(pars,
"ShiftedDPhiCut"));
853 y, (tmp < 0 ?
"n/a" : Form(
"%f", tmp)));
857 GetD(pars,
"TailDelta"));
860 DrawParam(
"#phi overlap cut", y,
GetD(pars,
"PhiOverlapCut"));
861 DrawParam(
"#it{z}-#eta overlap cut",y,
GetD(pars,
"ZEtaOverlapCut"));
862 DrawParam(
"#phi rotation", y, TMath::RadToDeg()*
863 GetD(pars,
"PhiRotation"));
865 DrawParam(
"Background method", y, comb ?
"Combinatorics" :
"Injection");
872 fBody->Divide(1,3,0,0);
875 TVirtualPad* p1 =
fBody->GetPad(1); p1->SetPad(0,1-yr,1,1);
876 TVirtualPad* p2 =
fBody->GetPad(2); p2->SetPad(0,(1-yr)/2,1,1-yr);
877 TVirtualPad* p3 =
fBody->GetPad(3); p3->SetPad(0,0,1,(1-yr)/2);
882 TLatex* latex =
new TLatex(.5, y,
"Post-processing");
883 latex->SetTextAlign(21);
884 latex->SetTextSize(0.023/p1->GetHNDC());
887 y -= 0.028/p1->GetHNDC();
893 "per eta,centrality"));
901 DrawParams(
GetC(simSums,
"parameters"),
"Simulated data", simComb);
913 THStack*
stack =
new THStack(name, title);
914 TH1* data =
CopyH1(realList, name, Form(
"real%s",name));
915 TH1* sim =
CopyH1(simList, name, Form(
"sim%s",name));
916 TString dtit(data->GetTitle());
917 if (dtit.Contains(
"\\")) dtit.Form(
"%s\\hbox{ - real}", data->GetTitle());
918 else dtit.Form(
"%s - real", data->GetTitle());
919 data->SetTitle(dtit);
921 if (stit.Contains(
"\\")) stit.Form(
"%s\\hbox{ - sim.}", sim->GetTitle());
922 else stit.Form(
"%s - sim.", sim->GetTitle());
924 stack->Add(data, dataOpt);
925 stack->Add(sim, simOpt);
938 sim->Draw(
"box same");
939 fBody->GetPad(pad)->Modified();
951 l->SetX1(px1+(px2-px1)*x1);
952 l->SetX2(px1+(px2-px1)*x2);
953 l->SetY1(py1+(py2-py1)*y1);
954 l->SetY2(py1+(py2-py1)*y2);
961 THStack* ipz =
Make2Stack(
"ipz",
"IP_{#it{z}}", realList,simList);
962 THStack* cent =
Make2Stack(
"cent",
"Centrality [%]", realList,simList);
963 THStack* status =
Make2Stack(
"status",
"Task status", realList,simList,
964 "B text90",
"B text90");
965 TH1* mcStatus =
GetH1(simList,
"statusMC");
966 mcStatus->SetMaximum(1.2*mcStatus->GetMaximum());
969 for (
Int_t i = 1; i <= 8; i++) {
970 fBody->GetPad(i)->SetRightMargin(0.01);
971 fBody->GetPad(i)->SetTopMargin(0.01);
997 while ((dir = static_cast<TObjString*>(next()))) {
998 subCont =
GetC(ress, dir->GetName());
1002 if (subCont) ret =
GetH1(subCont, name);
1011 if (!ress)
return 0;
1013 if (!subCont)
return 0;
1014 TH1* h =
GetH1(subCont, Form(
"delta%s", scaled ?
"Scaled" :
""));
1016 if (!scaled)
return h;
1018 if (tit.Contains(
"\\")) tit.Append(Form(
"\\hbox{ - %s}",sub));
1019 else tit.Append(Form(
" - %s", sub));
1025 THStack* particlePdgs =
new THStack(
"particlePdg",
"Particle species");
1026 particlePdgs->Add(
GetH1(mcList,
"allPrimaryPdg"));
1027 particlePdgs->Add(
GetH1(mcList,
"cutPrimaryPdg"));
1028 particlePdgs->Add(
GetH1(mcList,
"allSecondaryPdg"));
1029 particlePdgs->Add(
GetH1(mcList,
"cutSecondaryPdg"));
1030 particlePdgs->SetMaximum(particlePdgs->GetMaximum(
"nostack")*50);
1031 particlePdgs->SetMinimum(8*1e-7);
1032 THStack* parentPdgs =
new THStack(
"parentPdg",
"Parent species");
1033 parentPdgs->Add(
GetH1(mcList,
"allPrimaryParentPdg"));
1034 parentPdgs->Add(
GetH1(mcList,
"cutPrimaryParentPdg"));
1035 parentPdgs->Add(
GetH1(mcList,
"allSecondaryParentPdg"));
1036 parentPdgs->Add(
GetH1(mcList,
"cutSecondaryParentPdg"));
1037 parentPdgs->SetMaximum(parentPdgs->GetMaximum(
"nostack")*50);
1038 parentPdgs->SetMinimum(8*1e-5);
1041 fBody->Divide(1,2,0,0);
1042 fBody->GetPad(1)->SetRightMargin(0.01);
1043 fBody->GetPad(2)->SetRightMargin(0.01);
1045 TLegend* p1Leg =
DrawInPad(
fBody, 1, particlePdgs,
"nostack logy leg2 grid");
1046 TLegend* p2Leg =
DrawInPad(
fBody, 2, parentPdgs,
"nostack logy leg2 grid");
1047 p1Leg->SetHeader(particlePdgs->GetTitle());
1048 p2Leg->SetHeader(parentPdgs ->GetTitle());
1052 particlePdgs->GetHistogram()->GetXaxis()->LabelsOption(
"v");
1053 parentPdgs ->GetHistogram()->GetXaxis()->LabelsOption(
"v");
1057 fBody->GetPad(1)->Modified();
1058 fBody->GetPad(2)->Modified();
1067 fBody->Divide(1,2,0,0);
1068 fBody->GetPad(1)->SetRightMargin(0.01);
1069 fBody->GetPad(2)->SetRightMargin(0.01);
1072 THStack* orig =
new THStack(
"orig",
"#Delta");
1073 orig->Add(
FindDelta(realList,
"data",
false));
1074 orig->Add(
FindDelta(realList,
"injection",
false));
1075 orig->Add(
FindDelta(simList,
"data",
false));
1076 orig->Add(
FindDelta(simList,
"injection",
false));
1077 orig->Add(
FindDelta(simList,
"primaries",
false));
1078 orig->Add(
FindDelta(simList,
"combinatorics",
false));
1079 orig->Add(
FindDelta(simList,
"secondaries",
false));
1080 orig->Add(
FindDelta(simList,
"uncorrelatedCombinatorics",
false));
1082 THStack* scaled =
new THStack(
"scaled",
"#Delta (scaled)");
1083 scaled->Add(
FindDelta(realList,
"data",
false));
1084 scaled->Add(
FindDelta(realList,
"injection",
true));
1085 scaled->Add(
FindDelta(simList,
"data",
false));
1086 scaled->Add(
FindDelta(simList,
"injection",
true));
1087 scaled->Add(
FindDelta(simList,
"primaries",
false));
1088 scaled->Add(
FindDelta(simList,
"combinatorics",
true));
1089 scaled->Add(
FindDelta(simList,
"secondaries",
false));
1090 scaled->Add(
FindDelta(simList,
"uncorrelatedCombinatorics",
true));
1092 Double_t max = 1.2*orig->GetMaximum(
"nostack");
1094 TH2* frame =
new TH2D(
"frame",
"",
1096 templ->GetXaxis()->GetXmin(),
1097 templ->GetXaxis()->GetXmax(),
1099 frame->SetXTitle(templ->GetXaxis()->GetTitle());
1100 frame->SetYTitle(templ->GetYaxis()->GetTitle());
1102 frame->SetDirectory(0);
1104 cuts->SetLineColor(kGreen+1);
1105 frame->GetListOfFunctions()->Add(cuts);
1107 cutt->SetLineColor(kRed+1);
1108 frame->GetListOfFunctions()->Add(cutt);
1111 TH1* f1 =
static_cast<TH1*
>(frame->Clone());
1112 f1->SetDirectory(0);
1117 fBody->GetPad(1)->GetLeftMargin(),
1118 fBody->GetPad(1)->GetBottomMargin(),
1122 TH1* f2 =
static_cast<TH1*
>(frame->Clone());
1123 f2->SetDirectory(0);
1128 fBody->GetPad(2)->GetLeftMargin(),
1129 fBody->GetPad(2)->GetBottomMargin(),
1144 TH2* data =
CopyH2(sc,
"etaVsIPz",
"raw");
1145 TH2* bgEst =
CopyH2(sc,
"backgroundEst",
"rawBg");
1147 TH2* sigEst=
CopyH2(sc,
"signalEst",
"raw");
1148 if (data && mask) data ->Multiply(mask);
1149 if (bgEst && mask) bgEst ->Multiply(mask);
1150 if (mBeta && mask) mBeta ->Multiply(mask);
1151 if (sigEst && mask) sigEst->Multiply(mask);
1152 mBeta->SetMinimum(0);
1153 mBeta->SetMaximum(.7);
1154 Double_t max = TMath::Max(data->GetMaximum(), sigEst->GetMaximum());
1155 data ->SetMinimum(0);
1156 sigEst->SetMinimum(0);
1157 bgEst ->SetMinimum(0);
1158 data ->SetMaximum(max);
1159 sigEst->SetMaximum(max);
1161 TVirtualPad* q = c->cd(pad);
1162 q->SetRightMargin(0.10);
1168 TVirtualPad* r = q->GetPad(4);
1169 r->SetRightMargin(0.12);
1170 r->SetPad(r->GetXlowNDC(), r->GetYlowNDC(),
1171 .99, r->GetYlowNDC()+r->GetHNDC());
1173 TLatex* ltx =
new TLatex(.01,.5, pretty);
1175 ltx->SetTextFont(62);
1176 ltx->SetTextAngle(90);
1177 ltx->SetTextAlign(23);
1178 ltx->SetTextSize(0.07);
1189 fBody->SetLeftMargin(0.2);
1190 fBody->SetTopMargin(0.10);
1191 fBody->Divide(1,4,0,0);
1194 "injection",
"Injection - Real"));
1196 "injection",
"Injection - Sim."));
1198 "combinatorics",
"MC Labels"));
1200 "uncorrelatedCombinatorics",
1201 "MC Labels - Uncorr."));
1203 for (i = 1; i <= 4; i++) {
1204 TVirtualPad* p =
fBody->GetPad(i);
1206 for (
Int_t j = 1; j <= 4; j++) {
1207 TVirtualPad* q = p->GetPad(j);
1208 TH1* h =
static_cast<TH1*
>(q->FindObject(
"raw"));
1213 h =
static_cast<TH1*
>(q->FindObject(
"rawBg"));
1214 if (h) h->SetMaximum(max/5);
1217 const char* headings[] = {
"Measured",
1221 const char** ptr = headings;
1224 TLatex* head =
new TLatex(
fBody->GetRightMargin()+
1225 (1-
fBody->GetRightMargin())/4*(i+.5),
1228 head->SetTextAlign(23);
1229 head->SetTextFont(62);
1230 head->SetTextSize(0.025);
1240 Printf(
"Content of %s - %s", h->GetName(), h->GetTitle());
1241 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
1243 for (
Int_t j = 1; j <= h->GetNbinsY(); j++) {
1246 if (TMath::IsNaN(c) || TMath::IsNaN(e))
1247 printf(
"*** NAN ***");
1249 printf(
"%.*f+/-%.*f ", prec, c, prec, e);
1257 TH2* r =
static_cast<TH2*
>(h->Clone(
"fiducial"));
1260 r->SetTitle(
"Fiducial cut");
1261 for (
Int_t i = 1; i <= r->GetNbinsX(); i++) {
1262 for (
Int_t j = 1; j <= r->GetNbinsY(); j++) {
1264 if (c <= fAlphaMin || c >
fAlphaMax)
continue;
1265 r->SetBinContent(i,j,1);
1266 r->SetBinError (i,j,0);
1285 if (al && mask) al ->Multiply(mask);
1286 if (als && mask) als->Multiply(mask);
1290 TVirtualPad* q = c->cd(pad);
1291 q->SetRightMargin(0.10);
1296 TVirtualPad* r = q->GetPad(2);
1297 r->SetRightMargin(0.12);
1298 r->SetPad(r->GetXlowNDC(), r->GetYlowNDC(),
1299 .99, r->GetYlowNDC()+r->GetHNDC());
1301 TLatex* ltx =
new TLatex(.01,.5, pretty);
1303 ltx->SetTextFont(62);
1304 ltx->SetTextAngle(90);
1305 ltx->SetTextAlign(23);
1306 ltx->SetTextSize(0.07);
1314 fBody->SetLeftMargin(0.2);
1315 fBody->SetTopMargin(0.10);
1316 fBody->Divide(1,3,0,0);
1320 "MC Labels - Uncorr.");
1322 const char* headings[] = {
"#alpha all MC",
1323 "#alpha selected MC",
1325 const char** ptr = headings;
1328 TLatex* head =
new TLatex(
fBody->GetRightMargin()+
1329 (1-
fBody->GetRightMargin())/2*(i+.5),
1332 head->SetTextAlign(23);
1333 head->SetTextFont(62);
1334 head->SetTextSize(0.025);
1347 THStack* dNdeta =
new THStack(
"dndeta",
ObsTitle());
1348 TH1* all =
GetH1(simList,
"truedNdeta");
1349 TH1* sel =
GetH1(simList,
"truedNdetaSel");
1352 fBody->GetPad(1)->SetTopMargin(0.01);
1353 fBody->GetPad(1)->SetRightMargin(0.01);
1358 TVirtualPad* p =
fBody->cd(2);
1359 p->SetRightMargin(0.0);
1360 p->SetBottomMargin(0.15);
1362 p->GetPad(1)->SetRightMargin(0.01);
1363 p->GetPad(2)->SetRightMargin(0.01);
1364 p->GetPad(3)->SetRightMargin(0.01);
1365 THStack* ipz =
new THStack(
"ipz",
"IP_{#it{z}}");
1366 ipz->Add(
GetH1(simList,
"ipz"));
1367 ipz->Add(
GetH1(simList,
"ipzGen"));
1368 ipz->Add(
GetH1(simList,
"ipzSel"));
1369 l =
DrawInPad(p, 1, ipz,
"nostack grid leg");
1370 ipz->GetHistogram()->SetYTitle(
"Fraction");
1371 ipz->GetHistogram()->GetYaxis()->SetTitleSize(0.12);
1372 ipz->GetHistogram()->GetYaxis()->SetTitleOffset(0.4);
1373 ipz->GetHistogram()->GetYaxis()->SetLabelSize(0.09);
1374 ModLegend(p->GetPad(1), l, .4, 0, .75, .4);
1377 TGraphAsymmErrors::Class()));
1379 ipzEff->GetHistogram()->SetYTitle(
"#epsilon_{IP_{#it{z}}}");
1380 ipzEff->GetHistogram()->GetYaxis()->SetTitleSize(0.12);
1381 ipzEff->GetHistogram()->GetYaxis()->SetLabelSize(0.09);
1382 ipzEff->GetHistogram()->GetYaxis()->SetTitleOffset(0.4);
1383 ipzEff->GetHistogram()->GetXaxis()->SetRangeUser(ipz->GetXaxis()->GetXmin(),
1384 ipz->GetXaxis()->GetXmax());
1385 p->GetPad(2)->Modified();
1388 ipzRes->GetYaxis()->SetTitleSize(0.12);
1389 ipzRes->GetYaxis()->SetTitleOffset(0.4);
1390 ipzRes->GetYaxis()->SetLabelSize(0.09);
1391 ipzRes->GetXaxis()->SetTitleSize(0.09);
1392 ipzRes->GetXaxis()->SetLabelSize(0.09);
1393 ipzRes->GetXaxis()->SetTitleOffset(0.4);
1421 deltaIntg =
GetH1(c,
"deltaTailInt");
1423 if (deltaIntg)
return deltaIntg;
1425 TH2* etaVsDelta =
GetH2(c,
"etaVsDelta");
1426 Double_t maxDelta = etaVsDelta->GetYaxis()->GetXmax();
1427 deltaIntg = etaVsDelta->ProjectionX(
"deltaTailInt");
1428 deltaIntg->SetDirectory(0);
1430 deltaIntg->SetYTitle(Form(
"#int_{%3.1f}^{%4.1f}d#Delta",
1432 for (
Int_t i = 1; i <= deltaIntg->GetNbinsX(); i++) {
1433 TH1* tmp = etaVsDelta->ProjectionY(
"tmp",i,i);
1436 deltaIntg->SetBinContent(i, intg);
1437 deltaIntg->SetBinError (i, eintg);
1449 TH1* ret =
static_cast<TH1*
>(dataInt->Clone(
"deltaTailRatio"));
1450 ret->SetDirectory(0);
1451 ret->SetYTitle(
"Ratio of tails (data/injection)");
1452 ret->Divide(injInt);
1461 case 0:
return (sim ? 24 : 20);
1462 case 1:
return (sim ? 24 : 20);
1463 case 2:
return (sim ? 25 : 21);
1464 case 3:
return (sim ? 26 : 22);
1465 default:
return (sim ? 5 : 2);
1469 case 0:
return (sim ? 25 : 21);
1470 case 1:
return (sim ? 28 : 34);
1471 case 2:
return (sim ? 27 : 33);
1472 case 3:
return (sim ? 30 : 29);
1474 return (sim ? 5 : 2);
1490 Container* simBgC = simComb ? simCombC :
GetC(simList,
"injection");
1491 Container* realBgC = realComb ? simCombC :
GetC(realList,
"injection");
1494 TH2* realMeas =
CopyH2(realData,
"etaVsIPz",
"realMeas");
1495 TH1* realIPz =
CopyH1(realList,
"ipz",
"realIPz");
1496 TH2* realBg =
CopyH2(realBgC,
"backgroundEst",
"realBg");
1517 scale =
RatioE(rReal, eReal, rSim, eSim, scaleE);
1518 Scale(realBg, scale, scaleE);
1523 scaleH =
static_cast<TH1*
>(realTail->Clone(
"scaleBg"));
1524 scaleH->SetDirectory(0);
1525 scaleH->SetYTitle(
"k_{#eta}");
1526 scaleH->SetTitle(
"Scalar");
1527 SetAttr(scaleH, scaleH->GetMarkerColor(), 34);
1528 scaleH->Divide(simTail);
1529 TF1* scaleF =
new TF1(
"ff",
"pol0",
1530 scaleH->GetXaxis()->GetXmin(),
1531 scaleH->GetXaxis()->GetXmax());
1532 TFitResultPtr scaleR = scaleH->Fit(scaleF,
"QN0SR");
1533 scale = scaleR->Parameter(0);
1534 scaleE = scaleR->ParError(0);
1535 Scale(realBg, scaleH);
1539 Scale(beta, scale, scaleE);
1541 TH2* one =
CopyH2(realBgC,
"beta",
"one");
1543 for (
Int_t i = 1; i <= one->GetNbinsX(); i++)
1544 for (
Int_t j = 1; j <= one->GetNbinsY(); j++)
1545 one->SetBinContent(i,j,1);
1549 realSig =
CopyH2(realData,
"etaVsIPz",
"realSig");
1550 realSig->SetMarkerStyle(beta->GetMarkerStyle());
1551 realSig->Multiply(one);
1559 realSig =
CopyH2(realBgC,
"signalEst");
1561 if (!realMeas || !realSig || !realBg || !realIPz) {
1562 Warning(
"DrawdNdeta",
"One or more real data histograms missing: "
1563 "meas=%p sig=%p bg=%p ipz=%p", realMeas, realSig, realBg, realIPz);
1566 if (realBg ->GetMarkerStyle() == 30) realBg ->SetMarkerStyle(29);
1567 if (realBg ->GetMarkerStyle() == 27) realBg ->SetMarkerStyle(33);
1568 if (realSig->GetMarkerStyle() == 30) realSig->SetMarkerStyle(29);
1569 if (realSig->GetMarkerStyle() == 27) realSig->SetMarkerStyle(33);
1571 TH2* simMeas =
CopyH2(simData,
"etaVsIPz",
"simMeas");
1572 TH1* simIPz =
CopyH1(simList,
"ipz",
"simIPz");
1573 TH2* simBg =
CopyH2(simBgC,
"backgroundEst",
"simBg");
1574 TH2* simSig =
CopyH2(simBgC,
"signalEst",
"simSig");
1577 if (!simMeas || !simSig || !simBg || !simIPz || !alpha) {
1578 Warning(
"DrawdNdeta",
"One or more simuluated data histograms missing: "
1579 "meas=%p sig=%p bg=%p ipz=%p alpha=%p",
1580 simMeas, simSig, simBg, simIPz, alpha);
1583 alpha->Multiply(fiducial);
1584 TH2* trueGen =
CopyH2(simList,
"etaVsIPzMC",
"trueGen");
1585 TH1* trueIPz =
CopyH1(simList,
"ipzGen",
"trueIPz");
1586 if (!trueGen || !trueIPz) {
1587 Warning(
"DrawdNdeta",
"One or more generator data histograms missing: "
1588 "gen=%p ipz=%p", trueGen, trueIPz);
1592 realMeas->SetTitle(
"Measured (real)");
1593 realBg ->SetTitle(
"Background (real)");
1594 realSig ->SetTitle(
"Signal (real)");
1595 realIPz ->SetTitle(
"IP_{z} (real)");
1596 simMeas ->SetTitle(
"Measured (simulated)");
1597 simBg ->SetTitle(
"Background (simulated)");
1598 simSig ->SetTitle(
"Signal (simulated)");
1599 simIPz ->SetTitle(
"IP_{z} (simulated)");
1600 trueGen ->SetTitle(
"Generated");
1601 trueIPz ->SetTitle(
"IP_{z} (generated)");
1604 TH2* result =
static_cast<TH2*
>(realSig->Clone(
"result"));
1605 result->SetTitle(
"Result");
1606 result->SetDirectory(0);
1607 result->Multiply(alpha);
1613 SetAttr(truth, color,
MS(0,
true,alt), 1.5, 0, 7, 1);
1618 SetAttr(dndeta, color,
MS(0,
false,alt), 1.2, 0, 1, 1);
1621 realMeas->Multiply(fiducial);
1622 simMeas ->Multiply(fiducial);
1623 realSig ->Multiply(fiducial);
1624 simSig ->Multiply(fiducial);
1625 realBg ->Multiply(fiducial);
1626 simBg ->Multiply(fiducial);
1627 realSig ->Multiply(fiducial);
1628 simSig ->Multiply(fiducial);
1637 SetAttr(realAvgMeas,realAvgMeas->GetMarkerColor(),
MS(1,
false,alt));
1638 SetAttr(realAvgSig, realAvgSig ->GetMarkerColor(),
MS(2,
false,alt));
1639 SetAttr(realAvgBg, realAvgSig ->GetMarkerColor(),
MS(3,
false,alt));
1640 SetAttr(simAvgMeas, simAvgSig ->GetMarkerColor(),
MS(1,
true, alt));
1641 SetAttr(simAvgSig, simAvgSig ->GetMarkerColor(),
MS(2,
true, alt));
1642 SetAttr(simAvgBg, simAvgBg ->GetMarkerColor(),
MS(3,
true, alt));
1643 realAvgMeas->SetYTitle(
"#LT M#GT");
1644 realAvgSig ->SetYTitle(
"#LT S#GT");
1645 realAvgBg ->SetYTitle(
"#LT B#GT");
1646 simAvgMeas ->SetYTitle(
"#LT M'#GT");
1647 simAvgSig ->SetYTitle(
"#LT S'#GT");
1648 simAvgBg ->SetYTitle(
"#LT B'#GT");
1651 THStack* summary =
new THStack(
"summary", dndeta->GetYaxis()->GetTitle());
1652 summary->Add(dndeta,
"e2");
1653 summary->Add(truth,
"e");
1654 summary->Add(realAvgMeas);
1655 summary->Add(simAvgMeas);
1656 summary->Add(realAvgSig);
1657 summary->Add(simAvgSig);
1658 summary->Add(realAvgBg);
1659 summary->Add(simAvgBg);
1661 TH1* tmp =
static_cast<TH1*
>(scaleH->Clone(
"scaleBg"));
1662 Double_t sf = TMath::Power(10,
Int_t(TMath::Log10(realBg->GetMaximum())+.3));
1663 tmp->SetTitle(Form(
"%s#times%3.0f",scaleH->GetTitle(),sf));
1665 tmp->SetDirectory(0);
1670 fBody->SetLeftMargin(0.15);
1672 summary->GetHistogram()->SetXTitle(
"#eta");
1673 summary->GetHistogram()->SetYTitle(
ObsTitle());
1674 summary->GetHistogram()->GetYaxis()->SetTitleOffset(1.7);
1678 l->SetName(
"legend");
1680 l->SetBorderSize(0);
1683 TF1* f =
new TF1(
"ff",
"pol0", -lim, lim);
1684 TFitResultPtr r = dndeta->Fit(f,
"N0QSR",
"", -lim, lim);
1686 TLatex* ltx =
new TLatex(
fBody->GetLeftMargin()+
1687 (1-
fBody->GetLeftMargin()-
fBody->GetRightMargin())/2,
1689 Form(
"%s|_{|#eta|<%3.1f}"
1690 "=%6.1f#pm%6.1f (#chi^{2}/#nu=%5.2f)",
1692 r->ParError(0), r->Chi2()/r->Ndf()));
1693 ltx->SetTextAlign(22);
1695 ltx->SetTextFont(42);
1696 ltx->SetTextSize(0.035);
1698 printf(
"%6.1f +/- %6.1f (%5.2f - %5.3f+/-%5.3f)",
1699 r->Parameter(0), r->ParError(0),
1700 r->Chi2()/r->Ndf(), scale, scaleE);
1702 ltx->DrawLatex(
fBody->GetLeftMargin()+
1703 (1-
fBody->GetLeftMargin()-
fBody->GetRightMargin())/2,
1705 Form(
"%sk%s=%4.2f #pm %4.2f",
1706 scaleH ?
"#LT" :
"",
1707 scaleH ?
"#GT" :
"",
1709 summary->GetHistogram()->GetListOfFunctions()->Add(l);
1710 summary->GetHistogram()->GetListOfFunctions()->Add(ltx);
1713 if (summary->GetHistogram()->GetMinimum() < 1)
1714 summary->SetMinimum(1);
1715 summary->SetMaximum(1.5*summary->GetMaximum(
"nostack"));
1719 stack->Add(dndeta,
"e2");
1720 stack->Add(truth,
"e");
1728 if (scaleH) scaleH->Write();
1732 TDirectory* details = out->mkdir(
"details");
1743 GetH1(realData,
"delta") ->Write(
"realDataDelta");
1744 GetH1(
GetC(realList,
"injection"),
"delta")->Write(
"realInjDelta");
1745 GetH1(simData,
"delta") ->Write(
"simDataDelta");
1746 GetH1(
GetC(simList,
"injection"),
"delta") ->Write(
"simInjDelta");
1748 TDirectory* averages = out->mkdir(
"averages");
1750 realAvgMeas ->Write();
1751 realAvgSig ->Write();
1752 realAvgBg ->Write();
1753 simAvgMeas ->Write();
1754 simAvgSig ->Write();
1767 THStack*
stack, TDirectory* out)
1769 fLastBin.Form(
"%5.1f%% - %5.1f%%", c1, c2);
1770 printf(
"Centrality bin %5.1f%% - %5.1f%%: ", c1, c2);
1772 name.Form(
"cent%03dd%02d_%03dd%02d",
1777 if (!realListBin || !simListBin) {
1778 Warning(
"PostBin",
"Missing bin for %5.1f%% - %5.1f%% (%s): %p %p",
1779 c1, c2, name.Data(), realListBin, simListBin);
1782 const Color_t
cc[] = { kMagenta+2,
1793 Color_t
color = (bin <= 0 ? cc[10] : cc[(bin-1)%11]);
1794 TDirectory* binOut = 0;
1796 if (out) binOut = out->mkdir(name);
1805 color, stack, binOut, alt);
1811 const char* dataName,
1812 const char* simName)
1821 TFile* dataFile = 0;
1823 if (!(dataFile =
OpenFile(dataName)))
return;
1824 if (!(simFile =
OpenFile(simName)))
return;
1830 if (!realSums || !realRess || !simSums || !simRess)
return;
1842 TH1* realCent =
CopyH1(realSums,
"cent",
"realCent");
1843 TH1* simCent =
CopyH1(simSums,
"cent",
"simCent");
1844 TH1* realIPz =
GetH1(realSums,
"ipz");
1845 TH1* simIPz =
GetH1(simSums,
"ipz");
1848 Warning(
"Post",
"Centrality bins are incompatible, giving up");
1852 Warning(
"Post",
"Centrality bins are incompatible, giving up");
1855 if (what &
kClosure) realRess = simRess;
1859 ProcessBin(what, 0, 0, 100, realRess, simRess, stack);
1861 TFile* out = TFile::Open(Form(
"MiddNdeta_0x%1x.root", 0x3 & what),
1865 for (
Int_t i = 1; i <= realCent->GetNbinsX() && i <= maxBins ; i++) {
1866 Double_t c1 = realCent->GetXaxis()->GetBinLowEdge(i);
1867 Double_t c2 = realCent->GetXaxis()->GetBinUpEdge (i);
1869 ProcessBin(what, i, c1, c2, realRess, simRess, stack, out);
1872 if (stack->GetHists() && stack->GetHists()->GetEntries() > 0) {
1875 if (stack->GetHistogram()->GetMinimum() < 1)
1876 stack->SetMinimum(1);
1882 res = TFile::Open(
"result.root",
"READ");
1885 THStack* other =
static_cast<THStack*
>(res->Get(
"result"));
1893 Printf(
"Results stored in %s", out->GetName());
Int_t color[]
print message on plot with ok/not ok
static TH2 * CopyH2(Container *parent, const char *name, const char *newName=0)
THStack * Make2Stack(const char *name, const char *title, Container *realList, Container *simList, Option_t *dataOpt="", Option_t *simOpt="")
TH1 * FindDelta(Container *ress, const char *sub, Bool_t scaled=false)
void Run(UInt_t what=kDefault, UShort_t maxBins=9, const char *dataName="data.root", const char *simName="sim.root")
const char * ObsTitle() const
TLegend * DrawInPad(TVirtualPad *c, Int_t pad, TObject *o, Option_t *opt)
void DrawSim(Container *simList)
static TH1 * AverageOverIPz(TH2 *h, const char *name, UShort_t mode, TH1 *ipz, TH2 *mask=0)
TH1 * SetAttr(TH1 *h, Color_t color, Style_t marker=20, Double_t size=1., Style_t fill=0, Style_t line=1, Width_t width=1)
Double_t GetDeltaScale(Container *c, Double_t &e) const
static Int_t GetI(Container *parent, const char *name, Int_t def=-1)
void PrintH(TH2 *h, Int_t prec=2)
void DrawClusters(Int_t pad, const char *name, Container *realList, Container *simList)
static Double_t RatioE(Double_t n, Double_t en, Double_t d, Double_t ed, Double_t &er)
TH1 * GetDeltaIntDist(Container *c) const
static Double_t Integrate(TH1 *h, Double_t min, Double_t max, Double_t &err)
void DrawAlpha(TVirtualPad *c, Int_t pad, Container *ress, const char *name, const char *pretty)
void DrawDeltas(Container *realList, Container *simList)
static Container * GetC(Container *parent, const char *name)
static TH1 * CopyH1(Container *parent, const char *name, const char *newName=0)
static Int_t GetB(Container *parent, const char *name, Bool_t def=false)
Double_t DrawBackground(TVirtualPad *c, Int_t pad, Container *ress, const char *name, const char *pretty)
void PrintCanvas(const TString &title, Float_t size=.7)
Style_t MS(Int_t what, Bool_t sim, Bool_t alt) const
void ModLegend(TVirtualPad *p, TLegend *l, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void CreateCanvas(const TString &outputName)
void DrawParam(const char *name, Double_t &y, const char *val)
static TH1 * Scale(TH1 *h, Double_t x, Double_t xe)
static Double_t GetD(Container *parent, const char *name, Double_t def=-1)
void ProcessBin(UInt_t what, Int_t bin, Double_t c1, Double_t c2, Container *realList, Container *simList, THStack *stack=0, TDirectory *out=0)
SuppressGuard(Int_t lvl=2000)
static TH1 * GetH1(Container *parent, const char *name)
TFile * file
TList with histograms for a given trigger.
TH2 * CutAlpha(TH2 *alpha)
void DrawSpecies(Container *mcList)
void DrawParams(Container *pars, const char *title, Bool_t comb)
void DrawdNdeta(Container *realList, Bool_t realComb, Container *simList, Bool_t simComb, Color_t color=kBlack, THStack *stack=0, TDirectory *out=0, Bool_t alt=false)
ECombinatoricsScaleMode fCombinatoricsScaleMode
static Bool_t CheckConsistency(const TH1 *h1, const TH1 *h2)
TFile * OpenFile(const char *filename)
Double_t fCombinatoricsScale
static TObject * GetO(Container *parent, const char *name, TClass *cls)
TH1 * FindSub(Container *ress, const char *sub, const char *name)
void DrawGeneral(Container *realList, Container *simList)
static TH2 * GetH2(Container *parent, const char *name)
TH1 * GetDeltaScaleDist(Container *c) const