File indexing completed on 2025-08-06 08:13:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <iostream>
0019
0020 #include "TH1.h"
0021 #include "TPad.h"
0022 #include "TFile.h"
0023 #include "TMath.h"
0024 #include "TLine.h"
0025 #include "TError.h"
0026 #include "TString.h"
0027 #include "TCanvas.h"
0028 #include "TLegend.h"
0029 #include "TPaveText.h"
0030
0031 using namespace std;
0032
0033
0034 static const UInt_t NModes(4);
0035 static const UInt_t NRange(2);
0036 static const UInt_t NComp(7);
0037 static const UInt_t NPlot(2);
0038 static const UInt_t NPad(2);
0039 static const UInt_t NVtx(4);
0040 static const UInt_t NTxt(3);
0041
0042
0043 static const UInt_t FSubMode(0);
0044 static const Bool_t DoRebin(false);
0045 static const Bool_t DoIntNorm(true);
0046 static const Bool_t DoFluctuationRemoval(true);
0047
0048
0049
0050 void DoPercentDifference() {
0051
0052
0053 gErrorIgnoreLevel = kWarning;
0054 cout << "\n Beginning percent difference script..." << endl;
0055
0056
0057 const TString sOut("tuningDetEffects.testingPerDiffVsDiff_perDiffOverComp_pt15.pp200py8jet40.d27m4y2023.root");
0058 const TString sRef("tuning_detector_effects/SphenixRecoUnscaledWithConstitHistos_output.root");
0059 const TString sHistRef("EEC0");
0060 const TString sNameRef("hRecoEEC_pt15");
0061 const TString sLabelRef("Reco.");
0062
0063
0064 const TString sComp[NComp] = {"tuning_detector_effects/SphenixTruthShift0Check_output.root",
0065 "tuning_detector_effects/SphenixTruthShift.001Check_output.root",
0066 "tuning_detector_effects/SphenixTruthShift.005Check_output.root",
0067 "tuning_detector_effects/SphenixTruthShift.01Check_output.root",
0068 "tuning_detector_effects/SphenixTruthShift.015Check_output.root",
0069 "tuning_detector_effects/SphenixTruthShift.02Check_output.root",
0070 "tuning_detector_effects/SphenixTruthShift.025Check_output.root"};
0071 const TString sHistComp[NComp] = {"EEC0",
0072 "EEC0",
0073 "EEC0",
0074 "EEC0",
0075 "EEC0",
0076 "EEC0",
0077 "EEC0"};
0078 const TString sNameComp[NComp] = {"hTrueEEC_pt15_noSmear",
0079 "hTrueEEC_pt15_smear001",
0080 "hTrueEEC_pt15_smear005",
0081 "hTrueEEC_pt15_smear01",
0082 "hTrueEEC_pt15_smear015",
0083 "hTrueEEC_pt15_smear02",
0084 "hTrueEEC_pt15_smear025"};
0085 const TString sNameSub[NComp] = {"hSub_pt15_noSmear",
0086 "hSub_pt15_smear001",
0087 "hSub_pt15_smear005",
0088 "hSub_pt15_smear01",
0089 "hSub_pt15_smear015",
0090 "hSub_pt15_smear02",
0091 "hSub_pt15_smear025"};
0092 const TString sLabelComp[NComp] = {"Truth (no smearing)",
0093 "Truth (smear width = 0.001)",
0094 "Truth (smear width = 0.005)",
0095 "Truth (smear width = 0.01)",
0096 "Truth (smear width = 0.015)",
0097 "Truth (smear width = 0.02)",
0098 "Truth (smear width = 0.025)"};
0099
0100
0101 const UInt_t nRebin(2);
0102 const Float_t rMainPeak[NRange] = {0.001, 1.};
0103 const TString sTitleSubs[NModes] = {"\%-difference", "\%-diff. of logs", "difference", "diff. of logs"};
0104
0105
0106 const TString sOptRef("");
0107 const TString sOptComp[NComp] = {"SAME", "SAME", "SAME", "SAME", "SAME", "SAME", "SAME"};
0108 const TString sOptSub[NComp] = {"HIST P", "SAME HIST P", "SAME HIST P", "SAME HIST P", "SAME HIST P", "SAME HIST P", "SAME HIST p"};
0109 const Float_t xPlotRange[NPlot] = {0.0001, 1.};
0110
0111
0112 const TString sTitle("");
0113 const TString sTitleX("#DeltaR");
0114 const TString sTitleY("Normalized EEC");
0115 const UInt_t fColDen(923);
0116 const UInt_t fMarDen(20);
0117 const UInt_t fColNum[NComp] = {921, 799, 819, 839, 859, 879, 899};
0118 const UInt_t fMarNum[NComp] = {24, 26, 32, 25, 27, 28, 30};
0119
0120
0121 const TString sHeader("");
0122 const TString sTxt[NTxt] = {"#bf{#it{sPHENIX}} Simulation [Run6]", "PYTHIA-8, JS 40 GeV jet sample", "#bf{p_{T}^{jet} #in (15, 20) GeV/c}"};
0123
0124
0125 TFile *fOut = new TFile(sOut.Data(), "recreate");
0126 TFile *fRef = new TFile(sRef.Data(), "read");
0127 if (!fOut || !fRef) {
0128 cerr << "PANIC: couldn't open output or reference file!\n"
0129 << " fOut = " << fOut << ", fRef = " << fRef
0130 << endl;
0131 return;
0132 }
0133 cout << " Opened output and reference files." << endl;
0134
0135
0136 TFile *fComp[NComp];
0137 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0138 fComp[iComp] = new TFile(sComp[iComp].Data(), "read");
0139 if (!fComp[iComp]) {
0140 cerr << "PANIC: couldn't open comparison file #" << iComp << "!" << endl;
0141 return;
0142 }
0143 }
0144 cout << " Opened comparison files." << endl;
0145
0146
0147 TH1D *hRef = (TH1D*) fRef -> Get(sHistRef.Data());
0148 if (!hRef) {
0149 cerr << "PANIC: couldn't grab reference histogram!" << endl;
0150 return;
0151 }
0152 hRef -> SetName(sNameRef.Data());
0153 cout << " Grabbed reference histogram." << endl;
0154
0155
0156 TH1D *hComp[NComp];
0157 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0158 hComp[iComp] = (TH1D*) fComp[iComp] -> Get(sHistComp[iComp]);
0159 if (!hComp[iComp]) {
0160 cerr << "PANIC: couldn't grab comparison histogram #" << iComp << "!" << endl;
0161 return;
0162 }
0163 hComp[iComp] -> SetName(sNameComp[iComp].Data());
0164 }
0165 cout << " Grabbed comparison histograms." << endl;
0166
0167
0168 if (DoRebin) {
0169 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0170 hComp[iComp] -> Rebin(nRebin);
0171 }
0172 hRef -> Rebin(nRebin);
0173 cout << " Rebinned histograms." << endl;
0174 }
0175
0176
0177 if (DoIntNorm) {
0178
0179
0180 if (DoFluctuationRemoval) {
0181
0182
0183 {
0184
0185
0186 const UInt_t nBins = hRef -> GetNbinsX();
0187
0188
0189 Double_t yMainPeak = 0.;
0190 for (UInt_t iBin = 1; iBin < (nBins + 1); iBin++) {
0191
0192
0193 const Double_t xBinCenter = hRef -> GetBinCenter(iBin);
0194 const Bool_t isInMainPeakRange = ((xBinCenter >= rMainPeak[0]) && (xBinCenter < rMainPeak[1]));
0195 if (!isInMainPeakRange) continue;
0196
0197
0198 const Double_t yBin = hRef -> GetBinContent(iBin);
0199 if (yBin > yMainPeak) {
0200 yMainPeak = yBin;
0201 }
0202 }
0203
0204
0205 for (UInt_t iBin = 1; iBin < (nBins + 1); iBin++) {
0206
0207
0208 const Double_t xBinCenter = hRef -> GetBinCenter(iBin);
0209 const Bool_t isBelowMainPeak = (xBinCenter < rMainPeak[0]);
0210 if (!isBelowMainPeak) continue;
0211
0212
0213 const Double_t yBin = hRef -> GetBinContent(iBin);
0214 if (yBin >= yMainPeak) {
0215 hRef -> SetBinContent(iBin, 0.);
0216 hRef -> SetBinError(iBin, 0.);
0217 }
0218 }
0219 }
0220 cout << " Removed fluctuations for reference histogram." << endl;
0221
0222
0223 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0224
0225
0226 const UInt_t nBins = hRef -> GetNbinsX();
0227
0228
0229 Double_t yMainPeak = 0.;
0230 for (UInt_t iBin = 1; iBin < (nBins + 1); iBin++) {
0231
0232
0233 const Double_t xBinCenter = hComp[iComp] -> GetBinCenter(iBin);
0234 const Bool_t isInMainPeakRange = ((xBinCenter >= rMainPeak[0]) && (xBinCenter < rMainPeak[1]));
0235 if (!isInMainPeakRange) continue;
0236
0237
0238 const Double_t yBin = hComp[iComp] -> GetBinContent(iBin);
0239 if (yBin > yMainPeak) {
0240 yMainPeak = yBin;
0241 }
0242 }
0243
0244
0245 for (UInt_t iBin = 1; iBin < (nBins + 1); iBin++) {
0246
0247
0248 const Double_t xBinCenter = hComp[iComp] -> GetBinCenter(iBin);
0249 const Bool_t isBelowMainPeak = (xBinCenter < rMainPeak[0]);
0250 if (!isBelowMainPeak) continue;
0251
0252
0253 const Double_t yBin = hComp[iComp] -> GetBinContent(iBin);
0254 if (yBin >= yMainPeak) {
0255 hComp[iComp] -> SetBinContent(iBin, 0.);
0256 hComp[iComp] -> SetBinError(iBin, 0.);
0257 }
0258 }
0259 }
0260 cout << " Removed fluctuations for comparison histograms." << endl;
0261 }
0262
0263 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0264 const Double_t intComp = hComp[iComp] -> Integral();
0265 if (intComp > 0.) hComp[iComp] -> Scale(1. / intComp);
0266 }
0267
0268 const Double_t intRef = hRef -> Integral();
0269 if (intRef > 0.) hRef -> Scale(1. / intRef);
0270 cout << " Normalized histograms." << endl;
0271 }
0272
0273
0274 TH1D *hSub[NComp];
0275 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0276
0277
0278 hSub[iComp] = (TH1D*) hRef -> Clone();
0279 hSub[iComp] -> Reset("ICE");
0280 hSub[iComp] -> SetName(sNameSub[iComp]);
0281
0282
0283 const UInt_t nBins = hSub[iComp] -> GetNbinsX();
0284 for (UInt_t iBin = 1; iBin < (nBins + 1); iBin++) {
0285
0286
0287 const Double_t yRef = hRef -> GetBinContent(iBin);
0288 const Double_t yComp = hComp[iComp] -> GetBinContent(iBin);
0289 const Double_t eRef = hRef -> GetBinError(iBin);
0290 const Double_t eComp = hComp[iComp] -> GetBinError(iBin);
0291
0292
0293 Double_t ySub(-1.);
0294 Double_t eSub(0.);
0295 switch (FSubMode) {
0296 case 0:
0297 ySub = (yRef - yComp) / yComp;
0298 eSub = 0;
0299 break;
0300 case 1:
0301 ySub = (TMath::Log(yRef) - TMath::Log(yComp)) / TMath::Log(yRef);
0302 eSub = 0;
0303 break;
0304 case 2:
0305 ySub = yRef - yComp;
0306 eSub = 0;
0307 break;
0308 case 3:
0309 ySub = TMath::Log(yRef) - TMath::Log(yComp);
0310 eSub = 0;
0311 break;
0312 default:
0313 ySub = (yRef - yComp) / yRef;
0314 eSub = 0;
0315 break;
0316 }
0317
0318
0319 if (yRef > 0.) {
0320 hSub[iComp] -> SetBinContent(iBin, ySub);
0321 hSub[iComp] -> SetBinError(iBin, eSub);
0322 } else {
0323 hSub[iComp] -> SetBinContent(iBin, 0.);
0324 hSub[iComp] -> SetBinError(iBin, 0.);
0325 }
0326 }
0327 }
0328 cout << " Calculated ratios." << endl;
0329
0330
0331 TString sTitleS("");
0332 switch (FSubMode) {
0333 case 0:
0334 sTitleS = sTitleSubs[0];
0335 break;
0336 case 1:
0337 sTitleS = sTitleSubs[1];
0338 break;
0339 case 2:
0340 sTitleS = sTitleSubs[2];
0341 break;
0342 case 3:
0343 sTitleS = sTitleSubs[3];
0344 break;
0345 default:
0346 sTitleS = sTitleSubs[0];
0347 break;
0348 }
0349
0350
0351 const UInt_t fFil(0);
0352 const UInt_t fLin(1);
0353 const UInt_t fWid(1);
0354 const UInt_t fTxt(42);
0355 const UInt_t fAln(12);
0356 const UInt_t fCnt(1);
0357 const Float_t fLab[NPad] = {0.074, 0.04};
0358 const Float_t fTit[NPad] = {0.074, 0.04};
0359 const Float_t fOffX[NPad] = {1.1, 1.};
0360 const Float_t fOffY[NPad] = {0.7, 1.3};
0361 hRef -> SetMarkerColor(fColDen);
0362 hRef -> SetMarkerStyle(fMarDen);
0363 hRef -> SetFillColor(fColDen);
0364 hRef -> SetFillStyle(fFil);
0365 hRef -> SetLineColor(fColDen);
0366 hRef -> SetLineStyle(fLin);
0367 hRef -> SetLineWidth(fWid);
0368 hRef -> SetTitle(sTitle.Data());
0369 hRef -> SetTitleFont(fTxt);
0370 hRef -> GetXaxis() -> SetRangeUser(xPlotRange[0], xPlotRange[1]);
0371 hRef -> GetXaxis() -> SetTitle(sTitleX.Data());
0372 hRef -> GetXaxis() -> SetTitleFont(fTxt);
0373 hRef -> GetXaxis() -> SetTitleSize(fTit[1]);
0374 hRef -> GetXaxis() -> SetTitleOffset(fOffX[1]);
0375 hRef -> GetXaxis() -> SetLabelFont(fTxt);
0376 hRef -> GetXaxis() -> SetLabelSize(fLab[1]);
0377 hRef -> GetXaxis() -> CenterTitle(fCnt);
0378 hRef -> GetYaxis() -> SetTitle(sTitleY.Data());
0379 hRef -> GetYaxis() -> SetTitleFont(fTxt);
0380 hRef -> GetYaxis() -> SetTitleSize(fTit[1]);
0381 hRef -> GetYaxis() -> SetTitleOffset(fOffY[1]);
0382 hRef -> GetYaxis() -> SetLabelFont(fTxt);
0383 hRef -> GetYaxis() -> SetLabelSize(fLab[1]);
0384 hRef -> GetYaxis() -> CenterTitle(fCnt);
0385 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0386 hComp[iComp] -> SetMarkerColor(fColNum[iComp]);
0387 hComp[iComp] -> SetMarkerStyle(fMarNum[iComp]);
0388 hComp[iComp] -> SetFillColor(fColNum[iComp]);
0389 hComp[iComp] -> SetFillStyle(fFil);
0390 hComp[iComp] -> SetLineColor(fColNum[iComp]);
0391 hComp[iComp] -> SetLineStyle(fLin);
0392 hComp[iComp] -> SetLineWidth(fWid);
0393 hComp[iComp] -> SetTitle(sTitle.Data());
0394 hComp[iComp] -> SetTitleFont(fTxt);
0395 hComp[iComp] -> GetXaxis() -> SetRangeUser(xPlotRange[0], xPlotRange[1]);
0396 hComp[iComp] -> GetXaxis() -> SetTitle(sTitleX.Data());
0397 hComp[iComp] -> GetXaxis() -> SetTitleFont(fTxt);
0398 hComp[iComp] -> GetXaxis() -> SetTitleSize(fTit[1]);
0399 hComp[iComp] -> GetXaxis() -> SetTitleOffset(fOffX[1]);
0400 hComp[iComp] -> GetXaxis() -> SetLabelFont(fTxt);
0401 hComp[iComp] -> GetXaxis() -> SetLabelSize(fLab[1]);
0402 hComp[iComp] -> GetXaxis() -> CenterTitle(fCnt);
0403 hComp[iComp] -> GetYaxis() -> SetTitle(sTitleY.Data());
0404 hComp[iComp] -> GetYaxis() -> SetTitleFont(fTxt);
0405 hComp[iComp] -> GetYaxis() -> SetTitleSize(fTit[1]);
0406 hComp[iComp] -> GetYaxis() -> SetTitleOffset(fOffY[1]);
0407 hComp[iComp] -> GetYaxis() -> SetLabelFont(fTxt);
0408 hComp[iComp] -> GetYaxis() -> SetLabelSize(fLab[1]);
0409 hComp[iComp] -> GetYaxis() -> CenterTitle(fCnt);
0410 hSub[iComp] -> SetMarkerColor(fColNum[iComp]);
0411 hSub[iComp] -> SetMarkerStyle(fMarNum[iComp]);
0412 hSub[iComp] -> SetFillColor(fColNum[iComp]);
0413 hSub[iComp] -> SetFillStyle(fFil);
0414 hSub[iComp] -> SetLineColor(fColNum[iComp]);
0415 hSub[iComp] -> SetLineStyle(fLin);
0416 hSub[iComp] -> SetLineWidth(fWid);
0417 hSub[iComp] -> SetTitle(sTitle.Data());
0418 hSub[iComp] -> SetTitleFont(fTxt);
0419 hSub[iComp] -> GetXaxis() -> SetRangeUser(xPlotRange[0], xPlotRange[1]);
0420 hSub[iComp] -> GetXaxis() -> SetTitle(sTitleX.Data());
0421 hSub[iComp] -> GetXaxis() -> SetTitleFont(fTxt);
0422 hSub[iComp] -> GetXaxis() -> SetTitleSize(fTit[0]);
0423 hSub[iComp] -> GetXaxis() -> SetTitleOffset(fOffX[0]);
0424 hSub[iComp] -> GetXaxis() -> SetLabelFont(fTxt);
0425 hSub[iComp] -> GetXaxis() -> SetLabelSize(fLab[0]);
0426 hSub[iComp] -> GetXaxis() -> CenterTitle(fCnt);
0427 hSub[iComp] -> GetYaxis() -> SetTitle(sTitleS.Data());
0428 hSub[iComp] -> GetYaxis() -> SetTitleFont(fTxt);
0429 hSub[iComp] -> GetYaxis() -> SetTitleSize(fTit[0]);
0430 hSub[iComp] -> GetYaxis() -> SetTitleOffset(fOffY[0]);
0431 hSub[iComp] -> GetYaxis() -> SetLabelFont(fTxt);
0432 hSub[iComp] -> GetYaxis() -> SetLabelSize(fLab[0]);
0433 hSub[iComp] -> GetYaxis() -> CenterTitle(fCnt);
0434 }
0435 cout << " Set styles." << endl;
0436
0437
0438 const UInt_t fColLe = 0;
0439 const UInt_t fFilLe = 0;
0440 const UInt_t fLinLe = 0;
0441 const Float_t yObjLe = 0.1 + ((NComp + 1) * 0.05);
0442 const Float_t fLegXY[NVtx] = {0.1, 0.1, 0.3, yObjLe};
0443
0444 TLegend *leg = new TLegend(fLegXY[0], fLegXY[1], fLegXY[2], fLegXY[3], sHeader.Data());
0445 leg -> SetFillColor(fColLe);
0446 leg -> SetFillStyle(fFilLe);
0447 leg -> SetLineColor(fColLe);
0448 leg -> SetLineStyle(fLinLe);
0449 leg -> SetTextFont(fTxt);
0450 leg -> SetTextAlign(fAln);
0451 leg -> AddEntry(hRef, sLabelRef.Data(), "pf");
0452 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0453 leg -> AddEntry(hComp[iComp], sLabelComp[iComp], "pf");
0454 }
0455 cout << " Made legend." << endl;
0456
0457
0458 const UInt_t fColTx = 0;
0459 const UInt_t fFilTx = 0;
0460 const UInt_t fLinTx = 0;
0461 const Float_t yObjTx = 0.1 + (NTxt * 0.05);
0462 const Float_t fTxtXY[NVtx] = {0.3, 0.1, 0.5, yObjTx};
0463
0464 TPaveText *txt = new TPaveText(fTxtXY[0], fTxtXY[1], fTxtXY[2], fTxtXY[3], "NDC NB");
0465 txt -> SetFillColor(fColTx);
0466 txt -> SetFillStyle(fFilTx);
0467 txt -> SetLineColor(fColTx);
0468 txt -> SetLineStyle(fLinTx);
0469 txt -> SetTextFont(fTxt);
0470 txt -> SetTextAlign(fAln);
0471 for (UInt_t iTxt = 0; iTxt < NTxt; iTxt++) {
0472 txt -> AddText(sTxt[iTxt].Data());
0473 }
0474 cout << " Made text." << endl;
0475
0476
0477 const UInt_t fColLi(1);
0478 const UInt_t fLinLi(9);
0479 const UInt_t fWidLi(1);
0480 const Float_t fLinXY[NVtx] = {xPlotRange[0], 0., xPlotRange[1], 0.};
0481
0482 TLine *line = new TLine(fLinXY[0], fLinXY[1], fLinXY[2], fLinXY[3]);
0483 line -> SetLineColor(fColLi);
0484 line -> SetLineStyle(fLinLi);
0485 line -> SetLineWidth(fWidLi);
0486 cout << " Made line." << endl;
0487
0488
0489 const UInt_t width(750);
0490 const UInt_t height(950);
0491 const UInt_t fMode(0);
0492 const UInt_t fBord(2);
0493 const UInt_t fGrid(0);
0494 const UInt_t fTick(1);
0495 const UInt_t fLogX(1);
0496 const UInt_t fLogY1(0);
0497 const UInt_t fLogY2(1);
0498 const UInt_t fFrame(0);
0499 const Float_t fMarginL(0.15);
0500 const Float_t fMarginR(0.02);
0501 const Float_t fMarginT1(0.005);
0502 const Float_t fMarginT2(0.02);
0503 const Float_t fMarginTNR(0.02);
0504 const Float_t fMarginB1(0.25);
0505 const Float_t fMarginB2(0.005);
0506 const Float_t fMarginBNR(0.15);
0507 const Float_t fPadXY1[NVtx] = {0., 0., 1., 0.35};
0508 const Float_t fPadXY2[NVtx] = {0., 0.35, 1., 1.};
0509
0510 TCanvas *cPlot = new TCanvas("cPlot", "", width, height);
0511 TPad *pPad1 = new TPad("pPad1", "", fPadXY1[0], fPadXY1[1], fPadXY1[2], fPadXY1[3]);
0512 TPad *pPad2 = new TPad("pPad2", "", fPadXY2[0], fPadXY2[1], fPadXY2[2], fPadXY2[3]);
0513 cPlot -> SetGrid(fGrid, fGrid);
0514 cPlot -> SetTicks(fTick, fTick);
0515 cPlot -> SetBorderMode(fMode);
0516 cPlot -> SetBorderSize(fBord);
0517 pPad1 -> SetGrid(fGrid, fGrid);
0518 pPad1 -> SetTicks(fTick, fTick);
0519 pPad1 -> SetLogx(fLogX);
0520 pPad1 -> SetLogy(fLogY1);
0521 pPad1 -> SetBorderMode(fMode);
0522 pPad1 -> SetBorderSize(fBord);
0523 pPad1 -> SetFrameBorderMode(fFrame);
0524 pPad1 -> SetLeftMargin(fMarginL);
0525 pPad1 -> SetRightMargin(fMarginR);
0526 pPad1 -> SetTopMargin(fMarginT1);
0527 pPad1 -> SetBottomMargin(fMarginB1);
0528 pPad2 -> SetGrid(fGrid, fGrid);
0529 pPad2 -> SetTicks(fTick, fTick);
0530 pPad2 -> SetLogx(fLogX);
0531 pPad2 -> SetLogy(fLogY2);
0532 pPad2 -> SetBorderMode(fMode);
0533 pPad2 -> SetBorderSize(fBord);
0534 pPad2 -> SetFrameBorderMode(fFrame);
0535 pPad2 -> SetLeftMargin(fMarginL);
0536 pPad2 -> SetRightMargin(fMarginR);
0537 pPad2 -> SetTopMargin(fMarginT2);
0538 pPad2 -> SetBottomMargin(fMarginB2);
0539 cPlot -> cd();
0540 pPad1 -> Draw();
0541 pPad2 -> Draw();
0542 pPad1 -> cd();
0543 hSub[0] -> Draw(sOptSub[0].Data());
0544 for (UInt_t iComp = 1; iComp < NComp; iComp++) {
0545 hSub[iComp] -> Draw(sOptSub[iComp].Data());
0546 }
0547 line -> Draw();
0548 pPad2 -> cd();
0549 hRef -> Draw(sOptRef.Data());
0550 for(UInt_t iComp = 0; iComp < NComp; iComp++) {
0551 hComp[iComp] -> Draw(sOptComp[iComp].Data());
0552 }
0553 leg -> Draw();
0554 txt -> Draw();
0555 fOut -> cd();
0556 cPlot -> Write();
0557 cPlot -> Close();
0558 cout << " Made plot." << endl;
0559
0560
0561 fOut -> cd();
0562 hRef -> Write();
0563 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0564 hComp[iComp] -> Write();
0565 hSub[iComp] -> Write();
0566 }
0567 cout << " Saved histograms." << endl;
0568
0569
0570 fOut -> cd();
0571 fOut -> Close();
0572 fRef -> cd();
0573 fRef -> Close();
0574 for (UInt_t iComp = 0; iComp < NComp; iComp++) {
0575 fComp[iComp] -> cd();
0576 fComp[iComp] -> Close();
0577 }
0578 cout << " Finished plot!\n" << endl;
0579
0580 }
0581
0582