18 #include "TPaveText.h"
23 static const UInt_t
NNumer(14);
24 static const UInt_t
NPlot(2);
25 static const UInt_t
NPad(2);
26 static const UInt_t
NVtx(4);
33 gErrorIgnoreLevel = kError;
34 cout <<
"\n Beginning plot macro..." << endl;
37 const TString sOutput(
"recoCorrelator.forDebug_checkingHowCorrChanges.d9m4y2023.root");
38 const TString sDenom(
"reference/alex_output/pp200run6jet40.SphenixRecoUnscaled_output_trksAndChrgPars.root");
39 const TString sHistDenom(
"EEC0");
40 const TString sNameDenom(
"hReferenceReco");
41 const TString sLabelDenom(
"Reference output [Reco]");
44 const TString sNumer[
NNumer] = {
"reference/alex_code/SphenixRecoUnscaled_output_derekTestRun.root",
45 "reference/alex_code/SphenixRecoUnscaled_output_derekTestRun2.root",
46 "reference/alex_code/SphenixRecoUnscaled_output_derekTestRun3.root",
47 "pp200run6jet40.forDebug_reco_initialRun.d7m4y2023.root",
48 "pp200run6jet40.forDebug_reco_usingTVectors.d7m4y2023.root",
49 "pp200run6jet40.forDebug_reco_testingMinDr.d7m4y2023.root",
50 "pp200run6jet40.forDebug_reco_noCstCuts.d7m4y2023.root",
51 "pp200run6jet40.forDebug_reco_beingMoreCarefulWithJetPt.d7m4y2023.root",
52 "pp200run6jet40.forDebug_reco_onlyOnePtJetRange.d9m4y2023.root",
53 "pp200run6jet40.forDebug_reco_checkingJetPtRange.d9m4y2023.root",
54 "pp200run6jet40.forDebug_reco_usingAbsValEta.d9m4y2023.root",
55 "pp200run6jet40.forDebug_reco_numCstsG0.d9m4y2023.root",
56 "pp200run6jet40.forDebug_reco_checkingNumCst.d10m4y2023.root",
57 "pp200run6jet40.forDebug_reco_hardCodingNPoint.d10m4y2023.root"};
58 const TString sHistNumer[
NNumer] = {
"EEC0",
61 "hCorrelatorDrAxis_ptJet15",
62 "hCorrelatorDrAxis_ptJet15",
63 "hCorrelatorDrAxis_ptJet15",
64 "hCorrelatorDrAxis_ptJet15",
65 "hCorrelatorDrAxis_ptJet15",
66 "hCorrelatorDrAxis_ptJet15",
67 "hCorrelatorDrAxis_ptJet15",
68 "hCorrelatorDrAxis_ptJet15",
69 "hCorrelatorDrAxis_ptJet15",
70 "hCorrelatorDrAxis_ptJet15",
71 "hCorrelatorDrAxis_ptJet15"};
72 const TString sNameNumer[
NNumer] = {
"hLocalAlexTest",
73 "hLocalAlexTest_WithMyEECInit",
74 "hLocalAlexTest_Only1520",
79 "hF4A_BeingMoreCarefulWithJetPt",
80 "hF4A_OnlyOnePtJetRange",
81 "hF4A_CheckingPtJetRange",
82 "hF4A_UsingAbsValEta",
84 "hF4A_CheckingNumCst",
85 "hF4A_HardCodedNPoint"};
86 const TString sNameRatio[
NNumer] = {
"hRatio_LocalAlexTest",
87 "hRatio_LocalAlexTest_WithMyEECInit",
88 "hRatio_LocalAlexTest_Only1520",
90 "hRatio_UsingTVectors",
91 "hRatio_TestingMinDr",
93 "hRatio_BeingMoreCarefulWithJetPt",
94 "hRatio_OnlyOnePtJetRange",
95 "hRatio_CheckingPtJetRange",
96 "hRatio_UsingAbsValEta",
98 "hRatio_CheckingNumCst",
99 "hRatio_HardCodedNPoint"};
100 const TString sLabelNumer[
NNumer] = {
"Local test of Alex's Code",
101 "Local test of Alex's Code (using my EEC initialization/header)",
102 "Local test of Alex's Code (only pTjet = 15 - 20 GeV/c)",
104 "Using TVectors for pTcst calc",
105 "Testing minimum #DeltaR",
107 "Being careful with pTjet selection",
108 "Only 1 pTjet range",
109 "Checking pTjet range",
110 "Using |eta| in cut",
111 "N_{cst} must be > 0",
112 "Checking N_{cst} (no truth calc done)",
113 "Hard-coded N-point"};
116 const UInt_t nRebin(2);
117 const Bool_t doRebin(
false);
120 const TString sOptDenom(
"");
121 const TString sOptNumer[
NNumer] = {
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME"};
122 const TString sOptRatio[
NNumer] = {
"",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME",
"SAME"};
123 const Float_t xPlotRange[
NPlot] = {0.001, 1.};
126 const TString sTitle(
"");
127 const TString sTitleX(
"#DeltaR");
128 const TString sTitleY(
"EEC");
129 const TString sTitleR(
"[change] / [reference]");
130 const UInt_t fColDen(923);
131 const UInt_t fMarDen(20);
132 const UInt_t fColNum[
NNumer] = {799, 809, 899, 909, 879, 889, 859, 869, 839, 849, 819, 829, 921, 922};
133 const UInt_t fMarNum[
NNumer] = {24, 26, 32, 25, 27, 28, 30, 30, 46, 24, 26, 32, 25, 26};
136 const TString sSys(
"#bf{#it{sPHENIX}} Simulation [Run6]");
137 const TString sTrg(
"JS 40 GeV Jet Sample");
138 const TString sJet(
"p_{T}^{jet} #in (15, 20) GeV");
139 const TString sTyp(
"");
140 const TString sHeader(
"");
143 TFile *fOutput =
new TFile(sOutput.Data(),
"recreate");
144 TFile *fDenom =
new TFile(sDenom.Data(),
"read");
145 if (!fOutput || !fDenom) {
146 cerr <<
"PANIC: couldn't open output or denominator file!\n"
147 <<
" fOutput = " << fOutput <<
", fDenom = " << fDenom
151 cout <<
" Opened output and denominator files." << endl;
155 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
156 fNumer[iNumer] =
new TFile(sNumer[iNumer].
Data(),
"read");
157 if (!fNumer[iNumer]) {
158 cerr <<
"PANIC: couldn't open numerator file #" << iNumer <<
"!" << endl;
162 cout <<
" Opened numerator files." << endl;
165 TH1D *hDenom = (TH1D*) fDenom ->
Get(sHistDenom.Data());
167 cerr <<
"PANIC: couldn't grab denominator histogram!" << endl;
170 hDenom ->
SetName(sNameDenom.Data());
171 cout <<
" Grabbed denominator histogram." << endl;
175 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
176 hNumer[iNumer] = (TH1D*) fNumer[iNumer] ->
Get(sHistNumer[iNumer]);
177 if (!hNumer[iNumer]) {
178 cerr <<
"PANIC: couldn't grab numerator histogram #" << iNumer <<
"!" << endl;
181 hNumer[iNumer] ->
SetName(sNameNumer[iNumer].
Data());
183 cout <<
" Grabbed numerator histograms." << endl;
187 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
188 hNumer[iNumer] -> Rebin(nRebin);
190 hDenom -> Rebin(nRebin);
191 cout <<
" Rebinned histograms." << endl;
196 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
197 hRatio[iNumer] = (TH1D*) hDenom -> Clone();
198 hRatio[iNumer] ->
Reset(
"ICE");
199 hRatio[iNumer] -> Divide(hNumer[iNumer], hDenom, 1., 1.);
200 hRatio[iNumer] ->
SetName(sNameRatio[iNumer]);
202 cout <<
" Calculated ratios." << endl;
205 const UInt_t fFil(0);
206 const UInt_t fLin(1);
207 const UInt_t fWid(1);
208 const UInt_t fTxt(42);
209 const UInt_t fAln(12);
210 const UInt_t fCnt(1);
211 const Float_t fLab[
NPad] = {0.074, 0.04};
212 const Float_t fTit[
NPad] = {0.074, 0.04};
213 const Float_t fOffX[
NPad] = {1.1, 1.};
214 const Float_t fOffY[
NPad] = {0.7, 1.3};
223 hDenom -> SetTitleFont(fTxt);
224 hDenom ->
GetXaxis() -> SetRangeUser(xPlotRange[0], xPlotRange[1]);
226 hDenom ->
GetXaxis() -> SetTitleFont(fTxt);
227 hDenom ->
GetXaxis() -> SetTitleSize(fTit[1]);
228 hDenom ->
GetXaxis() -> SetTitleOffset(fOffX[1]);
229 hDenom ->
GetXaxis() -> SetLabelFont(fTxt);
230 hDenom ->
GetXaxis() -> SetLabelSize(fLab[1]);
231 hDenom ->
GetXaxis() -> CenterTitle(fCnt);
233 hDenom ->
GetYaxis() -> SetTitleFont(fTxt);
234 hDenom ->
GetYaxis() -> SetTitleSize(fTit[1]);
235 hDenom ->
GetYaxis() -> SetTitleOffset(fOffY[1]);
236 hDenom ->
GetYaxis() -> SetLabelFont(fTxt);
237 hDenom ->
GetYaxis() -> SetLabelSize(fLab[1]);
238 hDenom ->
GetYaxis() -> CenterTitle(fCnt);
239 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
247 hNumer[iNumer] ->
SetTitle(sTitle.Data());
248 hNumer[iNumer] -> SetTitleFont(fTxt);
249 hNumer[iNumer] ->
GetXaxis() -> SetRangeUser(xPlotRange[0], xPlotRange[1]);
251 hNumer[iNumer] ->
GetXaxis() -> SetTitleFont(fTxt);
252 hNumer[iNumer] ->
GetXaxis() -> SetTitleSize(fTit[1]);
253 hNumer[iNumer] ->
GetXaxis() -> SetTitleOffset(fOffX[1]);
254 hNumer[iNumer] ->
GetXaxis() -> SetLabelFont(fTxt);
255 hNumer[iNumer] ->
GetXaxis() -> SetLabelSize(fLab[1]);
256 hNumer[iNumer] ->
GetXaxis() -> CenterTitle(fCnt);
258 hNumer[iNumer] ->
GetYaxis() -> SetTitleFont(fTxt);
259 hNumer[iNumer] ->
GetYaxis() -> SetTitleSize(fTit[1]);
260 hNumer[iNumer] ->
GetYaxis() -> SetTitleOffset(fOffY[1]);
261 hNumer[iNumer] ->
GetYaxis() -> SetLabelFont(fTxt);
262 hNumer[iNumer] ->
GetYaxis() -> SetLabelSize(fLab[1]);
263 hNumer[iNumer] ->
GetYaxis() -> CenterTitle(fCnt);
271 hRatio[iNumer] ->
SetTitle(sTitle.Data());
272 hRatio[iNumer] -> SetTitleFont(fTxt);
273 hRatio[iNumer] ->
GetXaxis() -> SetRangeUser(xPlotRange[0], xPlotRange[1]);
275 hRatio[iNumer] ->
GetXaxis() -> SetTitleFont(fTxt);
276 hRatio[iNumer] ->
GetXaxis() -> SetTitleSize(fTit[0]);
277 hRatio[iNumer] ->
GetXaxis() -> SetTitleOffset(fOffX[0]);
278 hRatio[iNumer] ->
GetXaxis() -> SetLabelFont(fTxt);
279 hRatio[iNumer] ->
GetXaxis() -> SetLabelSize(fLab[0]);
280 hRatio[iNumer] ->
GetXaxis() -> CenterTitle(fCnt);
282 hRatio[iNumer] ->
GetYaxis() -> SetTitleFont(fTxt);
283 hRatio[iNumer] ->
GetYaxis() -> SetTitleSize(fTit[0]);
284 hRatio[iNumer] ->
GetYaxis() -> SetTitleOffset(fOffY[0]);
285 hRatio[iNumer] ->
GetYaxis() -> SetLabelFont(fTxt);
286 hRatio[iNumer] ->
GetYaxis() -> SetLabelSize(fLab[0]);
287 hRatio[iNumer] ->
GetYaxis() -> CenterTitle(fCnt);
289 cout <<
" Set styles." << endl;
292 const UInt_t fColLe(0);
293 const UInt_t fFilLe(0);
294 const UInt_t fLinLe(0);
295 const Float_t fLegXY[
NVtx] = {0.1, 0.1, 0.3, 0.3};
296 TLegend *
leg =
new TLegend(fLegXY[0], fLegXY[1], fLegXY[2], fLegXY[3], sHeader.Data());
302 leg -> SetTextAlign(fAln);
303 leg ->
AddEntry(hDenom, sLabelDenom.Data(),
"pf");
304 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
305 leg ->
AddEntry(hNumer[iNumer], sLabelNumer[iNumer],
"pf");
307 cout <<
" Made legend." << endl;
310 const UInt_t fColTx(0);
311 const UInt_t fFilTx(0);
312 const UInt_t fLinTx(0);
313 const Float_t fTxtXY[
NVtx] = {0.3, 0.1, 0.5, 0.3};
314 TPaveText *txt =
new TPaveText(fTxtXY[0], fTxtXY[1], fTxtXY[2], fTxtXY[3],
"NDC NB");
320 txt -> SetTextAlign(fAln);
321 txt -> AddText(sSys.Data());
322 txt -> AddText(sTrg.Data());
323 txt -> AddText(sJet.Data());
324 txt -> AddText(sTyp.Data());
325 cout <<
" Made text." << endl;
328 const UInt_t fColLi(1);
329 const UInt_t fLinLi(9);
330 const UInt_t fWidLi(1);
331 const Float_t fLinXY[
NVtx] = {xPlotRange[0], 1., xPlotRange[1], 1.};
332 TLine *
line =
new TLine(fLinXY[0], fLinXY[1], fLinXY[2], fLinXY[3]);
336 cout <<
" Made line." << endl;
339 const UInt_t
width(750);
340 const UInt_t height(950);
341 const UInt_t heightNR(750);
342 const UInt_t fMode(0);
343 const UInt_t fBord(2);
344 const UInt_t fGrid(0);
345 const UInt_t fTick(1);
346 const UInt_t fLogX(1);
347 const UInt_t fLogY1(0);
348 const UInt_t fLogY2(1);
349 const UInt_t fLogYNR(1);
350 const UInt_t fFrame(0);
351 const Float_t fMarginL(0.15);
352 const Float_t fMarginR(0.02);
353 const Float_t fMarginT1(0.005);
354 const Float_t fMarginT2(0.02);
355 const Float_t fMarginTNR(0.02);
356 const Float_t fMarginB1(0.25);
357 const Float_t fMarginB2(0.005);
358 const Float_t fMarginBNR(0.15);
359 const Float_t fPadXY1[
NVtx] = {0., 0., 1., 0.35};
360 const Float_t fPadXY2[
NVtx] = {0., 0.35, 1., 1.};
362 TCanvas *cPlot =
new TCanvas(
"cPlot",
"", width, height);
363 TPad *pPad1 =
new TPad(
"pPad1",
"", fPadXY1[0], fPadXY1[1], fPadXY1[2], fPadXY1[3]);
364 TPad *pPad2 =
new TPad(
"pPad2",
"", fPadXY2[0], fPadXY2[1], fPadXY2[2], fPadXY2[3]);
365 cPlot -> SetGrid(fGrid, fGrid);
366 cPlot -> SetTicks(fTick, fTick);
369 pPad1 -> SetGrid(fGrid, fGrid);
370 pPad1 -> SetTicks(fTick, fTick);
371 pPad1 -> SetLogx(fLogX);
380 pPad2 -> SetGrid(fGrid, fGrid);
381 pPad2 -> SetTicks(fTick, fTick);
382 pPad2 -> SetLogx(fLogX);
395 hRatio[0] ->
Draw(sOptRatio[0].
Data());
396 for (UInt_t iNumer = 1; iNumer <
NNumer; iNumer++) {
397 hRatio[iNumer] ->
Draw(sOptRatio[iNumer].
Data());
401 hDenom ->
Draw(sOptDenom.Data());
402 for(UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
403 hNumer[iNumer] ->
Draw(sOptNumer[iNumer].
Data());
411 TCanvas *cPlotNR =
new TCanvas(
"cPlotNoRatio",
"", width, heightNR);
412 cPlotNR -> SetGrid(fGrid, fGrid);
413 cPlotNR -> SetTicks(fTick, fTick);
421 cPlotNR -> SetLogx(fLogX);
424 hDenom ->
Draw(sOptDenom.Data());
425 for(UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
426 hNumer[iNumer] ->
Draw(sOptNumer[iNumer].
Data());
433 cout <<
" Made plot." << endl;
438 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
439 hNumer[iNumer] ->
Write();
440 hRatio[iNumer] ->
Write();
442 cout <<
" Saved histograms." << endl;
449 for (UInt_t iNumer = 0; iNumer <
NNumer; iNumer++) {
450 fNumer[iNumer] ->
cd();
451 fNumer[iNumer] ->
Close();
453 cout <<
" Finished plot!\n" << endl;