12 #include "Utilities/func/MathUtil.h" 20 #include "TPolyLine.h" 34 void leg(
double x0,
double y0,
double x1,
double y1)
36 TLegend*
leg =
new TLegend(x0, y0, x1, y1);
38 TH1*
dummy =
new TH1F(
"",
"", 1, 0, 1);
39 dummy->SetLineWidth(3);
40 for(
int i = 0;
i < 3; ++
i){
41 dummy->SetFillColor(
cols[
i]);
47 void pie_arc(
double cx,
double cy,
double a0,
double a1,
double r,
48 int width,
int lineCol,
int fillCol,
double fudgeR=0)
50 TPolyLine*
l =
new TPolyLine();
51 l->SetLineWidth(width);
52 l->SetLineColor(lineCol);
54 l->SetPoint(0, cx+fudgeR*r*
cos(a0), cy+fudgeR*r*
sin(a0));
56 for(
int i = 0;
i <= 100; ++
i){
57 const double a = a0 + (a1-a0)*
i/100.;
58 l->SetPoint(
i+1, cx+r*
cos(a), cy+r*
sin(a));
60 l->SetPoint(102, cx+fudgeR*r*
cos(a1), cy+fudgeR*r*
sin(a1));
61 l->SetPoint(103, cx+fudgeR*r*
cos(a0), cy+fudgeR*r*
sin(a0));
63 l->SetFillColor(fillCol);
64 l->SetFillStyle(1001);
66 if(fillCol >= 0) l->Draw(
"f");
72 int EBinsPerSelBin = 9;
73 int idx1 = 1 + EBinsPerSelBin*
bin;
74 int idx2 = EBinsPerSelBin*(bin+1);
76 return h->Integral(idx1,idx2);
77 return h->GetBinContent(30);
91 std::string cname=
"/nova/ana/nu_e_ana/Ana2017/Predictions/cosmic/cosmic_spectra_prediction.root",
100 double nonsScale = 1./10.45;
101 double swapScale = 1./12.91;
115 double pot = 9.48e20;
124 new TCanvas(
"a",
"b", 600, 600);
132 for(
int i = 0;
i < 12; ++
i) tot += vals[
i];
134 std::cout << tot <<
" "<< psig->Integral() +pbb->Integral() +pcos->Integral() <<
std::endl;
137 tots[0] = vals[0]+vals[1]+vals[2];
138 tots[1] = vals[3]+vals[4]+vals[5];
139 tots[2] = vals[6]+vals[7]+vals[8];
140 tots[3] = vals[9]+vals[10]+vals[11];
144 double tot_accum = 0;
145 for(
int i = 0;
i < 4; ++
i){
146 const double a0 = tot_accum/tot * 2*TMath::Pi();
147 tot_accum += tots[
i];
148 const double a1 = tot_accum/tot * 2*TMath::Pi();
152 for(
int j =
i*3;
j < (
i+1)*3; ++
j){
155 const double a0j = accum/tot * 2*TMath::Pi();
157 const double a1j = accum/tot * 2*TMath::Pi();
163 TLatex* ltx =
new TLatex(cx+(
R+.03)*
cos((a0+a1)/2),
164 cy+(
R+.03)*
sin((a0+a1)/2),
166 ltx->SetTextAlign(22);
167 double textAng = (a0+
a1)/2*180/TMath::Pi()-90;
168 if(textAng < -90 || textAng > +90) textAng += 180;
169 ltx->SetTextAngle(textAng);
174 pie_arc(cx, cy, a0, a1,
R, 5, kBlack, -1);
179 gPad->Print(
"pie.png");
180 gPad->Print(
"pie.pdf");
185 TH1* htot =
new TH1F(
"",
";;Expected Events", 17, 0, 17);
186 TH1* hcos =
new TH1F(
"",
"", 17, 0, 17);
187 TH1*
hbkg =
new TH1F(
"",
"", 17, 0, 17);
188 for(
int i = 0;
i < 4; ++
i){
189 for(
int j = 0;
j < 3; ++
j){
190 htot->SetBinContent(4*
i+
j+2, tots[
i]);
191 hcos->SetBinContent(4*i+
j+2, vals[i*3+2]);
192 hbkg->SetBinContent(4*i+
j+2, vals[i*3+1] + vals[i*3+2]);
195 htot->SetLineWidth(5);
197 for(
int i = 0;
i < 4; ++
i){
201 htot->GetXaxis()->SetLabelSize(1.5*htot->GetYaxis()->GetTitleSize());
202 htot->GetXaxis()->LabelsOption(
"h");
204 htot->GetXaxis()->SetTickLength(0);
206 htot->GetYaxis()->CenterTitle();
208 htot->SetFillColor(
cols[0]);
210 htot->SetFillStyle(0);
212 hbkg->SetLineWidth(3);
214 hbkg->SetFillColor(
cols[1]);
217 hcos->SetLineWidth(3);
219 hcos->SetFillColor(
cols[2]);
224 leg(.125, .65, .375, .85);
226 gPad->Print(
"bars.png");
227 gPad->Print(
"bars.pdf");
231 new TCanvas(
"c",
"d", 1000, 600);
233 const double padding = .1;
234 const double internal_padding = .025;
236 const double active_width = 1-2*padding-3*internal_padding;
237 const double active_height = 1-2*padding;
240 double frac[4] = {0,};
241 for(
int i = 0;
i < 4; ++
i){
242 for(
int j = 0;
j < 3; ++
j){
243 frac[
i] += vals[
i*3+
j]/tot_accum;
248 for(
int i = 0;
i < 4; ++
i){
249 const double x0 = padding + active_width*accum;
251 const double x1 = padding + active_width*accum;
252 accum += internal_padding;
253 TBox*
b =
new TBox(x0, padding, x1, 1-padding);
258 const double tot = vals[
i*3] + vals[
i*3+1] + vals[
i*3+2];
260 for(
int j = 2;
j >= 0; --
j){
261 const double y0 = padding + active_height*accum2;
262 accum2 += vals[
i*3+
j]/
tot;
263 const double y1 = padding + active_height*accum2;
265 TBox* b =
new TBox(x0, y0, x1, y1);
266 b->SetFillColor(
cols[
j]);
276 double labelsplit = 0.03;
278 TLatex* ltx1 =
new TLatex((x0+x1)/2, (y0+y1)/2+labelsplit,
"Cosmic");
279 ltx1->SetTextAlign(22);
281 TLatex* ltx2 =
new TLatex((x0+x1)/2, (y0+y1)/2-labelsplit,
"bkg");
282 ltx2->SetTextAlign(22);
286 TLatex* ltx1 =
new TLatex((x0+x1)/2, (y0+y1)/2+labelsplit,
"Beam");
287 ltx1->SetTextAlign(22);
289 TLatex* ltx2 =
new TLatex((x0+x1)/2, (y0+y1)/2-labelsplit,
"bkg");
290 ltx2->SetTextAlign(22);
294 TLatex* ltx =
new TLatex((x0+x1)/2, (y0+y1)/2,
component_labels[j].c_str());
295 ltx->SetTextAlign(22);
303 TLatex* ltx =
new TLatex((x0+x1)/2, padding/2,
sample_labels[
i].c_str());
304 ltx->SetTextAlign(22);
311 gPad->Print(
"mosaic.png");
312 gPad->Print(
"mosaic.pdf");
Cuts and Vars for the 2020 FD DiF Study.
Float_t y1[n_points_granero]
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.
const FitDmSq32 kFitDmSq32
Float_t x1[n_points_granero]
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
const int internal_line_col
TH1 * PredictCosmic(std::string fname, std::string name)
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
Forward to wrapped Var's SetValue()
osc::IOscCalcAdjustable * DefaultOscCalc()
Create a new calculator with default assumptions for all parameters.
Representation of a spectrum in any variable, with associated POT.
double IntInBin(TH1 *h, int bin)
Charged-current interactions.
const double kAna2017Livetime
void SetValue(osc::IOscCalcAdjustable *osc, double val) const override
const std::string sample_labels[4]
double frac(double x)
Fractional part.
const std::string component_labels[3]
virtual Spectrum PredictComponent(osc::IOscCalc *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const override
const ConstrainedFitVarWithPrior fitSsqTh23_UniformPriorSsqTh23 & kFitSinSqTheta23
void pie_arc(double cx, double cy, double a0, double a1, double r, int width, int lineCol, int fillCol, double fudgeR=0)
void leg(double x0, double y0, double x1, double y1)
const FitVarWithPrior fitDeltaInPiUnits_UniformPriordCP & kFitDeltaInPiUnits
void bin_composition_pie_chart(std::string fname="/nova/ana/nu_e_ana/Ana2017/Predictions/provisional/pred_nom.root", std::string predName="pred_nom2017", std::string cname="/nova/ana/nu_e_ana/Ana2017/Predictions/cosmic/cosmic_spectra_prediction.root", std::string cosName="All/cosm_merged_4bin")
virtual Spectrum Predict(osc::IOscCalc *calc) const override
void rock(std::string suffix="full")