12 #pragma GCC diagnostic ignored "-Wfloat-conversion"
48 for (
int i = 0; i <
nDraw; ++i)
53 const std::string CurrentName =
ParamNames[ParamEnum][ParamNo].Data();
56 if (CurrentName ==
"sin2th_13") {
59 }
else if (CurrentName ==
"sin2th_12") {
62 }
else if (CurrentName ==
"sin2th_23") {
65 }
else if (CurrentName ==
"delta_cp") {
68 }
else if (CurrentName ==
"delm2_23") {
79 Chain->SetAlias(
"J_cp",
"TMath::Sqrt(sin2th_13)*TMath::Sqrt(1.-sin2th_13)*TMath::Sqrt(1.-sin2th_13)*TMath::Sqrt(sin2th_12)*TMath::Sqrt(1.-sin2th_12)*TMath::Sqrt(sin2th_23)*TMath::Sqrt(1.-sin2th_23)*TMath::Sin(delta_cp)");
101 const double s13 = std::sqrt(s2th13);
102 const double s23 = std::sqrt(s2th23);
103 const double s12 = std::sqrt(s2th12);
104 const double sdcp = std::sin(dcp);
105 const double c13 = std::sqrt(1.-s2th13);
106 const double c12 = std::sqrt(1.-s2th12);
107 const double c23 = std::sqrt(1.-s2th23);
109 const double j = s13*c13*c13*s12*c12*s23*c23*sdcp;
118 double Prior = 1.0, PriorError = 1.0;
119 bool FlatPrior =
false;
126 FlatPrior =
ParamFlat[ParType][ParamTemp];
129 return randGen->Uniform(FlatBounds[0], FlatBounds[1]);
132 return randGen->Gaus(Prior, PriorError);
140 TFile *TempFile =
M3::Open((
MCMCFile +
".root"),
"open", __FILE__, __LINE__);
143 TMacro *Config = TempFile->Get<TMacro>(
"Reweight_Config");
145 if (Config !=
nullptr) {
152 YAML::Node firstReweight = Settings[
"ReweightMCMC"].begin()->second;
153 int dimension = GetFromManager<int>(firstReweight[
"ReweightDim"], 1);
154 std::string reweightType = GetFromManager<std::string>(firstReweight[
"ReweightType"],
"");
155 auto paramNames = GetFromManager<std::vector<std::string>>(firstReweight[
"ReweightVar"], {});
156 if (dimension == 1 && reweightType ==
"Gaussian" && paramNames.size() == 1){
157 Sin13_NewPrior = Get<std::pair<double, double>>(firstReweight[
"ReweightPrior"],__FILE__,__LINE__);
160 MACH3LOG_INFO(
"No valid reweighting configuration (1D Gaussian on sin2th_13 only) found for Jarlskog analysis");
163 MACH3LOG_INFO(
"No reweighting configuration found for Jarlskog analysis");
182 MACH3LOG_WARN(
"Will not {}, as oscillation parameters are missing", __func__);
190 bool DoReweight =
false;
191 std::pair<double, double> Sin13_NewPrior;
194 TDirectory *JarlskogDir =
OutputFile->mkdir(
"Jarlskog");
197 unsigned int step = 0;
198 Chain->SetBranchStatus(
"*",
false);
215 Chain->SetBranchStatus(
"step",
true);
216 Chain->SetBranchAddress(
"step", &step);
219 Chain->SetBranchStatus(
"Weight",
true);
220 Chain->SetBranchAddress(
"Weight", &weight);
227 auto jarl = std::make_unique<TH1D>(
"jarl",
"jarl", 1000, -0.05, 0.05);
228 jarl->SetDirectory(
nullptr);
229 auto jarl_th23 = std::make_unique<TH2D>(
"jarl_th23",
"jarl_th23", 500, -0.05, 0.05, 500, 0.3, 0.7);
230 jarl_th23->SetDirectory(
nullptr);
231 auto jarl_dcp = std::make_unique<TH2D>(
"jarl_dcp",
"jarl_dcp", 500, -0.05, 0.05, 500, -1. * TMath::Pi(), TMath::Pi());
232 jarl_dcp->SetDirectory(
nullptr);
234 jarl->SetTitle(
"Jarlskog Invariant;J #equiv s_{13}c_{13}^{2}s_{12}c_{12}s_{23}c_{23}sin#delta;Posterior probability");
235 jarl_th23->SetTitle(
"Jarlskog Invariant;J #equiv s_{13}c_{13}^{2}s_{12}c_{12}s_{23}c_{23}sin#delta;Posterior probability");
238 auto jarl_IH =
M3::Clone(jarl.get(),
"jarl_IH");
239 auto jarl_NH =
M3::Clone(jarl.get(),
"jarl_NH");
241 auto jarl_th23_IH =
M3::Clone(jarl_th23.get(),
"jarl_th23_IH");
242 auto jarl_th23_NH =
M3::Clone(jarl_th23.get(),
"jarl_th23_NH");
244 auto jarl_dcp_IH =
M3::Clone(jarl_dcp.get(),
"jarl_dcp_IH");
245 auto jarl_dcp_NH =
M3::Clone(jarl_dcp.get(),
"jarl_dcp_NH");
247 auto jarl_flatsindcp =
M3::Clone(jarl.get(),
"jarl_flatsindcp");
248 auto jarl_IH_flatsindcp =
M3::Clone(jarl.get(),
"jarl_IH_flatsindcp");
249 auto jarl_NH_flatsindcp =
M3::Clone(jarl.get(),
"jarl_NH_flatsindcp");
251 auto jarl_th23_flatsindcp =
M3::Clone(jarl_th23.get(),
"jarl_th23_flatsindcp");
252 auto jarl_th23_IH_flatsindcp =
M3::Clone(jarl_th23.get(),
"jarl_th23_IH_flatsindcp");
253 auto jarl_th23_NH_flatsindcp =
M3::Clone(jarl_th23.get(),
"jarl_th23_NH_flatsindcp");
255 auto jarl_prior =
M3::Clone(jarl.get(),
"jarl_prior");
256 auto jarl_prior_flatsindcp =
M3::Clone(jarl.get(),
"jarl_prior_flatsindcp");
257 std::unique_ptr<TH1D> jarl_wRC_prior, jarl_wRC_prior_flatsindcp, jarl_wRC_prior_t2kth23;
260 jarl_wRC_prior =
M3::Clone(jarl.get(),
"jarl_wRC_prior");
261 jarl_wRC_prior_flatsindcp =
M3::Clone(jarl.get(),
"jarl_wRC_prior_flatsindcp");
262 jarl_wRC_prior_t2kth23 =
M3::Clone(jarl.get(),
"jarl_wRC_prior_flatsindcp");
266 auto prior3 = std::make_unique<TF1>(
"prior3",
"TMath::Abs(TMath::Cos(x))");
269 auto randGen = std::make_unique<TRandom3>(0);
270 const Long64_t countwidth =
nEntries/5;
273 if (i % countwidth == 0) {
282 const double j =
CalcJarlskog(s2th13, s2th23, s2th12, dcp);
283 const double prior_weight = prior3->Eval(dcp);
285 jarl->Fill(j, weight);
286 jarl_th23->Fill(j, s2th23, weight);
287 jarl_dcp->Fill(j, dcp, weight);
289 jarl_flatsindcp->Fill(j, prior_weight*weight);
290 jarl_th23_flatsindcp->Fill(j, s2th23, prior_weight*weight);
297 const double prior_sindcp = randGen->Uniform(-1., 1.);
299 const double prior_s13 = std::sqrt(prior_s2th13);
300 const double prior_s23 = std::sqrt(prior_s2th23);
301 const double prior_s12 = std::sqrt(prior_s2th12);
302 const double prior_sdcp = std::sin(prior_dcp);
303 const double prior_c13 = std::sqrt(1.-prior_s2th13);
304 const double prior_c12 = std::sqrt(1.-prior_s2th12);
305 const double prior_c23 = std::sqrt(1.-prior_s2th23);
306 const double prior_j = prior_s13*prior_c13*prior_c13*prior_s12*prior_c12*prior_s23*prior_c23*prior_sdcp;
307 const double prior_flatsindcp_j = prior_s13*prior_c13*prior_c13*prior_s12*prior_c12*prior_s23*prior_c23*prior_sindcp;
309 jarl_prior->Fill(prior_j);
310 jarl_prior_flatsindcp->Fill(prior_flatsindcp_j);
313 const double prior_wRC_s2th13 = randGen->Gaus(Sin13_NewPrior.first, Sin13_NewPrior.second);
314 const double prior_wRC_s13 = std::sqrt(prior_wRC_s2th13);
315 const double prior_wRC_c13 = std::sqrt(1.-prior_wRC_s2th13);
316 const double prior_wRC_j = prior_wRC_s13*prior_wRC_c13*prior_wRC_c13*prior_s12*prior_c12*prior_s23*prior_c23*prior_sdcp;
317 const double prior_wRC_flatsindcp_j = prior_wRC_s13*prior_wRC_c13*prior_wRC_c13*prior_s12*prior_c12*prior_s23*prior_c23*prior_sindcp;
318 const double s23 = std::sqrt(s2th23);
319 const double c23 = std::sqrt(1.-s2th23);
321 jarl_wRC_prior->Fill(prior_wRC_j);
322 jarl_wRC_prior_flatsindcp->Fill(prior_wRC_flatsindcp_j);
323 jarl_wRC_prior_t2kth23->Fill(prior_wRC_s13*prior_wRC_c13*prior_wRC_c13*prior_s12*prior_c12*s23*c23*prior_sdcp);
327 jarl_NH->Fill(j, weight);
328 jarl_th23_NH->Fill(j, s2th23, weight);
329 jarl_dcp_NH->Fill(j, dcp, weight);
330 jarl_NH_flatsindcp->Fill(j, prior_weight*weight);
331 jarl_th23_NH_flatsindcp->Fill(j, s2th23, prior_weight*weight);
334 jarl_IH->Fill(j, weight);
335 jarl_th23_IH->Fill(j, s2th23, weight);
336 jarl_dcp_IH->Fill(j, dcp, weight);
337 jarl_IH_flatsindcp->Fill(j, prior_weight*weight);
338 jarl_th23_IH_flatsindcp->Fill(j, s2th23, prior_weight*weight);
342 jarl->Write(
"jarlskog_both");
343 jarl_NH->Write(
"jarlskog_NH");
344 jarl_IH->Write(
"jarlskog_IH");
345 jarl_th23->Write(
"jarlskog_th23_both");
346 jarl_th23_NH->Write(
"jarlskog_th23_NH");
347 jarl_th23_IH->Write(
"jarlskog_th23_IH");
349 jarl_dcp->Write(
"jarlskog_dcp_both");
350 jarl_dcp_NH->Write(
"jarlskog_dcp_NH");
351 jarl_dcp_IH->Write(
"jarlskog_dcp_IH");
354 jarl_flatsindcp->Write(
"jarlskog_both_flatsindcp");
355 jarl_NH_flatsindcp->Write(
"jarlskog_NH_flatsindcp");
356 jarl_IH_flatsindcp->Write(
"jarlskog_IH_flatsindcp");
357 jarl_th23_flatsindcp->Write(
"jarlskog_th23_both_flatsindcp");
358 jarl_th23_NH_flatsindcp->Write(
"jarlskog_th23_NH_flatsindcp");
359 jarl_th23_IH_flatsindcp->Write(
"jarlskog_th23_IH_flatsindcp");
361 jarl_prior->Write(
"jarl_prior");
362 jarl_prior_flatsindcp->Write(
"jarl_prior_flatsindcp");
364 jarl_wRC_prior->Write(
"jarl_wRC_prior");
365 jarl_wRC_prior_flatsindcp->Write(
"jarl_wRC_prior_flatsindcp");
366 jarl_wRC_prior_t2kth23->Write(
"jarl_wRC_prior_t2kth23");
370 jarl_NH, jarl_NH_flatsindcp,
371 jarl_IH, jarl_IH_flatsindcp);
376 SavageDickeyPlot(jarl_flatsindcp, jarl_wRC_prior_flatsindcp,
"Jarlskog flat sin#delta_{CP}", 0);
379 SavageDickeyPlot(jarl_flatsindcp, jarl_prior_flatsindcp,
"Jarlskog flat sin#delta_{CP}", 0);
382 JarlskogDir->Close();
385 Chain->SetBranchStatus(
"*",
true);
392 const std::unique_ptr<TH1D>& jarl_flatsindcp,
393 const std::unique_ptr<TH1D>& jarl_NH,
394 const std::unique_ptr<TH1D>& jarl_NH_flatsindcp,
395 const std::unique_ptr<TH1D>& jarl_IH,
396 const std::unique_ptr<TH1D>& jarl_IH_flatsindcp) {
399 int originalErrorLevel = gErrorIgnoreLevel;
400 gErrorIgnoreLevel = kFatal;
403 for(
int hierarchy = -1; hierarchy <= 1; hierarchy++)
405 std::unique_ptr<TH1D> j_hist;
406 std::unique_ptr<TH1D> j_hist_sdcp;
409 j_hist_sdcp =
M3::Clone(jarl_NH_flatsindcp.get(),
"");
410 j_hist->SetTitle(
";J_{CP} #equiv s_{13}c^{2}_{13}s_{12}c_{12}s_{23}c_{23}sin#delta_{CP};Posterior probability");
411 }
else if(hierarchy == 0) {
413 j_hist_sdcp =
M3::Clone(jarl_flatsindcp.get(),
"");
414 j_hist->SetTitle(
";J_{CP} #equiv s_{13}c^{2}_{13}s_{12}c_{12}s_{23}c_{23}sin#delta_{CP};Posterior probability");
415 }
else if(hierarchy == -1) {
417 j_hist_sdcp =
M3::Clone(jarl_IH_flatsindcp.get(),
"");
418 j_hist->SetTitle(
";J_{CP} #equiv s_{13}c^{2}_{13}s_{12}c_{12}s_{23}c_{23}sin#delta_{CP};Posterior probability");
420 MACH3LOG_ERROR(
"Invalid hierarchy option. 1 for NH, 0 for both, -1 for IH");
425 j_hist_sdcp->Rebin(7);
427 j_hist->SetLineColor(kAzure-2);
428 j_hist_sdcp->SetLineColor(kOrange+1);
429 j_hist->SetLineWidth(2);
430 j_hist_sdcp->SetLineWidth(2);
432 auto StyleAxis = [](TH1* h) {
433 auto xAxis = h->GetXaxis();
434 auto yAxis = h->GetYaxis();
436 xAxis->SetLabelSize(0.04);
437 xAxis->SetLabelFont(132);
438 xAxis->SetTitleSize(0.04);
439 xAxis->SetTitleOffset(0.80);
440 xAxis->SetTitleFont(132);
441 xAxis->SetNdivisions(505);
442 xAxis->SetTickSize(0.04);
444 yAxis->SetLabelSize(0.04);
445 yAxis->SetLabelFont(132);
446 yAxis->SetTitleSize(0.04);
447 yAxis->SetTitleOffset(1.2);
448 yAxis->SetTitleFont(132);
449 yAxis->SetNdivisions(505);
450 yAxis->SetTickSize(0.04);
453 StyleAxis(j_hist.get());
455 j_hist->GetXaxis()->SetRangeUser(-0.04,0.04);
456 j_hist->Scale(1./j_hist->Integral());
457 j_hist_sdcp->Scale(1./j_hist_sdcp->Integral());
459 std::unique_ptr<TH1D> j_hist_copy =
M3::Clone(j_hist.get(),
"j_hist_copy");
460 std::unique_ptr<TH1D> j_hist_1sig =
M3::Clone(j_hist.get(),
"j_hist_1sig");
461 std::unique_ptr<TH1D> j_hist_2sig =
M3::Clone(j_hist.get(),
"j_hist_2sig");
462 std::unique_ptr<TH1D> j_hist_3sig =
M3::Clone(j_hist.get(),
"j_hist_3sig");
465 double j_bf = j_hist_copy->GetXaxis()->GetBinCenter(j_hist_copy->GetMaximumBin());
466 double j_1sig_low = 9999999.;
467 double j_1sig_up = -9999999.;
468 double j_2sig_low = 9999999.;;
469 double j_2sig_up = -9999999.;
470 double j_3sig_low = 9999999.;;
471 double j_3sig_up = -9999999.;
474 std::unique_ptr<TH1D> j_hist_sdcp_copy =
M3::Clone(j_hist_sdcp.get(),
"j_hist_sdcp_copy");
475 std::unique_ptr<TH1D> j_hist_sdcp_1sig =
M3::Clone(j_hist_sdcp.get(),
"j_hist_sdcp_1sig");
476 std::unique_ptr<TH1D> j_hist_sdcp_2sig =
M3::Clone(j_hist_sdcp.get(),
"j_hist_sdcp_2sig");
477 std::unique_ptr<TH1D> j_hist_sdcp_3sig =
M3::Clone(j_hist_sdcp.get(),
"j_hist_sdcp_3sig");
480 double j_sdcp_1sig_low = 9999999.;
481 double j_sdcp_1sig_up = -9999999.;
482 double j_sdcp_2sig_low = 9999999.;;
483 double j_sdcp_2sig_up = -9999999.;
484 double j_sdcp_3sig_low = 9999999.;;
485 double j_sdcp_3sig_up = -9999999.;
487 double contlevel1 = 0.68;
488 double contlevel2 = 0.90;
489 double contlevel4 = 0.99;
490 double contlevel5 = 0.9973;
491 double integral, tsum = 0.;
493 integral = j_hist_copy->Integral();
495 while((tsum/integral)<contlevel5) {
496 double tmax = j_hist_copy->GetMaximum();
497 int bin = j_hist_copy->GetMaximumBin();
498 double xval = j_hist_copy->GetXaxis()->GetBinCenter(bin);
499 double xwidth = j_hist_copy->GetXaxis()->GetBinWidth(bin);
500 if((tsum/integral)<contlevel1) {
501 j_hist_copy->SetBinContent(bin,-1.0);
502 j_hist_1sig->SetBinContent(bin,0.);
503 j_hist_2sig->SetBinContent(bin,0.);
504 j_hist_3sig->SetBinContent(bin,0.);
505 if(xval<j_1sig_low && xval<j_bf) j_1sig_low = xval - xwidth/2.;
506 if(xval>j_1sig_up && xval>j_bf) j_1sig_up = xval + xwidth/2.;
508 if((tsum/integral)<contlevel2 && (tsum / integral > contlevel1) ) {
509 j_hist_copy->SetBinContent(bin,-5.0);
510 j_hist_2sig->SetBinContent(bin,0.);
511 j_hist_3sig->SetBinContent(bin,0.);
512 if(xval<j_2sig_low && xval<j_bf) j_2sig_low = xval - xwidth/2.;
513 if(xval>j_2sig_up && xval>j_bf) j_2sig_up = xval + xwidth/2.;
515 if((tsum/integral)<contlevel4 && (tsum / integral > contlevel1) ) {
516 j_hist_copy->SetBinContent(bin,-9.0);
517 j_hist_3sig->SetBinContent(bin,0.);
518 if(xval < j_3sig_low && xval <j_bf) j_3sig_low = xval - xwidth/2.;
519 if(xval > j_3sig_up && xval > j_bf) j_3sig_up = xval + xwidth/2.;
524 integral = j_hist_sdcp_copy->Integral();
527 while((tsum/integral)<contlevel5) {
528 double tmax = j_hist_sdcp_copy->GetMaximum();
529 int bin = j_hist_sdcp_copy->GetMaximumBin();
530 double xval = j_hist_sdcp_copy->GetXaxis()->GetBinCenter(bin);
531 double xwidth = j_hist_sdcp_copy->GetXaxis()->GetBinWidth(bin);
532 if((tsum/integral)<contlevel1) {
533 j_hist_sdcp_copy->SetBinContent(bin,-1.0);
534 j_hist_sdcp_1sig->SetBinContent(bin,0.);
535 j_hist_sdcp_2sig->SetBinContent(bin,0.);
536 j_hist_sdcp_3sig->SetBinContent(bin,0.);
537 if(xval<j_sdcp_1sig_low && xval<j_bf) j_sdcp_1sig_low = xval - xwidth/2.;
538 if(xval>j_sdcp_1sig_up && xval>j_bf) j_sdcp_1sig_up = xval + xwidth/2.;
540 if((tsum/integral)<contlevel2 && (tsum / integral > contlevel1) ) {
541 j_hist_sdcp_copy->SetBinContent(bin,-5.0);
542 j_hist_sdcp_2sig->SetBinContent(bin,0.);
543 j_hist_sdcp_3sig->SetBinContent(bin,0.);
544 if(xval<j_sdcp_2sig_low && xval<j_bf) j_sdcp_2sig_low = xval - xwidth/2.;
545 if(xval>j_sdcp_2sig_up && xval>j_bf) j_sdcp_2sig_up = xval + xwidth/2.;
547 if((tsum/integral)<contlevel4 && (tsum / integral > contlevel1) ) {
548 j_hist_sdcp_copy->SetBinContent(bin,-9.0);
549 j_hist_sdcp_3sig->SetBinContent(bin,0.);
550 if(xval<j_sdcp_3sig_low && xval<j_bf) j_sdcp_3sig_low = xval - xwidth/2.;
551 if(xval>j_sdcp_3sig_up && xval>j_bf) j_sdcp_3sig_up = xval + xwidth/2.;
556 j_hist_1sig->SetLineStyle(9);
557 j_hist_sdcp_1sig->SetLineStyle(9);
558 j_hist_2sig->SetLineStyle(7);
559 j_hist_sdcp_2sig->SetLineStyle(7);
560 j_hist_3sig->SetLineStyle(2);
561 j_hist_sdcp_3sig->SetLineStyle(2);
563 auto ldash = std::make_unique<TH1D>(
"ldash",
"solid", 10, -0.04, 0.04);
564 auto sdash = std::make_unique<TH1D>(
"sdash",
"dashed", 10, -0.04, 0.04);
565 auto fdash = std::make_unique<TH1D>(
"fdash",
"fdashed",10, -0.04, 0.04);
566 ldash->SetLineColor(kBlack);
567 sdash->SetLineColor(kBlack);
568 fdash->SetLineColor(kBlack);
569 ldash->SetLineWidth(2);
570 sdash->SetLineWidth(2);
571 fdash->SetLineWidth(2);
572 ldash->SetLineStyle(9);
573 sdash->SetLineStyle(7);
574 fdash->SetLineStyle(2);
576 double vertUp = 0.5 * j_hist->GetMaximum();
577 auto jline_1sig_low = std::make_unique<TLine>(j_1sig_low, 0., j_1sig_low, vertUp);
578 auto jline_2sig_low = std::make_unique<TLine>(j_2sig_low, 0., j_2sig_low, vertUp);
579 auto jline_3sig_low = std::make_unique<TLine>(j_3sig_low, 0., j_3sig_low, vertUp);
581 auto jline_1sig_up = std::make_unique<TLine>(j_1sig_up, 0., j_1sig_up,vertUp);
582 auto jline_2sig_up = std::make_unique<TLine>(j_2sig_up, 0., j_2sig_up,vertUp);
583 auto jline_3sig_up = std::make_unique<TLine>(j_3sig_up, 0., j_3sig_up,vertUp);
585 auto jline_sdcp_1sig_low = std::make_unique<TLine>(j_sdcp_1sig_low, 0., j_sdcp_1sig_low, vertUp);
586 auto jline_sdcp_2sig_low = std::make_unique<TLine>(j_sdcp_2sig_low, 0., j_sdcp_2sig_low, vertUp);
587 auto jline_sdcp_3sig_low = std::make_unique<TLine>(j_sdcp_3sig_low, 0., j_sdcp_3sig_low, vertUp);
589 auto jline_sdcp_1sig_up = std::make_unique<TLine>(j_sdcp_1sig_up, 0., j_sdcp_1sig_up, vertUp);
590 auto jline_sdcp_2sig_up = std::make_unique<TLine>(j_sdcp_2sig_up, 0., j_sdcp_2sig_up, vertUp);
591 auto jline_sdcp_3sig_up = std::make_unique<TLine>(j_sdcp_3sig_up, 0., j_sdcp_3sig_up, vertUp);
593 double arrowLength = 0.003;
594 double arrowHeight = vertUp;
596 auto MakeArrow = [&](
double x, Color_t color, Width_t width) -> std::unique_ptr<TArrow> {
597 auto arrow = std::make_unique<TArrow>(x, arrowHeight, x - arrowLength, arrowHeight, 0.02,
">");
598 arrow->SetLineColor(color);
599 arrow->SetLineWidth(width);
603 auto j_arrow_1sig_up = MakeArrow(j_1sig_up, j_hist_1sig->GetLineColor(), j_hist_1sig->GetLineWidth());
604 auto j_arrow_2sig_up = MakeArrow(j_2sig_up, j_hist_2sig->GetLineColor(), j_hist_2sig->GetLineWidth());
605 auto j_arrow_3sig_up = MakeArrow(j_3sig_up, j_hist_3sig->GetLineColor(), j_hist_3sig->GetLineWidth());
607 auto j_sdcp_arrow_1sig_up = MakeArrow(j_sdcp_1sig_up, j_hist_sdcp_1sig->GetLineColor(), j_hist_sdcp_1sig->GetLineWidth());
608 auto j_sdcp_arrow_2sig_up = MakeArrow(j_sdcp_2sig_up, j_hist_sdcp_2sig->GetLineColor(), j_hist_sdcp_2sig->GetLineWidth());
609 auto j_sdcp_arrow_3sig_up = MakeArrow(j_sdcp_3sig_up, j_hist_sdcp_3sig->GetLineColor(), j_hist_sdcp_3sig->GetLineWidth());
611 MACH3LOG_DEBUG(
"j_1sig_low = {:.4f}, j_2sig_low = {:.4f}, j_3sig_low = {:.4f}", j_1sig_low, j_2sig_low, j_3sig_low);
612 MACH3LOG_DEBUG(
"j_1sig_up = {:.4f}, j_2sig_up = {:.4f}, j_3sig_up = {:.4f}", j_1sig_up, j_2sig_up, j_3sig_up);
614 auto CopyLineStyle = [](
const TH1D* src, TLine* dst) {
615 dst->SetLineColor(src->GetLineColor());
616 dst->SetLineStyle(src->GetLineStyle());
617 dst->SetLineWidth(src->GetLineWidth());
620 CopyLineStyle(j_hist_1sig.get(), jline_1sig_low.get());
621 CopyLineStyle(j_hist_1sig.get(), jline_1sig_up.get());
622 CopyLineStyle(j_hist_2sig.get(), jline_2sig_low.get());
623 CopyLineStyle(j_hist_2sig.get(), jline_2sig_up.get());
624 CopyLineStyle(j_hist_3sig.get(), jline_3sig_low.get());
625 CopyLineStyle(j_hist_3sig.get(), jline_3sig_up.get());
627 CopyLineStyle(j_hist_sdcp_1sig.get(), jline_sdcp_1sig_low.get());
628 CopyLineStyle(j_hist_sdcp_1sig.get(), jline_sdcp_1sig_up.get());
629 CopyLineStyle(j_hist_sdcp_2sig.get(), jline_sdcp_2sig_low.get());
630 CopyLineStyle(j_hist_sdcp_2sig.get(), jline_sdcp_2sig_up.get());
631 CopyLineStyle(j_hist_sdcp_3sig.get(), jline_sdcp_3sig_low.get());
632 CopyLineStyle(j_hist_sdcp_3sig.get(), jline_sdcp_3sig_up.get());
634 auto leg = std::make_unique<TLegend>(0.45, 0.60, 0.75, 0.90);
635 leg->SetTextSize(0.05);
636 leg->SetFillStyle(0);
638 leg->SetTextFont(132);
639 leg->SetBorderSize(0);
641 leg->AddEntry(j_hist.get(),
"Prior flat in #delta_{CP}",
"l");
642 leg->AddEntry(j_hist_sdcp.get(),
"Prior flat in sin#delta_{CP}",
"l");
643 leg->AddEntry(ldash.get(),
"68% CI",
"l");
644 leg->AddEntry(sdash.get(),
"90% CI",
"l");
645 leg->AddEntry(fdash.get(),
"99% CI",
"l");
647 j_hist->GetYaxis()->SetRangeUser(0., j_hist->GetMaximum()*1.15);
649 j_hist_sdcp->Draw(
"same h");
651 jline_sdcp_1sig_up->Draw(
"same");
652 jline_sdcp_2sig_up->Draw(
"same");
653 jline_sdcp_3sig_up->Draw(
"same");
654 jline_1sig_up->Draw(
"same");
655 jline_2sig_up->Draw(
"same");
656 jline_3sig_up->Draw(
"same");
658 j_arrow_1sig_up->Draw();
659 j_arrow_2sig_up->Draw();
660 j_arrow_3sig_up->Draw();
661 j_sdcp_arrow_1sig_up->Draw();
662 j_sdcp_arrow_2sig_up->Draw();
663 j_sdcp_arrow_3sig_up->Draw();
666 auto ttext = std::make_unique<TText>();
668 ttext->SetTextSize(0.03);
669 ttext->SetTextAlign(13);
671 if (hierarchy == 1) ttext->DrawText(0.15, 0.85,
"Normal Ordering");
672 else if (hierarchy == 0) ttext->DrawText(0.15, 0.85,
"Both Orderings");
673 else if (hierarchy == -1) ttext->DrawText(0.15, 0.85,
"Inverted Ordering");
681 if(hierarchy == 1)
Posterior->Write(
"jarl1D_NH_comp");
682 else if(hierarchy == 0)
Posterior->Write(
"jarl1D_both_comp");
683 else if(hierarchy == -1)
Posterior->Write(
"jarl1D_IH_comp");
686 gErrorIgnoreLevel = originalErrorLevel;
694 MACH3LOG_WARN(
"Will not {}, as oscillation parameters are missing", __func__);
702 const double sigma_p = (*Errors_HPD_Positive)(
DeltaCPIndex);
703 const double sigma_n = (*Errors_HPD_Negative)(
DeltaCPIndex);
705 auto wrap_pi = [](
double x) {
706 while (x > TMath::Pi()) x -= 2*TMath::Pi();
707 while (x < -TMath::Pi()) x += 2*TMath::Pi();
711 std::array<double, 6> bds;
712 bds[0] = wrap_pi(best_fit - 3.0 * sigma_n);
713 bds[1] = wrap_pi(best_fit - 2.0 * sigma_n);
714 bds[2] = wrap_pi(best_fit - 1.0 * sigma_n);
715 bds[3] = wrap_pi(best_fit + 1.0 * sigma_p);
716 bds[4] = wrap_pi(best_fit + 2.0 * sigma_p);
717 bds[5] = wrap_pi(best_fit + 3.0 * sigma_p);
719 constexpr
double radius = 0.4;
720 constexpr
double rad_to_deg = 180.0 / TMath::Pi();
725 auto normalize_angle = [](
double rad) {
727 if (rad < 0) rad += 2.0 * TMath::Pi();
731 TEllipse onesig (0.5, 0.5, radius, radius, bds[2] * rad_to_deg, bds[4] * rad_to_deg);
732 TEllipse twosigA (0.5, 0.5, radius, radius, bds[1] * rad_to_deg, bds[2] * rad_to_deg);
733 TEllipse twosigB (0.5, 0.5, radius, radius, bds[3] * rad_to_deg, bds[4] * rad_to_deg);
736 TEllipse threesigA(0.5, 0.5, radius, radius, bds[0] * rad_to_deg, normalize_angle(bds[1]) * rad_to_deg);
737 TEllipse threesigB(0.5, 0.5, radius, radius, bds[4] * rad_to_deg, bds[5] * rad_to_deg);
740 TEllipse rest(0.5, 0.5, radius, radius, bds[5]*rad_to_deg, bds[0]*rad_to_deg);
741 TEllipse restA(0.5, 0.5, radius, radius, bds[5]*rad_to_deg, 180.0);
742 TEllipse restB(0.5, 0.5, radius, radius, -180.0, bds[0]*rad_to_deg);
744 onesig.SetFillColor(13);
745 twosigA.SetFillColor(12);
746 twosigB.SetFillColor(12);
747 threesigA.SetFillColor(11);
748 threesigB.SetFillColor(11);
749 TLine line1(0.5 - radius, 0.5, 0.5 + radius, 0.5);
750 line1.SetLineWidth(3);
752 TLine line2(0.5, 0.5 - radius, 0.5, 0.5 + radius);
753 line2.SetLineWidth(3);
755 TArrow bf(0.5, 0.5, 0.5 + radius * cos(best_fit),0.5 + radius * sin(best_fit),0.04,
"|>");
757 bf.SetLineColor(kRed);
758 bf.SetFillColor(kRed);
760 TCanvas canvas(
"canvas",
"canvas", 0, 0, 1000, 1000);
781 TLegend leg(0.0, 0.8, 0.23, 0.95);
782 leg.AddEntry(&bf,
"Best Fit",
"L");
783 leg.AddEntry(&onesig,
"1#sigma",
"F");
784 leg.AddEntry(&twosigA,
"2#sigma",
"F");
785 leg.AddEntry(&threesigA,
"3#sigma",
"F");
789 auto draw_text = [](
auto& txt, Color_t color = kBlack) {
790 txt.SetTextAlign(22);
791 txt.SetTextColor(color);
800 constexpr
double too_close_threshold = 0.1;
803 const double tbf_x = 0.5 + (radius + 0.02) * cos(best_fit);
804 const double tbf_y = 0.5 + (radius + 0.02) * sin(best_fit);
807 auto distance = [](
double x1,
double y1,
double x2,
double y2) {
808 return std::sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
812 constexpr
double t0_x = 0.5 + radius + 0.02;
813 constexpr
double t0_y = 0.5;
814 TText t0(t0_x, t0_y,
"0");
815 if (distance(tbf_x, tbf_y, t0_x, t0_y) > too_close_threshold) {
820 constexpr
double tp_x = 0.5 - radius - 0.02;
821 constexpr
double tp_y = 0.5;
822 TLatex tp(tp_x, tp_y,
"#pi");
823 if (distance(tbf_x, tbf_y, tp_x, tp_y) > too_close_threshold) {
828 constexpr
double tp2_x = 0.5;
829 constexpr
double tp2_y = 0.5 + radius + 0.04;
830 TLatex tp2(tp2_x, tp2_y,
"#frac{#pi}{2}");
831 if (distance(tbf_x, tbf_y, tp2_x, tp2_y) > too_close_threshold) {
836 constexpr
double tmp2_x = 0.5;
837 constexpr
double tmp2_y = 0.5 - radius - 0.04;
838 TLatex tmp2(tmp2_x, tmp2_y,
"-#frac{#pi}{2}");
839 if (distance(tbf_x, tbf_y, tmp2_x, tmp2_y) > too_close_threshold) {
843 TLatex tbf(0.5 + (radius + 0.02) * cos(best_fit),
844 0.5 + (radius + 0.02) * sin(best_fit),
845 fmt::format(
"{:.2f}", best_fit).c_str());
846 draw_text(tbf, kRed);
855 const double s13 = std::sqrt(s2th13);
856 const double s23 = std::sqrt(s2th23);
857 const double s12 = std::sqrt(s2th12);
859 const double sdcp = std::sin(dcp);
860 const double cdcp = std::cos(dcp);
862 const double c13 = std::sqrt(1.-s2th13);
863 const double c12 = std::sqrt(1.-s2th12);
864 const double c23 = std::sqrt(1.-s2th23);
868 real_ue[0] = c12*c13;
870 real_ue[1] = s12*c13;
872 real_ue[2] = s13*cdcp;
873 imag_ue[2] = -s13*sdcp;
877 real_umu[0] = -s12*c23 - c12*s23*s13*cdcp;
878 imag_umu[0] = -c12*s23*s13*sdcp;
879 real_umu[1] = c12*c23 - s12*s23*s13*cdcp;
880 imag_umu[1] = -s12*s23*s13*sdcp;
881 real_umu[2] = s23*c13;
886 real_utau[0] = s12*s23 - c12*c23*s13*cdcp;
887 imag_utau[0] = -c12*c23*s13*sdcp;
888 real_utau[1] = -c12*s23 - s12*c23*s13*cdcp;
889 imag_utau[1] = -s12*c23*s13*sdcp;
890 real_utau[2] = c23*c13;
894 for (
int i = 0; i < 3; i++) {
895 U[0][i] = TComplex(real_ue[i], imag_ue[i]);
896 U[1][i] = TComplex(real_umu[i], imag_umu[i]);
897 U[2][i] = TComplex(real_utau[i], imag_utau[i]);
900 return {{{U[0][0], U[0][1], U[0][2]}, {U[1][0], U[1][1], U[1][2]}, {U[2][0], U[2][1], U[2][2]}}};
913 MACH3LOG_WARN(
"Will not {}, as oscillation parameters are missing", __func__);
921 TDirectory *PMNSElementsDir =
OutputFile->mkdir(
"PMNSElements");
922 PMNSElementsDir->cd();
924 unsigned int step = 0;
925 Chain->SetBranchStatus(
"*",
false);
939 Chain->SetBranchStatus(
"step",
true);
940 Chain->SetBranchAddress(
"step", &step);
942 if (
Chain->GetBranch(
"Weight")) {
943 Chain->SetBranchStatus(
"Weight",
true);
944 Chain->SetBranchAddress(
"Weight", &weight);
949 constexpr
int n_bins = 1000;
951 std::unique_ptr<TH1D> h_ue[3];
952 std::unique_ptr<TH1D> h_umu[3];
953 std::unique_ptr<TH1D> h_utau[3];
955 std::unique_ptr<TH1D> h_ue_real[3];
956 std::unique_ptr<TH1D> h_umu_real[3];
957 std::unique_ptr<TH1D> h_utau_real[3];
959 std::unique_ptr<TH1D> h_ue_imag[3];
960 std::unique_ptr<TH1D> h_umu_imag[3];
961 std::unique_ptr<TH1D> h_utau_imag[3];
963 std::unique_ptr<TH2D> h_ue_s2th12[3];
964 std::unique_ptr<TH2D> h_umu_s2th12[3];
965 std::unique_ptr<TH2D> h_utau_s2th12[3];
967 std::unique_ptr<TH2D> h_ue_s2th13[3];
968 std::unique_ptr<TH2D> h_umu_s2th13[3];
969 std::unique_ptr<TH2D> h_utau_s2th13[3];
971 std::unique_ptr<TH2D> h_ue_s2th23[3];
972 std::unique_ptr<TH2D> h_umu_s2th23[3];
973 std::unique_ptr<TH2D> h_utau_s2th23[3];
975 std::unique_ptr<TH2D> h_ue_dcp[3];
976 std::unique_ptr<TH2D> h_umu_dcp[3];
977 std::unique_ptr<TH2D> h_utau_dcp[3];
979 for (
int iU = 0; iU < 3; iU++) {
980 h_ue[iU] = std::make_unique<TH1D>(Form(
"h_ue%d", iU+1), Form(
";|U_{e%d}|", iU+1), n_bins, 0., 1.);
981 h_ue[iU]->SetDirectory(
nullptr);
982 h_umu[iU] = std::make_unique<TH1D>(Form(
"h_umu%d", iU+1), Form(
";|U_{#mu%d}|", iU+1), n_bins, 0., 1.);
983 h_umu[iU]->SetDirectory(
nullptr);
984 h_utau[iU] = std::make_unique<TH1D>(Form(
"h_utau%d", iU+1), Form(
";|U_{#tau%d}|", iU+1), n_bins, 0., 1.);
985 h_utau[iU]->SetDirectory(
nullptr);
987 h_ue_real[iU] = std::make_unique<TH1D>(Form(
"h_ue%d_real", iU+1), Form(
";Re(U_{e%d})", iU+1), n_bins, -1., 1.);
988 h_ue_real[iU]->SetDirectory(
nullptr);
989 h_umu_real[iU] = std::make_unique<TH1D>(Form(
"h_umu%d_real", iU+1), Form(
";Re(U_{#mu%d})", iU+1), n_bins, -1., 1.);
990 h_umu_real[iU]->SetDirectory(
nullptr);
991 h_utau_real[iU] = std::make_unique<TH1D>(Form(
"h_utau%d_real", iU+1), Form(
";Re(U_{#tau%d})", iU+1), n_bins, -1., 1.);
992 h_utau_real[iU]->SetDirectory(
nullptr);
994 h_ue_imag[iU] = std::make_unique<TH1D>(Form(
"h_ue%d_imag", iU+1), Form(
";Im(U_{e%d})", iU+1), n_bins, -1., 1.);
995 h_ue_imag[iU]->SetDirectory(
nullptr);
996 h_umu_imag[iU] = std::make_unique<TH1D>(Form(
"h_umu%d_imag", iU+1), Form(
";Im(U_{#mu%d})", iU+1), n_bins, -1., 1.);
997 h_umu_imag[iU]->SetDirectory(
nullptr);
998 h_utau_imag[iU] = std::make_unique<TH1D>(Form(
"h_utau%d_imag", iU+1), Form(
";Im(U_{#tau%d})", iU+1), n_bins, -1., 1.);
999 h_utau_imag[iU]->SetDirectory(
nullptr);
1001 h_ue_s2th12[iU] = std::make_unique<TH2D>(Form(
"h_ue%d_s2th12", iU+1), Form(
";|U_{e%d}|;sin^{2}(#theta_{12})", iU+1),
1002 n_bins, 0., 1., n_bins, 0.15, 0.5);
1003 h_ue_s2th12[iU]->SetDirectory(
nullptr);
1004 h_umu_s2th12[iU] = std::make_unique<TH2D>(Form(
"h_umu%d_s2th12", iU+1), Form(
";|U_{#mu%d}|;sin^{2}(#theta_{12})", iU+1),
1005 n_bins, 0., 1., n_bins, 0.15, 0.5);
1006 h_umu_s2th12[iU]->SetDirectory(
nullptr);
1007 h_utau_s2th12[iU] = std::make_unique<TH2D>(Form(
"h_utau%d_s2th12", iU+1), Form(
";|U_{#tau%d}|;sin^{2}(#theta_{12})", iU+1),
1008 n_bins, 0., 1., n_bins, 0.15, 0.5);
1009 h_utau_s2th12[iU]->SetDirectory(
nullptr);
1012 h_ue_s2th13[iU] = std::make_unique<TH2D>(Form(
"h_ue%d_s2th13", iU+1), Form(
";|U_{e%d}|;sin^{2}(#theta_{13})", iU+1),
1013 n_bins, 0., 1., n_bins, 0., 0.1);
1014 h_ue_s2th13[iU]->SetDirectory(
nullptr);
1015 h_umu_s2th13[iU] = std::make_unique<TH2D>(Form(
"h_umu%d_s2th13", iU+1), Form(
";|U_{#mu%d}|;sin^{2}(#theta_{13})", iU+1),
1016 n_bins, 0., 1., n_bins, 0., 0.1);
1017 h_umu_s2th13[iU]->SetDirectory(
nullptr);
1018 h_utau_s2th13[iU] = std::make_unique<TH2D>(Form(
"h_utau%d_s2th13", iU+1), Form(
";|U_{#tau%d}|;sin^{2}(#theta_{13})", iU+1),
1019 n_bins, 0., 1., n_bins, 0., 0.1);
1020 h_utau_s2th13[iU]->SetDirectory(
nullptr);
1023 h_ue_s2th23[iU] = std::make_unique<TH2D>(Form(
"h_ue%d_s2th23", iU+1), Form(
";|U_{e%d}|;sin^{2}(#theta_{23})", iU+1),
1024 n_bins, 0., 1., n_bins, 0.3, 0.8);
1025 h_ue_s2th23[iU]->SetDirectory(
nullptr);
1026 h_umu_s2th23[iU] = std::make_unique<TH2D>(Form(
"h_umu%d_s2th23", iU+1), Form(
";|U_{#mu%d}|;sin^{2}(#theta_{23})", iU+1),
1027 n_bins, 0., 1., n_bins, 0.3, 0.8);
1028 h_umu_s2th23[iU]->SetDirectory(
nullptr);
1029 h_utau_s2th23[iU] = std::make_unique<TH2D>(Form(
"h_utau%d_s2th23", iU+1), Form(
";|U_{#tau%d}|;sin^{2}(#theta_{23})", iU+1),
1030 n_bins, 0., 1., n_bins, 0.3, 0.8);
1031 h_utau_s2th23[iU]->SetDirectory(
nullptr);
1034 h_ue_dcp[iU] = std::make_unique<TH2D>(Form(
"h_ue%d_dcp", iU+1), Form(
";|U_{e%d}|;#delta_{CP}", iU+1),
1035 n_bins, 0., 1., n_bins, -TMath::Pi(), TMath::Pi());
1036 h_ue_dcp[iU]->SetDirectory(
nullptr);
1037 h_umu_dcp[iU] = std::make_unique<TH2D>(Form(
"h_umu%d_dcp", iU+1), Form(
";|U_{#mu%d}|;#delta_{CP}", iU+1),
1038 n_bins, 0., 1., n_bins, -TMath::Pi(), TMath::Pi());
1039 h_umu_dcp[iU]->SetDirectory(
nullptr);
1040 h_utau_dcp[iU] = std::make_unique<TH2D>(Form(
"h_utau%d_dcp", iU+1), Form(
";|U_{#tau%d}|;#delta_{CP}", iU+1),
1041 n_bins, 0., 1., n_bins, -TMath::Pi(), TMath::Pi());
1042 h_utau_dcp[iU]->SetDirectory(
nullptr);
1046 std::vector<std::unique_ptr<TH2D>> h_UU;
1047 std::string U_names[9] = {
"ue1",
"ue2",
"ue3",
"umu1",
"umu2",
"umu3",
"utau1",
"utau2",
"utau3"};
1048 std::string U_tex[9] = {
"|U_{e1}|",
"|U_{e2}|",
"|U_{e3}|",
"|U_{#mu1}|",
"|U_{#mu2}|",
"|U_{#mu3}|",
"|U_{#tau1}|",
"|U_{#tau2}|",
"|U_{#tau3}|"};
1049 for(
int i=0; i < 9; ++i){
1050 for(
int j = i+1; j < 9; ++j){
1051 std::string name =
"h_" + U_names[i] +
"_" + U_names[j];
1052 std::string title =
";" + U_tex[i] +
";" + U_tex[j];
1053 h_UU.push_back(std::make_unique<TH2D>(name.c_str(), title.c_str(), n_bins, 0., 1., n_bins, 0., 1.));
1054 h_UU.back()->SetDirectory(
nullptr);
1057 const Long64_t countwidth =
nEntries/5;
1058 for(
int i = 0; i <
nEntries; i++) {
1059 if (i % countwidth == 0) {
1068 const std::array<std::array<TComplex, 3>, 3> U =
CalculatePMNSElements(s2th13, s2th23, s2th12, dcp);
1070 for(
int iU = 0; iU < 3; iU++){
1071 h_ue[iU]->Fill(TComplex::Abs(U[0][iU]), weight);
1072 h_umu[iU]->Fill(TComplex::Abs(U[1][iU]), weight);
1073 h_utau[iU]->Fill(TComplex::Abs(U[2][iU]), weight);
1075 h_ue_real[iU]->Fill(U[0][iU].Re(), weight);
1076 h_umu_real[iU]->Fill(U[1][iU].Re(), weight);
1077 h_utau_real[iU]->Fill(U[2][iU].Re(), weight);
1079 h_ue_imag[iU]->Fill(U[0][iU].Im(), weight);
1080 h_umu_imag[iU]->Fill(U[1][iU].Im(), weight);
1081 h_utau_imag[iU]->Fill(U[2][iU].Im(), weight);
1083 h_ue_s2th12[iU]->Fill(TComplex::Abs(U[0][iU]), s2th12, weight);
1084 h_umu_s2th12[iU]->Fill(TComplex::Abs(U[1][iU]), s2th12, weight);
1085 h_utau_s2th12[iU]->Fill(TComplex::Abs(U[2][iU]), s2th12, weight);
1087 h_ue_s2th13[iU]->Fill(TComplex::Abs(U[0][iU]), s2th13, weight);
1088 h_umu_s2th13[iU]->Fill(TComplex::Abs(U[1][iU]), s2th13, weight);
1089 h_utau_s2th13[iU]->Fill(TComplex::Abs(U[2][iU]), s2th13, weight);
1091 h_ue_s2th23[iU]->Fill(TComplex::Abs(U[0][iU]), s2th23, weight);
1092 h_umu_s2th23[iU]->Fill(TComplex::Abs(U[1][iU]), s2th23, weight);
1093 h_utau_s2th23[iU]->Fill(TComplex::Abs(U[2][iU]), s2th23, weight);
1095 h_ue_dcp[iU]->Fill(TComplex::Abs(U[0][iU]), dcp, weight);
1096 h_umu_dcp[iU]->Fill(TComplex::Abs(U[1][iU]), dcp, weight);
1097 h_utau_dcp[iU]->Fill(TComplex::Abs(U[2][iU]), dcp, weight);
1101 double U_mod[9] = {TComplex::Abs(U[0][0]), TComplex::Abs(U[0][1]), TComplex::Abs(U[0][2]), TComplex::Abs(U[1][0]), TComplex::Abs(U[1][1]), TComplex::Abs(U[1][2]), TComplex::Abs(U[2][0]), TComplex::Abs(U[2][1]), TComplex::Abs(U[2][2])};
1103 for(
int ix = 0; ix < 9; ++ix){
1104 for(
int iy = ix+1; iy<9; ++iy){
1105 h_UU[idx]->Fill(U_mod[ix], U_mod[iy], weight);
1112 PMNSElementsDir->cd();
1114 for (
int iU = 0; iU < 3; iU++) {
1115 h_ue[iU]->Write(Form(
"h_ue%d", iU+1));
1116 h_umu[iU]->Write(Form(
"h_umu%d", iU+1));
1117 h_utau[iU]->Write(Form(
"h_utau%d", iU+1));
1119 h_ue_real[iU]->Write(Form(
"h_ue%d_real", iU+1));
1120 h_umu_real[iU]->Write(Form(
"h_umu%d_real", iU+1));
1121 h_utau_real[iU]->Write(Form(
"h_utau%d_real", iU+1));
1123 h_ue_imag[iU]->Write(Form(
"h_ue%d_imag", iU+1));
1124 h_umu_imag[iU]->Write(Form(
"h_umu%d_imag", iU+1));
1125 h_utau_imag[iU]->Write(Form(
"h_utau%d_imag", iU+1));
1127 h_ue_s2th12[iU]->Write(Form(
"h_ue%d_s2th12", iU+1));
1128 h_umu_s2th12[iU]->Write(Form(
"h_umu%d_s2th12", iU+1));
1129 h_utau_s2th12[iU]->Write(Form(
"h_utau%d_s2th12", iU+1));
1131 h_ue_s2th13[iU]->Write(Form(
"h_ue%d_s2th13", iU+1));
1132 h_umu_s2th13[iU]->Write(Form(
"h_umu%d_s2th13", iU+1));
1133 h_utau_s2th13[iU]->Write(Form(
"h_utau%d_s2th13", iU+1));
1135 h_ue_s2th23[iU]->Write(Form(
"h_ue%d_s2th23", iU+1));
1136 h_umu_s2th23[iU]->Write(Form(
"h_umu%d_s2th23", iU+1));
1137 h_utau_s2th23[iU]->Write(Form(
"h_utau%d_s2th23", iU+1));
1139 h_ue_dcp[iU]->Write(Form(
"h_ue%d_dcp", iU+1));
1140 h_umu_dcp[iU]->Write(Form(
"h_umu%d_dcp", iU+1));
1141 h_utau_dcp[iU]->Write(Form(
"h_utau%d_dcp", iU+1));
1145 for(
size_t iPlot = 0; iPlot < h_UU.size(); ++iPlot){
1146 h_UU[iPlot]->Write();
1149 PMNSElementsDir->Close();
1150 delete PMNSElementsDir;
1152 Chain->SetBranchStatus(
"*",
true);
1166 MACH3LOG_WARN(
"Will not {}, as oscillation parameters are missing", __func__);
1172 double weight = 1.0;
1174 TComplex tr_emu_num, tr_etau_num, tr_mutau_num, tr_12_num, tr_13_num, tr_23_num;
1175 TComplex tr_emu_denom, tr_etau_denom, tr_mutau_denom, tr_12_denom, tr_13_denom, tr_23_denom;
1176 TComplex tr_emu, tr_etau, tr_mutau, tr_12, tr_13, tr_23;
1178 TDirectory *UnitarityTrianglesDir =
OutputFile->mkdir(
"UnitarityTriangles");
1179 UnitarityTrianglesDir->cd();
1181 unsigned int step = 0;
1182 Chain->SetBranchStatus(
"*",
false);
1196 Chain->SetBranchStatus(
"step",
true);
1197 Chain->SetBranchAddress(
"step", &step);
1199 if (
Chain->GetBranch(
"Weight")) {
1200 Chain->SetBranchStatus(
"Weight",
true);
1201 Chain->SetBranchAddress(
"Weight", &weight);
1203 MACH3LOG_WARN(
"No Weight branch found — defaulting to 1.0");
1206 constexpr
int n_bins = 1000;
1208 std::unique_ptr<TH2D> h_tr_emu;
1209 std::unique_ptr<TH2D> h_tr_etau;
1210 std::unique_ptr<TH2D> h_tr_mutau;
1212 std::unique_ptr<TH2D> h_tr_12;
1213 std::unique_ptr<TH2D> h_tr_13;
1214 std::unique_ptr<TH2D> h_tr_23;
1216 h_tr_emu = std::make_unique<TH2D>(
"h_tr_emu",
";#rho_{e#mu};#eta_{e#mu}",n_bins,-5,5,n_bins,-5,5);
1217 h_tr_emu->SetDirectory(
nullptr);
1218 h_tr_etau = std::make_unique<TH2D>(
"h_tr_etau",
";#rho_{e#tau};#eta_{e#tau}",n_bins,0,2,n_bins,-1,1);
1219 h_tr_etau->SetDirectory(
nullptr);
1220 h_tr_mutau = std::make_unique<TH2D>(
"h_tr_mutau",
";#rho_{#mu#tau};#eta_{#mu#tau}",n_bins,0,2,n_bins,-1,1);
1221 h_tr_mutau->SetDirectory(
nullptr);
1223 h_tr_12 = std::make_unique<TH2D>(
"h_tr_12",
";#rho_{12};#eta_{12}",n_bins,0,3.2,n_bins,-1.5,1.5);
1224 h_tr_12->SetDirectory(
nullptr);
1225 h_tr_13 = std::make_unique<TH2D>(
"h_tr_13",
";#rho_{13};#eta_{13}",n_bins,0,2,n_bins,-1,1);
1226 h_tr_13->SetDirectory(
nullptr);
1227 h_tr_23 = std::make_unique<TH2D>(
"h_tr_23",
";#rho_{23};#eta_{23}",n_bins,-8,8,n_bins,-8,8);
1228 h_tr_23->SetDirectory(
nullptr);
1230 const Long64_t countwidth =
nEntries/5;
1231 for(
int i = 0; i <
nEntries; i++) {
1232 if (i % countwidth == 0) {
1241 const std::array<std::array<TComplex, 3>, 3> U =
CalculatePMNSElements(s2th13, s2th23, s2th12, dcp);
1244 tr_emu_num = U[0][0].operator*(TComplex::Conjugate(U[1][0]));
1245 tr_emu_denom = U[0][2].operator*(TComplex::Conjugate(U[1][2]));
1246 tr_emu = - tr_emu_num.operator/(tr_emu_denom);
1248 tr_etau_num = U[0][1].operator*(TComplex::Conjugate(U[2][1]));
1249 tr_etau_denom = U[0][0].operator*(TComplex::Conjugate(U[2][0]));
1250 tr_etau = - tr_etau_num.operator/(tr_etau_denom);
1252 tr_mutau_num = U[1][2].operator*(TComplex::Conjugate(U[2][2]));
1253 tr_mutau_denom = U[1][1].operator*(TComplex::Conjugate(U[2][1]));
1254 tr_mutau = - tr_mutau_num.operator/(tr_mutau_denom);
1256 tr_12_num = U[0][0].operator*(TComplex::Conjugate(U[0][1]));
1257 tr_12_denom = U[1][0].operator*(TComplex::Conjugate(U[1][1]));
1258 tr_12 = - tr_12_num.operator/(tr_12_denom);
1260 tr_13_num = U[1][0].operator*(TComplex::Conjugate(U[1][2]));
1261 tr_13_denom = U[2][0].operator*(TComplex::Conjugate(U[2][2]));
1262 tr_13 = - tr_13_num.operator/(tr_13_denom);
1264 tr_23_num = U[2][1].operator*(TComplex::Conjugate(U[2][2]));
1265 tr_23_denom = U[0][1].operator*(TComplex::Conjugate(U[0][2]));
1266 tr_23 = - tr_23_num.operator/(tr_23_denom);
1268 h_tr_emu->Fill(tr_emu.Re(), tr_emu.Im(), weight);
1269 h_tr_etau->Fill(tr_etau.Re(), tr_etau.Im(), weight);
1270 h_tr_mutau->Fill(tr_mutau.Re(), tr_mutau.Im(), weight);
1272 h_tr_12->Fill(tr_12.Re(), tr_12.Im(), weight);
1273 h_tr_13->Fill(tr_13.Re(), tr_13.Im(), weight);
1274 h_tr_23->Fill(tr_23.Re(), tr_23.Im(), weight);
1278 UnitarityTrianglesDir->cd();
1280 h_tr_emu->Write(
"h_tr_emu");
1281 h_tr_etau->Write(
"h_tr_etau");
1282 h_tr_mutau->Write(
"h_tr_mutau");
1284 h_tr_12->Write(
"h_tr_12");
1285 h_tr_13->Write(
"h_tr_13");
1286 h_tr_23->Write(
"h_tr_23");
1288 UnitarityTrianglesDir->Close();
1289 delete UnitarityTrianglesDir;
1291 Chain->SetBranchStatus(
"*",
true);
#define _MaCh3_Safe_Include_Start_
KS: Avoiding warning checking for headers.
#define _MaCh3_Safe_Include_End_
YAML::Node TMacroToYAML(const TMacro ¯o)
KS: Convert a ROOT TMacro object to a YAML node.
bool CheckNodeExists(const YAML::Node &node, Args... args)
KS: Wrapper function to call the recursive helper.
Class responsible for processing MCMC chains, performing diagnostics, generating plots,...
void GetNthParameter(const int param, double &Prior, double &PriorError, TString &Title) const
Get properties of parameter by passing it number.
std::vector< std::vector< double > > ParamCentral
Parameters central values which we are going to analyse.
std::vector< std::vector< double > > ParamErrors
Uncertainty on a single parameter.
std::vector< int > nParam
Number of parameters per type.
std::vector< std::vector< bool > > ParamFlat
Whether Param has flat prior or not.
std::unique_ptr< TCanvas > Posterior
Fancy canvas used for our beautiful plots.
TFile * OutputFile
The output file.
TChain * Chain
Main chain storing all steps etc.
std::string MCMCFile
Name of MCMC file.
int nDraw
Number of all parameters used in the analysis.
std::vector< ParameterEnum > ParamType
Make an enum for which class this parameter belongs to so we don't have to keep string comparing.
TString CanvasName
Name of canvas which help to save to the sample pdf.
std::vector< std::string > ParameterGroup
std::vector< TString > BranchNames
std::vector< std::vector< TString > > ParamNames
Name of parameters which we are going to analyse.
std::vector< int > ParamTypeStartPos
int nEntries
KS: For merged chains number of entries will be different from nSteps.
void SavageDickeyPlot(std::unique_ptr< TH1D > &PriorHist, std::unique_ptr< TH1D > &PosteriorHist, const std::string &Title, const double EvaluationPoint) const
Produce Savage Dickey plot.
unsigned int BurnInCut
Value of burn in cut.
Custom exception class used throughout MaCh3.
double SamplePriorForParam(const int paramIndex, const std::unique_ptr< TRandom3 > &randGen, const std::vector< double > &FlatBounds) const
Draw Prior value.
void ProduceUnitarityTriangles()
MP: Produce unitarity triangles from PMNS matrix elements.
int DeltaCPIndex
Index of in the parameter list.
double CalcJarlskog(const double s2th13, const double s2th23, const double s2th12, const double dcp) const
Calculate Jarlskog Invariant using oscillation parameters.
std::string Sin2Theta13Name
Name of the parameter representing .
std::string Sin2Theta12Name
Name of the parameter representing .
int Sin2Theta12Index
Index of in the parameter list.
OscProcessor(const std::string &InputFile)
Constructs an OscProcessor object with the specified input file and options.
int DeltaM2_23Index
Index of in the parameter list.
std::string DeltaCPName
Name of the parameter representing (the CP-violating phase).
bool PlotJarlskog
Will plot Jarlskog Invariant using information in the chain.
void ProducePMNSElements()
MP: Produce PMNS matrix elements.
int Sin2Theta13Index
Index of in the parameter list.
std::string Sin2Theta23Name
Name of the parameter representing .
std::array< std::array< TComplex, 3 >, 3 > CalculatePMNSElements(const double s2th13, const double s2th23, const double s2th12, const double dcp) const
MP: Calculate PMNS matrix elements.
void Get1DReactorConstraintInfo(std::pair< double, double > &Sin13_NewPrior, bool &DoReweight) const
Extract 1D reactor constraint information from an MCMC file.
void MakeJarlskogPlot(const std::unique_ptr< TH1D > &jarl, const std::unique_ptr< TH1D > &jarl_flatsindcp, const std::unique_ptr< TH1D > &jarl_NH, const std::unique_ptr< TH1D > &jarl_NH_flatsindcp, const std::unique_ptr< TH1D > &jarl_IH, const std::unique_ptr< TH1D > &jarl_IH_flatsindcp)
Perform Jarlskog Plotting.
int Sin2Theta23Index
Index of in the parameter list.
virtual ~OscProcessor()
Destroys the OscProcessor object.
std::string DeltaM2_23Name
Name of the parameter representing (mass-squared difference).
void LoadAdditionalInfo() final
Read the Osc cov file and get the input central values and errors Here we allow Jarlskog Shenanigans.
bool OscEnabled
Will plot Jarlskog Invariant using information in the chain.
void MakePiePlot()
Make fancy Pie plot for delta CP.
void PerformJarlskogAnalysis()
Perform Several Jarlskog Plotting.
void EstimateDataTransferRate(TChain *chain, const Long64_t entry)
KS: Check what CPU you are using.
void PrintProgressBar(const Long64_t Done, const Long64_t All)
KS: Simply print progress bar.
std::unique_ptr< ObjectType > Clone(const ObjectType *obj, const std::string &name="")
KS: Creates a copy of a ROOT-like object and wraps it in a smart pointer.
constexpr static const double _BAD_DOUBLE_
Default value used for double initialisation.
TFile * Open(const std::string &Name, const std::string &Type, const std::string &File, const int Line)
Opens a ROOT file with the given name and mode.
constexpr static const int _BAD_INT_
Default value used for int initialisation.