17 #include "TDirectory.h" 43 std::map<std::string, PredictionCombinePeriods*>* preds);
46 const IFitVar*
var, std::vector<const IFitVar*> profVars,
47 TDirectory* rootOut,
int nbins,
double min,
double max,
49 std::vector<const ISyst*>
systs);
56 std::map<std::string, TH1*>* h24s,
57 std::map<std::string, TH1*>* h34s,
58 std::vector<const ISyst*>
systs = {});
61 double th2468,
double th2490,
62 double th3468,
double th3490);
65 double th24stat68,
double th2468,
66 double th24stat90,
double th2490,
67 double th34stat68,
double th3468,
68 double th34stat90,
double th3490);
77 std::map<std::string, PredictionCombinePeriods*> preds;
81 std::string filenm =
"pred_fitsysteffects_ana01_fix";
83 std::string loadLocation = folder + filenm +
".root";
84 std::string saveLocation = folder + filenm +
"Ana.root";
85 std::string textLocation = folder + filenm +
"Ana.txt";
88 TFile* rootL =
new TFile(loadLocation.c_str(),
"READ");
89 TDirectory* tmpL = gDirectory;
90 TDirectory* loadDir = gDirectory;
91 loadDir->cd((loadLocation +
":/pred").c_str());
94 loadDir->cd((loadLocation +
":/sCosmic").c_str());
96 loadDir->cd((loadLocation +
":/sData").c_str());
108 <<
" and " << nData <<
" events" <<
std::endl;
109 double nCos = sCos.Integral(sCos.POT());
110 std::cout <<
"Cos spectrum: " << sCos.POT()
111 <<
" and " << nCos <<
" events" <<
std::endl;
118 calc4f->
SetDm(4, 0.5);
131 const Color_t kFitColor =
kRed;
133 std::map<std::string, std::vector<const ISyst*> > systmap;
134 systmap[
"OscParam"] = std::vector<const ISyst*>();
135 systmap[
"Beam"] = std::vector<const ISyst*>();
136 systmap[
"Birks"] = std::vector<const ISyst*>();
137 systmap[
"Calib"] = std::vector<const ISyst*>();
138 systmap[
"DataMC"] = std::vector<const ISyst*>();
139 systmap[
"GENIE"] = std::vector<const ISyst*>();
140 systmap[
"NDCont"] = std::vector<const ISyst*>();
141 systmap[
"NDRock"] = std::vector<const ISyst*>();
142 systmap[
"Norm"] = std::vector<const ISyst*>();
143 systmap[
"Stats"] = std::vector<const ISyst*>();
145 systmap[
"OscParam"] .push_back(&kNusOscParamSysts);
162 std::map<std::string, TH1*> h24s;
163 std::map<std::string, TH1*> h34s;
166 TFile* rootF =
new TFile(saveLocation.c_str(),
"RECREATE");
168 textF = fopen(textLocation.c_str(),
"w");
185 rootF, avals,
"1", kFitColor,
186 "NoSysts", &h24s, &h34s
194 PrintAngles(textF,
"NoSysts", th24stat68, th24stat90, th34stat68, th34stat90);
196 for(
const auto& predpair : preds) {
212 rootF, avals,
"1", kFitColor,
213 label, &h24s, &h34s, systmap[label]
220 PrintAngles(textF, label, th2468, th2490, th3468, th3490);
222 th24stat68, th2468, th24stat90, th2490,
223 th34stat68, th3468, th34stat90, th3490);
233 return 100.*(withsyst - statonly)/statonly;
239 for(
int i = 1,
n = h->GetNbinsX();
i <
n; ++
i) {
240 if(h->GetBinContent(
i, 1) < chi2 &&
241 h->GetBinContent(
i+1, 1) >=
chi2) {
242 return h->GetXaxis()->GetBinCenter(
i+1);
246 return h->GetXaxis()->GetBinUpEdge(h->GetNbinsX());
253 std::map<std::string, PredictionCombinePeriods*>* preds)
255 TDirectory*
tmp = gDirectory;
256 TDirectory* keyDir = gDirectory;
260 TIter nextkey(dir->GetListOfKeys());
268 while((key = (TKey*)nextkey())) {
270 if(oldkey && !strcmp(oldkey->GetName(), key->GetName())) {
continue; }
271 if(key->ReadObj()->IsFolder()) {
272 keyDir = (TDirectory*)key->ReadObj();
279 std::vector<std::string>
tokens;
281 while(pos != std::string::npos) {
284 if(pos != std::string::npos) {
293 if(tokens.size() > 1) {
294 cafanaType = tokens[0];
295 sampleLabel = tokens[1];
296 if(cafanaType.compare(
"pred") == 0) {
309 const IFitVar*
var, std::vector<const IFitVar*> profVars,
310 TDirectory* rootOut,
int nbins,
double min,
double max,
312 std::vector<const ISyst*>
systs)
316 TH1*
h =
Profile(expt, calc, var, nbins, min, max, -1, profVars, systs);
321 h->SetLineColor(color);
324 h->SetName(name.c_str());
325 rootOut->WriteTObject(h);
336 std::map<std::string, TH1*>* h24s,
337 std::map<std::string, TH1*>* h34s,
338 std::vector<const ISyst*>
systs)
347 fullname = name +
"34Prof" + samplelabel;
349 expt, calc, var34, {var23, var24}, rootOut,
352 fullname = name +
"24Prof" + samplelabel;
354 expt, calc, var24, {var23, var34}, rootOut,
363 double th2468,
double th2490,
364 double th3468,
double th3490)
366 fprintf(text,
"Angle limits for %s:\n", label.c_str());
367 fprintf(text,
"Th24: 68% (%): %4.2f, 90%%: %4.2f\n", th2468, th2490);
368 fprintf(text,
"Th34: 68% (%): %4.2f, 90%%: %4.2f\n", th3468, th3490);
375 double th24stat68,
double th2468,
376 double th24stat90,
double th2490,
377 double th34stat68,
double th3468,
378 double th34stat90,
double th3490)
380 fprintf(text,
"Diff24: 68% (%) %4.2f, 90%%: %4.2f\n",
383 fprintf(text,
"Diff34: 68% (%) %4.2f, 90%%: %4.2f\n",
void Plot1DSlices(IExperiment *expt, osc::OscCalcSterile *calc, const IFitVar *var23, const IFitVar *var34, const IFitVar *var24, const IFitVar *vard24, TDirectory *rootOut, AngleValues a, std::string years, Color_t color, std::string samplelabel, std::map< std::string, TH1 * > *h24s, std::map< std::string, TH1 * > *h34s, std::vector< const ISyst * > systs={})
Cuts and Vars for the 2020 FD DiF Study.
void SetNFlavors(int nflavors)
double CalcSystEffect(double statonly, double withsyst)
cons_index_list< index_multi, nil_index_list > multi
static std::unique_ptr< PredictionCombinePeriods > LoadFrom(TDirectory *dir, const std::string &name)
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.
A simple Gaussian constraint on an arbitrary IFitVar.
const NusFlatSyst kNusNDContSyst("ndcont","ND Containment", 1.0, 0.6)
Adapt the PMNS_Sterile calculator to standard interface.
const FitTheta23InDegreesSterile kFitTheta23InDegreesSterile
TGraph * Profile(const IExperiment *expt, osc::IOscCalcAdjustable *calc, const IFitVar *v, int nbinsx, double minx, double maxx, double input_minchi, const std::vector< const IFitVar * > &profVars, const std::vector< const ISyst * > &profSysts, const SeedList &seedPts, const std::vector< SystShifts > &systSeedPts, std::map< const IFitVar *, TGraph * > &profVarsMap, std::map< const ISyst *, TGraph * > &profSystsMap, MinuitFitter::FitOpts opts)
scan in one variable, profiling over all others
void PrintSystEffect(FILE *text, double th24stat68, double th2468, double th24stat90, double th2490, double th34stat68, double th3468, double th34stat90, double th3490)
const FitTheta24InDegreesSterile kFitTheta24InDegreesSterile
double Integral(double exposure, double *err=0, EExposureType expotype=kPOT) const
Return total number of events scaled to pot.
const NusSystFromHist kNusCalibFlatSyst(kNusAna01SystFile,"EX","CalFlat","Flat Miscalibration")
Representation of a spectrum in any variable, with associated POT.
const FitDelta24InPiUnitsSterile kFitDelta24InPiUnitsSterile
const NusSystFromHist kNusBeamSysts(kNusAna01SystFile,"EX","Beam","All Beam")
osc::OscCalcSterile * DefaultSterileCalc(int nflavors)
Create a sterile calculator with default assumptions for all parameters.
std::vector< const ISyst * > getAllNusSysts()
Get a vector of all the nus group systs.
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
const NusSystFromHist kNusBirksSyst(kNusAna01SystFile,"EX","Birks","Birks C")
TH1 * Plot1DSlice(IExperiment *expt, osc::OscCalcSterile *calc, const IFitVar *var, std::vector< const IFitVar * > profVars, TDirectory *rootOut, int nbins, double min, double max, std::string name, Color_t color, std::vector< const ISyst * > systs)
const NusFlatSyst kNusMCStatsSyst("mcstat","MC Stats", 2.0, 4.8)
void ResetSterileCalcToDefault(osc::OscCalcSterile *calc)
Reset calculator to default assumptions for all parameters.
const NusSystFromHist kNusGENIESmallSysts(kNusAna01SystFile,"EX","GENIESm","Summed small GENIE Systs")
const NusSystFromHist kNusNueCCSyst(kNusAna01SystFile,"EX","NueCC","#nu_{e} CC Background")
void ResetAngles(osc::OscCalcSterile *calc)
static float min(const float a, const float b, const float c)
Combine multiple component experiments.
double FindAngleFromChi2(double chi2, TH1 *h)
void SetAngle(int i, int j, double th)
void SetDm(int i, double dm)
const NusSystFromHist kNusCalibRelSyst(kNusAna01SystFile,"EX","CalRel","Relative Detector Miscalibration")
const NusFlatSyst kNusNormSyst("normNus","Normalization", 4.9, 4.9)
Base class defining interface for experiments.
const FitTheta34InDegreesSterile kFitTheta34InDegreesSterile
Interface definition for fittable variables.
const NusSystFromHist kNusNDRockSyst(kNusAna01SystFile,"EX","NDNDRock","ND Rock")
void LoadMaps(TDirectory *dir, std::map< std::string, IDecomp * > *nominal, std::map< std::string, std::map< std::string, std::map< int, IDecomp * > > > *shifted)
Sum MC predictions from different periods scaled according to data POT targets.
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
const NusSystFromHist kNusCalibSlopeXSyst(kNusAna01SystFile,"EX","CalSlopeX","Sloped Miscalibration, X")
const NusSystFromHist kNusCalibSlopeYSyst(kNusAna01SystFile,"EX","CalSlopeY","Sloped Miscalibration, Y")
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
Compare a data spectrum to MC expectation using only the event count.
const NusSystFromHist kNusNumuCCSyst(kNusAna01SystFile,"EX","NumuCC","#nu_{#mu} CC Background")
void PrintAngles(FILE *text, std::string label, double th2468, double th2490, double th3468, double th3490)