Functions
SystsNDRockLoad.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/CheatDecomp.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

void SystsNDRockLoad ()
 

Function Documentation

void SystsNDRockLoad ( )

Definition at line 21 of file SystsNDRockLoad.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::GetLoader(), ana::Loaders::Go(), caf::Proxy< caf::StandardRecord >::hdr, caf::Proxy< caf::SRHeader >::ismc, ana::kBeam, ana::kCaloE, ana::Loaders::kData, caf::kFARDET, ana::Loaders::kFluxSwap, ana::Loaders::kMC, ana::kNCBinsNumuCCAxis, ana::kNCDisappearanceEnergyBinning, ana::kNDTruthFull(), caf::kNEARDET, ana::Loaders::kNonSwap, ana::kNoShift, ana::kNumuND, ana::kNusFD, ana::kNusND, ana::kOnly14DB, ana::kStandardSpillCuts, ana::Loaders::kTauSwap, ana::kTuftsWeightCC, loaders, caf::Proxy< caf::StandardRecord >::mc, ana::NDB, ana::NDE, ana::NDF, ana::NDL, ana::NDR, ana::NDT, caf::Proxy< caf::SRTruthBranch >::nnu, caf::Proxy< caf::SRTruthBranch >::nu, ana::SaveMaps(), ana::Loaders::SetLoaderPath(), ana::Loaders::SetSpillCut(), sr, and string.

22 {
23  TH1::AddDirectory(0);
24 
26 
28  loaders.SetLoaderPath(fnamefar_concat, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap);
29  loaders.SetLoaderPath(fnameswap_concat, caf::kFARDET, Loaders::kMC, ana::kBeam, Loaders::kFluxSwap);
32 
34 
35  // A map to set up systematics, starting with a label for the systematic,
36  // and finishing with a vector for items necessary to set up the Syst object
37  std::map<std::string, std::string> shiftlabels;
38  shiftlabels["NDRock"] = "ND Rock Contamination";
39 
40  const Cut kNDTruthFull(
41  [](const caf::SRProxy* sr)
42  {
43  if(sr->hdr.ismc == false) { return true; }
44  if(sr->mc.nnu < 1) { return false; }
45  if(sr->mc.nu[0].vtx.X() < NDL) { return false; }
46  if(sr->mc.nu[0].vtx.X() > NDR) { return false; }
47  if(sr->mc.nu[0].vtx.Y() < NDB) { return false; }
48  if(sr->mc.nu[0].vtx.Y() > NDT) { return false; }
49  if(sr->mc.nu[0].vtx.Z() < NDF) { return false; }
50 
51  double NDM = 1587.;
52  if(sr->mc.nu[0].vtx.Z() > NDM) { return false; }
53  if(sr->mc.nu[0].vtx.Z() > NDE) {
54  double MCT = (2./3.)*(NDT - NDB) + NDB;
55  if(sr->mc.nu[0].vtx.Y() > MCT) { return false; }
56  }
57  return true;
58  });
59 
60  // A map of systematic objects, indexed by the same label as above
61  std::map<std::string, Cut*> systematics;
62  systematics["NDRock"] = new Cut(kNDTruthFull);
63 
64  // Define a map of samples and cuts/axes to set them up
65  // Each sample, essentially, is a way to set up the analysis
66  std::string labelRecoE = "Calorimetric Energy (GeV)";
67  std::map<std::string, std::pair<HistAxis*, std::pair<Cut*, Cut*> > > cut_samples;
68  std::pair<Cut*, Cut*> Ana01(new Cut(kNusND), new Cut(kNusFD));
69  cut_samples["Ana01"] = std::pair<HistAxis*, std::pair<Cut*, Cut*> >(
71  Ana01
72  );
73 
74  // Set up maps to the decompositions/predictions (each flavor component)
75  // Nominal maps are indexed purely by sample label
76  // Shifted maps are indexed by sample label, systematic label, then sigma of the shift
77  std::map<std::string, IDecomp*> decomps_nominal;
78  std::map<std::string, std::map<std::string, std::map<int, IDecomp*> > > decomps_shifted;
79  std::map<std::string, PredictionNoExtrap*> predsNE_nominal;
80  std::map<std::string, std::map<std::string, std::map<int, PredictionNoExtrap*> > > predsNE_shifted;
81  std::map<std::string, PredictionSterile*> predsSt_nominal;
82  std::map<std::string, std::map<std::string, std::map<int, PredictionSterile*> > > predsSt_shifted;
83 
84  // Set up the actual decompositions/predictions
85  // sample.first = the sample label
86  // shiftlabel.first = the systematic shift label
87  // sample.second.first = the sample HistAxis
88  // sample.second.second = the sample Cut
89  // syst.first = the integer number of sigmas for the shift
90  // syst.second = the systematic being shifted
91  for(const auto& sample : cut_samples) {
92  SterileGenerator gen(
93  *sample.second.first, kNCBinsNumuCCAxis,
94  *sample.second.second.second, *sample.second.second.first,
96  );
97 
98  // Set up the nominal decompositions
99  // Only one is needed per sample
100  decomps_nominal[sample.first] = new CheatDecomp(
101  loaders.GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
102  *sample.second.first, *sample.second.second.first,
104  );
105  predsNE_nominal[sample.first] = new PredictionNoExtrap(
106  loaders,
107  *sample.second.first, *sample.second.second.second,
109  );
110  predsSt_nominal[sample.first] = (PredictionSterile*)gen.Generate(
111  loaders
112  ).release();
113 
114  // Set up the shifted decompositions
115  // One is needed for every sample, systematic, and sigma level
116  for(const auto& shiftlabel : shiftlabels) {
117  decomps_shifted[sample.first][shiftlabel.first][1] = new CheatDecomp(
118  loaders.GetLoader(caf::kNEARDET, Loaders::kMC, ana::kBeam, Loaders::kNonSwap),
119  *sample.second.first, *sample.second.second.first && *systematics[shiftlabel.first],
121  );
122  predsNE_shifted[sample.first][shiftlabel.first][1] = new PredictionNoExtrap(
123  loaders,
124  *sample.second.first, *sample.second.second.second,
125  kNoShift, kTuftsWeightCC
126  );
127 
128  SterileGenerator gen(
129  *sample.second.first, kNCBinsNumuCCAxis,
130  *sample.second.second.second,
131  *sample.second.second.first && *systematics[shiftlabel.first],
132  kNumuND && *systematics[shiftlabel.first],
133  kNoShift, kTuftsWeightCC
134  );
135  predsSt_shifted[sample.first][shiftlabel.first][1] =
136  (PredictionSterile*)gen.Generate(loaders).release();
137  }
138  }
139 
140  loaders.Go();
141 
142  std::string folder = "/nova/ana/steriles/Ana01/Systematics/";
143  std::string filenm = "SystsNDRock";
144 
145  std::string fullLocation = folder + filenm + ".root";
146  TFile* rootF = new TFile(fullLocation.c_str(), "RECREATE");
147 
148  SaveMaps(rootF,
149  decomps_nominal, decomps_shifted,
150  predsNE_nominal, predsNE_shifted,
151  predsSt_nominal, predsSt_shifted
152  );
153 }
Near Detector underground.
Definition: SREnums.h:10
const double NDT
Definition: NusCuts.cxx:12
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)
const Cut kNDTruthFull([](const caf::SRProxy *sr){if(sr->hdr.ismc==false){return true;}if(sr->mc.nnu< 1){return false;}if(sr->mc.nu[0].vtx.X()< NDL){return false;}if(sr->mc.nu[0].vtx.X() > NDR){return false;}if(sr->mc.nu[0].vtx.Y()< NDB){return false;}if(sr->mc.nu[0].vtx.Y() > NDT){return false;}if(sr->mc.nu[0].vtx.Z()< NDF){return false;}double NDM=1587.;if(sr->mc.nu[0].vtx.Z() > NDM){return false;}if(sr->mc.nu[0].vtx.Z() > NDE){double MCT=(2./3.)*(NDT-NDB)+NDB;if(sr->mc.nu[0].vtx.Y() > MCT){return false;}}return true;})
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
Far Detector at Ash River.
Definition: SREnums.h:11
const std::string fnametau_concat
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
const Cut kNusFD
Definition: NusCuts.h:46
const double NDR
Definition: NusCuts.cxx:10
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
const Color_t kMC
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
Generates extrapolated NC predictions using ProportionalDecomp.
const double NDL
Definition: NusCuts.cxx:9
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
SpectrumLoaderBase & GetLoader(caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Retrieve a specific loader.
Definition: Loaders.cxx:129
const Cut kNumuND
Definition: NumuCuts.h:55
caf::StandardRecord * sr
const SystShifts kNoShift
Definition: SystShifts.cxx:22
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
const double NDF
Definition: NusCuts.cxx:13
const HistAxis kNCBinsNumuCCAxis("Reconstructed Neutrino Energy (GeV)", kNCDisappearanceEnergyBinning, kCCE)
Definition: HistAxes.h:9
const Var kTuftsWeightCC
Definition: XsecTunes.h:30
const double NDB
Definition: NusCuts.cxx:11
std::vector< Loaders * > loaders
Definition: syst_header.h:386
caf::Proxy< bool > ismc
Definition: SRProxy.h:242
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 double NDE
Definition: NusCuts.cxx:14
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
Just return the ND truth spectra as the decomposition.
Definition: CheatDecomp.h:10
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