NusAna2020Systs.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/ISyst.h"
4 #include "CAFAna/Core/Sample.h"
6 #include "NuXAna/Vars/NusVars.h"
10 #include <vector>
11 #include <map>
12 
13 namespace ana
14 {
21 
22  class NusAna2020KaonSyst : public ISyst
23  {
24  public:
26  : ISyst("KaonFlux", "Normalisation of kaon flux in secondary beam")
27  {}
28 
29  void Shift(double sigma, caf::SRProxy* sr, double& weight) const override
30  {
31  if (sigma > 0) weight *= 1 + (sigma * (kNus18BeamWeightP(sr)-1));
32  else if (sigma < 0) weight *= 1 + (fabs(sigma) * (kNus18BeamWeightM(sr)-1));
33  if (weight < 0) weight = 0;
34  }
35  };
36 
38 
39  class NusAna2020TauSyst : public ISyst
40  {
41  public:
43  : ISyst("TauNorm", "Normalisation of tau component of spectrum")
44  {}
45 
46  void Shift(double sigma, caf::SRProxy* sr, double& weight) const override
47  {
48  if (sigma > 0) weight *= 1 + (sigma * (kFDTauWgtP(sr)-1));
49  else if (sigma < 0) weight *= 1 + (fabs(sigma) * (kFDTauWgtM(sr)-1));
50  if (weight < 0) weight = 0;
51  }
52  };
53 
55 
69 
70  const std::vector<std::string> kDetectorSystNames = { "AbsCalib", "Cherenkov", "LightLevel", "ShapeCalib" };
71  const std::vector<std::string> kOneSidedSysts = { "Cherenkov", "ShapeCalib" };
72  const std::vector<std::string> kUncorrelatedSysts = { "AbsCalib", "LightLevel", "ShapeCalib" };
73 
74  bool IsOneSided(std::string systKey);
75  bool IsDetUncorrelated(std::string systKey);
76  std::vector<std::string> GetKeySystNames();
77  std::vector<const KeySyst*> GetKeySysts();
78 
79  std::vector<const ISyst*> LoadSystsFromFile(std::string filePath, std::string dirName);
80  void AddNusAna2020NormSysts(std::vector<const ISyst*> &systs, covmx::Sample& s);
81  void AddNusAna2020NormSysts(std::vector<const ISyst*> &systs);
82  void AddNusAna2020FileSysts(std::vector<const ISyst*> &systs, covmx::Sample& s);
83  void AddNusAna2020XSecSysts(std::vector<const ISyst*> &systs);
84  void AddNusAna2020MECSysts(std::vector<const ISyst*> &systs);
85  void AddNusAna2020BeamSysts(std::vector<const ISyst*> &systs);
86  void AddNusAna2020KaonSyst(std::vector<const ISyst*> &systs);
87  void AddNusAna2020NeutronSyst(std::vector<const ISyst*> &systs);
88  void AddNusAna2020TauSyst(std::vector<const ISyst*> &systs);
89  void AddNusAna2020NumuSysts(std::vector<const ISyst*> &systs);
90 
91  //////////////////////////////////////////////////////////////////////
92 
93  std::vector<const ISyst*> getNusAna2020AllSysts(covmx::Sample& s);
94  std::vector<const ISyst*> getNusAna2020AllSysts();
95 
96  //////////////////////////////////////////////////////////////////////
97 
98  void SetSystAlias(covmx::Sample& sample);
99 
100 } // namespace
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DNorm_2(kGauss2DNorm_2Nux,"Norm_2Nux")
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
void AddNusAna2020FileSysts(vector< const ISyst * > &systs, Sample &s)
const Var kNus18BeamWeightM
Definition: NusVars.h:90
void AddNusAna2020XSecSysts(vector< const ISyst * > &systs)
const Var weight
bool IsOneSided(string systKey)
const std::vector< std::string > kOneSidedSysts
vector< const ISyst * > getNusAna2020AllSysts(covmx::Sample &s)
void SetSystAlias(Sample &sample)
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DMeanQ0_1(kGauss2DMeanQ0_1Nux,"MeanQ0_1Nux")
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const NusAna2020TauSyst kNusAna2020TauSyst
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DMeanQ3_2(kGauss2DMeanQ3_2Nux,"MeanQ3_2Nux")
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DCorr_2(kGauss2DCorr_2Nux,"Corr_2Nux")
void AddNusAna2020NeutronSyst(vector< const ISyst * > &systs)
vector< string > GetKeySystNames()
void AddNusAna2020NormSysts(vector< const ISyst * > &systs, Sample &s)
const NusAna2020KaonSyst kNusAna2020KaonSyst
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
const Var kNus18BeamWeightP
Definition: NusVars.h:87
const covmx::NormSyst kNusAna2020NormPOT("POT","POT uncertainty", 0.0055)
const covmx::NormSyst kNusAna2020NormMissingLepton("MissingLepton","Missing lepton bug", 0.008)
const MECDoubleGaussEnhSystNux kNusAna2020MECBaseline(kBaselineNux,"Baseline_2Nux")
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
const XML_Char * s
Definition: expat.h:262
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DMeanQ3_1(kGauss2DMeanQ3_1Nux,"MeanQ3_1Nux")
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DMeanQ0_2(kGauss2DMeanQ0_2Nux,"MeanQ0_2Nux")
caf::StandardRecord * sr
vector< const KeySyst * > GetKeySysts()
void AddNusAna2020TauSyst(vector< const ISyst * > &systs)
double sigma(TH1F *hist, double percentile)
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DSigmaQ0_2(kGauss2DSigmaQ0_2Nux,"SigmaQ0_2Nux")
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
void AddNusAna2020KaonSyst(vector< const ISyst * > &systs)
const covmx::NormSyst kNusAna2020NormNDNCOverlay("NDNCOverlay","ND NC selection overlay", 0.01)
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DSigmaQ3_2(kGauss2DSigmaQ3_2Nux,"SigmaQ3_2Nux")
std::string dirName
Definition: PlotSpectra.h:47
vector< const ISyst * > LoadSystsFromFile(string filePath, string dirName)
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DCorr_1(kGauss2DCorr_1Nux,"Corr_1Nux")
const covmx::NormSyst kNusAna2020NormNDMass("NDMass","Near detector mass", 0.003)
const std::vector< std::string > kDetectorSystNames
void AddNusAna2020MECSysts(vector< const ISyst * > &systs)
const Var kFDTauWgtP
Definition: NusVars.h:99
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DNorm_1(kGauss2DNorm_1Nux,"Norm_1Nux")
const Var kFDTauWgtM
Definition: NusVars.h:96
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DSigmaQ0_1(kGauss2DSigmaQ0_1Nux,"SigmaQ0_1Nux")
const std::vector< std::string > kUncorrelatedSysts
void AddNusAna2020NumuSysts(vector< const ISyst * > &systs)
const covmx::NormSyst kNusAna2020NormFDMass("FDMass","Far detector mass", 0.003)
bool IsDetUncorrelated(string systKey)
const MECDoubleGaussEnhSystNux kNusAna2020MECGauss2DSigmaQ3_1(kGauss2DSigmaQ3_1Nux,"SigmaQ3_1Nux")
void AddNusAna2020BeamSysts(vector< const ISyst * > &systs)
const covmx::NormSyst kNusAna2020NormNDNumuOverlay("NDNumuOverlay","ND numu selection overlay", 0.0021)
enum BeamMode string