Functions | Variables
mcTruthPredictions.C File Reference
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Core/Binning.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/SpectrumLoaderBase.h"
#include "3FlavorAna/Vars/NumuVars.h"
#include "CAFAna/Systs/Systs.h"
#include "CAFAna/Systs/XSecSystLists.h"
#include "CAFAna/Systs/BeamSysts.h"
#include "CAFAna/Systs/EnergySysts2018.h"
#include "CAFAna/XSec/GenieMultiverseSyst.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "NDAna/numucc_inc/NumuCCIncAnalysis.h"
#include "NDAna/numucc_inc/NumuCCIncBins.h"
#include "NDAna/numucc_inc/NumuCCIncVars.h"
#include "NDAna/numucc_inc/NumuCCIncCuts.h"
#include "NDAna/numucc_inc/NDXSecMuonPID.h"
#include "NDAna/numucc_inc/UnfoldingVariable.h"
#include "TFile.h"
#include "TH1.h"
#include "TH2.h"
#include <iostream>
#include <cmath>
#include <sstream>
#include <string>
#include <fstream>
#include <iomanip>
#include <map>
#include <algorithm>

Go to the source code of this file.

Functions

void mcTruthPredictions (string filename="mcPredictions.root")
 

Variables

const NuTruthVar wgt_xsST = kXSecCVWgt2018_smallerDISScale_NT
 
const NuTruthVar wgt_ppfxST = kPPFXFluxCVWgtST
 
const NuTruthVar wgtST = wgt_ppfxST * wgt_xsST
 
const Binning mukebins_fine = Binning::Simple(200, 0.5, 2.5)
 
const Binning angvsmukevseavailbins_fine
 
const Binning angvsmukebins_fine
 
const Binning q2bins_fine = Binning::Simple(500, 0.0, 5.0)
 
const Binning enubins_fine = Binning::Simple(400, 0.0, 10.0)
 
const NuTruthVar kTrueMuKEVsCosVsEavail_FineST
 
const NuTruthVar kTrueMuKEVsCos_FineST
 
const NuTruthHistAxis kTrueMuKEVsCosVsEavail_FineStandardAxisST ("True Muon Kinematics", angvsmukevseavailbins_fine, kTrueMuKEVsCosVsEavail_FineST)
 
const NuTruthHistAxis kTrueMuKEVsCos_FineStandardAxisST ("True Muon Kinematics", angvsmukebins_fine, kTrueMuKEVsCos_FineST)
 
const NuTruthHistAxis kTrueE_FineStandardAxisST ("True Neutrino Energy (GeV)", enubins_fine, kTrueEST)
 
const NuTruthHistAxis kTrueQ2_FineStandardAxisST ("True Q2 (GeV)", q2bins_fine, kTrueQ2_NT)
 
map< string, NuTruthVarweights
 

Function Documentation

void mcTruthPredictions ( string  filename = "mcPredictions.root")

Definition at line 114 of file mcTruthPredictions.C.

References shutoffs::filename, ana::SpectrumLoader::Go(), ana::kIsTrueSig1DST, ana::kIsTrueSigST, ana::kNoShift, kTrueE_FineStandardAxisST, kTrueMuKEVsCos_FineStandardAxisST, kTrueMuKEVsCosVsEavail_FineStandardAxisST, kTrueQ2_FineStandardAxisST, demo0::loader, outFile, PandAna.Demos.tute_pid_validation::specs, ana::weight, and weights.

115 {
116  // Define the spectrum
117  SpectrumLoader * loader = new SpectrumLoader("dataset_def_name_newest_snapshot nd_fhc_remid-hotfix_caf_minus_muonid_training_minus_fakedata");
118 
119  map<string, map<string, Spectrum* > > specmap;
120 
121  for (pair<string, NuTruthVar> weight : weights)
122  {
123  map<string, Spectrum*> specs;
124  specs["EAvail"] = new Spectrum(*loader, kTrueMuKEVsCosVsEavail_FineStandardAxisST, kIsTrueSigST, kNoShift, weight.second);
125  specs["MuKin"] = new Spectrum(*loader, kTrueMuKEVsCos_FineStandardAxisST, kIsTrueSigST, kNoShift, weight.second);
126  specs["ENu"] = new Spectrum(*loader, kTrueE_FineStandardAxisST, kIsTrueSig1DST, kNoShift, weight.second);
127  specs["Q2"] = new Spectrum(*loader, kTrueQ2_FineStandardAxisST, kIsTrueSig1DST, kNoShift, weight.second);
128 
129  specmap[weight.first] = specs;
130  }
131 
132  // Go
133  loader->Go();
134 
135  // Story the outputs
136  TFile * outFile = TFile::Open(filename.c_str(), "RECREATE");
137  TDirectory * predDir = outFile->mkdir("geniePrediction");
138  for(pair<string, map<string, Spectrum* > > weightSpecs : specmap)
139  {
140  TDirectory * weightDir = predDir->mkdir(weightSpecs.first.c_str());
141  for(pair<string, Spectrum*> spec : weightSpecs.second)
142  spec.second->SaveTo(weightDir->mkdir(spec.first.c_str()));
143  }
144  outFile->Close();
145 }
const Var weight
const NuTruthCut kIsTrueSig1DST
string filename
Definition: shutoffs.py:106
TFile * outFile
Definition: PlotXSec.C:135
const SpillTruthCut kIsTrueSigST
Definition: NueCCIncCuts.h:271
virtual void Go() override
Load all the registered spectra.
map< string, NuTruthVar > weights
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:573
const SystShifts kNoShift
Definition: SystShifts.cxx:21
const NuTruthHistAxis kTrueMuKEVsCos_FineStandardAxisST("True Muon Kinematics", angvsmukebins_fine, kTrueMuKEVsCos_FineST)
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const NuTruthHistAxis kTrueE_FineStandardAxisST("True Neutrino Energy (GeV)", enubins_fine, kTrueEST)
const NuTruthHistAxis kTrueQ2_FineStandardAxisST("True Q2 (GeV)", q2bins_fine, kTrueQ2_NT)
const NuTruthHistAxis kTrueMuKEVsCosVsEavail_FineStandardAxisST("True Muon Kinematics", angvsmukevseavailbins_fine, kTrueMuKEVsCosVsEavail_FineST)

Variable Documentation

const Binning angvsmukebins_fine
Initial value:
= Binning::Simple(
0,
int NBins() const
Definition: Binning.h:29
const Binning angbinsCustom
Definition: NumuCCIncBins.h:72
const Binning mukebins_fine

Definition at line 61 of file mcTruthPredictions.C.

const Binning angvsmukevseavailbins_fine
Initial value:
= Binning::Simple(
0,
const Binning eavailbins
int NBins() const
Definition: Binning.h:29
const Binning angbinsCustom
Definition: NumuCCIncBins.h:72
const Binning mukebins_fine

Definition at line 53 of file mcTruthPredictions.C.

const Binning enubins_fine = Binning::Simple(400, 0.0, 10.0)

Definition at line 68 of file mcTruthPredictions.C.

const NuTruthHistAxis kTrueE_FineStandardAxisST("True Neutrino Energy (GeV)", enubins_fine, kTrueEST)

Referenced by mcTruthPredictions().

const NuTruthVar kTrueMuKEVsCos_FineST
Initial value:
const NuTruthVar kTrueMuCosthetaST([](const caf::SRNeutrinoProxy *nu){if(abs(nu->pdg)!=14||!nu->iscc) return-5.0;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==13){TVector3 mudir=nu->prim[iprim].p.Vect();TVector3 beamdir=NuMIBeamDirection(caf::kNEARDET);return mudir.Unit().Dot(beamdir.Unit());}}return-5.0;})
_Var< T > Var2D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb)
Variable formed from two input variables.
Definition: Var.cxx:247
const NuTruthVar kTrueMuKEST([](const caf::SRNeutrinoProxy *nu){float ke=-5;if(abs(nu->pdg)!=14||!nu->iscc) return ke;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==13){double E=nu->prim[iprim].p.T();ke=E-MuonMass();}}return ke;})
const Binning angbinsCustom
Definition: NumuCCIncBins.h:72
const Binning mukebins_fine

Definition at line 78 of file mcTruthPredictions.C.

const NuTruthHistAxis kTrueMuKEVsCos_FineStandardAxisST("True Muon Kinematics", angvsmukebins_fine, kTrueMuKEVsCos_FineST)

Referenced by mcTruthPredictions().

const NuTruthVar kTrueMuKEVsCosVsEavail_FineST
Initial value:
const NuTruthVar kTrueMuCosthetaST([](const caf::SRNeutrinoProxy *nu){if(abs(nu->pdg)!=14||!nu->iscc) return-5.0;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==13){TVector3 mudir=nu->prim[iprim].p.Vect();TVector3 beamdir=NuMIBeamDirection(caf::kNEARDET);return mudir.Unit().Dot(beamdir.Unit());}}return-5.0;})
const NuTruthVar kTrueMuKEST([](const caf::SRNeutrinoProxy *nu){float ke=-5;if(abs(nu->pdg)!=14||!nu->iscc) return ke;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==13){double E=nu->prim[iprim].p.T();ke=E-MuonMass();}}return ke;})
const Binning eavailbins
_Var< T > Var3D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb, const _Var< T > &c, const Binning &binsc)
This is just like a Var2D, but useful for 3D Spectra.
Definition: Var.cxx:273
const NuTruthVar kTrueEavailST
const Binning angbinsCustom
Definition: NumuCCIncBins.h:72
const Binning mukebins_fine

Definition at line 70 of file mcTruthPredictions.C.

const NuTruthHistAxis kTrueMuKEVsCosVsEavail_FineStandardAxisST("True Muon Kinematics", angvsmukevseavailbins_fine, kTrueMuKEVsCosVsEavail_FineST)

Referenced by mcTruthPredictions().

const NuTruthHistAxis kTrueQ2_FineStandardAxisST("True Q2 (GeV)", q2bins_fine, kTrueQ2_NT)

Referenced by mcTruthPredictions().

const Binning mukebins_fine = Binning::Simple(200, 0.5, 2.5)

Definition at line 52 of file mcTruthPredictions.C.

const Binning q2bins_fine = Binning::Simple(500, 0.0, 5.0)

Definition at line 67 of file mcTruthPredictions.C.

map<string, NuTruthVar> weights
Initial value:
{
{"unweight", kNuTruthUnweighted},
{"ppfx", wgt_ppfxST},
{"xsec", wgt_xsST},
{"both", wgtST}
}
const NuTruthVar wgt_xsST
const NuTruthVar wgt_ppfxST
const NuTruthVar wgtST
const NuTruthVar kNuTruthUnweighted
Definition: Var.h:100

Definition at line 107 of file mcTruthPredictions.C.

Referenced by mcTruthPredictions().

const NuTruthVar wgt_ppfxST = kPPFXFluxCVWgtST

Definition at line 48 of file mcTruthPredictions.C.

const NuTruthVar wgt_xsST = kXSecCVWgt2018_smallerDISScale_NT

Definition at line 47 of file mcTruthPredictions.C.

const NuTruthVar wgtST = wgt_ppfxST * wgt_xsST

Definition at line 49 of file mcTruthPredictions.C.