44 "F_{#mu}#nu_{#muQE}/N_{#mu}#nu_{#muQE}",
45 "F_{#mu}#nu_{#mu}/N_{#mu}#nu_{#mu}",
48 "F_{e}#nu_{eQE}/N_{#mu}#nu_{#muQE}",
49 "F_{e}#nu_{e}/N_{#mu}#nu_{#mu}",
50 "F_{e}#nu_{#mu}/N_{e}#nu_{#mu}",
55 std::vector<TH1D*> topHistos,
56 std::vector<TString> topOption,
57 std::vector<TH1D*> bottomHistos,
58 std::vector<TString> bottomOption,
59 double min = 0.3,
double max = 1.7,
60 std::vector<double>
ls = {0.8,1,1.2})
62 gStyle->SetTitleStyle(0);
63 TCanvas *
c =
new TCanvas(name.c_str(),
"canvas", 1000, 700);
65 TPad*
p1 =
new TPad(
"p1",
"p1", 0, 0, 1, 1);
66 TPad*
p2 =
new TPad(
"p2",
"p2", 0, 0, 1, 1);
69 p1->SetBottomMargin(.55);
70 p2->SetTopMargin(.45);
71 p2->SetBottomMargin(.35);
79 auto h1 = (TH1D*) topHistos[0]->
Clone();
80 auto h3 = (TH1D*) bottomHistos[0]->
Clone();
82 for(
auto &
h:{
h1,
h3}){
85 h->GetYaxis()->SetTitleSize(26);
86 h->GetYaxis()->SetTitleFont(43);
87 h->GetYaxis()->SetTitleOffset(1.3);
88 h->GetYaxis()->SetLabelFont(43);
89 h->GetYaxis()->CenterTitle();
91 h->GetXaxis()->SetTitleOffset(1.2);
92 h->GetXaxis()->SetTitleSize(28);
93 h->GetXaxis()->SetTitleFont(43);
94 h->GetXaxis()->SetLabelFont(43);
95 h->GetXaxis()->CenterTitle();
98 h1->GetYaxis()->SetLabelSize(18);
100 h1->GetXaxis()->SetLabelSize(0);
101 h1->GetXaxis()->SetTitleSize(0);
104 h3->GetYaxis()->SetTitle(
"Ratio");
105 h3->GetYaxis()->SetRangeUser(
min,
max);
106 h3->GetYaxis()->SetLabelSize(15);
107 h3->GetYaxis()->SetDecimals();
108 h3->GetYaxis()->CenterTitle();
110 h3->GetXaxis()->SetTitle(
h1->GetXaxis()->GetTitle());
111 h3->GetXaxis()->SetLabelSize(0);
115 h1->Draw(topOption[0]);
117 for(
unsigned int ii = 1; ii < topHistos.size(); ++ii) {
118 topHistos[ii]->Draw(
"same "+topOption[ii]);
120 h1->Draw(
"same "+topOption[0]);
125 h3->Draw(bottomOption[0]);
126 for(
unsigned int ii = 1; ii < bottomHistos.size(); ++ii){
127 bottomHistos[ii]->Draw(
"same " + bottomOption[ii]);
131 TLine *lone =
new TLine();
132 lone->SetLineStyle(3);
133 lone->SetLineColor(kGray+3);
135 for(
unsigned int i = 0;
i <
ls.size();++
i) lone->DrawLine(p2->GetUxmin(),
ls[
i],p2->GetUxmax(),
ls[
i]);
142 for(
int i = 1;
i <= h->GetNbinsX();++
i){
143 if(h->GetBinContent(
i) == 0) h->SetBinContent(
i,1);
148 std::vector<TH1D*> h0;
149 std::vector<TString> h0opt;
150 std::vector<TH1D*> hRat;
151 std::vector<TString> hRatopt;
154 h0opt.push_back(
"hist");
155 for(
unsigned int i = 0;
i < others.size();++
i){
157 h0.push_back(others[
i]);
158 h0opt.push_back(
"hist");
159 TH1D*
h = (TH1D*)others[i]->
Clone(
"h");
163 hRatopt.push_back(
"hist");
166 return RatioPlot(name,h0,h0opt,hRat,hRatopt);
170 TLine *lone =
new TLine();
172 std::vector<double> coverage = {0.9,0.95,0.99,0.999,0.9999};
173 std::vector<int> coverageBins;
174 for(
unsigned int i = 0;
i < coverage.size();++
i) coverageBins.push_back(hist->FindFirstBinAbove(coverage[
i]));
177 for(
unsigned int i = 0;i < coverage.size();++
i){
178 double x = hist->GetBinCenter(coverageBins[i]);
179 lone->DrawLine(x,gPad->GetUymin(),
x,gPad->GetUymax());
187 TLine *lone =
new TLine();
191 for(
unsigned int i = 0;
i < width.size();++
i){
192 for(
int j = 0;
j < width[
i];++
j){
194 if(
j == width[
i]-1 &&
i != width.size()-1){
195 lone->SetLineWidth(3);
196 lone->DrawLine(loc,gPad->GetUymin(),
loc,gPad->GetUymax());
199 lone->SetLineWidth(1);
200 lone->DrawLine(loc,gPad->GetUymin(),
loc,gPad->GetUymax());
207 double left = gPad->GetLeftMargin();
208 double right = 1-gPad->GetRightMargin();
209 double top = 1-gPad->GetTopMargin();
210 double bottom = gPad->GetBottomMargin();
212 TLatex *tLabel =
new TLatex();
213 tLabel->SetTextSize(0.025);
214 tLabel->SetTextAlign(12);
215 tLabel->SetTextSize(1./30);
217 tLabel->SetTextAngle(-90);
220 for(
unsigned int i = 0;
i < labels.size();++
i){
221 center = left+(right-
left)*(1+2*
i)/(labels.size()*2);
222 tLabel->DrawLatex(center, 0.95*bottom, labels[
i].c_str());
227 std::vector<TH1D*> topHistos,
228 std::vector<TH1D*> bottomHistos)
230 gStyle->SetTitleStyle(0);
231 TCanvas *c =
new TCanvas(name.c_str(),
"canvas", 1000, 700);
233 TPad* p1 =
new TPad(
"p1",
"p1", 0, 0, 1, 1);
234 TPad* p2 =
new TPad(
"p2",
"p2", 0, 0, 1, 1);
237 p1->SetBottomMargin(.5);
238 p2->SetTopMargin(.5);
246 auto h1 = (TH1D*) topHistos[0]->
Clone();
247 auto h3 = (TH1D*) bottomHistos[0]->
Clone();
249 for(
auto &
h:{
h1,
h3}){
252 h->GetYaxis()->SetTitleSize(26);
253 h->GetYaxis()->SetTitleFont(43);
254 h->GetYaxis()->SetTitleOffset(1.3);
255 h->GetYaxis()->SetLabelFont(43);
256 h->GetYaxis()->CenterTitle();
257 h->GetYaxis()->SetRangeUser(0.75,1.25);
259 h->GetXaxis()->SetTitleOffset(1.2);
260 h->GetXaxis()->SetTitleSize(28);
261 h->GetXaxis()->SetTitleFont(43);
262 h->GetXaxis()->SetLabelFont(43);
263 h->GetXaxis()->CenterTitle();
266 h1->GetYaxis()->SetTitle(
"Shift");
267 h1->GetYaxis()->SetLabelSize(18);
269 h1->GetXaxis()->SetLabelSize(0);
270 h1->GetXaxis()->SetTitleSize(0);
273 h3->GetYaxis()->SetTitle(
"Shift");
274 h3->GetYaxis()->SetLabelSize(15);
275 h3->GetYaxis()->SetDecimals();
276 h3->GetYaxis()->CenterTitle();
278 h3->GetXaxis()->SetTitle(
h1->GetXaxis()->GetTitle());
279 h3->GetXaxis()->SetLabelSize(0);
285 for(
unsigned int ii = 1; ii < topHistos.size(); ++ii) {
286 topHistos[ii]->Draw(
"hist same");
288 h1->Draw(
"hist same");
294 for(
unsigned int ii = 1; ii < bottomHistos.size(); ++ii){
295 bottomHistos[ii]->Draw(
"hist same");
297 h3->Draw(
"hist same");
299 TLine *lone =
new TLine();
300 lone->SetLineStyle(3);
301 lone->SetLineColor(kGray+3);
TCanvas * QuickUnivRatioPlot(std::string name, TH1D *hNom, std::vector< TH1D * > others)
std::vector< int > axis_widths
TCanvas * RatioPlot(std::string name, std::vector< TH1D * > topHistos, std::vector< TString > topOption, std::vector< TH1D * > bottomHistos, std::vector< TString > bottomOption, double min=0.3, double max=1.7, std::vector< double > ls={0.8, 1, 1.2})
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
void drawBinLines(std::vector< int > width)
TCanvas * SplitPlot(std::string name, std::vector< TH1D * > topHistos, std::vector< TH1D * > bottomHistos)
void drawLabels(std::vector< std::string > labels)
static float min(const float a, const float b, const float c)
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
std::vector< std::string > axis_labels_fv
std::vector< std::string > axis_labels
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void drawCoverLines(TH1D *hist)