test_multiverse_class.C
Go to the documentation of this file.
1 // $ setup_nova -b maxopt -r R17-03-01-prod3reco.d; cd $WORK/test_releases/R17-03-01-prod3reco.d; srt_setup -a; setup_proxy
2 // $ setup_nova; cd $WORK/test_releases/development; srt_setup -a; setup_proxy; cd -
3 // $ setup_nova -b maxopt; cd $WORK/test_releases/development; srt_setup -a; setup_proxy; cd -
4 
6 #include "CAFAna/Core/HistAxis.h"
7 #include "CAFAna/Core/Spectrum.h"
11 #include "TCanvas.h"
12 #include "TROOT.h"
13 
14 using namespace ana;
15 
16 const Var kXvertex ([](const caf::SRProxy *sr){return sr->vtx.elastic.vtx.x;});
17 const Var kYvertex ([](const caf::SRProxy *sr){return sr->vtx.elastic.vtx.y;});
18 const Var kZvertex ([](const caf::SRProxy *sr){return sr->vtx.elastic.vtx.z;});
19 
20 void test_multiverse_class(int nfiles = INT_MAX,
21  int nuniverses = 10,
22  string flistpn = "/nova/ana/users/slin/sam_definition_file_lists/prod_caf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1.txt")
23 {
24  // load file names into a vector
25  vector<string> flist = LoadFileList(flistpn);
26  if(!flist.size())
27  {
28  cout << "Not able to load the file list. Quit." << endl;
29  return;
30  }
31  // only run over the specified number of files
32  flist.resize(min(min(nfiles, INT_MAX), (int)flist.size()));
33 
34  // spectrum loaders for MC
35  SpectrumLoader mcloader(flist);
36 
37  HistAxis kRecoMuKEAxis("Reconstructed T_{#mu};T_{#mu} [GeV];cos #{theta}", mukebins, kRecoMuKE);
38  HistAxis kXAxis("Reco X(cm)", xybins, kXvertex);
39  HistAxis kYAxis("Reco Y(cm)", xybins, kYvertex);
40  HistAxis kZAxis("Reco Z(cm)", zbins, kZvertex);
41  HistAxis kCosAxis("Reco cos#theta_{#mu}", angbins, kRecoMuCostheta);
42  HistAxis axes[] = {kXAxis, kYAxis, kZAxis, kRecoMuKEAxis, kRecoEStandardAxis, kCosAxis};
43  string fn[] = {
44  "reco_x",
45  "reco_y",
46  "reco_z",
47  "reco_mu_ke",
48  "reco_e",
49  "reco_mu_ang"
50  };
51  int nhist = sizeof(axes)/sizeof(axes[0]);
52  MultiverseSpectra* spectra[nhist];
53  for(int i = 0; i < nhist; i++)
54  spectra[i] = new MultiverseSpectra(nuniverses, mcloader, axes[i], kAllNumuCCCuts, kNoShift);
55 
56  // load spectra
57  mcloader.Go();
58 
59  gROOT->ProcessLine(".! mkdir -p output");
60  for(int i = 0; i < nhist; i++)
61  {
62  PlotWithSystErrorBand(*spectra[i]->Nominal(),vector<Spectrum>{*(spectra[i]->UpperSigma())},vector<Spectrum>{*(spectra[i]->LowerSigma())},spectra[i]->Nominal()->POT());
63  gPad->Print(("output/"+fn[i]+"_sigma.pdf").c_str());
64  }
65 }
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kRecoMuKE
const Binning zbins
Definition: NumuCCIncBins.h:21
const Var kYvertex([](const caf::SRProxy *sr){return sr->vtx.elastic.vtx.y;})
TGraphAsymmErrors * PlotWithSystErrorBand(IPrediction *pred, const std::vector< const ISyst * > &systs, osc::IOscCalc *calc, double pot, int col, int errCol, float headroom, bool newaxis, EBinType bintype, double alpha)
Plot prediction with +/-1sigma error band.
Definition: Plots.cxx:304
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const Binning xybins
Definition: NumuCCIncBins.h:18
void test_multiverse_class(int nfiles=INT_MAX, int nuniverses=10, string flistpn="/nova/ana/users/slin/sam_definition_file_lists/prod_caf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1.txt")
const Var kRecoMuCostheta([](const caf::SRProxy *sr){int ibesttrk=kBestTrack(sr);if(sr->trk.kalman.ntracks< 1) return-1000.f;if(ibesttrk< 0||ibesttrk >=int(sr->trk.kalman.ntracks)) return-1000.f;TVector3 dir=sr->trk.kalman.tracks[ibesttrk].dir;TVector3 beamdir=NuMIBeamDirection(sr->hdr.det);return(float) dir.Dot(beamdir);})
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
std::vector< std::string > LoadFileList(const std::string &listfile)
Read list of input files from a text file, one per line.
Definition: Utilities.cxx:210
const Var kXvertex([](const caf::SRProxy *sr){return sr->vtx.elastic.vtx.x;})
const Binning angbins
Definition: NumuCCIncBins.h:37
caf::Proxy< float > z
Definition: SRProxy.h:108
caf::Proxy< float > x
Definition: SRProxy.h:106
caf::StandardRecord * sr
virtual void Go() override
Load all the registered spectra.
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
const Binning mukebins
Definition: NumuCCIncBins.h:90
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
caf::Proxy< float > y
Definition: SRProxy.h:107
GenieMultiverseSpectra MultiverseSpectra
typedef for backward compatibility
caf::Proxy< caf::SRVector3D > vtx
Definition: SRProxy.h:2073
const Var kZvertex([](const caf::SRProxy *sr){return sr->vtx.elastic.vtx.z;})
const Spectrum * UpperSigma(BandOptions opt=kBandFromNominal) const
const Spectrum * LowerSigma(BandOptions opt=kBandFromNominal) const
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const int nuniverses
const HistAxis kRecoEStandardAxis("Reconstructed Neutrino Energy (GeV)", enubins, kRecoE)
const Cut kAllNumuCCCuts