print_nueFDprediction_table.C
Go to the documentation of this file.
1 // Macro to make table of nominal predictions at oscillation values
2 
5 #include "CAFAna/Core/Binning.h"
6 #include "CAFAna/Core/Cut.h"
7 #include "CAFAna/Core/HistAxis.h"
9 #include "CAFAna/Core/Spectrum.h"
12 #include "CAFAna/Cuts/Cuts.h"
13 #include "CAFAna/Cuts/NumuCuts.h"
15 #include "CAFAna/Cuts/SpillCuts.h"
22 #include "CAFAna/Vars/NueVars.h"
23 #include "CAFAna/Vars/Vars.h"
24 
28 
29 #include "TFile.h"
30 #include "TH1.h"
31 #include "TCanvas.h"
32 #include "TGaxis.h"
33 #include "TLatex.h"
34 #include "TLegend.h"
35 #include "TLine.h"
36 #include "TSystem.h"
37 #include <iostream>
38 #include <iomanip>
39 
40 using namespace ana;
41 
43 
44  double kPOTFD = kSecondAnaPOT;
45  TH1* hNC = pred->PredictComponent(mycalc,
48  Sign::kBoth).ToTH1(kPOTFD );
49  TH1* hCC = pred->PredictComponent(mycalc,
52  Sign::kBoth).ToTH1(kPOTFD );
53  TH1* hSig = pred->PredictComponent(mycalc,
56  Sign::kBoth).ToTH1(kPOTFD );
57  TH1* hTau = pred->PredictComponent(mycalc,
60  Sign::kBoth).ToTH1(kPOTFD );
61  TH1* hBeam = pred->PredictComponent(mycalc,
64  Sign::kBoth).ToTH1(kPOTFD);
65  TH1* hAll = (TH1*)hNC->Clone(UniqueName().c_str());
66  hAll->Add(hCC);
67  hAll->Add(hBeam);
68  hAll->Add(hTau);
69 
70  std::cout<<name<<" & "<<hSig->Integral()<<" & "<<hAll->Integral()<<" & "<<hCC->Integral()<<" & "<<hNC->Integral()<<" & "<<hBeam->Integral()<<" & "<<hTau->Integral()<<" \\\\ \n";
71 
72 }
73 
74 void print_nueFDprediction_table(const std::string& ShortName_no,
75  const std::string& LongName_no,
76  const std::string& filename_no
77  )
78 
79 {
80  enum shift{nomin,kNumSamples};
81  TString labels[kNumSamples]={ShortName_no};
82  TString titles[kNumSamples]={ LongName_no};
83  int nominIdx=nomin;
84 
85 
86  TFile * file_no = new TFile (filename_no.c_str(),"READ");
87  if(file_no->IsZombie()){std::cerr << "Can't find " << filename_no.c_str() << std::endl; return;}
88 
90  ResetOscCalcToDefault(&mycalc);
91 
92  std::cout << "{ \\begin{tabular}{ l | r r r r r } \n";
93  std::cout << " & Signal & TotBkg & NumuCC & NC & BeamNue & NuTau \\\\ \\hline \n";
94 
95  for(int selIdx=0;selIdx<kNumSels;selIdx++ )
96  {
97  for(int varIdx=1;varIdx<kNumVars;varIdx++ ){
98  bool pidaxes = varIdx;
99 
100  for (int extrapolated=0;extrapolated<=1;extrapolated++){
101  TString xp = extrapolated ? "nue_pred_combo":"nue_pred_noextrap";
102  TDirectory * dpred_no = file_no->GetDirectory("prediction_"+labels[nominIdx]+"/"+xp+"_"+selNames[selIdx]+"_"+varNames[varIdx]);
103 
104  //FD Plots
105  auto pred_no = ana::LoadFrom<IPrediction> (dpred_no);
106  TString name = "NH, 3pi/2, sstheta23=0.5, "+titles[nominIdx]+( extrapolated ? " Extrap, ":" NoExtrap, ")+ selNames[selIdx];
107  mycalc.SetDmsq32(+fabs(mycalc.GetDmsq32()));
108  mycalc.SetdCP(3*TMath::Pi()/2);
109  printline(pred_no.get(), &mycalc, name);
110  name = "IH, pi/2, sstheta23=0.5, "+titles[nominIdx]+( extrapolated ? " Extrap, ":" NoExtrap, ")+ selNames[selIdx];
111  ResetOscCalcToDefault(&mycalc);
112  mycalc.SetDmsq32(-fabs(mycalc.GetDmsq32()));
113  mycalc.SetdCP(TMath::Pi()/2);
114  printline(pred_no.get(), &mycalc, name);
115  name = "NH, 3*pi/2, sstheta23=0.6, "+titles[nominIdx]+( extrapolated ? " Extrap, ":" NoExtrap, ")+ selNames[selIdx];
116  ResetOscCalcToDefault(&mycalc);
117  mycalc.SetDmsq32(+fabs(mycalc.GetDmsq32()));
118  mycalc.SetdCP(3*TMath::Pi()/2);
119  mycalc.SetTh23(asin(sqrt(0.6)));
120  printline(pred_no.get(), &mycalc, name);
121  name = "NH, 3*pi/2, sstheta23=0.4, "+titles[nominIdx]+( extrapolated ? " Extrap, ":" NoExtrap, ")+ selNames[selIdx];
122  ResetOscCalcToDefault(&mycalc);
123  mycalc.SetDmsq32(+fabs(mycalc.GetDmsq32()));
124  mycalc.SetdCP(3*TMath::Pi()/2);
125  mycalc.SetTh23(asin(sqrt(0.4)));
126  printline(pred_no.get(), &mycalc, name);
127  name = "NH, 1.58134pi, sstheta23=0.453377, "+titles[nominIdx]+( extrapolated ? " Extrap, ":" NoExtrap, ")+ selNames[selIdx];
128  ResetOscCalcToDefault(&mycalc);
129  mycalc.SetDmsq32(0.00244051);
130  mycalc.SetdCP(1.58134*TMath::Pi());
131  mycalc.SetTh23(asin(sqrt(0.453377)));
132  printline(pred_no.get(), &mycalc, name);
133  }
134  }
135  } //end selIdx
136  std::cout << "\\end{tabular} } \n";
137 } // end
const XML_Char * name
Definition: expat.h:151
const int kNumVars
Definition: vars.h:14
Oscillation analysis framework, runs over CAF files outside of ART.
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
General interface to oscillation calculators.
Definition: FwdDeclare.h:15
(&#39; appearance&#39;)
Definition: IPrediction.h:18
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.
Definition: Spectrum.cxx:553
virtual Spectrum PredictComponent(osc::IOscCalculator *calc, Flavors::Flavors_t flav, Current::Current_t curr, Sign::Sign_t sign) const =0
Optimized version of OscCalculatorPMNS.
Definition: StanTypedefs.h:28
(&#39;beam &#39;)
Definition: IPrediction.h:15
T sqrt(T number)
Definition: d0nt_math.hpp:156
OStream cerr
Definition: OStream.cxx:7
TString varNames[kNumVars]
void ResetOscCalcToDefault(osc::IOscCalculatorAdjustable *calc)
Reset calculator to default assumptions for all parameters.
Definition: Calcs.cxx:23
void SetTh23(const T &th23) override
void SetDmsq32(const T &dmsq32) override
void SetdCP(const T &dCP) override
Charged-current interactions.
Definition: IPrediction.h:39
const int kNumSels
Definition: vars.h:43
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::unique_ptr< IPrediction > LoadFrom< IPrediction >(TDirectory *dir)
Definition: IPrediction.cxx:38
virtual T GetDmsq32() const
Neutral-current interactions.
Definition: IPrediction.h:40
Both neutrinos and antineutrinos.
Definition: IPrediction.h:52
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
const std::string selNames[kNumSels]
Definition: vars.h:46
All neutrinos, any flavor.
Definition: IPrediction.h:26
const double kSecondAnaPOT
Definition: Exposures.h:87
std::string UniqueName()
Return a different string each time, for creating histograms.
Definition: Utilities.cxx:30
T asin(T number)
Definition: d0nt_math.hpp:60