Problems with closing root

I am having an issue when I am attempting to close the root browser with the .q command. Here is a snap shot of my terminal output:

bash-3.2$ root -l -b -q UnfoldpAJetsData.C\(\"072814\",\"lhc13\",\"semigood\",\"2\"\,1,0,2,-50,200,0,250,15,90,10,150,1,2,0,0,0,0,0\)

 *******************************************
 *                                         *
 *        W E L C O M E  to  R O O T       *
 *                                         *
 *******************************************

 Version 5.34/25

root [0] 
Processing UnfoldpAJetsData.C("072814","lhc13","semigood","2",1,0,2,-50,200,0,250,15,90,10,150,1,2,0,0,0,0,0)...
Warning in <TFile::Append>: Replacing existing TH1: fhMCTruthWide (Potential memory leak).
Warning in <TFile::Append>: Replacing existing TH1: fhPrior_Input (Potential memory leak).
Warning in <TFile::Append>: Replacing existing TH1: fhPrior_Input_Truncated (Potential memory leak).
Warning in <TFile::Append>: Replacing existing TH1: fhBSPtSignal2CMSScale_Truncated (Potential memory leak).
Warning in <TFile::Append>: Replacing existing TH1: hJetFindingEff2_Truncated (Potential memory leak).

 *** Break *** segmentation violation
 Generating stack trace...
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001010163bb in _ZN12_GLOBAL__N_132TerminalConfigUnix__handleSignalEi + 0x1b from /Users/cgy606/alicesw/root/v5-34-25/lib/libCore.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00007fff92f2bf1a in _sigtramp + 0x1a from /usr/lib/system/libsystem_platform.dylib
 0x0000000100463000 in <unknown function>
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001038ef8f4 in _ZN7TCanvas5CloseEPKc + 0x204 from /Users/cgy606/alicesw/root/v5-34-25/lib/libGpad.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001038eefe2 in _ZN7TCanvas10DestructorEv + 0x112 from /Users/cgy606/alicesw/root/v5-34-25/lib/libGpad.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001038eedbc in _ZN7TCanvasD2Ev + 0x5c from /Users/cgy606/alicesw/root/v5-34-25/lib/libGpad.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001038ef045 in _ZN7TCanvasD1Ev + 0x15 from /Users/cgy606/alicesw/root/v5-34-25/lib/libGpad.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001038ef158 in _ZN7TCanvasD0Ev + 0x18 from /Users/cgy606/alicesw/root/v5-34-25/lib/libGpad.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x0000000100fcdc8b in _ZN11TCollection14GarbageCollectEP7TObject + 0x15b from /Users/cgy606/alicesw/root/v5-34-25/lib/libCore.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x0000000100fd467f in _ZN5TList6DeleteEPKc + 0x86f from /Users/cgy606/alicesw/root/v5-34-25/lib/libCore.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x0000000101146d1c in _ZN5TROOT20EndOfProcessCleanupsEb + 0xcc from /Users/cgy606/alicesw/root/v5-34-25/lib/libCore.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001010b85ae in _ZN11TUnixSystem4ExitEib + 0x3e from /Users/cgy606/alicesw/root/v5-34-25/lib/libCore.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00000001010dd1a9 in _ZN12TApplication9TerminateEi + 0xc9 from /Users/cgy606/alicesw/root/v5-34-25/lib/libCore.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x0000000100a1603a in _ZN5TRint9TerminateEi + 0x19a from /Users/cgy606/alicesw/root/v5-34-25/lib/libRint.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x0000000100a15233 in _ZN5TRint3RunEb + 0xa23 from /Users/cgy606/alicesw/root/v5-34-25/lib/libRint.5.so
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x000000010045ea87 in main + 0x87 from /Users/cgy606/alicesw/root/v5-34-25/bin/root.exe
[invalid usage]: unrecognized option '-d'
Usage: atos [-p pid] [-o executable] [-f file] [-s slide | -l loadAddress] [-arch architecture] [-printHeader] [address ...]
 0x00007fff97bdd5c9 in start + 0x1 from /usr/lib/system/libdyld.dylib
[AliEnv] bash-3.2$ 

I did not face these issues in v5-34-09. I am using MAC OS Yosemite in the latest release 10.10.2. I believe there are some issues with libraries and am not sure how to address them…

Chris Yaldo

We need a macro reproducing the problem.

Hi,

The macro I use is actually much larger then what I am attaching below, but this code reproduces the same errors:

void myTest()
{
    // Load Files
    // R = r1, Period 1
    TString tF1_2 = "";
    TString tF10_2 = "";
    
    tF1_2 = "/Users/cgy606/Documents/Train/LEGOTrain/Unfolding/Results/lhc13_semigood_UnfoldingPlots_jS0_R2_-50_200_0_250_10_90_10_150_pri1_dPt2_ue0_sF0_hC0_tE0_cE0.root"; // Baseline, Regularization Strength, and Unfolding algorithm systematics (i.e. f0,f1,f2)
    tF10_2 = "/Users/cgy606/Documents/Train/LEGOTrain/Unfolding/Results/lhc13_semigood_UnfoldingPlots_jS0_R2_-50_200_0_250_15_90_10_150_pri1_dPt2_ue0_sF0_hC0_tE1_cE0.root"; // Tracking Efficiency systematic

    
    TFile *f1_2 = new TFile(tF1_2,"READ");
    TFile *f10_2 = new TFile(tF10_2,"READ");
    
    TList *l1_2 = (TList*) f1_2->Get("HistogramPlots");
    TList *l10_2 = (TList*) f10_2->Get("HistogramPlots");
    
    // Format: "h$Observable_$period$radius_systematic
    TString histname = "fhBayesReco3";
    TH1D *hXSec_2_Base = (TH1D*) l1_2->FindObject(histname);
    hXSec_2_Base->SetName("hXSec_2_Base");

    TH1D *hXSec_2_TrackEff = (TH1D*) l10_2->FindObject(histname);
    hXSec_2_TrackEff->SetName("hXSec_2_TrackEff");

    // Histogram formatting
    Double_t xLow = 20.0;
    Double_t xUp = 120.0;
    Double_t yLow = 1E-08;
    Double_t yUp = 1E-02;
    
    TString yUnits = "d^{2}#sigma/dp_{T}d#eta";
    // Jet Cross-section
    // R = 0.2
    FormatHistogram(*hXSec_2_Base,0,xLow,xUp,yLow,yUp,yUnits); // Baseline
    FormatHistogram(*hXSec_2_TrackEff,0,xLow,xUp,yLow,yUp,yUnits); // Baseline

    // Canvas Formatting
    // Jet Cross-section
    TCanvas *cXSec_2_TrackEff = new TCanvas();

    Double_t yTitle = 2E-03;
    TString savePath = "/Users/cgy606/Documents/Train/LEGOTrain/Unfolding/";
    
    // R = 0.2
    Plot1VariationCross("cXSec_2_TrackEff","X-Section for different Tracking Efficiencies","XSec_TrackEff",*cXSec_2_TrackEff,hXSec_2_Base,hXSec_2_TrackEff,"TrackEff = 100% (Default)","TrackEff = 95%",savePath,30,yTitle,"lhc13","2"); // Tracking Efficiency

}

void FormatHistogram(TH1D& histo, Int_t opt, Double_t xLow, Double_t xUp, Double_t yLow, Double_t yUp, TString yTitle)
{
    Int_t xBinLow = histo.GetXaxis()->FindBin(xLow);
    Int_t xBinUp = histo.GetXaxis()->FindBin(xUp-1.0);
    
    histo.SetStats(kFALSE);
    histo.SetTitle("");
    if (opt == 0)
    {
        histo.SetLineColor(kBlue);
        histo.SetMarkerColor(kBlue);
        histo.SetMarkerStyle(20);
    }
    else if (opt ==1)
    {
        histo.SetLineColor(kRed);
        histo.SetMarkerColor(kRed);
        histo.SetMarkerStyle(25);
    }
    else
    {
        histo.SetLineColor(kBlack);
        histo.SetMarkerColor(kBlack);
        histo.SetMarkerStyle(3);
    }
    
    histo.GetXaxis()->SetRange(xBinLow,xBinUp);
    histo.GetXaxis()->SetTitleOffset(1.2);
    histo.GetXaxis()->SetTitle("#it{p}_{T,jet}^{ch+em} (GeV/#it{c})");
    histo.GetYaxis()->SetRangeUser(yLow,yUp);
    histo.GetYaxis()->SetTitleOffset(1.2);
    histo.GetYaxis()->SetTitle(yTitle);
}

void Plot1VariationCross(TString name, TString title, TString plotName, TCanvas& cPlot,TH1D* histBase, TH1D* histVar1, TString histBase_Title, TString histVar1_Title, TString fPath, Double_t xTitle, Double_t yTitle, TString period, TString jetR)
{
    cPlot = new TCanvas(name,"",0,0,1200,800);
    cPlot.SetLogy(kTRUE);
    cPlot.SetTicks(1,1);
    
    TLegend *lPlot = new TLegend(0.12,0.12,0.37,0.37);
    lPlot->SetFillColor(0);
    lPlot->SetBorderSize(0);
    lPlot->SetTextSize(0.04);
    
    histBase->Draw();
    histVar1->Draw("same");
    
    TLatex *tPlot_Title = new TLatex(xTitle,yTitle,title);
    tPlot_Title->SetTextFont(gStyle->GetTextFont());
    tPlot_Title->SetTextSize(gStyle->GetTextSize());
    tPlot_Title->Draw();
    
    lPlot->AddEntry(histBase,histBase_Title,"p");
    lPlot->AddEntry(histVar1,histVar1_Title,"p");
    lPlot->Draw();
    
    TString tRTitle = "anti-k_{T} R = 0." + jetR;
    TLatex *tPlot_RTitle = new TLatex(80,1E-06,tRTitle);
    tPlot_RTitle->SetTextFont(gStyle->GetTextFont());
    tPlot_RTitle->SetTextSize(gStyle->GetTextSize());
    tPlot_RTitle->Draw();
    
    TString cPlot_Path = fPath + period + "_R" + jetR + "_" + plotName + ".png";
    cPlot.SaveAs(cPlot_Path);
}

This macro cannot be run. It access files we do not have.
Please make a standalone one.

Sorry for that. I have changed the macro to be standalone. Still the same errors:

void myTest()
{
    // Manually input histograms
    TH1D *hXSec_2_Base = new TH1D("hXSec_2_Base","",14,10,150);
    hXSec_2_Base->SetBinContent(1,0.0150096);
    hXSec_2_Base->SetBinError(1,0.000302078);
    hXSec_2_Base->SetBinContent(2,0.00119452);
    hXSec_2_Base->SetBinError(2,3.28637e-05);
    hXSec_2_Base->SetBinContent(3,0.00030347);
    hXSec_2_Base->SetBinError(3,9.19787e-06);
    hXSec_2_Base->SetBinContent(4,0.00010144);
    hXSec_2_Base->SetBinError(4,3.54978e-06);
    hXSec_2_Base->SetBinContent(5,3.99859e-05);
    hXSec_2_Base->SetBinError(5,1.64532e-06);
    hXSec_2_Base->SetBinContent(6,1.85655e-05);
    hXSec_2_Base->SetBinError(6,9.68297e-07);
    hXSec_2_Base->SetBinContent(7,9.44225e-06);
    hXSec_2_Base->SetBinError(7,6.11403e-07);
    hXSec_2_Base->SetBinContent(8,5.0142e-06);
    hXSec_2_Base->SetBinError(8,3.90394e-07);
    hXSec_2_Base->SetBinContent(9,2.86627e-06);
    hXSec_2_Base->SetBinError(9,2.80637e-07);
    hXSec_2_Base->SetBinContent(10,1.72214e-06);
    hXSec_2_Base->SetBinError(10,1.97945e-07);
    hXSec_2_Base->SetBinContent(11,1.08546e-06);
    hXSec_2_Base->SetBinError(11,1.37822e-07);
    hXSec_2_Base->SetBinContent(12,7.09017e-07);
    hXSec_2_Base->SetBinError(12,8.99664e-08);
    hXSec_2_Base->SetBinContent(13,4.78023e-07);
    hXSec_2_Base->SetBinError(13,6.51604e-08);
    hXSec_2_Base->SetBinContent(14,3.35842e-07);
    hXSec_2_Base->SetBinError(14,4.81834e-08);
    
    TH1D *hXSec_2_TrackEff = new TH1D("hXSec_2_TrackEff","",14,10,150);
    hXSec_2_TrackEff->SetBinContent(1,0.0141095);
    hXSec_2_TrackEff->SetBinError(1,0.000305863);
    hXSec_2_TrackEff->SetBinContent(2,0.0013615);
    hXSec_2_TrackEff->SetBinError(2,3.70887e-05);
    hXSec_2_TrackEff->SetBinContent(3,0.000334459);
    hXSec_2_TrackEff->SetBinError(3,9.9466e-06);
    hXSec_2_TrackEff->SetBinContent(4,0.000109922);
    hXSec_2_TrackEff->SetBinError(4,3.71045e-06);
    hXSec_2_TrackEff->SetBinContent(5,4.32548e-05);
    hXSec_2_TrackEff->SetBinError(5,1.71187e-06);
    hXSec_2_TrackEff->SetBinContent(6,1.9919e-05);
    hXSec_2_TrackEff->SetBinError(6,1.00098e-06);
    hXSec_2_TrackEff->SetBinContent(7,1.01787e-05);
    hXSec_2_TrackEff->SetBinError(7,6.27389e-07);
    hXSec_2_TrackEff->SetBinContent(8,5.3449e-06);
    hXSec_2_TrackEff->SetBinError(8,3.99579e-07);
    hXSec_2_TrackEff->SetBinContent(9,3.09443e-06);
    hXSec_2_TrackEff->SetBinError(9,2.90066e-07);
    hXSec_2_TrackEff->SetBinContent(10,1.86272e-06);
    hXSec_2_TrackEff->SetBinError(10,2.03664e-07);
    hXSec_2_TrackEff->SetBinContent(11,1.17263e-06);
    hXSec_2_TrackEff->SetBinError(11,1.44346e-07);
    hXSec_2_TrackEff->SetBinContent(12,7.6833e-07);
    hXSec_2_TrackEff->SetBinError(12,9.63622e-08);
    hXSec_2_TrackEff->SetBinContent(13,5.18354e-07);
    hXSec_2_TrackEff->SetBinError(13,7.24187e-08);
    hXSec_2_TrackEff->SetBinContent(14,3.65966e-07);
    hXSec_2_TrackEff->SetBinError(14,5.05592e-08);

    /*
    // Load Files
    // R = r1, Period 1
    TString tF1_2 = "";
    TString tF10_2 = "";
    
    tF1_2 = "/Users/cgy606/Documents/Train/LEGOTrain/Unfolding/Results/lhc13_semigood_UnfoldingPlots_jS0_R2_-50_200_0_250_10_90_10_150_pri1_dPt2_ue0_sF0_hC0_tE0_cE0.root"; // Baseline, Regularization Strength, and Unfolding algorithm systematics (i.e. f0,f1,f2)
    tF10_2 = "/Users/cgy606/Documents/Train/LEGOTrain/Unfolding/Results/lhc13_semigood_UnfoldingPlots_jS0_R2_-50_200_0_250_15_90_10_150_pri1_dPt2_ue0_sF0_hC0_tE1_cE0.root"; // Tracking Efficiency systematic

    
    TFile *f1_2 = new TFile(tF1_2,"READ");
    TFile *f10_2 = new TFile(tF10_2,"READ");
    
    TList *l1_2 = (TList*) f1_2->Get("HistogramPlots");
    TList *l10_2 = (TList*) f10_2->Get("HistogramPlots");
    
    // Format: "h$Observable_$period$radius_systematic
    TString histname = "fhBayesReco3";
    TH1D *hXSec_2_Base = (TH1D*) l1_2->FindObject(histname);
    hXSec_2_Base->SetName("hXSec_2_Base");

    TH1D *hXSec_2_TrackEff = (TH1D*) l10_2->FindObject(histname);
    hXSec_2_TrackEff->SetName("hXSec_2_TrackEff");

    for (int i=1;i<=hXSec_2_Base->GetXaxis()->GetNbins();i++)
    {
        cout<<"hXSec_2_Base->SetBinContent("<<i<<","<<hXSec_2_Base->GetBinContent(i)<<");"<<endl;
        cout<<"hXSec_2_Base->SetBinError("<<i<<","<<hXSec_2_Base->GetBinError(i)<<");"<<endl;
    }

    for (int i=1;i<=hXSec_2_TrackEff->GetXaxis()->GetNbins();i++)
    {
        cout<<"hXSec_2_TrackEff->SetBinContent("<<i<<","<<hXSec_2_TrackEff->GetBinContent(i)<<");"<<endl;
        cout<<"hXSec_2_TrackEff->SetBinError("<<i<<","<<hXSec_2_TrackEff->GetBinError(i)<<");"<<endl;
    }
    */
    
    // Histogram formatting
    Double_t xLow = 20.0;
    Double_t xUp = 120.0;
    Double_t yLow = 1E-08;
    Double_t yUp = 1E-02;
    
    TString yUnits = "d^{2}#sigma/dp_{T}d#eta";
    // Jet Cross-section
    // R = 0.2
    FormatHistogram(*hXSec_2_Base,0,xLow,xUp,yLow,yUp,yUnits); // Baseline
    FormatHistogram(*hXSec_2_TrackEff,1,xLow,xUp,yLow,yUp,yUnits); // Baseline

    // Canvas Formatting
    // Jet Cross-section
    TCanvas *cXSec_2_TrackEff = new TCanvas();

    Double_t yTitle = 2E-03;
    TString savePath = "";
    //TString savePath = "/Users/cgy606/Documents/Train/LEGOTrain/Unfolding/";
    
    // R = 0.2
    Plot1VariationCross("cXSec_2_TrackEff","X-Section for different Tracking Efficiencies","XSec_TrackEff",*cXSec_2_TrackEff,hXSec_2_Base,hXSec_2_TrackEff,"TrackEff = 100% (Default)","TrackEff = 95%",savePath,30,yTitle,"lhc13","2"); // Tracking Efficiency

}

void FormatHistogram(TH1D& histo, Int_t opt, Double_t xLow, Double_t xUp, Double_t yLow, Double_t yUp, TString yTitle)
{
    Int_t xBinLow = histo.GetXaxis()->FindBin(xLow);
    Int_t xBinUp = histo.GetXaxis()->FindBin(xUp-1.0);
    
    histo.SetStats(kFALSE);
    histo.SetTitle("");
    if (opt == 0)
    {
        histo.SetLineColor(kBlue);
        histo.SetMarkerColor(kBlue);
        histo.SetMarkerStyle(20);
    }
    else if (opt ==1)
    {
        histo.SetLineColor(kRed);
        histo.SetMarkerColor(kRed);
        histo.SetMarkerStyle(25);
    }
    else
    {
        histo.SetLineColor(kBlack);
        histo.SetMarkerColor(kBlack);
        histo.SetMarkerStyle(3);
    }
    
    histo.GetXaxis()->SetRange(xBinLow,xBinUp);
    histo.GetXaxis()->SetTitleOffset(1.2);
    histo.GetXaxis()->SetTitle("#it{p}_{T,jet}^{ch+em} (GeV/#it{c})");
    histo.GetYaxis()->SetRangeUser(yLow,yUp);
    histo.GetYaxis()->SetTitleOffset(1.2);
    histo.GetYaxis()->SetTitle(yTitle);
}

void Plot1VariationCross(TString name, TString title, TString plotName, TCanvas& cPlot,TH1D* histBase, TH1D* histVar1, TString histBase_Title, TString histVar1_Title, TString fPath, Double_t xTitle, Double_t yTitle, TString period, TString jetR)
{
    cPlot = new TCanvas(name,"",0,0,1200,800);
    cPlot.SetLogy(kTRUE);
    cPlot.SetTicks(1,1);
    
    TLegend *lPlot = new TLegend(0.12,0.12,0.37,0.37);
    lPlot->SetFillColor(0);
    lPlot->SetBorderSize(0);
    lPlot->SetTextSize(0.04);
    
    histBase->Draw();
    histVar1->Draw("same");
    
    TLatex *tPlot_Title = new TLatex(xTitle,yTitle,title);
    tPlot_Title->SetTextFont(gStyle->GetTextFont());
    tPlot_Title->SetTextSize(gStyle->GetTextSize());
    tPlot_Title->Draw();
    
    lPlot->AddEntry(histBase,histBase_Title,"p");
    lPlot->AddEntry(histVar1,histVar1_Title,"p");
    lPlot->Draw();
    
    TString tRTitle = "anti-k_{T} R = 0." + jetR;
    TLatex *tPlot_RTitle = new TLatex(80,1E-06,tRTitle);
    tPlot_RTitle->SetTextFont(gStyle->GetTextFont());
    tPlot_RTitle->SetTextSize(gStyle->GetTextSize());
    tPlot_RTitle->Draw();
    
    TString cPlot_Path = fPath + period + "_R" + jetR + "_" + plotName + ".png";
    cPlot.SaveAs(cPlot_Path);
}

Several mistakes… fixed in the following :

void FormatHistogram(TH1D& histo, Int_t opt, Double_t xLow, Double_t xUp, Double_t yLow, Double_t yUp, TString yTitle)
{
    Int_t xBinLow = histo.GetXaxis()->FindBin(xLow);
    Int_t xBinUp = histo.GetXaxis()->FindBin(xUp-1.0);

    histo.SetStats(kFALSE);
    histo.SetTitle("");
    if (opt == 0)
    {
        histo.SetLineColor(kBlue);
        histo.SetMarkerColor(kBlue);
        histo.SetMarkerStyle(20);
    }
    else if (opt ==1)
    {
        histo.SetLineColor(kRed);
        histo.SetMarkerColor(kRed);
        histo.SetMarkerStyle(25);
    }
    else
    {
        histo.SetLineColor(kBlack);
        histo.SetMarkerColor(kBlack);
        histo.SetMarkerStyle(3);
    }

    histo.GetXaxis()->SetRange(xBinLow,xBinUp);
    histo.GetXaxis()->SetTitleOffset(1.2);
    histo.GetXaxis()->SetTitle("#it{p}_{T,jet}^{ch+em} (GeV/#it{c})");
    histo.GetYaxis()->SetRangeUser(yLow,yUp);
    histo.GetYaxis()->SetTitleOffset(1.2);
    histo.GetYaxis()->SetTitle(yTitle);
}

void Plot1VariationCross(TString name, TString title, TString plotName, TCanvas& cPlot,TH1D* histBase, TH1D* histVar1, TString histBase_Title, TString histVar1_Title, TString fPath, Double_t xTitle, Double_t yTitle, TString period, TString jetR)
{
    cPlot.SetLogy(kTRUE);
    cPlot.SetTicks(1,1);

    TLegend *lPlot = new TLegend(0.12,0.12,0.37,0.37);
    lPlot->SetFillColor(0);
    lPlot->SetBorderSize(0);
    lPlot->SetTextSize(0.04);

    histBase->Draw();
    histVar1->Draw("same");

    TLatex *tPlot_Title = new TLatex(xTitle,yTitle,title);
    tPlot_Title->SetTextFont(gStyle->GetTextFont());
    tPlot_Title->SetTextSize(gStyle->GetTextSize());
    tPlot_Title->Draw();

    lPlot->AddEntry(histBase,histBase_Title,"p");
    lPlot->AddEntry(histVar1,histVar1_Title,"p");
    lPlot->Draw();

    TString tRTitle = "anti-k_{T} R = 0." + jetR;
    TLatex *tPlot_RTitle = new TLatex(80,1E-06,tRTitle);
    tPlot_RTitle->SetTextFont(gStyle->GetTextFont());
    tPlot_RTitle->SetTextSize(gStyle->GetTextSize());
    tPlot_RTitle->Draw();

    TString cPlot_Path = fPath + period + "_R" + jetR + "_" + plotName + ".png";
    cPlot.SaveAs(cPlot_Path);
}

void myTest1()
{
    // Manually input histograms
    TH1D *hXSec_2_Base = new TH1D("hXSec_2_Base","",14,10,150);
    hXSec_2_Base->SetBinContent(1,0.0150096);
    hXSec_2_Base->SetBinError(1,0.000302078);
    hXSec_2_Base->SetBinContent(2,0.00119452);
    hXSec_2_Base->SetBinError(2,3.28637e-05);
    hXSec_2_Base->SetBinContent(3,0.00030347);
    hXSec_2_Base->SetBinError(3,9.19787e-06);
    hXSec_2_Base->SetBinContent(4,0.00010144);
    hXSec_2_Base->SetBinError(4,3.54978e-06);
    hXSec_2_Base->SetBinContent(5,3.99859e-05);
    hXSec_2_Base->SetBinError(5,1.64532e-06);
    hXSec_2_Base->SetBinContent(6,1.85655e-05);
    hXSec_2_Base->SetBinError(6,9.68297e-07);
    hXSec_2_Base->SetBinContent(7,9.44225e-06);
    hXSec_2_Base->SetBinError(7,6.11403e-07);
    hXSec_2_Base->SetBinContent(8,5.0142e-06);
    hXSec_2_Base->SetBinError(8,3.90394e-07);
    hXSec_2_Base->SetBinContent(9,2.86627e-06);
    hXSec_2_Base->SetBinError(9,2.80637e-07);
    hXSec_2_Base->SetBinContent(10,1.72214e-06);
    hXSec_2_Base->SetBinError(10,1.97945e-07);
    hXSec_2_Base->SetBinContent(11,1.08546e-06);
    hXSec_2_Base->SetBinError(11,1.37822e-07);
    hXSec_2_Base->SetBinContent(12,7.09017e-07);
    hXSec_2_Base->SetBinError(12,8.99664e-08);
    hXSec_2_Base->SetBinContent(13,4.78023e-07);
    hXSec_2_Base->SetBinError(13,6.51604e-08);
    hXSec_2_Base->SetBinContent(14,3.35842e-07);
    hXSec_2_Base->SetBinError(14,4.81834e-08);

    TH1D *hXSec_2_TrackEff = new TH1D("hXSec_2_TrackEff","",14,10,150);
    hXSec_2_TrackEff->SetBinContent(1,0.0141095);
    hXSec_2_TrackEff->SetBinError(1,0.000305863);
    hXSec_2_TrackEff->SetBinContent(2,0.0013615);
    hXSec_2_TrackEff->SetBinError(2,3.70887e-05);
    hXSec_2_TrackEff->SetBinContent(3,0.000334459);
    hXSec_2_TrackEff->SetBinError(3,9.9466e-06);
    hXSec_2_TrackEff->SetBinContent(4,0.000109922);
    hXSec_2_TrackEff->SetBinError(4,3.71045e-06);
    hXSec_2_TrackEff->SetBinContent(5,4.32548e-05);
    hXSec_2_TrackEff->SetBinError(5,1.71187e-06);
    hXSec_2_TrackEff->SetBinContent(6,1.9919e-05);
    hXSec_2_TrackEff->SetBinError(6,1.00098e-06);
    hXSec_2_TrackEff->SetBinContent(7,1.01787e-05);
    hXSec_2_TrackEff->SetBinError(7,6.27389e-07);
    hXSec_2_TrackEff->SetBinContent(8,5.3449e-06);
    hXSec_2_TrackEff->SetBinError(8,3.99579e-07);
    hXSec_2_TrackEff->SetBinContent(9,3.09443e-06);
    hXSec_2_TrackEff->SetBinError(9,2.90066e-07);
    hXSec_2_TrackEff->SetBinContent(10,1.86272e-06);
    hXSec_2_TrackEff->SetBinError(10,2.03664e-07);
    hXSec_2_TrackEff->SetBinContent(11,1.17263e-06);
    hXSec_2_TrackEff->SetBinError(11,1.44346e-07);
    hXSec_2_TrackEff->SetBinContent(12,7.6833e-07);
    hXSec_2_TrackEff->SetBinError(12,9.63622e-08);
    hXSec_2_TrackEff->SetBinContent(13,5.18354e-07);
    hXSec_2_TrackEff->SetBinError(13,7.24187e-08);
    hXSec_2_TrackEff->SetBinContent(14,3.65966e-07);
    hXSec_2_TrackEff->SetBinError(14,5.05592e-08);

    // Histogram formatting
    Double_t xLow = 20.0;
    Double_t xUp = 120.0;
    Double_t yLow = 1E-08;
    Double_t yUp = 1E-02;

    TString yUnits = "d^{2}#sigma/dp_{T}d#eta";
    // Jet Cross-section
    // R = 0.2
    FormatHistogram(*hXSec_2_Base,0,xLow,xUp,yLow,yUp,yUnits); // Baseline
    FormatHistogram(*hXSec_2_TrackEff,1,xLow,xUp,yLow,yUp,yUnits); // Baseline

    // Canvas Formatting
    // Jet Cross-section
    TCanvas *cXSec_2_TrackEff = new TCanvas();

    Double_t yTitle = 2E-03;
    TString savePath = "";

    // R = 0.2
    Plot1VariationCross("cXSec_2_TrackEff","X-Section for different Tracking Efficiencies","XSec_TrackEff",*cXSec_2_TrackEff,hXSec_2_Base,hXSec_2_TrackEff,"TrackEff = 100% (Default)","TrackEff = 95%",savePath,30,yTitle,"lhc13","2"); // Tracking Efficiency

}