I have two points in data and in MC, and I want to plot them along with the ratio of data/MC. Currently I have an empty plot at the bottom, I don’t know how to fix the problem. Is this even the best way of going about this task?
void HistoricalCrossSec()
{
double bottommargin = 0.25;
double topmargin = 0.06;
double leftmargin = 0.09;
double rightmargin = 0.01;
gStyle->SetPadBottomMargin(bottommargin);
gStyle->SetPadTopMargin(topmargin);
gStyle->SetPadLeftMargin(leftmargin);
gStyle->SetPadRightMargin(rightmargin);
gStyle->SetMarkerStyle(8);
gStyle->SetOptStat(0);
double myDataCrossSec = 1e10;
double myDataCrossSecerr = 0.42e10;
double myMCCrossSec = 0.9e10;
double myMCCrossSecerr = 0.0288e10;
double slacDataCrossSec = 2e10;
double slacDataCrossSecerr = 0.45e10;
double slacMCCrossSec = 1.8e10;
double slacMCCrossSecerr = 0.036e10;
TH1F* hData = new TH1F("hData",";Positron Energy (MeV); Cross section (pb)",300,149.5,449.5);
TH1F* hMC = new TH1F("hMC",";Positron Energy (MeV); Cross section (pb)",300,149.5,449.5);
std::cout<<hData->FindBin(199)<<" "<<hData->FindBin(431.6)<<"\n";
hData->Fill(199,slacDataCrossSec);
hData->SetBinError(hData->FindBin(199),1.);
hData->Fill(431.6,myDataCrossSec);
hData->SetBinError(hData->FindBin(431.6),1.);
hMC->Fill(199,slacMCCrossSec);
hMC->SetBinError(hMC->FindBin(199),slacMCCrossSecerr);
hMC->Fill(431.6,myMCCrossSec);
hMC->SetBinError(hMC->FindBin(431.6),myMCCrossSecerr);
hData->SetMarkerColor(kRed);
TCanvas* crp = new TCanvas("crp","crp",900,700);
TRatioPlot* rpCrossSec = new TRatioPlot(hData,hMC);
rpCrossSec->Draw();
rpCrossSec->SetH1DrawOpt("E");
}