11 #include "TGraphAsymmErrors.h" 18 #include "TLegendEntry.h" 27 {
"tot",
"Total inelastic"}
48 {
"Enu",
"True E_{#nu}"},
49 {
"Epi",
"True E_{#pi}"}
54 std::vector<TH1*> univs,
58 std::pair<TH1*, TH1*>
ret;
63 TH1* hDown = univs[down_idx];
65 hDown->GetXaxis()->SetTitle(myFullLabel.c_str());
67 TH1* hUp = univs[up_idx];
69 hUp->GetXaxis()->SetTitle(myFullLabel.c_str());
92 TGaxis::SetMaxDigits(5);
96 TFile*
inFile = TFile::Open(inName.c_str(),
"read");
113 std::string base_dir = myVarName +
"_" + myCutName ;
120 TH1 * hSig = sSig->
ToTH1(pot);
121 hSig->GetXaxis()->SetTitle(myVarName.c_str());
129 std::string myHistTitle = histTitle +
" " + mySystLabel;
133 hSig->SetTitle((myHistTitle).c_str());
135 std::vector<TH1*> hUnivs{
136 (
Spectrum::LoadFrom( inFile->GetDirectory(
"foo") , (base_dir +
"_" + mySystName +
"_minus1sigma").c_str() ).
release() )->ToTH1(pot),
137 (
Spectrum::LoadFrom( inFile->GetDirectory(
"foo") , (base_dir +
"_" + mySystName +
"_plus1sigma").c_str() ).
release() )->ToTH1(pot)
140 TH1* hDown = hUnivs[0];
141 TH1* hUp = hUnivs[1];
143 hDown->SetLineColor(
kRed);
144 hUp->SetLineColor(
kBlue);
146 TH1* frac_down = (TH1*)hDown->Clone();
147 frac_down->Divide(hSig);
149 TH1* frac_up = (TH1*)hUp->Clone();
150 frac_up->Divide(hSig);
152 auto legend =
new TLegend(0.6,0.5,0.95,0.9);
153 legend->AddEntry(hSig,
"Nominal",
"l");
154 legend->AddEntry(hDown,
"Knob val = 0.8",
"l");
155 legend->AddEntry(hUp,
"Knob val = 1.2",
"l");
158 TString rCname =
"rC";
160 TCanvas* rC =
new TCanvas(rCname, rCname);
162 rC -> SetBottomMargin(0.);
164 TPad* P1 =
new TPad(
"Temp_1",
"", 0.0, Spl, 1.0, 1.0, 0 );
165 TPad* P2 =
new TPad(
"Temp_2",
"", 0.0, 0.0, 1.0, Spl, 0 );
166 P2 -> SetRightMargin (.03);
167 P2 -> SetTopMargin (.00);
168 P2 -> SetBottomMargin(.3);
169 P2 -> SetLeftMargin (.13);
171 P1 -> SetRightMargin (.03);
172 P1 -> SetLeftMargin (.13);
173 P1 -> SetTopMargin (.1);
174 P1 -> SetBottomMargin(.00);
183 frac_down->GetYaxis()->SetTitleSize( Lb2 );
184 frac_down->GetYaxis()->SetTitleOffset(0.4);
186 frac_down->GetYaxis()->SetLabelSize( Lb2 );
187 frac_down->GetXaxis()->SetTitleSize( Lb2 );
188 frac_down->GetXaxis()->SetLabelSize( Lb2 );
189 frac_down->GetYaxis()->SetRangeUser(0.9, 1.1);
190 frac_down->GetYaxis()->SetTitle(
"Ratio");
192 frac_down->Draw(
"HIST");
194 double x[2] = {frac_down->GetXaxis()->GetXmin(), frac_down->GetXaxis()->GetXmax()};
195 double y[2] = {1, 1};
196 TGraph *
line =
new TGraph(2, x, y);
197 line->SetLineColor(kGray);
198 line->SetLineWidth(3);
199 line->SetLineStyle(2);
200 line->Draw(
"l same");
203 frac_down->Draw(
"SAME HIST AXIS");
204 frac_up->Draw(
"SAME HIST");
208 hSig->GetYaxis()->SetTitleSize( Lb1 );
209 hSig->GetYaxis()->SetLabelSize( Lb1 );
210 hSig->GetYaxis()->SetTitleOffset( 0.7 );
212 hSig->GetXaxis()->SetLabelSize (0 );
213 hSig->GetXaxis()->SetLabelOffset(99);
217 hSig->Draw(
"hist ][");
218 hDown->Draw(
"SAME HIST");
219 hUp->Draw(
"SAME HIST");
222 rC->SaveAs((outName +
".png").c_str());
Cuts and Vars for the 2020 FD DiF Study.
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
std::vector< std::pair< std::string, std::string > > cutName_list
Representation of a spectrum in any variable, with associated POT.
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
std::vector< std::pair< std::string, std::string > > varName_list
std::pair< TH1 *, TH1 * > RatioPlots(TH1 *hSig, std::vector< TH1 * > univs, std::string myFullLabel)
std::vector< std::pair< std::string, std::string > > systName_list