Classes | Functions | Variables
syst_variations.h File Reference
#include "CAFAna/Core/Loaders.h"
#include "CAFAna/Analysis/Prod4Loaders.h"
#include "CAFAna/Core/SystShifts.h"
#include "CAFAna/Cuts/Cuts.h"
#include "3FlavorAna/Cuts/NueCuts2018.h"
#include "3FlavorAna/Cuts/NumuCuts2018.h"
#include "3FlavorAna/Cuts/QuantileCuts.h"
#include "3FlavorAna/Systs/NueExtrapSysts.h"
#include "CAFAna/Systs/XSecSysts.h"
#include "CAFAna/Systs/XSecSystLists.h"
#include "CAFAna/Systs/BeamSysts.h"
#include "3FlavorAna/Vars/Binnings.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "3FlavorAna/Vars/HistAxes.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "3FlavorAna/Systs/EnergySysts.h"
#include "3FlavorAna/Systs/JointAna2017Systs.h"
#include "3FlavorAna/Systs/NueSystHelper.h"
#include "3FlavorAna/Systs/GeniePCASyst.h"
#include <TFile.h>
#include <TString.h>
#include <vector>
#include <iostream>

Go to the source code of this file.

Classes

struct  ExtrapDef
 

Functions

ana::LoadersGetLoaders2018 (const TString option, const TString period="full")
 
void SwapNDDataLoader (Loaders *loaders, const TString option, const TString period="full")
 
const HistAxis axisMuEnergy ("Reconstructed Muon Energy (GeV)", kNumuCCEOptimisedBinning, kMuE)
 
const HistAxis axisHadEfrac ("Hadronic Energy Fraction", Binning::Simple(50, 0.0, 1.01), kHadEFrac)
 
const HistAxis axisNueEnergy ("Reconstructed neutrino energy (GeV)", kNueSAEnergyBinning, kNueEnergy2018)
 
std::vector< ExtrapDefGetExtrapolationDefs (const TString analysis, const TString period, const TString option="")
 

Variables

const Cut cutNumuND = kNumuCutND2018
 
const Cut cutNueND = kNue2018NDCVNSsb
 
const Cut cutNumuFD = kNumuCutFD2018
 
const Cut cutNueFDAll = kNue2018FDAllSamples
 
const Cut cutNueFDCore = kNue2018FD
 
const HistAxis axisNumu = kNumuCCOptimisedAxis
 
const HistAxis axisNumuForNueSig = kNumuCCOptimisedAxis
 

Function Documentation

const HistAxis axisHadEfrac ( "Hadronic Energy Fraction"  ,
Binning::Simple(50, 0.0, 1.01)  ,
kHadEFrac   
)
const HistAxis axisMuEnergy ( "Reconstructed Muon Energy (GeV)"  ,
kNumuCCEOptimisedBinning  ,
kMuE   
)
const HistAxis axisNueEnergy ( "Reconstructed neutrino energy (GeV)"  ,
kNueSAEnergyBinning  ,
kNueEnergy2018   
)
std::vector<ExtrapDef> GetExtrapolationDefs ( const TString  analysis,
const TString  period,
const TString  option = "" 
)

Definition at line 228 of file syst_variations.h.

References axisNumu, om::cerr, om::cout, cutNueFDAll, cutNueND, cutNumuFD, allTimeWatchdog::endl, inFile, ana::kHadEFracAxis, ana::kNoCut, ana::kNue2018Axis(), ana::kNumuCCOptimisedAxis, ana::pnfs2xrootd(), ana::QuantileCutsFromTH2(), runNovaSAM::ret, string, and art::to_string().

230  {
231  std::vector <ExtrapDef> ret;
232  if (analysis.Contains("nue"))
233  {
234  // Not making core only predictions for 2018 analysis
235  // Nue 2018 analysis axis/binning
236  // This is the only axis we need for Nue systematics 2018
237  ret.push_back(
238  {"Nue2018Axis", kNue2018Axis,
240  // Nue 2018 analysis axis/binning with single peripheral bin
241  //ret.push_back(
242  // {"Nue2018AxisMergedPeripheral", kNue2018AxisMergedPeripheral,
243  // cutNueFDAll, cutNueND, cutNumuND});
244  //ret.push_back(
245  // {"NueEnergy", axisNueEnergy, cutNueFDCore, cutNueND, cutNumuND});
246  }
247  else if(analysis.Contains("numu"))
248  {
249  // Want to load the quantile files from disk...
250  std::string sFHC_RHC = (analysis.Contains("FHC") == true ? "fhc" :"rhc");
251  std::string fdspecfile = "/pnfs/nova/persistent/analysis/numu/Ana2018/official/Quantiles/quantiles__"+sFHC_RHC+"_full__numu2018.root";
252  std::cout << "\nI'm going to try and get my quantile boundaries from " << fdspecfile << ".\n\n" << std::endl;
253  TFile* inFile = TFile::Open( pnfs2xrootd(fdspecfile).c_str() );
254  // Check that the file is valid.
255  if (inFile->IsZombie()) {
256  std::cout << "Problem with file " << fdspecfile << std::endl;
257  abort();
258  }
259  // Get the hadronic cut boundaries
260  TH2 *FDSpec2D = (TH2*)inFile->FindObjectAny("FDSpec2D");
261  const unsigned int nquantiles = 4;
262  std::vector<Cut> HadEFracQuantCuts = QuantileCutsFromTH2( FDSpec2D, kNumuCCOptimisedAxis, kHadEFracAxis, nquantiles );
263 
264  ret.push_back({"NumuEnergy", axisNumu, cutNumuFD, kNoCut, cutNumuND});
265  for ( unsigned int quant=0; quant<HadEFracQuantCuts.size(); ++quant ) {
266  ret.push_back({"Energy_Quant" +std::to_string(quant+1), axisNumu , cutNumuFD && HadEFracQuantCuts[quant], kNoCut, cutNumuND && HadEFracQuantCuts[quant]});
267  //ret.push_back({"MuonEn_Quant" +std::to_string(quant+1), axisMuEnergy, cutNumuFD && HadEFracQuantCuts[quant], kNoCut, cutNumuND && HadEFracQuantCuts[quant]});
268  //ret.push_back({"HadEFrac_Quant"+std::to_string(quant+1), axisHadEfrac, cutNumuFD && HadEFracQuantCuts[quant], kNoCut, cutNumuND && HadEFracQuantCuts[quant]});
269  }
270  }
271  else
272  std:: cerr << "Please mention nue or numu in analysis" << std::endl;
273 
274  std::cout << "ret has size " << ret.size() << std::endl;
275 
276  return ret;
277  }
const Cut cutNumuND
const Cut cutNumuFD
const Cut cutNueND
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
OStream cerr
Definition: OStream.cxx:7
std::string pnfs2xrootd(std::string loc, bool unauth)
Definition: UtilsExt.cxx:237
ifstream inFile
Definition: AnaPlotMaker.h:34
const HistAxis kNumuCCOptimisedAxis("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kCCE)
HistAxis that implements optimised numuCCE from L. Vinton. See docdb 16332. This was close to &#39;custC&#39;...
Definition: HistAxes.h:24
OStream cout
Definition: OStream.cxx:6
const Cut cutNueFDAll
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...
const HistAxis axisNumu
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
const HistAxis kNue2018Axis("NuE Energy / Analysis Bin", kNue2018Binning, kNue2018AnaBin)
Use this Axis for Ana2018, official Axis.
enum BeamMode string
ana::Loaders* GetLoaders2018 ( const TString  option,
const TString  period = "full" 
)

Definition at line 35 of file syst_variations.h.

References om::cerr, om::cout, allTimeWatchdog::endl, flux, ana::Loaders::GetLoaderPath(), ana::kBeam, ana::Loaders::kData, ana::Loaders::kFHC, ana::kFullCAF, ana::Loaders::kMC, caf::kNEARDET, ana::Loaders::kNonSwap, ana::kNueConcat, ana::kNumuConcat, ana::Loaders::kRHC, loaders, DCS_db_parser::period, ana::Loaders::SetLoaderPath(), and canMan::sign().

Referenced by make_predictions_systs().

37 {
38  Loaders * loaders = new Loaders();
39 
40  // Define CAF type
41  auto caftype = ana::ECAFType::kFullCAF;
42  if (option.Contains("nueconcat")) caftype = ana::ECAFType::kNueConcat;
43  if (option.Contains("numuconcat")) caftype = ana::ECAFType::kNumuConcat;
44 
45  // Get flux (FHC or RHC) from option
46  if (!(option.Contains("FHC") || option.Contains("RHC")))
47  {
48  std:: cerr << "Please mention FHC or RHC in option" << std::endl;
49  abort(); // unable to determine if FHC or RHC
50  }
51  auto flux = option.Contains("RHC") ? Loaders::kRHC : Loaders::kFHC;
52 
53  if(option.Contains("CalibrationUp"))
54  loaders = new Prod4AbsCalibLoaders(caftype, flux, +1,
55  period.Data(), period.Data());
56  else if(option.Contains("CalibrationDown"))
57  loaders = new Prod4AbsCalibLoaders(caftype, flux, -1,
58  period.Data(), period.Data());
59  else if(option.Contains("CalibShape"))
60  loaders = new Prod4CalibShapeLoaders(caftype, flux,
61  period.Data(), period.Data());
62  else if(option.Contains("Cherenkov"))
63  loaders = new Prod4CherenkovLoaders(caftype, flux,
64  period.Data(), period.Data());
65  else if(option.Contains("LightLevelUp"))
66  loaders = new Prod4LightLevelLoaders(caftype, flux, +1,
67  period.Data(), period.Data());
68  else if(option.Contains("LightLevelDown"))
69  loaders = new Prod4LightLevelLoaders(caftype, flux, -1,
70  period.Data(), period.Data());
71  else if(option.Contains("LightLevelNom")) // FD ONLY
72  {
73  loaders = new Prod4LightLevelLoaders(caftype, flux, 0,
74  period.Data(), period.Data());
75  auto temploaders = new Prod4NomLoaders(caftype, flux,
76  period.Data(), "full");
77  auto nominalNDMC = temploaders->GetLoaderPath(
78  caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
79  delete temploaders;
80  std::cout << "LightLevelNom ONLY for FD" << std::endl
81  << " --> adding loader path for standard ND nominal\n\n";
82  loaders->SetLoaderPath(
83  nominalNDMC, caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
84  std::cout << "Now: " << loaders->GetLoaderPath(
85  caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap)
86  << std::endl << std::endl;
87  }
88  else if(option.Contains("RelativeCalib"))
89  {
90  int sign = (option.Contains("Up") ? +1:-1);
91  loaders = new Prod4AbsCalibLoaders(caftype, flux, sign,
92  period.Data(), period.Data());
93  auto temploaders = new Prod4AbsCalibLoaders(
94  caftype, flux, - sign, period.Data(), period.Data());
95  auto oppositeNDMC = temploaders->GetLoaderPath(
96  caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
97  loaders->SetLoaderPath(oppositeNDMC, caf::kNEARDET,
98  Loaders::kData, ana::kBeam, Loaders::kNonSwap);
99  std::cout << "Swapped calibration loader" << oppositeNDMC << std::endl;
100  delete temploaders;
101  }
102  // TODO: Do we still need this?
103  else if (option.Contains("NoTau"))
104  {
105  std::cout << "WARNING: Option NoTau currently does nothing" << std::endl;
106  //loaders->DisableLoader(caf::kFARDET, Loaders::kMC,
107  // ana::kBeam, Loaders::kTauSwap);
108  /*
109  if (option.Contains("2sigmaNoTau"))
110  {
111  std::string posneg = (option.Contains("Up")) ? "pos" : "neg";
112  std::string NonSwa = "prod_decaf_R17-03-01-prod3reco.m_fd_genie_nonswap_fhc_nova_v08_full_calib-shift-fd-xyview-"+posneg+"-offset-2sigma_nue_or_numu_or_nus_contain_v1";
113  std::string FluSwa = "prod_decaf_R17-03-01-prod3reco.m_fd_genie_fluxswap_fhc_nova_v08_full_calib-shift-fd-xyview-"+posneg+"-offset-2sigma_nue_or_numu_or_nus_contain_v1";
114  loaders->SetLoaderPath( NonSwa, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap );
115  loaders->SetLoaderPath( FluSwa, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap );
116  }*/
117  }
118  else loaders = new Prod4NomLoaders(caftype, flux,
119  period.Data(), period.Data());
120 
121  return loaders;
122 }
Near Detector underground.
Definition: SREnums.h:10
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
const Color_t kMC
OStream cerr
Definition: OStream.cxx:7
Loaders for Cherenkov paths/definitions.
Definition: Prod4Loaders.h:172
Loaders::FluxType flux
Loaders for calibration shape paths/definitions.
Definition: Prod4Loaders.h:196
std::string GetLoaderPath(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap) const
Definition: Loaders.cxx:89
Loaders for absolute calibration paths/definitions.
Definition: Prod4Loaders.h:119
Loaders for light level paths/definitions.
Definition: Prod4Loaders.h:145
OStream cout
Definition: OStream.cxx:6
std::vector< Loaders * > loaders
Definition: syst_header.h:386
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod4Loaders.h:96
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
def sign(x)
Definition: canMan.py:197
void SwapNDDataLoader ( Loaders loaders,
const TString  option,
const TString  period = "full" 
)

Definition at line 167 of file syst_variations.h.

References om::cout, allTimeWatchdog::endl, flux, ana::Loaders::GetLoaderPath(), ana::kBeam, ana::Loaders::kData, ana::Loaders::kFHC, ana::kFullCAF, ana::Loaders::kMC, caf::kNEARDET, ana::Loaders::kNonSwap, ana::kNueConcat, ana::kNumuConcat, ana::Loaders::kRHC, DCS_db_parser::period, and ana::Loaders::SetLoaderPath().

170 {
171  auto caftype = ana::ECAFType::kFullCAF;
172  auto flux = option.Contains("RHC") ? Loaders::kRHC : Loaders::kFHC;
173 
174  if (option.Contains("nueconcat")) caftype = ana::ECAFType::kNueConcat;
175  if (option.Contains("numuconcat")) caftype = ana::ECAFType::kNumuConcat;
176 
177  auto temploaders = new Prod4NomLoaders (caftype, flux, period.Data(), "full");
178  auto nominalNDMC = temploaders->GetLoaderPath(
179  caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
180  delete temploaders;
181  std::cout << "\n\nSwapping ND Data for fake data \n\n";
182  std::cout << "Before " << loaders->GetLoaderPath(
183  caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap) << "\n";
184  loaders->SetLoaderPath(
185  nominalNDMC, caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap);
186  std::cout << "After " << loaders->GetLoaderPath(
187  caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap)
188  << std::endl << std::endl;
189 }
Near Detector underground.
Definition: SREnums.h:10
const Color_t kMC
Loaders::FluxType flux
std::string GetLoaderPath(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap) const
Definition: Loaders.cxx:89
OStream cout
Definition: OStream.cxx:6
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod4Loaders.h:96
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25

Variable Documentation

const HistAxis axisNumu = kNumuCCOptimisedAxis
const HistAxis axisNumuForNueSig = kNumuCCOptimisedAxis

Definition at line 211 of file syst_variations.h.

Referenced by make_predictions_systs(), and make_predictions_systs_fakedata().

const Cut cutNueFDAll = kNue2018FDAllSamples

Definition at line 201 of file syst_variations.h.

Referenced by GetExtrapolationDefs().

const Cut cutNueFDCore = kNue2018FD

Definition at line 202 of file syst_variations.h.

const Cut cutNueND = kNue2018NDCVNSsb

Definition at line 197 of file syst_variations.h.

Referenced by GetExtrapolationDefs().

const Cut cutNumuFD = kNumuCutFD2018

Definition at line 199 of file syst_variations.h.

Referenced by GetExtrapolationDefs().

const Cut cutNumuND = kNumuCutND2018

Definition at line 195 of file syst_variations.h.