energy_resolution.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Spectrum.h"
3 #include "CAFAna/Core/Var.h"
4 #include "CAFAna/Core/Cut.h"
5 #include "CAFAna/Core/Binning.h"
8 
13 
14 #include "TFile.h"
15 
16 #include <string>
17 
18 using namespace ana;
19 
25 
27 
28 void energy_resolution(string outfile = "energy_resolution_study.root")
29 {
31 
32  Spectrum * energy_spec_2D = new Spectrum(
35 
36  Spectrum * true_muke_spec = new Spectrum(
40 
41  Spectrum * reco_muke_spec = new Spectrum(
45 
46  Spectrum * res_muke_spec = new Spectrum(
47  "res_muke", ana::Binning::Simple(1000, -10, 10),
48  *loader, kResMuonKE,
50 
51  loader->Go();
52 
53  TFile * fout = TFile::Open(outfile.c_str(), "RECREATE");
54  energy_spec_2D->SaveTo(fout, "energy_2D");
55  true_muke_spec->SaveTo(fout, "true_muke");
56  reco_muke_spec->SaveTo(fout, "reco_muke");
57  res_muke_spec->SaveTo(fout, "res_muke");
58  fout->Close();
59 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kRecoMuonKE([](const caf::SRProxy *sr){return kRecoMuonE(sr)-MUON_MASS;})
const std::string nominal_decaf
std::vector< double > Spectrum
Definition: Constants.h:746
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:39
const HistAxis kTrueRecoMuonKEAxis("reco_muon_energy", ana::xsec::numubarcc::kMuonEnergyBinningFine, kRecoMuonKE,"true_muon_energy", ana::xsec::numubarcc::kMuonEnergyBinningFine, kTrueMuonKE)
virtual void Go() override
Load all the registered spectra.
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:534
const Var kResMuonKE
loader
Definition: demo0.py:10
const SystShifts kNoShift
Definition: SystShifts.cxx:22
const ana::Var std_wgt
const Cut kTrueKalmanMuon([](const caf::SRProxy *sr){ int ibesttrk=kBestMuonIDIndex(sr);if(ibesttrk< 0||ibesttrk >=int(sr->trk.kalman.ntracks)) return false;return std::abs(sr->trk.kalman.tracks[ibesttrk].truth.pdg)==13;})
void energy_resolution(string outfile="energy_resolution_study.root")
const Cut kSelectCut
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kMuonIDCut([](const caf::SRProxy *sr){return kMuonID(sr) >=kMuonIDCutVal;})
const Binning kMuonEnergyBinningFine
FILE * outfile
Definition: dump_event.C:13