Functions
SystsDecompLoad.C File Reference
#include "CAFAna/Core/Loaders.h"
#include "CAFAna/Core/SystShifts.h"
#include "CAFAna/Core/Utilities.h"
#include "CAFAna/Cuts/Cuts.h"
#include "NuXAna/Cuts/NusCuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Decomp/NCDecomp.h"
#include "3FlavorAna/Decomp/NueDecomp.h"
#include "CAFAna/Decomp/NueDecomp100Dn.h"
#include "CAFAna/Decomp/NueDecomp100Up.h"
#include "3FlavorAna/Decomp/NumuDecomp.h"
#include "CAFAna/Decomp/ProportionalDecomp.h"
#include "CAFAna/Extrap/ExtrapSterile.h"
#include "CAFAna/Prediction/PredictionGenerator.h"
#include "NuXAna/Prediction/PredictionGeneratorNuX.h"
#include "NuXAna/Prediction/PredictionSterile.h"
#include "CAFAna/Systs/Systs.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "NuXAna/Vars/HistAxes.h"
#include "NuXAna/macros/NuSLoadMacroDefs.h"
#include "NuXAna/macros/NuSSystFunctions.h"

Go to the source code of this file.

Functions

IDecompMakeDecomp (Loaders *loaders, const HistAxis &axis, const Cut &cut, std::string shiftlabel, const SystShifts &kMCShift=kNoShift, const Var &wei=kUnweighted)
 
void SystsDecompLoad ()
 

Function Documentation

IDecomp * MakeDecomp ( Loaders loaders,
const HistAxis axis,
const Cut cut,
std::string  shiftlabel,
const SystShifts kMCShift = kNoShift,
const Var wei = kUnweighted 
)

Definition at line 150 of file SystsDecompLoad.C.

References allInOneTrainingPlots::axis, om::cout, cut, allTimeWatchdog::endl, ana::Loaders::GetLoader(), ana::kBeam, ana::Loaders::kData, ana::Loaders::kMC, caf::kNEARDET, ana::Loaders::kNonSwap, and ana::kNoShift.

Referenced by SystsDecompLoad().

154 {
155  if(shiftlabel.compare("NC") == 0) {
156  return new NCDecomp(
157  loaders->GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
158  loaders->GetLoader(caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap),
159  axis, cut, kMCShift, kNoShift, wei
160  );
161  }
162  if(shiftlabel.compare("Numu") == 0) {
163  return new NumuDecomp(
164  loaders->GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
165  loaders->GetLoader(caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap),
166  axis, cut, kMCShift, kNoShift, wei
167  );
168  }
169  if(shiftlabel.compare("NueUp") == 0) {
170  return new NueDecomp100Up(
171  loaders->GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
172  loaders->GetLoader(caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap),
173  axis, cut, kMCShift, kNoShift, wei
174  );
175  }
176  if(shiftlabel.compare("NueDn") == 0) {
177  return new NueDecomp100Dn(
178  loaders->GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
179  loaders->GetLoader(caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap),
180  axis, cut, kMCShift, kNoShift, wei
181  );
182  }
183 
184  std::cout << "Label not found, reverting to ProportionalDecomp." << std::endl;
185  return new ProportionalDecomp(
186  loaders->GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
187  loaders->GetLoader(caf::kNEARDET, Loaders::kData, ana::kBeam, Loaders::kNonSwap),
188  axis, cut, kMCShift, kNoShift, wei
189  );
190 }
Near Detector underground.
Definition: SREnums.h:10
const Color_t kMC
Uses MC for CC and CC components, assigns remainder of data to NC.
Definition: NCDecomp.h:10
Uses MC for NC and CC components, assigns remainder of data to CC.
Definition: NumuDecomp.h:10
SpectrumLoaderBase & GetLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
Definition: Loaders.cxx:129
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
const Cut cut
Definition: exporter_fd.C:30
Splits Data proportionally according to MC.
void SystsDecompLoad ( )

Definition at line 30 of file SystsDecompLoad.C.

References ana::fnamefar_concat, ana::fnamenear_concat, ana::fnameneardata_concat, ana::fnameswap_concat, ana::fnametau_concat, PandAna.Demos.tute_pid_validation::folder, ana::SterileGenerator::Generate(), ana::Loaders::Go(), ana::kBeam, ana::kCaloE, ana::Loaders::kData, caf::kFARDET, ana::Loaders::kFluxSwap, ana::Loaders::kMC, ana::kNCBinsNumuCCAxis, ana::kNCDisappearanceEnergyBinning, caf::kNEARDET, ana::Loaders::kNonSwap, ana::kNoShift, ana::kNumuND, ana::kNusFD, ana::kNusND, ana::kOnly14DB, ana::kStandardSpillCuts, ana::Loaders::kTauSwap, ana::kTuftsWeightCC, loaders, MakeDecomp(), ana::ModularExtrapSterile::NCDisappearance(), ana::SaveMaps(), ana::Loaders::SetLoaderPath(), ana::Loaders::SetSpillCut(), and string.

31 {
32  TH1::AddDirectory(0);
33 
35 
37  loaders.SetLoaderPath(fnamefar_concat, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
38  loaders.SetLoaderPath(fnameswap_concat, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap);
41 
43 
44  // A map to set up systematics, starting with a label for the systematic,
45  // and finishing with a vector for items necessary to set up the Syst object
46  std::map<std::string, std::string> shiftlabels;
47  shiftlabels["NC"] = "NC";
48  shiftlabels["Numu"] = "Numu";
49  shiftlabels["NueUp"] = "NueUp";
50  shiftlabels["NueDn"] = "NueDn";
51 
52  // A map of systematic objects, indexed by the same label as above
53  std::map<std::string, std::vector<IDecomp*> > systematics;
54 
55  // Define a map of samples and cuts/axes to set them up
56  // Each sample, essentially, is a way to set up the analysis
57  std::string labelRecoE = "Calorimetric Energy (GeV)";
58  std::map<std::string, std::pair<HistAxis*, std::pair<Cut*, Cut*> > > cut_samples;
59  std::pair<Cut*, Cut*> Ana01(new Cut(kNusND), new Cut(kNusFD));
60  cut_samples["Ana01"] = std::pair<HistAxis*, std::pair<Cut*, Cut*> >(
62  Ana01
63  );
64 
65  // Set up maps to the decompositions/predictions (each flavor component)
66  // Nominal maps are indexed purely by sample label
67  // Shifted maps are indexed by sample label, systematic label, then sigma of the shift
68  std::map<std::string, IDecomp*> decomps_nominal;
69  std::map<std::string, std::map<std::string, std::map<int, IDecomp*> > > decomps_shifted;
70  std::map<std::string, PredictionNoExtrap*> predsNE_nominal;
71  std::map<std::string, std::map<std::string, std::map<int, PredictionNoExtrap*> > > predsNE_shifted;
72  std::map<std::string, PredictionSterile*> predsSt_nominal;
73  std::map<std::string, std::map<std::string, std::map<int, PredictionSterile*> > > predsSt_shifted;
74 
75  // Set up the actual decompositions/predictions
76  // sample.first = the sample label
77  // shiftlabel.first = the systematic shift label
78  // sample.second.first = the sample HistAxis
79  // sample.second.second = the sample Cut
80  // syst.first = the integer number of sigmas for the shift
81  // syst.second = the systematic being shifted
82  for(const auto& sample : cut_samples) {
83  SterileGenerator gen(
84  *sample.second.first, kNCBinsNumuCCAxis,
85  *sample.second.second.second, *sample.second.second.first,
87  );
88 
89  // Set up the nominal decompositions
90  // Only one is needed per sample
91  decomps_nominal[sample.first] = MakeDecomp(
92  &loaders, *sample.second.first, *sample.second.second.first, "",
94  );
95  predsNE_nominal[sample.first] = new PredictionNoExtrap(
96  loaders,
97  *sample.second.first, *sample.second.second.second,
99  );
100  predsSt_nominal[sample.first] = (PredictionSterile*)gen.Generate(
101  loaders
102  ).release();
103 
104  // Set up the shifted decompositions
105  // One is needed for every sample, systematic, and sigma level
106  for(const auto& shiftlabel : shiftlabels) {
107  decomps_shifted[sample.first][shiftlabel.first][1] = MakeDecomp(
108  &loaders, *sample.second.first, *sample.second.second.first, shiftlabel.first,
110  );
111  predsNE_shifted[sample.first][shiftlabel.first][1] = new PredictionNoExtrap(
112  loaders, *sample.second.first, *sample.second.second.second,
114  );
115 
116  IDecomp* decompnc = MakeDecomp(
117  &loaders, *sample.second.first, *sample.second.second.first, shiftlabel.first,
119  );
120  IDecomp* decompnm = MakeDecomp(
121  &loaders, kNCBinsNumuCCAxis, kNumuND, shiftlabel.first,
123  );
124  ModularExtrapSterile* extrap = new ModularExtrapSterile(ModularExtrapSterile::NCDisappearance(
125  loaders, *decompnc, *decompnm,
126  *sample.second.first, kNCBinsNumuCCAxis,
127  *sample.second.second.second, *sample.second.second.first, kNumuND,
129  ));
130  predsSt_shifted[sample.first][shiftlabel.first][1] =
131  new PredictionSterile(extrap);
132  }
133  }
134 
135  loaders.Go();
136 
137  std::string folder = "/nova/ana/steriles/Ana01/Systematics/";
138  std::string filenm = "SystsDecomp";
139 
140  std::string fullLocation = folder + filenm + ".root";
141  TFile* rootF = new TFile(fullLocation.c_str(), "RECREATE");
142 
143  SaveMaps(rootF,
144  decomps_nominal, decomps_shifted,
145  predsNE_nominal, predsNE_shifted,
146  predsSt_nominal, predsSt_shifted
147  );
148 }
Near Detector underground.
Definition: SREnums.h:10
void SaveMaps(TDirectory *dir, TString prefix, std::vector< const IFitVar * > profvars, std::vector< TString > profnames, std::map< const IFitVar *, TGraph * > &profMap, std::vector< const ISyst * > systs, std::map< const ISyst *, TGraph * > &systMap)
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
Far Detector at Ash River.
Definition: SREnums.h:11
const std::string fnametau_concat
const Cut kNusFD
Definition: NusCuts.h:46
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
const Color_t kMC
Generates extrapolated NC predictions using ProportionalDecomp.
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
const SpillCut kOnly14DB([](const caf::SRSpillProxy *spill){if(spill->det!=caf::kFARDET) return true;std::bitset< 14 > binary(spill->dibmask);for(int i=0;i< 14;++i){if(!binary[i]) return false;}return true;})
const std::string fnamenear_concat
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
void Cut(double x)
Definition: plot_outliers.C:1
const std::string fnameneardata_concat
const Var kCaloE
Summed calorimetric energy of all hits in slice, uncorrected.
Definition: Vars.cxx:52
const Cut kNumuND
Definition: NumuCuts.h:55
const SystShifts kNoShift
Definition: SystShifts.cxx:22
const HistAxis kNCBinsNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNCDisappearanceEnergyBinning, kCCE)
Definition: HistAxes.h:9
IDecomp * MakeDecomp(Loaders *loaders, const HistAxis &axis, const Cut &cut, std::string shiftlabel, const SystShifts &kMCShift=kNoShift, const Var &wei=kUnweighted)
const Var kTuftsWeightCC
Definition: XsecTunes.h:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
Standard interface to all decomposition techniques.
Definition: IDecomp.h:13
A prediction object compatible with sterile oscillations.
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
Prediction that just uses FD MC, with no extrapolation.
const std::string fnameswap_concat
const std::string fnamefar_concat
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
const Cut kNusND
Definition: NusCuts.h:71
const Binning kNCDisappearanceEnergyBinning
Energy binnings used in Ana01 for nus extrapolation.
Definition: Binning.cxx:68
enum BeamMode string