11 #include "TDirectory.h" 23 TH1* nom, TH1* hup, TH1* hdn);
26 double nom,
double up,
double dn);
41 std::string loadLocation =
"/nova/ana/steriles/Ana01/FitSystEffects.root";
42 std::string saveLocation = folder + filenm +
"Ana.root";
43 std::string textLocation = folder + filenm +
"Ana.txt";
46 TFile* rootL =
new TFile(loadLocation.c_str(),
"READ");
47 TDirectory* tmpL = gDirectory;
48 TDirectory* loadDir = gDirectory;
49 loadDir->cd((loadLocation +
":/pred").c_str());
52 loadDir->cd((loadLocation +
":/sCosmic").c_str());
60 <<
" and " << nCos <<
" events" <<
std::endl;
66 std::map<std::string, std::pair<double, double> > parammap;
67 parammap[
"t13"] = {-0.3675*
M_PI/180., 0.3714*
M_PI/180.};
68 parammap[
"d13"] = {-0.27, 0.38};
69 parammap[
"m32"] = {-0.00006, 0.00006};
71 std::map<std::string, TH1*> hups;
72 std::map<std::string, TH1*> hdns;
73 std::map<std::string, double> nups;
74 std::map<std::string, double> ndns;
79 double scale = 83.509/nnom;
83 TFile* rootF =
new TFile(saveLocation.c_str(),
"RECREATE");
85 textF = fopen(textLocation.c_str(),
"w");
87 for(
const auto& parampair : parammap) {
89 double upshift = parampair.second.second;
90 double dnshift = parampair.second.first;
105 PrintEvents(textF, label, nnom, nups[label], ndns[label]);
106 PlotEvents( rootF, label, hnom, hups[label], hdns[label]);
116 return 100.*(shift - nom)/nom;
121 TH1* nom, TH1* hup, TH1* hdn)
123 double max = nom->GetBinContent(nom->GetMaximumBin());
124 max =
std::max(max, hup->GetBinContent(hup->GetMaximumBin()));
125 max =
std::max(max, hdn->GetBinContent(hdn->GetMaximumBin()));
133 hup->SetLineStyle(2);
134 hdn->SetLineStyle(3);
139 if(ptype.compare(
"t") == 0) {
140 param =
"#theta_{" + label.substr(1,2) +
"} ";
142 if(ptype.compare(
"d") == 0) {
143 param =
"#delta_{" + label.substr(1,2) +
"} ";
145 if(ptype.compare(
"m") == 0) {
146 param =
"#Deltam^{2}_{" + label.substr(1,2) +
"} ";
149 double xL = 0.6, xR = 0.8, yB = 0.65, yT = 0.85;
150 TLegend*
leg =
new TLegend(xL, yB, xR, yT);
152 leg->AddEntry(nom,
"Nominal",
"l");
153 leg->AddEntry(hup, (param +
"+1#sigma").c_str(),
"l");
154 leg->AddEntry(hdn, (param +
"-1#sigma").c_str(),
"l");
155 leg->SetY1(leg->GetY2() - leg->GetNRows()*0.05);
158 TCanvas*
c =
new TCanvas(ctitle.c_str(), ctitle.c_str(), 800, 500);
160 hup->Draw(
"hist same");
161 hdn->Draw(
"hist same");
165 out->WriteTObject(c);
171 double nom,
double up,
double dn)
173 fprintf(text,
"Number of events for %s:\n", label.c_str());
174 fprintf(text,
"Nom: %4.2f, Up: %4.2f, Down: %4.2f\n", nom, up, dn);
175 fprintf(text,
"Shifts: Up: %4.2f%%, Down: %4.2f%%\n\n",
196 int val1 = std::stoi(label.substr(1,1));
197 int val2 = std::stoi(label.substr(2,1));
199 if(val1 > val2) {
std::swap(val1, val2); }
201 if(ptype.compare(
"t") == 0) {
204 else if(ptype.compare(
"d") == 0) {
207 else if(ptype.compare(
"m") == 0) {
void SetHistOptions(TH1 *h, double max, std::string title, int ndiv, Color_t col, bool fill)
Set common options for a TLegend.
T max(const caf::Proxy< T > &a, T b)
double GetDelta(int i, int j) const
Cuts and Vars for the 2020 FD DiF Study.
void SetNFlavors(int nflavors)
static std::unique_ptr< PredictionCombinePeriods > LoadFrom(TDirectory *dir, const std::string &name)
void ResetAngles(osc::OscCalcSterile *calc)
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.
void OverridePOT(double newpot)
DO NOT USE UNLESS YOU ARE 110% CERTAIN THERE ISN'T A BETTER WAY!
void SetDelta(int i, int j, double delta)
Adapt the PMNS_Sterile calculator to standard interface.
double Integral(double exposure, double *err=0, EExposureType expotype=kPOT) const
Return total number of events scaled to pot.
void SpectrumParamEffectsAna()
Representation of a spectrum in any variable, with associated POT.
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
double CalcParamEffect(double nom, double shift)
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
void PrintEvents(FILE *text, std::string label, double nom, double up, double dn)
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
void ResetSterileCalcToDefault(osc::OscCalcSterile *calc)
Reset calculator to default assumptions for all parameters.
void SetAngle(int i, int j, double th)
void SetLegendOptions(TLegend *leg)
Set common options for a TLegend.
void SetDm(int i, double dm)
double GetDm(int i) const
Sum MC predictions from different periods scaled according to data POT targets.
void SetCalcParam(osc::OscCalcSterile *calc, std::string label, double shift)
const double kSecondAnaPOT
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void PlotEvents(TDirectory *out, std::string label, TH1 *nom, TH1 *hup, TH1 *hdn)
double GetAngle(int i, int j) const
Spectrum Predict(osc::IOscCalc *calc) const override