20 #include <TGraphErrors.h> 21 #include <TGraphAsymmErrors.h> 22 #include <TMultiGraph.h> 34 #include <TLegendEntry.h> 39 #include <TParameter.h> 47 #define SYSERR_COLOR TColor::GetColor(220, 220, 255) 49 #define SYSERR_STYLE 1001 116 Int_t base = bits & (0xFE);
119 case kCircle:
return (hollow ? 24 : 20);
120 case kSquare:
return (hollow ? 25 : 21);
123 case kDiamond:
return (hollow ? 27 : 33);
124 case kCross:
return (hollow ? 28 : 34);
125 case kStar:
return (hollow ? 30 : 29);
140 case 24:
case 25:
case 26:
case 27:
case 28:
case 30:
case 32:
144 case 20:
case 24: bits |=
kCircle;
break;
145 case 21:
case 25: bits |=
kSquare;
break;
148 case 27:
case 33: bits |=
kDiamond;
break;
149 case 28:
case 34: bits |=
kCross;
break;
150 case 29:
case 30: bits |=
kStar;
break;
231 sysErr->SetAlpha(0.7);
328 Info(
"",
"Setting delta from %f,%f",meanIpx,meanIpy);
329 if (meanIpx < 0 && meanIpy < 0)
return;
334 Info(
"",
"Shifts (%f-%f)=%f, (%f-%f)=%f",
337 if (TMath::Abs(dx) < 1e-3 && TMath::Abs(dy) < 1e-3)
return;
338 Double_t delta = TMath::Sqrt(dx*dx+dy*dy);
386 fVtxAxis->SetTitle(Form(
"v_{z}#in[%+5.1f,%+5.1f]cm", vzMin, vzMax));
409 trig & 0x2 ?
"INEL>0" :
410 trig & 0x4 ?
"MBAND5" :
411 trig & 0x2000 ?
"V0-AND" :
446 if (!path.Contains(
"empirical.root")) {
447 path =
gSystem->ConcatFileName(
gSystem->ExpandPathName(prx.Data()),
449 path.Append(
"#default");
452 TFile* empirical = TFile::Open(empUrl.GetUrl(),
"READ");
453 if (!empirical)
return false;
455 const char* empPath = empUrl.GetAnchor();
456 TObject* fwdObj = empirical->Get(Form(
"Forward/%s", empPath));
457 TObject* cenObj = empirical->Get(Form(
"Central/%s", empPath));
459 (fwdObj->IsA()->InheritsFrom(TH1::Class()) ||
460 fwdObj->IsA()->InheritsFrom(TGraphAsymmErrors::Class())))) {
461 Warning(
"Run",
"Didn't get the object Forward/%s from %s",
462 empPath, empUrl.GetUrl());
466 (cenObj->IsA()->InheritsFrom(TH1::Class()) ||
467 cenObj->IsA()->InheritsFrom(TGraphAsymmErrors::Class())))) {
468 Warning(
"Run",
"Didn't get the object Central/%s from %s",
469 empPath, empUrl.GetUrl());
474 empName = empUrl.GetUrl();
475 if (fwdEmp->IsA()->InheritsFrom(TH1::Class())) {
476 TH1* h =
static_cast<TH1*
>(fwdEmp);
480 TF1* f =
new TF1(
"corr",
483 "+(x<[1])*[2]*[0]*TMath::Power(x-[1],2)",
486 TF1* f =
new TF1(
"corr",
"1+[2]*([0]+(x<[1])*pow([0]*(x-[1]),2))");
488 f->SetParNames(
"delta",
"eta0",
"a");
489 f->SetParameter(0,
fDelta);
490 f->SetParameter(1,-2.0);
491 f->SetParameter(2,.10);
493 Info(
"",
"Applying correction for IP_delta=%f",
fDelta);
494 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
496 if (c < 1e-6)
continue;
499 Double_t eta = h->GetXaxis()->GetBinCenter(i);
502 h->SetBinContent(i, c*cor);
503 h->SetBinError(i, e*cor);
507 if (cenEmp->IsA()->InheritsFrom(TH1::Class()))
508 static_cast<TH1*>(cenEmp)->SetDirectory(0);
511 return !empName.IsNull();
520 const char*
title=
"",
521 const char* others=
"all",
522 const char* options=
"default",
523 const char* formats=
"all",
533 "============================================================\n" 535 "This script is deprecated. Please use new GSE based drawing\n" 537 "============================================================\n");
538 TString ostr(others); ostr.ToUpper();
540 if (ostr.EqualTo(
"ALL")) obits = 0xf;
542 if (ostr.Contains(
"UA5")) obits |= 0x1;
543 if (ostr.Contains(
"CMS")) obits |= 0x2;
544 if (ostr.Contains(
"ALICE")) obits |= 0x4;
545 if (ostr.Contains(
"WIP")) obits |= 0x8;
550 if (fstr.EqualTo(
"default", TString::kIgnoreCase)) fbits =
kDefaultOptions;
554 TObjString* ftoken = 0;
555 while ((ftoken = static_cast<TObjString*>(next()))) {
556 TString& token = ftoken->String();
558 if (token.BeginsWith(
"ratio")) fbits |=
kShowRatios;
562 else if (token.BeginsWith(
"rings")) fbits |=
kShowRings;
563 else if (token.BeginsWith(
"noedge")) fbits |=
kCutEdges;
565 else if (token.BeginsWith(
"finalmc")) fbits |=
kUseFinalMC;
566 else if (token.BeginsWith(
"mb")) fbits |=
kForceMB;
567 else if (token.BeginsWith(
"mirror")) fbits |=
kMirror;
568 else if (token.BeginsWith(
"export")) fbits |=
kExport;
569 else if (token.BeginsWith(
"exec")) fbits |=
kAddExec;
570 else if (token.BeginsWith(
"old")) fbits |=
kOldFormat;
571 else if (token.BeginsWith(
"verbose")) fbits |=
kVerbose;
572 else if (token.BeginsWith(
"hires")) fbits |=
kHiRes;
573 else if (token.BeginsWith(
"extraw")) fbits |=
kExtraWhite;
574 else if (token.BeginsWith(
"logo")) fbits |=
kLogo;
575 else if (token.BeginsWith(
"nocentr")) fbits |=
kNoCentral;
576 else if (token.BeginsWith(
"nolabels")) fbits |=
kNoLabels;
577 else if (token.BeginsWith(
"empirical")) {
580 if (parts->GetEntriesFast() > 1)
587 TString estr(formats); estr.ToUpper();
591 if (ostr.Contains(
"PNG")) ebits |=
kPNG;
592 if (ostr.Contains(
"PDF")) ebits |=
kPDF;
593 if (ostr.Contains(
"ROOT")) ebits |=
kROOT;
594 if (ostr.Contains(
"C")) ebits |=
kScript;
645 if (vzMin < 999 && vzMax > -999)
660 gStyle->SetPalette(1);
663 TFile*
file = TFile::Open(filename,
"READ");
665 Error(
"Run",
"Cannot open %s", filename);
668 Info(
"Run",
"Drawing results from %s", file->GetName());
671 TList* forward =
static_cast<TList*
>(file->Get(
"ForwarddNdetaResults"));
673 Error(
"Run",
"Couldn't find list ForwarddNdetaResults");
676 TList* sums =
static_cast<TList*
>(file->Get(
"ForwarddNdetaSums"));
678 Error(
"Run",
"Couldn't find list ForwarddNdetaSums");
685 if (p && p->GetVal() && !
fEmpirical.IsNull()) {
686 Warning(
"Run",
"Empirical correction already applied");
689 else if (forward->FindObject(
"dndetaEmp")) {
690 Warning(
"Run",
"Empirical correction already applied");
695 if (!forward->FindObject(
"deltaIP")) {
696 TH2* vertexXY =
static_cast<TH2*
>(sums->FindObject(
"vertexAccXY"));
697 if (vertexXY &&
fDelta <= 0)
698 SetDelta(vertexXY->GetMean(1), vertexXY->GetMean(2));
705 Info(
"Run",
"Settings for the drawer:\n" 706 " Show ratios: %5s\n" 707 " Show Left/right: %5s\n" 709 " Cut edges when rebinning: %5s\n" 710 " Remove outer rings: %5s\n" 711 " Force minimum bias: %5s\n" 712 " Mirror to un-covered regions: %5s\n" 713 " Export to file: %5s\n" 714 " Add Zoom code: %5s\n" 715 " Assume old format: %5s\n" 717 " Hi-resolution plot: %5s\n" 718 " Extra whitespace: %5s\n" 720 " Show clusters: %5s\n" 721 " Show y-axis labels: %5s\n" 722 " Show other results: 0x%03x\n" 723 " Rebinning factor: %5d\n" 724 " Forward systematic error: %5.1f%%\n" 725 " Central systematic error: %5.1f%%\n" 726 " Trigger efficiency: %5.1f%%\n" 727 " Title on plot: %s\n" 728 " Scaling of clusters to tracklets: %s\n" 729 " Final MC correction file: %s\n" 730 " Empirical correction file: %s",
758 TString savPath(gROOT->GetMacroPath());
759 gROOT->SetMacroPath(Form(
"%s:$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2",
760 gROOT->GetMacroPath()));
762 if (!gROOT->GetClass(
"RefData"))
763 gROOT->LoadMacro(
"OtherData.C+");
764 gROOT->SetMacroPath(savPath);
770 clusters =
static_cast<TList*
>(file->Get(
"CentraldNdetaResults"));
771 if (!clusters) Warning(
"Run",
"Couldn't find list CentraldNdetaResults");
775 TList* mcTruth =
static_cast<TList*
>(file->Get(
"MCTruthdNdetaResults"));
776 if (!mcTruth) Warning(
"Run",
"Couldn't find list MCTruthdNdetaResults");
779 fResults =
new THStack(
"results",
"Results");
780 fRatios =
new THStack(
"ratios",
"Ratios");
781 fLeftRight =
new THStack(
"asymmetry",
"Left-right asymmetry");
785 TList* forwardMC = 0;
788 TFile* finalMC = TFile::Open(
fFinalMC,
"READ");
790 Warning(
"Run",
"Failed to open file %s for final MC corrections",
794 forwardMC =
static_cast<TList*
>(finalMC->Get(
"ForwarddNdetaResults"));
796 Warning(
"Run",
"Couldn't find list ForwarddNdetaResults for final MC");
798 centralMC =
static_cast<TList*
>(finalMC->Get(
"CentradNdetalResults"));
800 Warning(
"Run",
"Couldn't find list CentraldNdetaResults for final MC");
810 TFile* empirical = 0;
813 const char*
test[] = {
817 "file://${OADB_PATH}/PWGLF/FORWARD/EMPIRICAL",
818 "file://${ALICE_PHYSICS}/OADB/PWGLF/FORWARD/EMPIRICAL",
820 const char** ptr =
test;
823 const char* testf[] = {
"",
"empirical_000138190.root", 0 };
824 const char** ptr2 = testf;
842 max, rmax, amax,truths);
844 max, rmax, amax,truths);
850 static_cast<TList*
>(sums->FindObject(
"all")));
856 Warning(
"Run",
"List all not found in ForwardSums");
861 Warning(
"Run",
"No ForwardSums directory found in %s", file->GetName());
867 fResults->GetHists()->GetEntries() <= 0) {
868 Error(
"Run",
"No histograms in result stack!");
871 if (!
fOthers->GetListOfGraphs() ||
872 fOthers->GetListOfGraphs()->GetEntries() <= 0) {
873 Warning(
"Run",
"No other data found - disabling that");
877 fRatios->GetHists()->GetEntries() <= 0) {
878 Warning(
"Run",
"No ratio data found - disabling that");
884 Warning(
"Run",
"No left/right data found - disabling that");
890 for (
Int_t i = 0; i < fwdA->GetEntriesFast(); i++) {
891 TH1*
fwd =
static_cast<TH1*
>(fwdA->At(i));
892 TH1* cen = (cenA ?
static_cast<TH1*
>(cenA->At(i)) : 0);
896 TH1* tmp =
Merge(cen, fwd, low, high);
903 const char* nme = tmp->GetName();
904 TH1* tmpp =
static_cast<TH1*
>(tmp->Clone(Form(
"%s_a", nme)));
905 tmp->SetName(Form(
"%s_c", nme));
906 for (
Int_t k = 1; k <= tmp->GetNbinsX(); k++) {
907 Double_t x = tmp->GetXaxis()->GetBinCenter(k);
908 TH1* tmppp = (x < 0 ? tmpp : tmp);
909 tmppp->SetBinError(k, 0);
910 tmppp->SetBinContent(k, 0);
912 fResults->GetHists()->AddFirst(tmpp, (f ?
"e5" :
"e2"));
916 Info(
"",
"Adding systematic error histogram %s", tmp->GetName());
917 fResults->GetHists()->AddFirst(tmp, (f ?
"e5" :
"e2"));
919 if (!(
fOptions & kMirror))
continue;
923 tmp2->SetFillColor(tmp->GetFillColor());
924 tmp2->SetFillStyle(tmp->GetFillStyle());
925 tmp2->SetMarkerStyle(tmp->GetMarkerStyle());
926 tmp2->SetLineWidth(tmp->GetLineWidth());
927 fResults->GetHists()->AddFirst(tmp2,
"e5");
941 Plot(max, rmax, amax);
961 fVtxAxis =
static_cast<TAxis*
>(results->FindObject(
"vtxAxis"));
963 TObject* cO = results->FindObject(
"centAxis");
965 if (cO->IsA()->InheritsFrom(TH1::Class())) {
969 else if (cO->IsA()->InheritsFrom(TAxis::Class()))
974 fCentMeth = results->FindObject(
"centEstimator");
977 tmp.Remove(0,tmp.Index(
"CENT")+4);
997 Info(
"FetchInformation",
"External trigger efficicency: %5.3f",
1003 TNamed* options =
static_cast<TAxis*
>(results->FindObject(
"options"));
1011 fVtxAxis->SetTitle(
"v_{z} range unspecified");
1014 Printf(
"Centrality axis: %d [%f,%f] vs [%f,%f]",
1026 if (binLow <
fCentMin-.5)
continue;
1027 if (binHigh >
fCentMax+.5)
continue;
1029 bins[nBins] = binLow;
1041 else if (mask == 0x2000)
fTrigString->SetTitle(
"NSD");
1042 else if (mask == 0x4)
fTrigString->SetTitle(
"NSD");
1051 centTxt = Form(
"%s %d bins", centMeth.Data(), nCent);
1052 for (
Int_t i = 0; i <= nCent; i++)
1053 centTxt.Append(Form(
"%c%d", i == 0 ?
' ' :
'-',
1056 Info(
"FetchInformation",
1058 " Trigger: %-30s (0x%x)\n" 1059 " Efficiency: %-6.4f\n" 1060 " sqrt(sNN): %-30s (%dGeV)\n" 1061 " System: %-30s (%d)\n" 1062 " Vz range: %-30s (%f,%f)\n" 1063 " Normalization: %-30s (%d)\n" 1072 centTxt.Data(), (options ? options->GetTitle() :
"none"));
1076 Info(
"FetchInformation",
"Left/Right asymmetry, and mirroring " 1077 "explicitly disabled for pPb/Pbp");
1085 TMultiGraph* thisOther = 0;
1092 if (centLow < centHigh) {
1099 if (cm.EqualTo(
"V0M", TString::kIgnoreCase)) msk = 0x01;
1100 else if (cm.EqualTo(
"V0A", TString::kIgnoreCase)) msk = 0x02;
1101 else if (cm.EqualTo(
"ZNA", TString::kIgnoreCase)) msk = 0x04;
1102 else if (cm.EqualTo(
"ZNC", TString::kIgnoreCase)) msk = 0x08;
1103 else if (cm.EqualTo(
"V0C", TString::kIgnoreCase)) msk = 0x10;
1104 else if (cm.EqualTo(
"Cl1", TString::kIgnoreCase)) msk = 0x20;
1108 case 1: msk = 0x01;
break;
1109 case 2: msk = 0x01;
break;
1110 case 3: msk = 0x02;
break;
1112 case 5: msk = 0x10;
break;
1117 case 10: msk = 0x20;
break;
1119 case 12: msk = 0x04;
break;
1120 case 13: msk = 0x08;
break;
1134 trg = (trg & 0x200f) | (msk << 4);
1137 gROOT->ProcessLine(Form(
"RefData::GetData(%d,%d,%d,%d,%d,%d);",
1141 Warning(
"",
"RefData::GetData(%d,%d,0x%x,%d,%d,0x%x);",
1143 Warning(
"FetchOthers",
1144 "No other data for %s %s %s %3d%%-%3d%% central (0x%x)",
1153 thisOther =
reinterpret_cast<TMultiGraph*
>(ret);
1173 const TList* mcList,
1181 if (!list)
return 0;
1204 centLow =
fCentAxis->GetBinLowEdge(i+1);
1205 centHigh =
fCentAxis->GetBinUpEdge(i+1);
1206 lname = Form(
"cent%03dd%02d_%03dd%02d",
1210 centTxt = Form(
"%6.2f%%-%6.2f%% central", centLow, centHigh);
1212 TH1* tt =
static_cast<TH1*
>(truths.At(i));
1214 TH1* h =
FetchOne(list, mcList, empCorr, name, lname,
1216 centTxt.Data(), max, rmax, amax, tt);
1221 truths.AddAt(tt, i);
1226 if (a->GetEntries() <= 0) {
1252 const TList* mcList,
1255 const char* folderName,
1256 TMultiGraph* others,
1266 static_cast<TList*>(list->FindObject(foldName)));
1269 "Couldn't find list '%s' in %s, trying w/o decimals (%s)",
1270 foldName.Data(), list->GetName(), txt);
1271 foldName.ReplaceAll(
"d00",
"");
1272 foldName.ReplaceAll(
"d10",
"");
1274 static_cast<TList*>(list->FindObject(foldName)));
1276 Error(
"FetchOne",
"Couldn't find list '%s' in %s",
1277 foldName.Data(), list->GetName());
1281 TList* mcFolder = 0;
1283 mcFolder =
static_cast<TList*
>(mcList->FindObject(folderName));
1286 "Didn't find the list '%s' in %s for final MC correction",
1287 folderName, mcList->GetName());
1290 TObject* normCalc = folder->FindObject(
"normCalc");
1292 Info(
"FetchOne",
"%s:\n%s",
1293 folderName, normCalc->GetTitle());
1296 others, col, folderName, max, rmax, amax, truth);
1318 const TList* mcList,
1321 TMultiGraph* thisOther,
1323 const char* centTxt,
1330 if (!norm)
return 0;
1331 if (norm->GetMaximum() < 1000) {
1332 Warning(
"FetchCentResults",
"Too few events in %s: %ld",
1333 list->GetName(), Long_t(norm->GetMaximum()));
1343 if (dndetaEmp) dndeta = dndetaEmp;
1346 Warning(
"FetchCentResults",
"dNdeta already corrected for final MC");
1355 TH1* dndetaMCSym = 0;
1362 dndetaMC->SetMarkerStyle(dndetaMC->GetMarkerStyle()+2);
1364 dndetaMCSym->SetMarkerStyle(dndetaMCSym->GetMarkerStyle()+2);
1365 if (dndetaTruth &&
HasCent()) {
1366 dndetaTruth->SetMarkerStyle(34);
1367 dndetaTruth->SetMarkerColor(kYellow-1);
1370 dndetaTruth->SetLineColor(kBlack);
1371 dndetaTruth->SetFillColor(kBlack);
1372 dndetaTruth->SetFillStyle(3002);
1387 truth = dndetaTruth;
1391 THStack* rings =
static_cast<THStack*
>(list->FindObject(
"dndetaRings"));
1393 TIter next(rings->GetHists());
1395 while ((hist = static_cast<TH1*>(next())))
1408 TIter next(thisOther->GetListOfGraphs());
1410 while ((g = static_cast<TGraph*>(next()))) {
1415 if (!
fOthers->GetListOfGraphs() ||
1416 !
fOthers->GetListOfGraphs()->FindObject(g->GetName())) {
1417 max = TMath::Max(max,TMath::MaxElement(g->GetN(), g->GetY()));
1429 Info(
"",
"Forming ratio to truth:\n\t%s\n\t%s",
1440 if (!dndeta)
return;
1441 if (!mcList)
return;
1445 if (!dndetaMC || !dndetaTruth)
return;
1447 TH1* corr =
static_cast<TH1*
>(dndetaMC->Clone(
"finalMCCorr"));
1448 corr->Divide(dndetaTruth);
1450 Info(
"CorrectFinalMC",
"Correcting dN/deta with final MC correction");
1451 dndeta->Divide(corr);
1456 if (!dndeta)
return;
1457 if (!empObj)
return;
1460 if (empObj->IsA()->InheritsFrom(TGraphAsymmErrors::Class())) {
1461 Info(
"CorrectEmpirical",
"Doing empirical correction of dN/deta");
1463 TAxis* xAxis = dndeta->GetXaxis();
1464 for (
Int_t i = 1; i <= xAxis->GetNbins(); i++) {
1465 Double_t x = xAxis->GetBinCenter(i);
1466 Double_t y = dndeta->GetBinContent(i);
1468 dndeta->SetBinContent(i, y / c);
1471 else if (empObj->IsA()->InheritsFrom(TH1::Class())) {
1472 Info(
"CorrectEmpirical",
"Doing empirical correction of dN/deta");
1473 TH1* empCorr =
static_cast<TH1*
>(empObj);
1474 dndeta->Divide(empCorr);
1477 Warning(
"CorrectEmpirical",
1478 "Don't know how to apply a %s as an empirical correction",
1479 empObj->IsA()->GetName());
1486 if (!dndeta)
return;
1488 Info(
"CorrectTriggerEff",
"Correcting with trigger efficiency %5.3f",
1503 gStyle->SetOptTitle(0);
1504 gStyle->SetTitleFont(
kFont,
"xyz");
1505 gStyle->SetLabelFont(
kFont,
"xyz");
1507 Int_t h = (gROOT->IsBatch() ?
1509 gClient->GetDisplayHeight());
1519 y1 = (y11 > 0.0001 ? 0.4 : 0.2);
1520 y2 = (y11 > 0.0001 ? 0.2 : 0.2);
1522 TCanvas*
c =
new TCanvas(
"Results",
"Results", w, h);
1524 c->SetBorderSize(0);
1525 c->SetBorderMode(0);
1546 trg.ReplaceAll(
" ",
"_");
1547 trg.ReplaceAll(
">",
"Gt");
1548 trg.ReplaceAll(
"&",
"AND");
1549 trg.ReplaceAll(
"|",
"OR");
1551 fBase =
"dndeta_<sys>_<snn>_<trig>_<ipmin><ipmax>cm_<nev>ev";
1554 fBase.ReplaceAll(
"<trig>", trg.Data());
1555 fBase.ReplaceAll(
"<ipmin>", Form(
"%c%02d",vMin<0?
'm':
'p',TMath::Abs(vMin)));
1556 fBase.ReplaceAll(
"<ipmax>", Form(
"%c%02d",vMax<0?
'm':
'p',TMath::Abs(vMax)));
1557 fBase.ReplaceAll(
"<nev>", Form(
"%09d", nev));
1564 exp.ReplaceAll(
"dndeta",
"export");
1565 exp.ReplaceAll(
"dNdeta",
"export");
1581 fTitle.ReplaceAll(
"@",
" ");
1583 TLatex* tit =
new TLatex((bottom ?
kRightMargin : p->GetLeftMargin()),
1584 (bottom ? 0.01 : .99),
fTitle.Data());
1586 tit->SetTextFont(
kFont);
1587 tit->SetTextAlign(bottom ? 11 : 13);
1588 tit->SetTextSize(s*0.045);
1609 TLegend* l =
new TLegend(x1,y1,x2,y2);
1610 Int_t nCol = forceCol;
1611 if (nCol <= 0) nCol =
HasCent() ? 1 : 2;
1612 l->SetNColumns(nCol);
1615 l->SetBorderSize(0);
1616 l->SetTextFont(
kFont);
1621 TIter next(stack->GetHists());
1625 Bool_t sysErrSeen =
false;
1626 Bool_t mirrorSeen =
false;
1627 while ((hist = static_cast<TH1*>(next()))) {
1631 if (t.Contains(
"mirrored")) { mirrorSeen =
true;
continue; }
1632 if (n.Contains(
"syserror")) { sysErrSeen =
true;
continue; }
1633 if (unique.FindObject(t.Data()))
continue;
1636 s1->SetUniqueID(((hist->GetMarkerStyle() & 0xFFFF) << 16) |
1637 ((hist->GetMarkerColor() & 0xFFFF) << 0));
1643 TIter nexto(mg->GetListOfGraphs());
1645 while ((g = static_cast<TGraph*>(nexto()))) {
1647 if (n.Contains(
"mirrored"))
continue;
1648 if (unique.FindObject(n.Data()))
continue;
1651 s2->SetUniqueID(((g->GetMarkerStyle() & 0xFFFF) << 16) |
1652 ((g->GetMarkerColor() & 0xFFFF) << 0));
1659 TIter nextu(&unique);
1664 TLegendEntry* dd = l->AddEntry(Form(
"data%2d", i++),
1665 s->GetName(),
"lp");
1666 Int_t style = (s->GetUniqueID() >> 16) & 0xFFFF;
1667 Int_t color = (s->GetUniqueID() >> 0) & 0xFFFF;
1668 dd->SetLineColor(kBlack);
1669 if (
HasCent()) dd->SetMarkerColor(kBlack);
1670 else dd->SetMarkerColor(color);
1671 dd->SetMarkerStyle(style);
1672 dd->SetMarkerSize(s->GetVal());
1676 TLegendEntry* d0 = l->AddEntry(
"d0", Form(
"%4.1f%% Systematic error",
1682 d0->SetMarkerStyle(0);
1683 d0->SetLineWidth(0);
1686 if (nCol == 2 && i % 2 == 1) {
1689 TLegendEntry* dd = l->AddEntry(
"dd",
" ",
"");
1691 dd->SetFillStyle(0);
1692 dd->SetFillColor(0);
1693 dd->SetLineWidth(0);
1694 dd->SetLineColor(0);
1695 dd->SetMarkerSize(0);
1699 TLegendEntry* d1 = l->AddEntry(
"d1",
"Data",
"lp");
1700 d1->SetLineColor(kBlack);
1701 d1->SetMarkerColor(kBlack);
1702 d1->SetMarkerStyle(20);
1705 TLegendEntry* d2 = l->AddEntry(
"d2",
"Mirrored data",
"lp");
1706 d2->SetLineColor(kBlack);
1707 d2->SetMarkerColor(kBlack);
1708 d2->SetMarkerStyle(24);
1715 if (isMult)
return Form(
"%3d",
Int_t(v));
1716 if ((
Int_t(v*100) % 100) == 0)
return Form(
"%3d%%",
Int_t(v));
1717 if ((
Int_t(v*100) % 10) == 0)
return Form(
"%5.1f%%", v);
1718 return Form(
"%6.2f%%", v);
1733 Printf(
"Centralities seen 0x%x",
fCentSeen);
1735 if (
fCentAxis->GetNbins() <= 4) y1 += .15;
1736 TLegend* l =
new TLegend(x1,y1,x2,y2);
1740 l->SetBorderSize(0);
1741 l->SetTextFont(
kFont);
1745 Bool_t isMult = centMeth.EqualTo(
"MULT");
1746 Int_t lowOff = (isMult ? 1 : 0);
1749 for (
Int_t i = 1; i <= n; i++) {
1750 if (!(
fCentSeen & (1 << (i-1)))) { nextOff = 0;
continue; }
1756 if (isMult && upp == low) {
1762 TLegendEntry* e = l->AddEntry(Form(
"dummy%02d", i), txt,
"pl");
1775 p->AddExec(
"range", Form(
"RangeExec((dNdetaDrawer::RangeParam*)%p)",
1800 TPad* p1 =
new TPad(
"p1",
"p1", 0, yd, 1.0, 1.0, 0, 0, 0);
1802 p1->SetBorderSize(0);
1803 p1->SetBorderMode(0);
1804 p1->SetBottomMargin(yd > 0.001 ? 0.001 : 0.1);
1815 fResults->SetMinimum(yd > 0.00001 ? -0.02*max : 0);
1819 Double_t yyd = (1-yd)*(yd > .001 ? 1 : .9 / 1.2);
1821 "1/#it{N}#kern[.1]{d#it{N}_{ch}/d#it{#eta}}" 1828 while ((h = static_cast<TH1*>(next())))
1829 h->SetMarkerSize(h->GetMarkerSize()*s);
1837 TIter nextG(
fOthers->GetListOfGraphs());
1838 while ((o = static_cast<TGraphAsymmErrors*>(nextG()))) {
1840 switch (o->GetMarkerStyle()) {
1842 case 30: gS *= 1.2;
break;
1844 case 33: gS *= 1.2;
break;
1846 o->SetMarkerSize(o->GetMarkerSize()*gS);
1848 o->DrawClone(
"same p");
1853 Double_t x1 = p1->GetLeftMargin()+.08;
1854 Double_t x2 = 1-p1->GetRightMargin()-.08;
1855 Double_t y1 = p1->GetBottomMargin()+.01;
1860 x1 = p1->GetLeftMargin()+.15;
1861 x2 = 1-p1->GetRightMargin()-.15;
1870 y2 = 1-p1->GetTopMargin()-0.06;
1874 x2 = 1-p1->GetRightMargin()-.01;
1876 y2 = 1-p1->GetTopMargin()-0.16;
1883 Double_t yTop = 1-p1->GetTopMargin()-.02;
1891 if (snn == 2750) snn = 2760;
1892 if (snn < 1000) eS = Form(
"%3dGeV", snn);
1893 else if (snn % 1000 == 0) eS = Form(
"%dTeV", snn/1000);
1894 else eS = Form(
"%.2fTeV",
float(snn)/1000);
1899 if (centMeth.EqualTo(
"MULT"))
1900 tS =
"by N_{#lower[-.2]{ch}} |#it{#eta}|<0.8";
1902 tS =
"by centrality";
1904 tS.Append(Form(
" (%s)",
fCentMeth->GetTitle()));
1908 case 0x10: tS.Append(
" (V0M)");
break;
1909 case 0x20: tS.Append(
" (V0A)");
break;
1910 case 0x40: tS.Append(
" (ZNA)");
break;
1911 case 0x80: tS.Append(
" (ZNC)");
break;
1916 TLatex* tt =
new TLatex(xR, yR, Form(
"%s #sqrt{s%s}=%s, %s",
1917 sys, (nn ?
"_{NN}" :
""),
1918 eS.Data(), tS.Data()));
1921 tt->SetTextFont(
kFont);
1922 tt->SetTextAlign(33);
1924 yR -= tt->GetTextSize() + .01;
1933 TArrow* a =
new TArrow(yCM, 0, yCM, 0.05*max, 0.01,
"<|");
1943 TLatex* et =
new TLatex(xR, yR, Form(
"%d events", nev));
1946 et->SetTextFont(
kFont);
1947 et->SetTextAlign(33);
1949 yR -= et->GetTextSize() + .01;
1953 TLatex* vt =
new TLatex(xR, yR,
fVtxAxis->GetTitle());
1955 vt->SetTextFont(
kFont);
1956 vt->SetTextAlign(33);
1959 yR -= vt->GetTextSize() + .01;
1965 if (!
fEmpirical.IsNull()) corrs.Append(
"Emperical");
1967 if (!corrs.IsNull()) corrs.Append(
"+");
1968 corrs.Append(
"IP_{xy}");
1971 if (!corrs.IsNull()) corrs.Append(
"+");
1972 corrs.Append(
"Final MC");
1975 if (!corrs.IsNull()) {
1976 corrs.Append(
" correction");
1977 if (corrs.Index(
"+") != kNPOS) corrs.Append(
"s");
1978 TLatex* em =
new TLatex(xR, yR, corrs);
1980 em->SetTextFont(
kFont);
1981 em->SetTextAlign(33);
1984 yR -= em->GetTextSize() + .01;
1989 TLatex*
ef =
new TLatex(xR, yR, Form(
"#varepsilon_{%s} = %5.3f",
1993 ef->SetTextFont(
kFont);
1994 ef->SetTextAlign(33);
1997 yR -= ef->GetTextSize() + .01;
2002 TString savPath(gROOT->GetMacroPath());
2003 TString fwd(
"$(ALICE_PHYSICS)/PWGLF/FORWARD/analysis2");
2004 gROOT->SetMacroPath(Form(
"%s:%s/scripts",
2005 gROOT->GetMacroPath(), fwd.Data()));
2007 if (!gROOT->GetClass(
"AliceLogo"))
2008 gROOT->LoadMacro(
"AliceLogo.C+");
2009 gROOT->SetMacroPath(savPath);
2011 if (gROOT->GetClass(
"AliceLogo")) {
2015 gROOT->ProcessLine(
"AliceLogo* al = new AliceLogo();");
2016 gROOT->ProcessLine(Form(
"al->Draw(0,.88,%f,.2, 0, 0);", yR));
2027 TLatex* pt =
new TLatex(xL, yL,
"Work in progress");
2029 pt->SetTextFont(62);
2032 pt->SetTextAlign(13);
2034 yL -= pt->GetTextSize()+.01;
2037 TLatex* dt =
new TLatex(xL, yL, now.AsSQLString());
2039 dt->SetTextFont(42);
2040 dt->SetTextSize(0.04);
2042 dt->SetTextAlign(13);
2044 yL -= dt->GetTextSize()+.01;
2047 if (
fSysString->GetUniqueID() == 1) { xL += .2; yL = y1; }
2054 if (yd < 0.0001)
PlotTitle(p1, yyd,
true);
2070 bool isBottom = (y1 < 0.0001);
2074 TPad* p2 =
new TPad(
"p2",
"p2", 0, y1, 1.0, y2, 0, 0, 0);
2075 p2->SetTopMargin(0.001);
2077 p2->SetBottomMargin(isBottom ? 1/yd * 0.07 : 0.0001);
2088 fRatios->SetMaximum(1+TMath::Max(.22,1.05*max));
2089 fRatios->SetMinimum(1-TMath::Max(.32,1.05*max));
2093 fRatios->DrawClone(
"nostack e1");
2098 isBottom ? .6 : .4, 2);
2102 band->SetPoint(0,
fResults->GetXaxis()->GetXmin(), 1);
2103 band->SetPoint(1,
fResults->GetXaxis()->GetXmax(), 1);
2106 band->SetFillColor(kYellow+2);
2107 band->SetFillStyle(3002);
2108 band->SetLineStyle(2);
2109 band->SetLineWidth(1);
2110 band->Draw(
"3 same");
2111 band->DrawClone(
"X L same");
2114 fRatios->DrawClone(
"nostack e1 same");
2132 bool isBottom = (y1 < 0.0001);
2135 TPad* p3 =
new TPad(
"p3",
"p3", 0, y1, 1.0, y2, 0, 0, 0);
2136 p3->SetTopMargin(0.001);
2138 p3->SetBottomMargin(isBottom ? 1/yd * 0.07 : 0.0001);
2149 fLeftRight->SetMaximum(1+TMath::Max(.12,1.05*max));
2150 fLeftRight->SetMinimum(1-TMath::Max(.15,1.05*max));
2160 Double_t yy1 = p3->GetBottomMargin()+.01;
2166 band->SetPoint(0,
fResults->GetXaxis()->GetXmin(), 1);
2167 band->SetPoint(1,
fResults->GetXaxis()->GetXmax(), 1);
2170 band->SetFillColor(kYellow+2);
2171 band->SetFillStyle(3002);
2172 band->SetLineStyle(2);
2173 band->SetLineWidth(1);
2174 band->Draw(
"3 same");
2175 band->DrawClone(
"X L same");
2192 TColor* col = gROOT->GetColor(origNum);
2193 if (!col)
return origNum;
2198 Int_t off = nTimes*0x33;
2199 Int_t newR = TMath::Min((origR+off),0xff);
2200 Int_t newG = TMath::Min((origG+off),0xff);
2201 Int_t newB = TMath::Min((origB+off),0xff);
2202 Int_t newNum = TColor::GetColor(newR, newG, newB);
2217 case 1:
return kRed+2;
2218 case 2:
return kGreen+2;
2219 case 3:
return kBlue+1;
2220 case 4:
return kCyan+1;
2221 case 5:
return kMagenta+1;
2222 case 6:
return kYellow+2;
2230 Float_t fc = ((centHigh+centLow)/2-min) / (max-min);
2231 Int_t nCol = gStyle->GetNumberOfColors();
2232 Int_t icol = TMath::Min(nCol-1,
int(fc * nCol + .5));
2233 Int_t col = gStyle->GetColorPalette(icol);
2248 if (color < 0)
return;
2249 h->SetLineColor(color);
2250 h->SetMarkerColor(color);
2263 if (color < 0)
return;
2265 g->SetMarkerColor(color);
2278 title.ReplaceAll(
"ALICE ",
"");
2279 if (
title.Contains(
"Central"))
2280 title.ReplaceAll(
"CentraldNdeta",
"SPD clusters");
2281 if (
title.Contains(
"Forward"))
2282 title.ReplaceAll(
"ForwarddNdeta",
"FMD");
2285 if (centTxt && centTxt[0] !=
'\0') {
2287 name.Append(Form(
"_%s", centTxt));
2305 if (!list)
return 0;
2307 TH1* ret =
static_cast<TH1*
>(list->FindObject(name));
2311 Warning(
"GetResult",
"Histogram %s not found", name);
2330 if (!hist)
return 0;
2335 stack->Add(hist, option);
2336 return hist->GetMaximum();
2353 if (!hist)
return 0;
2357 stack->Add(hist, option);
2362 stack->Add(sym, option);
2365 return hist->GetMaximum();
2378 Int_t nBins = h->GetNbinsX();
2379 if(nBins %
fRebin != 0) {
2380 Warning(
"Rebin",
"Rebin factor %d is not a devisor of current number " 2381 "of bins %d in the histogram %s",
fRebin, nBins, h->GetName());
2386 TH1* tmp =
static_cast<TH1*
>(h->Clone(
"tmp"));
2388 tmp->SetDirectory(0);
2392 for(
Int_t i = 1;i<= nBinsNew; i++) {
2401 if (c <= 0)
continue;
2404 if (h->GetBinContent(bin+1)<=0 ||
2405 h->GetBinContent(bin-1)<=0) {
2406 Warning(
"Rebin",
"removing bin %d=%f of %s (%d=%f,%d=%f)",
2407 bin, c, h->GetName(),
2408 bin+1, h->GetBinContent(bin+1),
2409 bin-1, h->GetBinContent(bin-1));
2421 if(content > 0 && nbins > 1 ) {
2422 tmp->SetBinContent(i, wsum / sumw);
2423 tmp->SetBinError(i,1./TMath::Sqrt(sumw));
2430 for(
Int_t i = 1; i<= nBinsNew; i++) {
2431 h->SetBinContent(i,tmp->GetBinContent(i));
2432 h->SetBinError(i, tmp->GetBinError(i));
2448 Int_t nBins = h->GetNbinsX();
2449 TH1* s =
static_cast<TH1*
>(h->Clone(Form(
"%s_mirror", h->GetName())));
2450 s->SetTitle(Form(
"%s (mirrored)", h->GetTitle()));
2452 s->SetBins(nBins, -h->GetXaxis()->GetXmax(), -h->GetXaxis()->GetXmin());
2453 s->SetMarkerColor(h->GetMarkerColor());
2454 s->SetMarkerSize(h->GetMarkerSize());
2455 s->SetMarkerStyle(h->GetMarkerStyle()+4);
2456 s->SetFillColor(h->GetFillColor());
2457 s->SetFillStyle(h->GetFillStyle());
2461 Int_t first = nBins+1;
2463 for (
Int_t i = 1; i <= nBins; i++) {
2464 if (h->GetBinContent(i) <= 0)
continue;
2465 first = TMath::Min(first, i);
2466 last = TMath::Max(last, i);
2469 Double_t xfirst = h->GetBinCenter(first-1);
2470 Int_t f1 = h->GetXaxis()->FindBin(-xfirst);
2471 Int_t l2 = s->GetXaxis()->FindBin(xfirst);
2472 for (
Int_t i = f1, j=l2; i <= last; i++,j--) {
2473 s->SetBinContent(j, h->GetBinContent(i));
2474 s->SetBinError(j, h->GetBinError(i));
2477 s->SetBinContent(l2+1, h->GetBinContent(first));
2478 s->SetBinError(l2+1, h->GetBinError(first));
2494 TH1* ret =
static_cast<TH1*
>(h->Clone(Form(
"%s_leftright", h->GetName())));
2501 ret->SetDirectory(0);
2503 ret->SetTitle(Form(
"%s (+/-)", h->GetTitle()));
2504 ret->SetYTitle(
"Right/Left");
2505 Int_t nBins = h->GetNbinsX();
2506 for (
Int_t i = 1; i <= nBins; i++) {
2512 if (c1 <= 0)
continue;
2514 Int_t j = h->FindBin(-x);
2515 if (j <= 0 || j > nBins)
continue;
2521 Double_t e = TMath::Sqrt((e2*e2*c1*c1+e1*e1*c2*c2)/(c12*c12));
2523 Int_t k = ret->FindBin(x);
2524 ret->SetBinContent(k, c2/c1);
2525 ret->SetBinError(k, e);
2527 max = TMath::Max(max,
RatioMax(ret));
2541 Int_t nBins = g->GetN();
2542 TArrayF bins(nBins+1);
2544 for (
Int_t i = 0; i < nBins; i++) {
2548 bins.fArray[i] = x-exl;
2549 bins.fArray[i+1] = x+exh;
2551 if (i == 0) dx = dxi;
2552 else if (dxi != dx) dx = 0;
2558 h =
new TH1D(name.Data(),
title.Data(), nBins, bins[0], bins[nBins]);
2561 h =
new TH1D(name.Data(),
title.Data(), nBins, bins.fArray);
2563 h->SetMarkerStyle(g->GetMarkerStyle());
2564 h->SetMarkerColor(g->GetMarkerColor());
2565 h->SetMarkerSize(g->GetMarkerSize());
2584 Int_t nBins = h->GetNbinsX();
2586 for (
Int_t i = 1; i <= nBins; i++) {
2588 if (c == 0)
continue;
2591 ret = TMath::Max(d, ret);
2604 Warning(
"ErrorGraphs",
"Called with vanila TGraph (%s)",
2605 g->IsA()->GetName());
2606 Int_t n = g->GetN();
2609 for (
Int_t i = 0; i < n; i++) {
2610 low->SetPoint(i, 0, 0);
2611 up->SetPoint(i, 0, 0);
2620 Int_t n = g->GetN();
2623 for (
Int_t i = 0; i < n; i++) {
2624 low->SetPoint(i, g->GetX()[i], g->GetY()[i] - g->GetEY()[i]);
2625 up->SetPoint(i, g->GetX()[i], g->GetY()[i] + g->GetEY()[i]);
2634 Int_t n = g->GetN();
2637 for (
Int_t i = 0; i < n; i++) {
2638 low->SetPoint(i, g->GetX()[i], g->GetY()[i] - g->GetEYlow()[i]);
2639 up->SetPoint(i, g->GetX()[i], g->GetY()[i] + g->GetEYhigh()[i]);
2655 if (!o1 || !o2)
return 0;
2657 bool mirror =
false;
2659 if (n1.Contains(
"mirror")) mirror =
true;
2662 const TAttMarker* m1 = 0;
2663 const TAttMarker* m2 = 0;
2664 const TH1* h1 =
dynamic_cast<const TH1*
>(o1);
2667 const TH1* h2 =
dynamic_cast<const TH1*
>(o2);
2698 if (r->GetEntries() <= 0) {
2707 r->SetMarkerColor(m1->GetMarkerColor());
2708 if (
TString(o2->GetName()).Contains(
"truth", TString::kIgnoreCase))
2709 r->SetMarkerStyle(m1->GetMarkerStyle());
2710 r->SetMarkerSize(0.9*m1->GetMarkerSize());
2711 r->SetName(Form(
"%s_over_%s", o1->GetName(), o2->GetName()));
2712 r->SetTitle(Form(
"%s / %s", o1->GetTitle(), o2->GetTitle()));
2714 max = TMath::Max(
RatioMax(r), max);
2731 if (!h || !g)
return 0;
2733 TH1* ret =
static_cast<TH1*
>(h->Clone(
"tmp"));
2735 Int_t n = g->GetN();
2740 if (g->IsA()->InheritsFrom(TGraphErrors::Class())) {
2742 xlow -= ge->GetErrorXlow(0);
2743 xhigh += ge->GetErrorXhigh(n-1);
2746 if (g->IsA()->InheritsFrom(TGraphAsymmErrors::Class())) {
2748 xlow -= ge->GetErrorXlow(0);
2749 xhigh += ge->GetErrorXhigh(n-1);
2752 if (xlow > xhigh) {
Double_t t = xhigh; xhigh = xlow; xlow = t; }
2754 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
2756 if (c <= 0)
continue;
2759 if (x < xlow || x > xhigh)
continue;
2762 if (f <= 0)
continue;
2767 Double_t e = TMath::Max(ec, TMath::Max(efl, efh));
2769 ret->SetBinContent(i, c / f);
2770 ret->SetBinError(i, e / f);
2785 if (!h1 || !h2)
return 0;
2787 if (h1->GetNbinsX() != h2->GetNbinsX()) {
2788 Error(
"RatioHH",
"They have differnet number of bins");
2791 for (
Int_t i = 1; i <= h1->GetNbinsX(); i++) {
2792 if (h1->GetXaxis()->GetBinLowEdge(i) !=
2793 h2->GetXaxis()->GetBinLowEdge(i)) {
2801 TH1* t1 =
static_cast<TH1*
>(h1->Clone(
"tmp"));
2818 Int_t nBins = g1->GetN();
2819 TArrayF bins(nBins+1);
2821 for (
Int_t i = 0; i < nBins; i++) {
2825 bins.fArray[i] = x-exl;
2826 bins.fArray[i+1] = x+exh;
2828 if (i == 0) dx = dxi;
2829 else if (dxi != dx) dx = 0;
2833 h =
new TH1F(
"tmp",
"tmp", nBins, bins[0], bins[nBins]);
2836 h =
new TH1F(
"tmp",
"tmp", nBins, bins.fArray);
2840 Double_t high = g2->GetX()[g2->GetN()-1];
2841 if (low > high) {
Double_t t = low; low = high; high = t; }
2842 for (
Int_t i = 0; i < nBins; i++) {
2844 if (x < low-dx || x > high+dx)
continue;
2849 h->SetBinContent(i+1, c1 / c2);
2850 h->SetBinError(i+1, e1 / c2);
2870 TObject* o = p->GetListOfPrimitives()->FindObject(name);
2872 Warning(
"FindXAxis",
"%s not found in pad", name);
2875 THStack*
stack =
dynamic_cast<THStack*
>(o);
2877 Warning(
"FindXAxis",
"%s is not a THStack", name);
2880 if (!stack->GetHistogram()) {
2881 Warning(
"FindXAxis",
"%s has no histogram", name);
2884 TAxis* ret = stack->GetHistogram()->GetXaxis();
2902 Warning(
"FixAxis",
"No stack passed for %s!", ytitle);
2906 if (force) stack->Draw(
"nostack e1");
2908 TH1* h = stack->GetHistogram();
2910 Warning(
"FixAxis",
"Stack %s has no histogram", stack->GetName());
2916 h->SetXTitle(
"#it{#eta}");
2917 h->SetYTitle(ytitle);
2918 TAxis* xa = h->GetXaxis();
2919 TAxis* ya = h->GetYaxis();
2928 xa->SetTitleSize(s*xa->GetTitleSize());
2929 xa->SetLabelSize(s*xa->GetLabelSize());
2930 xa->SetTickLength(s*xa->GetTickLength());
2935 xa->Set(rxa->GetNbins(), rxa->GetXmin(), rxa->GetXmax());
2942 ya->SetNdivisions(ynDiv);
2943 ya->SetTitleSize(s*ya->GetTitleSize());
2944 ya->SetTitleOffset(1.4*ya->GetTitleOffset()/s);
2945 ya->SetLabelSize(supLabel ? 0 : s*ya->GetLabelSize());
2963 TH1* tmp =
static_cast<TH1*
>(fwd->Clone(
"tmp"));
2965 name.ReplaceAll(
"Forward",
"Merged");
2970 tmp->SetDirectory(0);
2971 if (!cen)
return tmp;
2975 for (
Int_t i = 1; i <= tmp->GetNbinsX(); i++) {
2977 Double_t cf = fwd->GetBinContent(i);
2982 if (cc < 0.001 && cf < 0.01)
continue;
2983 xlow = TMath::Min(tmp->GetXaxis()->GetBinLowEdge(i),xlow);
2984 xhigh = TMath::Max(tmp->GetXaxis()->GetBinUpEdge(i),xhigh);
2990 ne = TMath::Sqrt(ec*ec + ef*ef);
2993 tmp->SetBinContent(i, nc);
2994 tmp->SetBinError(i, ne);
3012 TF1* tmpf =
new TF1(
"tmpf",
"gaus", xlow, xhigh);
3013 tmp->Fit(tmpf,
"NQ",
"");
3014 tmp->SetDirectory(0);
3016 TF1* fit =
new TF1(
"f",
myFunc, xlow, xhigh, 4);
3017 fit->SetParNames(
"a_{1}",
"a_{2}",
"#sigma_{1}",
"#sigma_{2}");
3018 fit->SetParameters(tmpf->GetParameter(0),
3020 tmpf->GetParameter(2),
3021 tmpf->GetParameter(2)/4);
3022 fit->SetParLimits(3, 0, 100);
3023 fit->SetParLimits(4, 0, 100);
3025 tmp->Fit(fit,fitOpts,
"");
3042 if (!tmp || !fwd)
return;
3043 for (
Int_t i = 1; i <= tmp->GetNbinsX(); i++) {
3044 Double_t tc = tmp->GetBinContent(i);
3045 if (tc < 0.01)
continue;
3046 Double_t fc = fwd->GetBinContent(i);
3047 Double_t cc = cen ? cen->GetBinContent(i) : 0;
3050 if (cc > .01 && fc > 0.01) {
3054 else if (cc > .01) {
3058 Double_t x = tmp->GetXaxis()->GetBinCenter(i);
3059 Double_t y = (fit ? fit->Eval(x) : mc);
3060 tmp->SetBinContent(i, y);
3061 tmp->SetBinError(i,sysErr*y);
3064 name.ReplaceAll(
"Merged",
"SysError");
3070 tmp->SetMarkerStyle(0);
3071 tmp->SetLineWidth(0);
3077 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
3079 if (TMath::Abs(eta) < 2.3) {
3080 h->SetBinContent(i, 0);
3081 h->SetBinError(i, 0);
3090 Info(
"CorrectCentral",
"Replacing Central with Tracklets in %s", t.Data());
3091 t.ReplaceAll(
"Central",
"Tracklets");
3095 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
3100 h->SetBinContent(i, c / f);
3108 bname.ReplaceAll(
" ",
"_");
3109 bname.ReplaceAll(
"-",
"_");
3110 TString fname(Form(
"%s.C", bname.Data()));
3112 std::ofstream outf(fname.Data());
3114 Error(
"Export",
"Failed to open output file %s", fname.Data());
3117 Info(
"Export",
"Exporting data to %s", fname.Data());
3118 outf <<
"// Create by dNdetaDrawer\n" 3119 <<
"// Setting for this draw\n" 3121 <<
"// Draw(\"\",\"" <<
fTitle <<
"\"," <<
fRebin <<
",0x" 3123 << std::dec <<
fSNNString->GetUniqueID() <<
"," 3129 << std::dec <<
");\n" 3131 <<
"void " << bname <<
"(THStack* stack, TLegend* l, Int_t m)\n" 3133 <<
" Int_t ma[] = { 24, 25, 26, 32,\n" 3134 <<
" 20, 21, 22, 33,\n" 3135 <<
" 34, 30, 29, 0, \n" 3137 <<
" Int_t mm = ((m < 20 || m > 34) ? 0 : ma[m-20]);\n\n";
3141 while ((hist = static_cast<TH1*>(next()))) {
3142 TString hname = hist->GetName();
3143 hname.Append(Form(
"_%04x", (
gRandom->Integer(0xffff) & 0xffff)));
3144 hist->SetName(hname);
3145 hist->GetListOfFunctions()->Clear();
3146 hist->SavePrimitive(outf,
"nodraw");
3147 bool mirror = hname.Contains(
"mirror");
3148 bool syserr = hname.Contains(
"SysError");
3150 outf <<
" " << hname <<
"->SetMarkerStyle(" 3151 << (mirror ?
"mm" :
"m") <<
");\n";
3153 outf <<
" " << hname <<
"->SetMarkerStyle(1);\n";
3154 outf <<
" stack->Add(" << hname
3155 << (syserr ?
",\"e5\"" :
"") <<
");\n\n";
3160 if (snn == 2750) snn = 2760;
3161 if (snn < 1000) eS = Form(
"%3dGeV", snn);
3162 else if (snn % 1000 == 0) eS = Form(
"%dTeV", snn/1000);
3163 else eS = Form(
"%4.2fTeV",
float(snn)/1000);
3164 outf <<
" if (l) {\n" 3165 <<
" TLegendEntry* e = l->AddEntry(\"\",\"" << eS <<
"\",\"pl\");\n" 3166 <<
" e->SetMarkerStyle(m);\n" 3167 <<
" e->SetMarkerColor(kBlack);\n" 3169 <<
"}\n" << std::endl;
3172 TString clean(Form(
"sed -e 's/_[0-9a-f]\\{4\\}" 3173 "\\(\\|_\\{1,4\\}[0-9a-f]\\{1,4\\}\\)\\b//g'" 3174 " -e 's/%s/%s/g' < %s > %s.C",
3175 bname.Data(), tgt.Data(), fname.Data(), tgt.Data()));
3176 Printf(
"Execute \"%s\"", clean.Data());
3184 Printf(
"Copy %s.C to %s/%s/%05d/%s%s/%s.C",tgt.Data(),
3186 fSysString->GetTitle(), snn, trg.Data(), mth.Data(),
3189 if (trg.EqualTo(
"INEL") || trg.EqualTo(
"MBOR")) trg =
"INEL";
3190 else if (trg.EqualTo(
"INEL>0") || trg.EqualTo(
"INELGt0")) trg =
"INELGt0";
3191 else if (trg.EqualTo(
"NSD") || trg.EqualTo(
"V0AND")) trg =
"NSD";
3194 std::ofstream outs(
"gse.C");
3196 Error(
"Export",
"Failed to open output file %s", fname.Data());
3200 <<
"TList* gse() {\n" 3201 <<
" TString mkLib = gSystem->GetMakeSharedLib();\n" 3202 <<
" mkLib.ReplaceAll(\"-std=c++14\", \"-std=c++98\");\n" 3203 <<
" gSystem->SetMakeSharedLib(mkLib);\n" 3204 <<
" TString gseDir(gSystem->ExpandPathName(\"~/GraphSysErr\"));\n" 3205 <<
" TString phyDir(gSystem->ExpandPathName(\"${ALICE_PHYSICS}\"));\n" 3206 <<
" gROOT->SetMacroPath(Form(\"%s:%s/PWGLF/FORWARD/analysis2/dndeta:%s\",gseDir.Data(),phyDir.Data(),gROOT->GetMacroPath()));\n" 3207 <<
" gSystem->AddIncludePath(Form(\"-I%s\",gseDir.Data()));\n" 3208 <<
" gROOT->LoadMacro(\"GraphSysErr.C+g\");\n" 3209 <<
" gROOT->LoadMacro(\"SysErrorAdder.C+g\");\n" 3210 <<
" TString t = \"" << trg <<
"\";\n" 3211 <<
" TString c = \"" << mth <<
"\";\n" 3212 <<
" TString s = \"" <<
fSysString->GetTitle() <<
"\";\n" 3213 <<
" UShort_t e = " << snn <<
";\n" 3214 <<
" TString m = \"" << tgt <<
".C\";\n" 3215 <<
" TList* r = new TList;\n" 3216 <<
" THStack* l = new THStack(\"l\",\"l\");\n" 3217 <<
" gROOT->Macro(Form(\"%s((THStack*)%p,0,20)\",m.Data(),l));\n" 3218 <<
" SysErrorAdder* a = SysErrorAdder::Create(t,s,e,c);\n" 3219 <<
" TIter n(l->GetHists());\n" 3221 <<
" Bool_t f = true;\n" 3222 <<
" while ((h = static_cast<TH1*>(n()))) {\n" 3223 <<
" TString nme(h->GetName());\n" 3224 <<
" if (nme.Contains(\"mirror\")||nme.Contains(\"SysError\"))\n" 3226 <<
" h->SetMarkerColor(kBlack);\n" 3227 <<
" h->SetFillColor(kBlack);\n" 3228 <<
" h->SetLineColor(kBlack);\n" 3229 <<
" GraphSysErr* g = a->Make(h,0);\n" 3230 <<
" g->SetSumOption(GraphSysErr::kBox);\n" 3231 <<
" g->SetSumFillColor(g->GetMarkerColor());\n" 3232 <<
" g->SetSumFillStyle(3002);\n" 3233 <<
" g->SetCommonSumOption(GraphSysErr::kBox);\n" 3234 <<
" g->SetCommonSumFillColor(g->GetMarkerColor());\n" 3235 <<
" g->SetCommonSumFillStyle(3001);\n" 3236 <<
" if (f) g->Draw(\"SUM QUAD AXIS\");\n" 3237 <<
" else g->Draw(\"SUM QUAD\");\n" 3241 <<
" TFile* file = TFile::Open(Form(\"%s_%05d_%s%s.root\",s.Data(),e,t.Data(),c.Data()),\"RECREATE\");\n" 3242 <<
" r->Write(\"container\",TObject::kSingleKey);\n" 3243 <<
" file->Write();\n" 3246 <<
"// EOF" << std::endl;
3361 return a1*(TMath::Gaus(x, 0, s1) - a2 * TMath::Gaus(x, 0, s2));
3373 Warning(
"UpdateRange",
"No parameters %p", p);
3377 Warning(
"UpdateRange",
"No master axis %p", p->
fMasterAxis);
3399 TCanvas*
c = gPad->GetCanvas();
3419 Int_t event = gPad->GetEvent();
3420 TObject *select = gPad->GetSelected();
3425 if (event != 11 || !select || select != p->
fMasterAxis)
return;
3439 std::ostream& o = std::cout;
3440 o <<
"Usage: DrawdNdeta(FILE,TITLE,REBIN,OTHERS,FLAGS," 3441 <<
"SNN,SYS,TRIG,IPZMIN,IPZMAX,BASE,FMT)\n" 3442 <<
" const char* FILE File name to open (\"forward_dndeta.root\")\n" 3443 <<
" const char* TITLE Title to put on plot (\"\")\n" 3444 <<
" UShort_t REBIN Rebinning factor (1)\n" 3445 <<
" UShort_t OTHERS Other data to draw - more below (0x7)\n" 3446 <<
" UShort_t FLAGS Visualisation flags - more below (0x7)\n" 3447 <<
" UShort_t SYS (optional) 1:pp, 2:PbPb, 3:pPb\n" 3448 <<
" UShort_t SNN (optional) sqrt(s_NN) in GeV\n" 3449 <<
" UShort_t TRIG (optional) 1: INEL, 2: INEL>0, 4: NSD, ...\n" 3450 <<
" Float_t EFF (optional) Trigger efficiency\n" 3451 <<
" Float_t IPZMIN (optional) Least z coordinate of IP\n" 3452 <<
" Float_t IPZMAX (optional) Largest z coordinate of IP\n" 3453 <<
" const char* BASE (optional) base name of output files\n" 3454 <<
" UShort_t FMT (optional) Output formats\n" 3456 o <<
" OTHERS is a bit mask of\n" 3457 <<
" 0x1 Show UA5 data (INEL,NSD, ppbar, 900GeV)\n" 3458 <<
" 0x2 Show CMS data (NSD, pp)\n" 3459 <<
" 0x4 Show published ALICE data (INEL,INEL>0,NSD, pp)\n" 3460 <<
" 0x8 Show event genertor data\n" 3462 o <<
" FMT is a bit mask of\n" 3463 <<
" 0x1 Make PNG output\n" 3464 <<
" 0x2 Make PDF output\n" 3465 <<
" 0x4 Make ROOT file output\n" 3466 <<
" 0x8 Make ROOT script output\n" 3468 o <<
" FLAGS is a bit mask of\n" 3469 <<
" 0x1 Show ratios of data to other data and possibly MC\n" 3470 <<
" 0x2 Show left-right asymmetry\n" 3471 <<
" 0x4 Show systematic error band\n" 3472 <<
" 0x8 Show individual ring results (INEL only)\n" 3473 <<
" 0x10 Cut edges when rebinning\n" 3474 <<
" 0x20 Remove FMDxO points\n" 3475 <<
" 0x40 Apply `final MC' correction\n" 3476 <<
" 0x80 Apply `Emperical' correction\n" 3477 <<
" 0x100 Force use of MB\n" 3478 <<
" 0x200 Mirror data\n" 3479 <<
" 0x400 Export results to script\n" 3480 <<
" 0x800 Add code to do combined zooms on eta axis\n" 3481 <<
" 0x1000 Assume old-style input\n" 3482 <<
" 0x2000 Be verbose\n" 3483 <<
" 0x4000 Hi-res batch output\n" 3484 <<
" 0x8000 Add aditional white-space above results\n" 3486 o <<
"0x200 requires the file forward_dndetamc.root\n" 3487 <<
"0x400 requires the file EmpiricalCorrection.root\n" 3488 <<
"To specify that you want ratios, force MB, apply empirical " 3489 <<
"correction, and export to script, set flags to\n\n" 3490 <<
" 0x1|0x100|0x80|0x400=0x581\n" 3515 const char*
title=
"",
3522 const char* base=
"",
3527 if (fname.CompareTo(
"help") == 0 ||
3528 fname.CompareTo(
"--help") == 0) {
3537 0, 0, +999, -999, base, outflg);
3547 std::ostream& o = std::cout;
3548 o <<
"Usage: DrawdNdeta(FILE,TITLE,OTHERS,OPTIONS,FORMATS,REBIN,EFF," 3549 <<
"CMIN,CMAX,IPZMIN,IPZMAX,BASE)\n" 3550 <<
" const char* FILE File name to open (\"forward_dndeta.root\")\n" 3551 <<
" const char* TITLE Title to put on plot (\"\")\n" 3552 <<
" const char* OTHERS Other data to draw - more below (\"all\")\n" 3553 <<
" const char* FLAGS Visualisation flags - more below (\"default\")\n" 3554 <<
" const char* FMT (optional) Output formats (\"all\")\n" 3555 <<
" UShort_t REBIN (optional) Rebinning factor (5)\n" 3556 <<
" Float_t EFF (optional) Trigger efficiency\n" 3557 <<
" Float_t IPZMIN (optional) Least z coordinate of IP\n" 3558 <<
" Float_t IPZMAX (optional) Largest z coordinate of IP\n" 3559 <<
" UShort_t CMIN (optional) Least centrality\n" 3560 <<
" UShort_t CMAX (optional) Largest centrality\n" 3561 <<
" const char* BASE (optional) base name of output files\n" 3563 o <<
" OTHERS space separated list of\n" 3564 <<
" UA5 Show UA5 data (INEL,NSD, ppbar, 900GeV)\n" 3565 <<
" CMS Show CMS data (NSD, pp)\n" 3566 <<
" ALICE Show published ALICE data (INEL,INEL>0,NSD, pp)\n" 3567 <<
" WIP Show event genertor data/work-in-progress\n" 3569 o <<
" FMT space separated list of \n" 3570 <<
" PNG Make PNG output\n" 3571 <<
" PDF Make PDF output\n" 3572 <<
" ROOT Make ROOT file output\n" 3573 <<
" C Make ROOT script output\n" 3575 o <<
" FLAGS is a bit mask of\n" 3576 <<
" ratio Show ratios of data to other data and possibly MC\n" 3577 <<
" asymmetry Show left-right asymmetry\n" 3578 <<
" syserror Show systematic error band\n" 3579 <<
" rings Show individual ring results (INEL only)\n" 3580 <<
" noedges Cut edges when rebinning\n" 3581 <<
" noouters Remove FMDxO points\n" 3582 <<
" finalmc Apply `final MC' correction\n" 3583 <<
" empirical[=URL] Apply `Emperical' correction\n" 3584 <<
" mb Force use of MB\n" 3585 <<
" mirror Mirror data\n" 3586 <<
" export Export results to script\n" 3587 <<
" exec Add code to do combined zooms on eta axis\n" 3588 <<
" old Assume old-style input\n" 3589 <<
" verbose Be verbose\n" 3590 <<
" hires Hi-res batch output\n" 3591 <<
" extrawhite Add aditional white-space above results\n" 3592 <<
" logo Add ALICE logo\n" 3593 <<
" nocentral Do not plot cluster data\n" 3594 <<
" nolabels No labels on y-axis\n" 3596 o <<
"finalmc requires the file forward_dndetamc.root\n" 3597 <<
"empirical requires the histogram at URL \n" 3604 const char*
title=
"",
3605 const char* others=
"ALL",
3606 const char* options=
"DEFAULT",
3607 const char* outFlg=
"ALL",
3610 const char* base=
"")
3614 if (fname.CompareTo(
"help") == 0 ||
3615 fname.CompareTo(
"--help") == 0) {
3623 pd->
Run(filename,
title, others, options, outFlg,
rebin, eff,
3624 0, 0, +999, -999, base);
Int_t color[]
print message on plot with ok/not ok
TH1 * FetchOne(const TList *list, const TList *mcList, TObject *empCorr, const char *name, const char *folderName, TMultiGraph *others, Int_t col, const char *txt, Double_t &max, Double_t &rmax, Double_t &amax, TH1 *&truth)
void ModifyTitle(TNamed *h, const char *centTxt)
TH1 * RatioGG(const TGraphAsymmErrors *g1, const TGraphAsymmErrors *g2) const
dNdetaDrawer & operator=(const dNdetaDrawer &)
void Draw(const char *filename, const char *title="", const char *others="ALL", const char *options="DEFAULT", const char *outFlg="ALL", UShort_t rebin=5, Float_t eff=0, const char *base="")
static const Int_t kAlicePurple
void PlotLeftRight(Double_t max, Double_t y1, Double_t y2)
TH1 * Graph2Hist(const TGraphAsymmErrors *g) const
virtual void Rebin(TH1 *h) const
void SetEmpirical(const TString &file)
void SetAttributes(TGraph *g, Int_t color)
void Run(const char *filename, const char *title, UShort_t rebin, UShort_t others=0x7, UInt_t flags=kDefaultOptions, UShort_t sys=0, UShort_t sNN=0, UShort_t trg=0, Float_t eff=0, UShort_t centMin=0, UShort_t centMax=0, Float_t vzMin=+999, Float_t vzMax=-999, const char *base="", UShort_t formats=kAllFormats)
static const Int_t kAliceRed
void CorrectCentral(TH1 *h) const
TMultiGraph * FetchOthers(UShort_t centLow, UShort_t centHigh)
TH1 * Merge(const TH1 *cen, const TH1 *fwd, Double_t &xlow, Double_t &xhigh)
TH1 * Ratio(const TObject *o1, const TObject *o2, Double_t &max) const
static void ErrorGraphs(const TGraphAsymmErrors *g, TGraph *&low, TGraph *&up)
void SetShowOthers(UInt_t others)
static UShort_t GetMarkerBits(Int_t style)
static const Int_t kSysErrColor
Bool_t GetEmpirical(const TString &prx, Bool_t useCen, TObject *&fwdEmp, TObject *&cenEmp, TString &empName)
void Export(const char *basename)
void SetTriggerEfficiency(Float_t eff)
void SetRebin(UShort_t x)
void BuildCentLegend(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
static void ErrorGraphs(const TGraphErrors *g, TGraph *&low, TGraph *&up)
void SetTrigger(UShort_t trig)
void PlotResults(Double_t max, Double_t yd, Double_t s)
void CorrectTriggerEff(TH1 *dndeta)
Double_t myFunc(Double_t *xp, Double_t *pp)
static const Float_t kRightMargin
void DrawdNdeta(const char *filename="forward_dndeta.root", const char *title="", UShort_t rebin=5, UShort_t others=0x7, UInt_t flags=dNdetaDrawer::kDefaultOptions, Double_t meanIpX=-1, Double_t meanIpY=-1, Float_t eff=0, const char *base="", UShort_t outflg=dNdetaDrawer::kAllFormats)
void Run(const char *filename="forward_dndeta.root", const char *title="", const char *others="all", const char *options="default", const char *formats="all", UShort_t rebin=5, Float_t eff=0, UShort_t centMin=0, UShort_t centMax=0, Float_t vzMin=+999, Float_t vzMax=-999, const char *base="")
dNdetaDrawer(const dNdetaDrawer &)
TAxis * FindXAxis(TVirtualPad *p, const char *name)
static void ErrorGraphs(const TGraph *g, TGraph *&low, TGraph *&up)
void UpdateRange(dNdetaDrawer::RangeParam *p)
void BuildLegend(THStack *stack, TMultiGraph *mg, Double_t x1, Double_t y1, Double_t x2, Double_t y2, Int_t forceCol=0)
TH1 * FetchHistogram(const TList *list, const char *name) const
static const Int_t kAliceBlue
Int_t GetCentralityColor(Int_t bin) const
void SetDelta(Double_t meanIpx, Double_t meanIpy)
static Int_t FlipHollowStyle(Int_t style)
void SetAttributes(TH1 *h, Int_t color)
void SetVertexRange(Double_t vzMin, Double_t vzMax)
void CorrectEmpirical(TH1 *dndeta, TObject *empObj)
Double_t AddHistogram(THStack *stack, TH1 *hist, TH1 *&sym, Option_t *option="") const
void RangeExec(dNdetaDrawer::RangeParam *p)
void PlotRatios(Double_t max, Double_t y1, Double_t y2)
static const Int_t kAliceYellow
void Plot(Double_t max, Double_t rmax, Double_t amax)
TF1 * FitMerged(TH1 *tmp, Double_t xlow, Double_t xhigh)
TObjArray * FetchTopResults(const TList *list, const TList *mcList, TObject *empCorr, const char *name, Double_t &max, Double_t &rmax, Double_t &amax, TObjArray &truths)
TH1 * Asymmetry(TH1 *h, Double_t &max)
TFile * file
TList with histograms for a given trigger.
Double_t RatioMax(TH1 *h) const
void SetSys(UShort_t sys)
void SetSNN(UShort_t sNN)
void SetCentralityRange(UShort_t centMin, UShort_t centMax)
void test(int runnumber=195345)
Double_t AddHistogram(THStack *stack, TH1 *hist, Option_t *option="") const
void MakeSysError(TH1 *tmp, TH1 *cen, TH1 *fwd, TF1 *fit)
void CorrectForward(TH1 *h) const
TH1 * RatioHG(const TH1 *h, const TGraph *g) const
void SetCentralSysError(Double_t e=0)
void FixAxis(THStack *stack, Double_t yd, const char *ytitle, Int_t ynDiv=210, Bool_t force=true)
TH1 * RatioHH(const TH1 *h1, const TH1 *h2) const
TH1 * FetchCentResults(const TList *list, const TList *mcList, TObject *empCorr, const char *name, TMultiGraph *thisOther, Int_t color, const char *centTxt, Double_t &max, Double_t &rmax, Double_t &amax, TH1 *&truth)
void SetFinalMC(const TString &file)
void AttachExec(TVirtualPad *p, const char *plot, UShort_t id, Bool_t isBottom)
void CorrectFinalMC(TH1 *dndeta, const TList *mcList)
void SetForwardSysError(Double_t e=0)
TH1 * Symmetrice(const TH1 *h) const
void FetchInformation(const TList *results)
void SetDelta(Double_t delta)
const char * CentLimitName(Bool_t isMult, Float_t v)
static Int_t GetMarkerStyle(UShort_t bits)
void PlotTitle(TVirtualPad *p, Double_t yd, Bool_t bottom=true)
Color_t Brighten(Color_t origNum, Int_t nTimes=2) const