Utilities.h
Go to the documentation of this file.
1 /// Utilities.h by J. Hewes (jhewes15@fnal.gov)
2 /// Utility functions for Nus20 covariance analysis
3 
4 #pragma once
5 
7 
9 #include "CAFAna/Core/Sample.h"
10 #include "CAFAna/Core/Registry.h"
12 #include "CAFAna/Cuts/QuantileCuts.h"
18 
21 
22 #include "NuXAna/Cuts/NusCuts20.h"
27 
28 #include "TFile.h"
29 #include "TKey.h"
30 
31 using namespace ana;
32 
33 // Hard-coded parameters
34 const double kNux20Dm21 = 7.53e-5;
35 const double kNux20Dm32 = 2.44e-3;
36 const double kNux20Dm32Sigma = 0.08e-3;
37 
38 const double kNux20Th12 = 0.587;
39 const double kNux20Th13 = 0.145;
40 const double kNux20Th23 = 0.844;
41 const double kNux20Th23Sigma = 0.042;
42 
43 const double kNux20Delta13 = 1.21*M_PI;
44 const double kNux20Delta24 = M_PI/2;
45 
46 const double kNux20FHCNDPOT = 11e20;
48 const double kNux20RHCNDPOT = 11.8e20;
52 
63 
68 
69 //===========================================================================================
70 bool CheckOption(TString opts, TString opt) {
71 
72  if (opts.Contains(opt, TString::ECaseCompare::kIgnoreCase))
73  return true;
74  else return false;
75 
76 }
77 
78 //===========================================================================================
79 template <class T>
80 T ParseOption(std::vector<std::pair<std::string, T>> opts, TString optString, T def) {
81 
82  T ret = def;
83  size_t nOpts = 0;
84  for (auto opt : opts) {
85  if (optString.Contains(opt.first.c_str(), TString::kIgnoreCase)) {
86  ++nOpts;
87  ret = opt.second;
88  }
89  }
90  if (nOpts > 1) {
91  std::ostringstream err;
92  err << "Option string must include one of: ";
93  for (auto opt : opts) err << "\"" << opt.first << "\", ";
94  std::cerr << err.str().substr(0, err.str().size()-2) << std::endl;
95  assert(false);
96  }
97  return ret;
98 
99 } // template function ParseOption
100 
101 //===========================================================================================
102 template <class T>
103 std::vector<T> ParseOptions(std::vector<std::pair<std::string, T>> opts, TString optString) {
104 
105  std::vector<T> ret;
106  for (auto opt : opts) {
107  if (optString.Contains(opt.first.c_str(), TString::kIgnoreCase)) {
108  ret.push_back(opt.second);
109  }
110  }
111  return ret;
112 
113 } // template function ParseOption
114 
115 //===========================================================================================
116 std::vector<covmx::Sample> GetNumuNDSamples() {
117  std::vector<covmx::Sample> ret;
120  ret.push_back(covmx::Sample(covmx::kCCNumu, p, covmx::kNearDet, q));
121  }
122  }
123  return ret;
124 }
125 
126 //===========================================================================================
127 std::vector<covmx::Sample> GetNumuFDSamples() {
128  std::vector<covmx::Sample> ret;
131  ret.push_back(covmx::Sample(covmx::kCCNumu, p, covmx::kFarDet, q));
132  }
133  }
134  return ret;
135 }
136 
137 //===========================================================================================
138 std::vector<covmx::Sample> GetNumuSamples() {
139  std::vector<covmx::Sample> ret;
140  for (auto tmp : { GetNumuNDSamples(), GetNumuFDSamples() }) {
141  ret.insert(ret.end(), tmp.begin(), tmp.end());
142  }
143  return ret;
144 }
145 
146 //===========================================================================================
147 std::vector<covmx::Sample> GetNCNDSamples() {
148  std::vector<covmx::Sample> ret;
150  ret.push_back(covmx::Sample(covmx::kNC, p, covmx::kNearDet));
151  }
152  return ret;
153 }
154 
155 //===========================================================================================
156 std::vector<covmx::Sample> GetNCFDSamples() {
157  std::vector<covmx::Sample> ret;
159  ret.push_back(covmx::Sample(covmx::kNC, p, covmx::kFarDet));
160  }
161  return ret;
162 }
163 
164 //===========================================================================================
165 std::vector<covmx::Sample> GetNCSamples() {
166  std::vector<covmx::Sample> ret;
167  for (auto tmp : { GetNCNDSamples(), GetNCFDSamples() }) {
168  ret.insert(ret.end(), tmp.begin(), tmp.end());
169  }
170  return ret;
171 }
172 
173 //===========================================================================================
174 std::vector<covmx::Sample> GetAllSamples() {
175  std::vector<covmx::Sample> ret;
176  for (auto tmp : { GetNumuSamples(), GetNCSamples() }) {
177  ret.insert(ret.end(), tmp.begin(), tmp.end());
178  }
179  return ret;
180 }
181 
182 //===========================================================================================
183 string InputPath() {
184  string ret;
185  if (kUseCVMFS) {
186  const char* cpath = getenv("NUSDATA_DIR");
187  if (!cpath)
188  throw runtime_error("nusdata directory not found! Exiting.");
189  ret = string(cpath) + "/nus20";
190  } else {
191  ret = kNus20Path;
192  }
193  if (kUseXRootD) ret = pnfs2xrootd(ret);
194  return ret;
195 }
196 
197 //===========================================================================================
198 double GetDefaultPOT(covmx::Sample sample) {
199  if (sample.detector == covmx::kNearDet) {
200  if (sample.polarity == covmx::kFHC) return kNux20FHCNDPOT;
201  else return kNux20RHCNDPOT;
202  } else {
203  if (sample.polarity == covmx::kFHC) return kNux20FHCFDPOT;
204  else return kNux20RHCFDPOT;
205  }
206 }
207 
208 //===========================================================================================
209 void SetPOT(covmx::Sample& sample) {
210  sample.SetPOT(GetDefaultPOT(sample));
211 }
212 
213 //===========================================================================================
215  if (sample.detector == covmx::kNearDet) return -1; // no livetime at ND
216  else {
217  if (sample.polarity == covmx::kFHC) return kNux20FHCLivetime;
218  else return kNux20RHCLivetime;
219  }
220 }
221 
222 //===========================================================================================
223 void SetLivetime(covmx::Sample& sample) {
224  sample.SetLivetime(GetDefaultLivetime(sample));
225 }
226 
227 //===========================================================================================
228 const HistAxis* GetDefaultAxis(covmx::Sample sample, double res=0) {
229 
230  if (sample.selection == covmx::kNC) {
231  if (res != 0) { // Resolution-based binning
232  std::vector<double> bins = { 0.5 };
233  while (true) {
234  double next = (1 + (res/100)) * bins.back();
235  double nextnext = (1 + (res/100)) * next;
236  if (nextnext > 20.) {
237  bins.push_back(20);
238  break;
239  } else {
240  bins.push_back(next);
241  }
242  } // while true
243  std::cout << "Created dynamic binning scheme with resolution " << res << ", and edges:";
244  for (double bin : bins) std::cout << " " << bin;
245  std::cout << endl;
246  return new HistAxis("Energy Deposited in Scintillator (GeV)",
248  } else {
249  if ( sample.detector == covmx::kNearDet ) return &kNus20NDAxis;
250  else if ( sample.detector == covmx::kFarDet ) return &kNus20FDAxis;
251  }
252  }
253  else if (sample.selection == covmx::kCCNumu){
254  return &kNumuCCOptimisedAxis2020;
255  }
256  else if (sample.selection == covmx::kCCNue){
257  return &kNue2020Axis;
258  }
259  else{
260  std::cout << "No default binning for " << sample.GetName() << std::endl;
261  assert(false);
262  }
263  return &kNus20NDAxis; // moot return to avoid -Wreturn-type non-void warning
264 
265 }
266 
267 //===========================================================================================
268 void SetAxis(covmx::Sample& sample, double res=0) {
269  sample.SetAxis(GetDefaultAxis(sample, res));
270 }
271 
272 //===========================================================================================
273 
274 void SetCut(covmx::Sample& sample) {
275 
276  // Neutral current cuts
277  if (sample.selection == covmx::kNC) {
278  if (sample.detector == covmx::kNearDet) sample.SetCut(&kNus20NDCuts);
279  else sample.SetCut(&kNus20FDCuts_ML);
280  }
281 
282  else if (sample.selection == covmx::kCCNue) {
283  if (sample.detector == covmx::kNearDet) sample.SetCut(&kNue2020ND);
284  else sample.SetCut(&kNue2020FDAllSamples_ML);
285  }
286 
287  else if (sample.selection == covmx::kCCNumu) {
288  if (sample.quantile == covmx::kNoQ) {
289  if (sample.detector == covmx::kNearDet) sample.SetCut(&kNumu2020ND);
290  else sample.SetCut(&kNumu2020FD_ML);
291  } else {
292  std::string quantDir = std::getenv("NUMUDATA_DIR");
293  std::string infileQuant = quantDir + "/lib/ana2020/Quantiles/quantiles_" + sample.GetPolarity() + "_full_numu2020.root";
294  TFile* infile = TFile::Open( pnfs2xrootd(infileQuant).c_str() );
295  TH2* spec2DFD = (TH2*)infile->FindObjectAny("FDSpec2D");
296  std::vector<Cut> HadEFracQuantCuts = QuantileCutsFromTH2(spec2DFD, kNumuCCOptimisedAxis2020, kHadEFracAxis, 4);
297  infile->Close();
298  if (sample.detector == covmx::kNearDet) {
299  sample.SetCut(new const Cut(kNumu2020ND && HadEFracQuantCuts[sample.quantile]));
300  } else {
301  sample.SetCut(new const Cut(kNumu2020FD_ML && HadEFracQuantCuts[sample.quantile]));
302  }
303  } // if using quantiles
304  } // numu selection
305 
306 } // function SetCut
307 
308 //===========================================================================================
309 void SetCuts(std::vector<covmx::Sample>& samples) {
310 
311  // Instantiate this once so we can reuse it if necessary without reloading
312  std::vector<Cut> HadEFracQuantCuts;
313 
314  for (covmx::Sample& sample : samples) {
315 
316  // Neutral current cuts
317 
318  if (sample.selection == covmx::kNC) {
319  if (sample.detector == covmx::kNearDet) sample.SetCut(&kNus20NDCuts);
320  else sample.SetCut(&kNus20FDCuts_ML);
321  }
322 
323  else if (sample.selection == covmx::kCCNue) {
324  if (sample.detector == covmx::kNearDet) sample.SetCut(&kNue2020ND);
325  else sample.SetCut(&kNue2020FDAllSamples_ML);
326  }
327 
328  else if (sample.selection == covmx::kCCNumu) {
329  if (sample.quantile == covmx::kNoQ) {
330  if (sample.detector == covmx::kNearDet) sample.SetCut(&kNumu2020ND);
331  else sample.SetCut(&kNumu2020FD_ML);
332  } else {
333  if (HadEFracQuantCuts.size() == 0) { // Load quantiles
334  std::string quantDir = std::getenv("NUMUDATA_DIR");
335  std::string infileQuant = quantDir + "/lib/ana2020/Quantiles/quantiles_" + sample.GetPolarity() + "_full_numu2020.root";
336  TFile* infile = TFile::Open( pnfs2xrootd(infileQuant).c_str() );
337  TH2* spec2DFD = (TH2*)infile->FindObjectAny("FDSpec2D");
338  HadEFracQuantCuts = QuantileCutsFromTH2(spec2DFD, kNumuCCOptimisedAxis2020, kHadEFracAxis, 4);
339  infile->Close();
340  }
341 
342  if (sample.detector == covmx::kNearDet) {
343  sample.SetCut(new const Cut(kNumu2020ND && HadEFracQuantCuts[sample.quantile]));
344  } else {
345  sample.SetCut(new const Cut(kNumu2020FD_ML && HadEFracQuantCuts[sample.quantile]));
346  }
347  } // if using quantiles
348  } // numu selection
349  } // for sample
350 
351 } // function SetCuts
352 
353 //===========================================================================================
354 /// Function to take an option TString and return a single associated covmx::Sample
356 
357  // Get selection
358  std::vector<std::pair<std::string, covmx::Selection>> selOpts
359  = { {"nuesel", covmx::kCCNue}, {"numusel", covmx::kCCNumu}, {"ncsel", covmx::kNC} };
360  covmx::Selection sel = ParseOption<covmx::Selection>(selOpts, optString, covmx::kNoSel);
361  // Get polarity
362  std::vector<std::pair<std::string, covmx::Polarity>> polOpts
363  = { {"fhc", covmx::kFHC}, {"rhc", covmx::kRHC } };
364  covmx::Polarity pol = ParseOption<covmx::Polarity>(polOpts, optString, covmx::kNoPol);
365  // Get detector
366  std::vector<std::pair<std::string, covmx::Detector>> detOpts
367  = { {"neardet", covmx::kNearDet}, {"fardet", covmx::kFarDet} };
368  covmx::Detector det = ParseOption<covmx::Detector>(detOpts, optString, covmx::kNoDet);
369  // Define sample
370  covmx::Sample ret(sel, pol, det);
371  // Get quantile if applicable
372  if (sel == covmx::kCCNumu) {
373  std::vector<std::pair<std::string, covmx::Quantile>> qOpts
374  = { {"q0", covmx::kQ1}, {"q1", covmx::kQ2}, {"q2", covmx::kQ3}, {"q3", covmx::kQ4} };
375  covmx::Quantile q = ParseOption<covmx::Quantile>(qOpts, optString, covmx::kNoQ);
376  ret.quantile = q;
377  }
378  return ret;
379 
380 } // function GetSampleFromOptString
381 
382 //===========================================================================================
383 /// Function to take an option TString and return a vector of associated covmx::Samples
384 std::vector<covmx::Sample> GetSamplesFromOptString(TString optString) {
385 
386  // Get selections
387  std::vector<std::pair<std::string, covmx::Selection>> selOpts
388  = { {"nuesel", covmx::kCCNue}, {"numusel", covmx::kCCNumu}, {"ncsel", covmx::kNC} };
389  std::vector<covmx::Selection> sels
390  = ParseOptions<covmx::Selection>(selOpts, optString);
391  // Get polarities
392  std::vector<std::pair<std::string, covmx::Polarity>> polOpts
393  = { {"fhc", covmx::kFHC}, {"rhc", covmx::kRHC } };
394  std::vector<covmx::Polarity> pols
395  = ParseOptions<covmx::Polarity>(polOpts, optString);
396  // Get detectors
397  std::vector<std::pair<std::string, covmx::Detector>> detOpts
398  = { {"neardet", covmx::kNearDet}, {"fardet", covmx::kFarDet} };
399  std::vector<covmx::Detector> dets
400  = ParseOptions<covmx::Detector>(detOpts, optString);
401  bool quantiles = optString.Contains("quantiles");
402  // Check for optional no-quantile config
403  // std::vector<std::pair<std::string, covmx::Quantile>> qOpts
404  // = { {"noquantiles", covmx::kNoQ}, {"q0", covmx::kQ1}, {"q1", covmx::kQ2},
405  // {"q2", covmx::kQ3}, {"q3", covmx::kQ4} };
406  // std::vector<covmx::Quantile> quantiles
407  // = ParseOptions<covmx::Quantile>(qOpts, optString);
408 
409  // Loop over samples and add to vector
410  std::vector<covmx::Sample> ret;
411  for (covmx::Selection sel : sels) {
412  for (covmx::Polarity pol : pols) {
413  for (covmx::Detector det : dets) {
414  // If it's numu, add all the quantiles unless configured for no quantiles
415  if (sel == covmx::kCCNumu && quantiles) {
416  // if (quantiles.empty()) {
417  // ret.push_back(covmx::Sample(sel, pol, det, covmx::kNoQ));
418  // } else {
420  ret.push_back(covmx::Sample(sel, pol, det, q));
421  }
422  // }
423  }
424  else {
425  ret.push_back(covmx::Sample(sel, pol, det));
426  }
427  } // for detector
428  } // for polarity
429  } // for selection
430 
431  std::cout << "Samples: " << std::endl;
432  for(auto& s : ret){
433  SetAxis(s);
434  SetPOT(s);
435  SetLivetime(s);
436  std::cout << s.GetTag() << " (" << s.GetBinning().NBins() << " bins)" << std::endl;
437  }
438  return ret;
439 
440 } // function GetSampleFromOptString
441 
442 //===========================================================================================
443 std::vector<bool> GetOptionConfig(TString opt, std::vector<std::string> options) {
444 
445  size_t n_opts = options.size();
446 
447  std::vector<bool> vec(n_opts);
448  for (size_t i = 0; i < n_opts; ++i)
449  if (CheckOption(opt, options[i]))
450  vec[i] = true;
451 
452  if (std::none_of(vec.begin(), vec.end(), [](bool v) { return v; })) {
453  std::string err = "Option string must contain ";
454  for (size_t i = 0; i < n_opts-2; ++i)
455  err += "\"" + options[i] + "\", ";
456  err += options[n_opts-2] + " or " + options[n_opts-1] + ".";
457  throw std::runtime_error(err);
458  }
459 
460  else {
461  std::cout << "Running for";
462  for (size_t i = 0; i < n_opts; ++i)
463  if (vec[i])
464  std::cout << " " << options[i];
465  std::cout << std::endl;
466  }
467 
468  return vec;
469 
470 } // function GetOptionConfig
471 
472 
473 //===========================================================================================
476  or sample.polarity != covmx::Polarity::kFHC) {
477  assert(false and "Nus20 currently only supports up to FHC NC + Numu.");
478  }
479 }
480 
481 //===========================================================================================
482 /// Load systematics from file
483 std::vector<const ISyst*> LoadSystsFromFile(std::string filePath, std::string dirName) {
484 
485  DontAddDirectory guard;
486 
487  // Open up input directory
488  TFile* inFile = TFile::Open(filePath.c_str(), "read");
489  TDirectory* dir = inFile->GetDirectory(dirName.c_str());
490 
491  // Loop over everything in this directory and load it as a systematic
492  std::vector<const ISyst*> systs;
493  TIter next(dir->GetListOfKeys());
494  TKey* key;
495  while ((key = (TKey*)next())) {
496  // Check if this systematic has already been loaded
497  std::string shortName = ((TObjString*)((TDirectory*)key->ReadObj())->Get("name"))
498  ->GetString().Data();
499 
500  const ISyst* syst = Registry<ISyst>::ShortNameToPtr(shortName, true);
501  // If it's already been loaded, just return the existing version
502  if (syst) {
503  systs.push_back(syst);
504  } else {
505  // If it hasn't already been loaded, load it
506  systs.push_back(NuISyst::LoadFrom((TDirectory*)key->ReadObj()).release());
507  }
508  }
509  for (size_t i = 0; i < systs.size(); ++i) {
510  // We need to remove the vestigial totErr systematic to avoid double-counting
511  if (systs[i]->ShortName().find("totErr") != std::string::npos) {
512  systs.erase(systs.begin()+i);
513  break;
514  }
515  }
516 
517  inFile->Close();
518  return systs;
519 
520 } // function LoadSystsFromFile
521 
522 //===========================================================================================
523 /// Get systematics for a given sample
524 std::vector<const ISyst*> LoadSysts(covmx::Sample sample) {
525 
526  DontAddDirectory guard;
527 
528  // Open systfile and get directory
529  std::string filePath = InputPath() + "/systs/isysts.root";
530  std::string dirName = "isysts_" + sample.GetTag();
531 
532  return LoadSystsFromFile(filePath, dirName);
533 
534 } // function LoadSysts
535 
536 //===========================================================================================
537 /// Get cosmics for a given sample
538 std::unique_ptr<Spectrum> LoadCosmic(covmx::Sample sample) {
539 
540  DontAddDirectory guard;
541 
542  // No cosmics for ND
543  if (sample.detector == covmx::kNearDet)
544  return nullptr;
545 
546  std::string filename = InputPath() + "/cosmics/cosmics.root";
547  TFile* f = TFile::Open(filename.c_str(), "read");
548  std::string dirName = "cosmic_" + sample.GetTag();
549  auto ret = LoadFromFile<Spectrum>(f, dirName);
550  f->Close();
551  return std::move(ret);
552 
553 } // function LoadCosmic
554 
555 //===========================================================================================
556 void SetInfo(covmx::Sample& sample, double res=0) {
557  SetAxis(sample, res);
558  SetPOT(sample);
559  SetCut(sample);
560  SetLivetime(sample);
561 }
562 
563 //===========================================================================================
564 void SetPrediction(covmx::Sample& sample, bool systs=true) {
565 
566  string filename = InputPath()+"/pred/predictions.root";
567 
568  // Load prediction from file
569  TFile* f = TFile::Open(filename.c_str(), "read");
570  TDirectory* predDir = f->GetDirectory(sample.GetTag().c_str());
571  IPrediction* p = nullptr;
572  if (systs) {
573  GetXsecSysts();
574  LoadSysts(sample);
575  p = LoadFrom<PredictionInterp>(predDir->GetDirectory("pred_interp")).release();
576  }
577  else {
578  p = (sample.detector == covmx::kNearDet) ?
579  (IPrediction*)LoadFrom<NDPredictionSterile>(predDir->GetDirectory("pred")).release() :
580  (IPrediction*)LoadFrom<FDPredictionSterile>(predDir->GetDirectory("pred")).release();
581  }
582  sample.SetPrediction(p);
583  delete f;
584 
585 }
586 
587 //===========================================================================================
588 void SetEverything(covmx::Sample& sample, bool systs=false, double res=0) {
589  SetInfo(sample, res);
590  LoadSysts(sample);
591  SetPrediction(sample, systs);
592 }
593 
594 //===========================================================================================
595 /// Get the last part of a systematic's ShortName
597 
598  size_t pos = name.find("_");
599  if (pos == std::string::npos) return name;
600 
601  while (pos != std::string::npos) {
602  size_t tmppos = name.find("_", pos+1);
603  if (tmppos == std::string::npos) break;
604  pos = tmppos;
605  }
606 
607  return name.substr(pos+1);
608 
609 } // function GetSystBaseName
610 
611 //===========================================================================================
612 std::vector<covmx::CovarianceMatrix*> GetMatrices(std::vector<covmx::Sample> samples,
613  bool cvmfs=true) {
614  for(auto sample : samples) AssertSupported(sample);
615 
616  DontAddDirectory guard;
617 
618  std::string dirname = "both";
619  if (samples.size() == 1 and samples[0] == kNusFHCNearDet) dirname = "nd";
620  else if (samples.size() == 1 and samples[0] == kNusFHCFarDet) dirname = "fd";
621  //else if (samples.size() == 2 and samples[0] == kNusFHCNearDet
622  // and samples[1] == kNusFHCFarDet) dirname = "both";
623  //else if (samples.size() == 10) dirname = "both";
624  //else assert (false and "Only NC FHC neardet & fardet supported for now.");
625 
627  if (cvmfs) {
628  // commenting out bc nusdata environment variables are temporarily hecked up
629  //const char* cpath = getenv("NUSDATA_NUS19FHC_COVMX");
630  const char* cpath = getenv("NUSDATA_DIR");
631  assert (cpath and "nusdata directory not found! Aborting.");
632  path = std::string(cpath) + "/nus19/covmx";
633  }
634  else {
635  path = kNus20Path+"/covmx";
636  }
637  std::string filepath = path + "/covmx.root";
638 
639  // Temporary hack so I can cautiously preserve the existing covmx file
640  for(auto sample : samples){
641  if(sample.selection == covmx::kCCNumu){
642  filepath = path + "/covmx_nus_numu_fhc.root";
643  break;
644  }
645  }
646 
647  //if (not cvmfs) filepath = pnfs2xrootd(filepath); will this work without xrootd?
648  TFile* f = TFile::Open(filepath.c_str(), "read");
649 
650  TDirectory* dir = f->GetDirectory(dirname.c_str());
651  TIter next(dir->GetListOfKeys());
652  TKey* key;
653  std::vector<covmx::CovarianceMatrix*> ret;
654  while ((key = (TKey*)next())) {
655  std::string name(key->GetName());
656  if (name.find("totErr") != std::string::npos) continue;
657  covmx::CovarianceMatrix* mx = covmx::CovarianceMatrix::LoadFrom((TDirectory*)key->ReadObj()).release();
658  mx->SetName(name);
659  ret.push_back(mx);
660  }
661 
662  delete f;
663  return ret;
664 
665 } // function GetMatrices
666 
667 //===========================================================================================
669 
670  covmx::Sample ndSample(kNusFHCNearDet);
671  SetAxis(ndSample);
672  covmx::Sample fdSample(kNusFHCFarDet);
673  SetAxis(fdSample);
674  covmx::CovarianceMatrix* mx = new covmx::CovarianceMatrix({ndSample,fdSample});
675  for (auto syst : GetMatrices({ndSample,fdSample}, cvmfs))
676  mx->AddMatrix(syst);
677  return mx;
678 
679 } // function GetFullMatrix
680 
681 //===========================================================================================
683 
684  // Mass splittings
685  calc->SetDm(2, kNux20Dm21);
686  calc->SetDm(3, kNux20Dm21 + kNux20Dm32);
687  calc->SetDm(4, 0.);
688 
689  // Angles
690  calc->SetAngle(1, 3, kNux20Th13);
691  calc->SetAngle(2, 3, kNux20Th23);
692  calc->SetAngle(3, 4, 0.);
693  calc->SetAngle(2, 4, 0.);
694  calc->SetAngle(1, 4, 0.);
695 
696  // Phases
697  calc->SetDelta(1, 3, kNux20Delta13);
698  calc->SetDelta(2, 4, kNux20Delta24);
699 }
700 
701 //===========================================================================================
703 
704  SetNus20Params(calc); // Start with nominal parameters always
705 
706  if (type == 1 || type == 2) { // fake signal 1 & 2: MiniBooNE sterile parameters
707  Double_t dm41 = 0.041;
708  Double_t theta_24 = TMath::ASin(TMath::Sqrt(0.9580));
709  Double_t theta_34 = TMath::ASin(TMath::Sqrt(0.9580));
710  calc->SetDm(4, dm41);
711  calc->SetAngle(2, 4, theta_24);
712  calc->SetAngle(3, 4, theta_34);
713  } else if (type == 3) {
714  return; // Use nominal parameters for this set!
715  } else { // Throw an error if fake signal type not recognised.
716  std::ostringstream err;
717  err << "Error in SetFakeSignalParams! Invalid fake signal set "
718  << type << " was requested!";
719  throw std::runtime_error(err.str());
720  }
721 
722 } // function SetFakeSignalParams
723 
724 //===========================================================================================
726 
727  std::cout << "---------- OSCILLATION PARAMETERS ----------" << std::endl
728  << "Dm21: " << calc->GetDm(2) << std::endl
729  << "Dm31: " << calc->GetDm(3) << std::endl
730  << "Dm41: " << calc->GetDm(4) << std::endl
731  << "Theta 13: " << calc->GetAngle(1, 3) << std::endl
732  << "Theta 23: " << calc->GetAngle(2, 3) << std::endl
733  << "Theta 14: " << calc->GetAngle(1, 4) << std::endl
734  << "Theta 24: " << calc->GetAngle(2, 4) << std::endl
735  << "Theta 34: " << calc->GetAngle(3, 4) << std::endl
736  << "Delta 13: " << calc->GetDelta(1, 3) << std::endl
737  << "Delta 24: " << calc->GetDelta(2, 4) << std::endl
738  << "--------------------------------------------" << std::endl;
739 }
740 
741 //===========================================================================================
742 /// Gaussian constrains on atmospheric parameters
743 std::vector<const IChiSqExperiment*> GetConstraints() {
744 
745  std::vector<const IChiSqExperiment*> ret;
747  ret.push_back(new const GaussianConstraint(&kFitDmSq32Sterile, kNux20Dm32, kNux20Dm32Sigma));
748  return ret;
749 
750 }
751 
752 //===========================================================================================
753 /// Load fake data from file
754 std::vector<Spectrum*> LoadFakeData(std::vector<covmx::Sample> samples, size_t universe,
755  bool systs)
756 {
757  DontAddDirectory guard;
758  std::vector<Spectrum*> ret(samples.size());
759 
760  std::string filepath = InputPath() + "/fakedata/FakeData" + (systs ? "Systs" : "Stats") + ".root";
761  //if (not cvmfs) filepath = pnfs2xrootd(filepath);
762  TFile* f = TFile::Open(filepath.c_str(), "read");
763 
764  // Get universe and spectra
765  TDirectory* dir = f->GetDirectory(Form("universe_%zu", universe));
766  for (size_t i = 0; i < ret.size(); ++i) {
767  ret[i] = Spectrum::LoadFrom(dir->GetDirectory(samples[i].GetTag().c_str())).release();
768  }
769  return ret;
770 
771 } // function LoadFakeData
772 
773 // //===========================================================================================
774 // /// Get decorrelated near detector errors
775 // std::vector<double> GetDecorrelatedNDErrors() {
776 
777 // // Get covariance matrix and predictions
778 // covmx::CovarianceMatrix* mx = GetFullMatrix(kUseCVMFS);
779 // auto predND = LoadPrediction(kNusFHCNearDet, "nosysts", kUseCVMFS);
780 // auto predFD = LoadPrediction(kNusFHCFarDet, "nosysts", kUseCVMFS);
781 // covmx::Sample ndSample(kNusFHCNearDet);
782 // ndSample.SetPrediction(predND);
783 // covmx::Sample fdSample(kNusFHCFarDet);
784 // fdSample.SetPrediction(predFD);
785 // auto calc = DefaultSterileCalc(4);
786 // SetNus20Params(calc);
787 // TMatrixD matrix = mx->Predict({ndSample,fdSample}, calc);
788 
789 // size_t ndbins = kNCNDBinning.NBins();
790 // size_t fdbins = kNCFDBinning.NBins();
791 
792 // // Create and populate submatrices
793 // TMatrixD s11(ndbins, ndbins);
794 // TMatrixD s12(fdbins, ndbins);
795 // TMatrixD s21(ndbins, fdbins);
796 // TMatrixD s22(fdbins, fdbins);
797 
798 // for (size_t i = 0; i < ndbins; ++i) {
799 // for (size_t j = 0; j < ndbins; ++j) {
800 // s11(i,j) = matrix(i,j);
801 // }
802 // }
803 
804 // for (size_t i = 0; i < ndbins; ++i) {
805 // for (size_t j = 0; j < fdbins; ++j) {
806 // s12(j,i) = matrix(i,ndbins+j);
807 // s21(i,j) = matrix(i,ndbins+j);
808 // }
809 // }
810 
811 // for (size_t i = 0; i < fdbins; ++i) {
812 // for (size_t j = 0; j < fdbins; ++j) {
813 // s22(i,j) = matrix(ndbins+i, ndbins+j);
814 // }
815 // }
816 
817 // // Decorrelate
818 // TMatrixD tmp(ndbins, ndbins);
819 // s22.Invert();
820 // s21 *= s22;
821 // tmp.Mult(s21, s12);
822 // s11 -= tmp;
823 
824 // std::vector<double> ret(ndbins);
825 // for (size_t i = 0; i < ndbins; ++i) {
826 // ret[i] = sqrt(s11(i, i));
827 // }
828 
829 // // Clean up
830 // delete mx;
831 // delete predND;
832 // delete predFD;
833 // delete calc;
834 
835 // return ret;
836 
837 // } // function GetDecorrelatedNDErrors
838 
839 // //===========================================================================================
840 // /// Get decorrelated far detector errors
841 // std::vector<double> GetDecorrelatedFDErrors() {
842 
843 // // Get covariance matrix and predictions
844 // covmx::CovarianceMatrix* mx = GetFullMatrix(kUseCVMFS);
845 // auto predND = LoadPrediction(kNusFHCNearDet, "nosysts", kUseCVMFS);
846 // auto predFD = LoadPrediction(kNusFHCFarDet, "nosysts", kUseCVMFS);
847 // covmx::Sample ndSample(kNusFHCNearDet);
848 // ndSample.SetPrediction(predND);
849 // covmx::Sample fdSample(kNusFHCFarDet);
850 // fdSample.SetPrediction(predFD);
851 // auto calc = DefaultSterileCalc(4);
852 // SetNus20Params(calc);
853 // TMatrixD matrix = mx->Predict({ndSample,fdSample}, calc);
854 
855 // size_t ndbins = kNCNDBinning.NBins();
856 // size_t fdbins = kNCFDBinning.NBins();
857 
858 // TMatrixD s11(fdbins, fdbins);
859 // TMatrixD s12(ndbins, fdbins);
860 // TMatrixD s21(fdbins, ndbins);
861 // TMatrixD s22(ndbins, ndbins);
862 
863 // for (size_t i = 0; i < ndbins; ++i) {
864 // for (size_t j = 0; j < ndbins; ++j) {
865 // s22(i,j) = matrix(i,j);
866 // }
867 // }
868 
869 // for (size_t i = 0; i < ndbins; ++i) {
870 // for (size_t j = 0; j < fdbins; ++j) {
871 // s12(i,j) = matrix(i,ndbins+j);
872 // s21(j,i) = matrix(i,ndbins+j);
873 // }
874 // }
875 
876 // for (size_t i = 0; i < fdbins; ++i) {
877 // for (size_t j = 0; j < fdbins; ++j) {
878 // s11(i,j) = matrix(ndbins+i, ndbins+j);
879 // }
880 // }
881 
882 // TMatrixD tmp(fdbins, fdbins);
883 // s22.Invert();
884 // s21 *= s22;
885 // tmp.Mult(s21, s12);
886 // s11 -= tmp;
887 
888 // std::vector<double> ret(fdbins);
889 // for (size_t i = 0; i < fdbins; ++i) {
890 // ret[i] = sqrt(s11(i, i));
891 // }
892 
893 // // Clean up
894 // delete mx;
895 // delete predND;
896 // delete predFD;
897 // delete calc;
898 
899 // return ret;
900 
901 // } // function GetDecorrelatedFDErrors
902 
903 //===========================================================================================
904 // Function to pack covariance matrix to remove empty ND components prior to inversion
906 
907  size_t mxSize = mx.GetNrows();
908  size_t nComps = 13; // if this is a hardcoded hack, may as well go all in
909  std::vector<Binning> bins = { kNCNDBinning, kNCFDBinning };
910  size_t nSamples = bins.size();
911  size_t nBinsPerComp = kNCNDBinning.NBins() + kNCFDBinning.NBins();
912  std::vector<size_t> ndComps = { 0, 1, 8, 9, 12 };
913  size_t mxPackedSize = mxSize - ((8*bins[0].NBins())+1);
914  TMatrixD ret(mxPackedSize, mxPackedSize);
915  ret.Zero();
916  size_t iPack = 0;
917  // Loop over all components, samples, bins
918  for (size_t iComp = 0; iComp < nComps; ++iComp) {
919  for (size_t iSample = 0; iSample < nSamples; ++iSample) {
920  // If we're in an ND flux swap component, throw it away
921  if (iSample == 0 && std::find(ndComps.begin(), ndComps.end(), iComp) == ndComps.end()) {
922  // std::cout << "Skipping component " << iComp << ", sample " << iSample << std::endl;
923  continue;
924  }
925  for (size_t iBin = 0; iBin < (size_t)bins[iSample].NBins(); ++iBin) {
926  size_t i = (iComp*nBinsPerComp) + (iSample*kNCNDBinning.NBins()) + iBin;
927  if (i == 124) continue; // awful hack to remove problem bin
928  size_t jPack = 0;
929  for (size_t jComp = 0; jComp < nComps; ++jComp) {
930  for (size_t jSample = 0; jSample < nSamples; ++jSample) {
931  // If we're in an ND flux swap component, throw it away
932  if (jSample == 0 && std::find(ndComps.begin(), ndComps.end(), jComp) == ndComps.end()) {
933  // std::cout << "Skipping component " << jComp << ", sample " << jSample << std::endl;
934  continue;
935  }
936  for (size_t jBin = 0; jBin < (size_t)bins[jSample].NBins(); ++jBin) {
937  size_t j = (jComp*nBinsPerComp) + (jSample*kNCNDBinning.NBins()) + jBin;
938  if (j == 124) continue; // awful hack to remove problem bin
939  ret(iPack,jPack) = mx(i,j);
940  ++jPack;
941  } // for bin j
942  } // for sample j
943  } // for component j
944  ++iPack;
945  } // for bin i
946  } // for sample i
947  } // for component i
948 
949  return ret;
950 
951 } // function PackMatrix
952 
953 //===========================================================================================
954 // Unpack matrix to restore empty ND components
956 
957  size_t nComps = 13; // if this is a hardcoded hack, may as well go all in
958  std::vector<Binning> bins = { kNCNDBinning, kNCFDBinning };
959  size_t nSamples = bins.size();
960  size_t nBinsPerComp = kNCNDBinning.NBins() + kNCFDBinning.NBins();
961  std::vector<size_t> ndComps = { 0, 1, 8, 9, 12 };
962  size_t mxSize = nBinsPerComp * nComps;
963  TMatrixD ret(mxSize, mxSize);
964  ret.Zero();
965 
966  // Now if we packed the matrix, we need to unpack it!
967  size_t iPack = 0;
968  // Loop over all components, samples, bins
969  for (size_t iComp = 0; iComp < nComps; ++iComp) {
970  for (size_t iSample = 0; iSample < nSamples; ++iSample) {
971  // If we're in an ND flux swap component, throw it away
972  if (iSample == 0 && std::find(ndComps.begin(), ndComps.end(), iComp) == ndComps.end()) {
973  // std::cout << "Skipping component " << iComp << ", sample " << iSample << std::endl;
974  continue;
975  }
976  for (size_t iBin = 0; iBin < (size_t)bins[iSample].NBins(); ++iBin) {
977  size_t i = (iComp*nBinsPerComp) + (iSample*kNCNDBinning.NBins()) + iBin;
978  if (i == 124) continue; // awful hack to remove problem bin
979  size_t jPack = 0;
980  for (size_t jComp = 0; jComp < nComps; ++jComp) {
981  for (size_t jSample = 0; jSample < nSamples; ++jSample) {
982  // If we're in an ND flux swap component, throw it away
983  if (jSample == 0 && std::find(ndComps.begin(), ndComps.end(), jComp) == ndComps.end()) {
984  // std::cout << "Skipping component " << jComp << ", sample " << jSample << std::endl;
985  continue;
986  }
987  for (size_t jBin = 0; jBin < (size_t)bins[jSample].NBins(); ++jBin) {
988  size_t j = (jComp*nBinsPerComp) + (jSample*kNCNDBinning.NBins()) + jBin;
989  if (j == 124) continue; // awful hack to remove problem bin
990  ret(i,j) = mx(iPack,jPack);
991  ++jPack;
992  } // for bin j
993  } // for sample j
994  } // for component j
995  ++iPack;
996  } // for bin i
997  } // for sample i
998  } // for component i
999 
1000  return ret;
1001 
1002 } // function UnpackMatrix
std::vector< covmx::Sample > GetNumuNDSamples()
Definition: Utilities.h:116
const double kNux20Th23
Definition: Utilities.h:40
const covmx::Sample kNumuRHCFarDet(covmx::kCCNumu, covmx::kRHC, covmx::kFarDet)
const XML_Char * name
Definition: expat.h:151
TMatrixD UnpackMatrix(TMatrixD mx)
Definition: Utilities.h:955
std::vector< double > quantiles(TH1D *h)
Definition: absCal.cxx:528
double GetDelta(int i, int j) const
const double kNux20RHCLivetime
Definition: Utilities.h:51
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::string GetSystBaseName(std::string name)
Get the last part of a systematic&#39;s ShortName.
Definition: Utilities.h:232
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
const double kNux20RHCNDPOT
Definition: Utilities.h:48
const covmx::Sample kNumuQ1FHCFarDet(covmx::kCCNumu, covmx::kFHC, covmx::kFarDet, covmx::kQ1)
void SetEverything(covmx::Sample &sample, bool systs=false, double res=0)
Definition: Utilities.h:588
std::vector< covmx::Sample > GetNCFDSamples()
Definition: Utilities.h:156
const double kNux20Th12
Definition: Utilities.h:38
A simple Gaussian constraint on an arbitrary IFitVar.
std::vector< const ISyst * > LoadSystsFromFile(std::string filePath, std::string dirName)
Load systematics from file.
Definition: Utilities.h:483
std::vector< covmx::Sample > GetNumuSamples()
Definition: Utilities.h:138
const char * p
Definition: xmltok.h:285
void SetPrediction(covmx::Sample &sample, bool systs=true)
Definition: Utilities.h:564
void SetPOT(covmx::Sample &sample)
Definition: Utilities.h:209
const Var kNus20Energy([](const caf::SRProxy *sr){if(sr->hdr.det!=caf::kNEARDET &&sr->hdr.det!=caf::kFARDET) return(double) sr->slc.calE;double pars[4][6]={{1.049, 0.795, 0.8409, 0.17, 0.82,-1.00},{1.025, 0.797, 0.9162, 0.53,-0.26,-1.48},{1.000, 1.000, 1.0000, 0.00, 0.00, 0.00},{1.000, 1.000, 1.0000, 0.00, 0.00, 0.00}};int detCur=(sr->hdr.det==caf::kFARDET)+((sr->spill.isRHC)<< 1);double e_EM=ana::kEME_2020(sr);double e_Had=ana::kHADE_2020(sr);double e_Cal=sr->slc.calE;return(e_EM/pars[detCur][0]+e_Had/pars[detCur][1])/(pars[detCur][2]+pars[detCur][3]*std::pow(e_Cal+pars[detCur][4], 2)*std::exp(pars[detCur][5]*e_Cal));})
Definition: NusVars.h:64
bool CheckOption(TString opts, TString opt)
Definition: Utilities.h:47
const HistAxis kHadEFracAxis("E_{had.} / E_{#nu}", Binning::Simple(200, 0, 1), kHadEFrac)
HistAxis that implements Hadronic Energy fraction binning used by L.Vinton to derive Hadronic Energy ...
Definition: HistAxes.h:30
void SetDelta(int i, int j, double delta)
const Cut kNumu2020ND
Definition: NumuCuts2020.h:57
void SetLivetime(double l)
Definition: Sample.h:56
const covmx::Sample kNumuRHCNearDet(covmx::kCCNumu, covmx::kRHC, covmx::kNearDet)
Adapt the PMNS_Sterile calculator to standard interface.
const FitDmSq32Sterile kFitDmSq32Sterile
OStream cerr
Definition: OStream.cxx:7
std::vector< Spectrum * > LoadFakeData(std::vector< covmx::Sample > samples, size_t universe, bool systs)
Load fake data from file.
Definition: Utilities.h:754
const double kNux20Th13
Definition: Utilities.h:39
void SetInfo(covmx::Sample &sample, double res=0)
Definition: Utilities.h:556
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
void AddMatrix(CovarianceMatrix *gen)
std::string GetTag() const
Definition: Sample.cxx:94
string filename
Definition: shutoffs.py:106
const bool kUseCVMFS
Float_t tmp
Definition: plot.C:36
void SetCut(covmx::Sample &sample)
Definition: Utilities.h:274
std::string pnfs2xrootd(std::string loc, bool unauth)
Definition: UtilsExt.cxx:237
const double kNux20RHCFDPOT
Definition: Utilities.h:49
const HistAxis kNumuCCOptimisedAxis2020("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kNumuE2020)
Definition: HistAxes.h:25
osc::OscCalcDumb calc
const covmx::Sample kNumuQ2FHCFarDet(covmx::kCCNumu, covmx::kFHC, covmx::kFarDet, covmx::kQ2)
covmx::Sample GetSampleFromOptString(TString optString)
Function to take an option TString and return a single associated covmx::Sample.
Definition: Utilities.h:355
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
std::unique_ptr< T > LoadFrom(TDirectory *dir, const std::string &label)
Definition: LoadFromFile.h:17
const Cut kNue2020ND
Definition: NueCuts2020.h:178
#define M_PI
Definition: SbMath.h:34
const double kNux20FHCFDPOT
Definition: Utilities.h:47
const covmx::Sample kNumuQ4FHCFarDet(covmx::kCCNumu, covmx::kFHC, covmx::kFarDet, covmx::kQ4)
void SetCut(const Cut *c)
Definition: Sample.h:54
const Cut kNus20NDCuts
Definition: NusCuts20.h:102
ifstream inFile
Definition: AnaPlotMaker.h:34
const XML_Char * s
Definition: expat.h:262
std::string GetPolarity() const
Definition: Sample.cxx:52
void SetFakeSignalParams(osc::OscCalcSterile *calc, size_t type)
Definition: Utilities.h:702
double GetDefaultPOT(covmx::Sample sample)
Definition: Utilities.h:198
const double kNux20FHCLivetime
Definition: Utilities.h:50
void SetAxis(const HistAxis *a)
Definition: Sample.h:53
T ParseOption(std::vector< std::pair< std::string, T >> opts, TString optString, T def)
Definition: Utilities.h:80
void SetNus20Params(osc::OscCalcSterile *calc)
Definition: Utilities.h:682
std::vector< const IExperiment * > GetConstraints()
Gaussian constrains on atmospheric parameters.
Definition: Utilities.h:416
string infile
const Cut sels[kNumSels]
Definition: vars.h:44
static std::unique_ptr< Spectrum > LoadFrom(TDirectory *dir, const std::string &name)
Definition: Spectrum.cxx:546
std::vector< bool > GetOptionConfig(TString opt, std::vector< std::string > options)
Definition: Utilities.h:56
const std::string kNus20Path
void SetPrediction(IPrediction *p)
Definition: Sample.cxx:103
std::string getenv(std::string const &name)
Selection selection
Definition: Sample.h:98
const HistAxis kNue2020Axis("NuE Energy / Analysis Bin", kNue2020Binning, kNue2020AnaBin)
Use this Axis for Ana2020, official Axis.
Definition: NueCuts2020.h:195
Detector detector
Definition: Sample.h:100
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
const double kAna2020FHCLivetime
Definition: Exposures.h:237
const double kNux20Delta24
Definition: Utilities.h:44
void PrintOscParams(osc::OscCalcSterile *calc)
Definition: Utilities.h:725
const std::vector< std::string > ndComps
Definition: TestCovMxNew.C:12
const HistAxis * GetDefaultAxis(covmx::Sample sample, double res=0)
Definition: Utilities.h:228
const double j
Definition: BetheBloch.cxx:29
Eigen::VectorXd vec
std::vector< covmx::Sample > GetNCSamples()
Definition: Utilities.h:165
double GetDefaultLivetime(covmx::Sample sample)
Definition: Utilities.h:214
const covmx::Sample kNusFHCFarDet(covmx::Analysis::kNC, covmx::Polarity::kFHC, covmx::Detector::kFarDet)
std::vector< CovarianceMatrix * > GetMatrices(std::vector< covmx::Sample > samples, bool cvmfs=true)
Definition: Utilities.h:350
const double kNux20Dm32Sigma
Definition: Utilities.h:36
const double kAna2020FHCPOT
Definition: Exposures.h:233
static Binning Custom(const std::vector< double > &edges)
Definition: Binning.cxx:161
float bin[41]
Definition: plottest35.C:14
void SetLivetime(covmx::Sample &sample)
Definition: Utilities.h:223
const double kAna2020RHCPOT
Definition: Exposures.h:235
std::vector< covmx::Sample > GetAllSamples()
Definition: Utilities.h:174
OStream cout
Definition: OStream.cxx:6
const covmx::Sample kNumuQ2FHCNearDet(covmx::kCCNumu, covmx::kFHC, covmx::kNearDet, covmx::kQ2)
TMatrixD PackMatrix(TMatrixD mx)
Definition: Utilities.h:905
const std::string path
Definition: plot_BEN.C:43
const Binning bins
Definition: NumuCC_CPiBin.h:8
void SetAngle(int i, int j, double th)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
const Binning kNCNDBinning
NC custom binning.
Definition: Binning.cxx:104
const covmx::Sample kNumuQ1FHCNearDet(covmx::kCCNumu, covmx::kFHC, covmx::kNearDet, covmx::kQ1)
std::vector< const ISyst * > GetXsecSysts()
std::string dirName
Definition: PlotSpectra.h:47
void SetName(std::string name)
void SetDm(int i, double dm)
string GetString(xmlDocPtr xml_doc, string node_path)
TDirectory * dir
Definition: macro.C:5
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:326
Quantile quantile
Definition: Sample.h:101
static std::unique_ptr< CovarianceMatrix > LoadFrom(TDirectory *dir)
const double kAna2020RHCLivetime
Definition: Exposures.h:238
int NBins() const
Definition: Binning.h:29
const covmx::Sample kNumuQ3FHCNearDet(covmx::kCCNumu, covmx::kFHC, covmx::kNearDet, covmx::kQ3)
std::vector< T > ParseOptions(std::vector< std::pair< std::string, T >> opts, TString optString)
Definition: Utilities.h:103
std::string GetName() const
Definition: Sample.cxx:72
const Binning kNCFDBinning
Definition: Binning.cxx:105
std::vector< covmx::Sample > GetSamplesFromOptString(TString optString)
Function to take an option TString and return a vector of associated covmx::Samples.
Definition: Utilities.h:384
std::vector< Cut > QuantileCutsFromTH2(TH2 *quantileHist, const HistAxis &independentAxis, const HistAxis &quantileAxis, const unsigned int &numQuantiles, const bool verbose)
: Do the same as the QuantileCuts function but taking in the TH2 instead of making it...
std::unique_ptr< Spectrum > LoadCosmic(covmx::Sample sample, bool cvmfs=true)
Get cosmics for a given sample.
Definition: Utilities.h:145
assert(nhit_max >=nhit_nbins)
std::vector< const ISyst * > LoadSysts(covmx::Sample sample)
Get systematics for a given sample.
Definition: Utilities.h:524
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
const double kNux20Th23Sigma
Definition: Utilities.h:41
double GetDm(int i) const
void SetPOT(double d)
Definition: Sample.h:55
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
const covmx::Sample kNumuQ3FHCFarDet(covmx::kCCNumu, covmx::kFHC, covmx::kFarDet, covmx::kQ3)
const double kNux20Dm32
Definition: Utilities.h:35
covmx::CovarianceMatrix * GetFullMatrix(bool cvmfs=true)
Definition: Utilities.h:668
double T
Definition: Xdiff_gwt.C:5
const bool kUseXRootD
const Cut kNue2020FDAllSamples_ML
Prevent histograms being added to the current directory.
Definition: UtilsExt.h:46
const Cut kNus20FDCuts_ML
Polarity polarity
Definition: Sample.h:99
std::vector< covmx::Sample > GetNCNDSamples()
Definition: Utilities.h:147
string InputPath()
Definition: Utilities.h:183
const covmx::Sample kNusFHCNearDet(covmx::Analysis::kNC, covmx::Polarity::kFHC, covmx::Detector::kNearDet)
const Cut kNumu2020FD_ML
void next()
Definition: show_event.C:84
const double kNux20Delta13
Definition: Utilities.h:43
const double kNux20FHCNDPOT
Definition: Utilities.h:46
void AssertSupported(covmx::Sample sample)
Definition: Utilities.h:474
void SetCuts(std::vector< covmx::Sample > &samples)
Definition: Utilities.h:309
const covmx::Sample kNumuFHCNearDet(covmx::kCCNumu, covmx::kFHC, covmx::kNearDet)
double GetAngle(int i, int j) const
static const T * ShortNameToPtr(const std::string &s, bool allowFail=false)
Definition: Registry.cxx:60
const double kNux20Dm21
Definition: Utilities.h:34
A class for generating a covariance matrices as a function of oscillation parameters and systematics ...
const covmx::Sample kNumuFHCFarDet(covmx::kCCNumu, covmx::kFHC, covmx::kFarDet)
const covmx::Sample kNumuQ4FHCNearDet(covmx::kCCNumu, covmx::kFHC, covmx::kNearDet, covmx::kQ4)
const FitTheta23Sterile kFitTheta23Sterile
void SetAxis(covmx::Sample &sample, double res=0)
Definition: Utilities.h:268
std::vector< covmx::Sample > GetNumuFDSamples()
Definition: Utilities.h:127