Functions
NumuCosmic.C File Reference
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Cuts/Cuts.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "3FlavorAna/Cuts/QuantileCuts.h"
#include "3FlavorAna/Cuts/NumuCuts2020.h"
#include "3FlavorAna/Vars/HistAxes.h"
#include "CAFAna/Vars/Vars.h"
#include "3FlavorAna/Vars/NueVars.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "CAFAna/Vars/XsecTunes.h"
#include "CAFAna/Prediction/PredictionNoExtrap.h"
#include "CAFAna/Prediction/PredictionGenerator.h"
#include "CAFAna/Prediction/PredictionExtrap.h"
#include "CAFAna/Core/Loaders.h"
#include "CAFAna/Core/LoadFromFile.h"
#include "TFile.h"
#include <iostream>
#include <cmath>

Go to the source code of this file.

Functions

void NumuCosmic (bool isFHC)
 

Function Documentation

void NumuCosmic ( bool  isFHC)

Definition at line 29 of file NumuCosmic.C.

References axis_numu, POTSpillRate::beam, cut_numufd, make_training::dataset, ana::SpectrumLoader::Go(), infile, ana::kHadEFracAxis, ana::kInCosmicTimingWindow, ana::kNoShift, ana::kNumuCCOptimisedAxis, ana::kStandardSpillCuts, loaders, outFile, ana::QuantileCutsFromTH2(), ana::SpectrumLoaderBase::SetSpillCut(), and string.

30 {
31  // What do my arguments mean?
32  std::string beam = "rhc";
33  if (isFHC) beam = "fhc";
34 
35  // Set my axis.
37 
38  // Set the default cuts to the combined quantile cuts for the Full FOM
39  Cut cut_numufd = kNumu2020;
40 
41  // Set the string for the cosmic definitions.
42  std::string dataset = "prod_caf_R19-11-18-prod5reco.i_fd_cosmic_"+beam+"_full_v1_goodruns";
43  SpectrumLoader loaders(dataset);
44  loaders.SetSpillCut(kStandardSpillCuts);
45 
46  //std::string infile_quant = (std::string)std::getenv("NUMUDATA_DIR")+"/lib/ana2020/Quantiles/quantiles_"+beam+"_full_numu2020.root";
47  std::string infile_quant = "/cvmfs/nova.opensciencegrid.org/externals/numudata/v00.03/NULL/lib/ana2020/Quantiles/quantiles_"+beam+"_full_numu2020.root";
48  TFile* infile = new TFile(infile_quant.c_str());
49 
50  TH2* FDSpec2D = (TH2*)infile->FindObjectAny("FDSpec2D_LoosePTP");
51  std::vector<Cut> HadEFracQuantCuts = QuantileCutsFromTH2(FDSpec2D, axis_numu, kHadEFracAxis, 4);
52  infile->Close();
53  delete infile;
54 
55  // Make a vector of spectra.
56  std::vector<Spectrum*> pred_cosmic_numu;
57 
58  // First, push back a combined quantile one.
59  pred_cosmic_numu.push_back(new Spectrum(loaders, axis_numu, cut_numufd && kInCosmicTimingWindow, kNoShift));
60  // Then, loop through my Quantile cuts.
61  for(int quant=0; quant<4; ++quant) {
62 
63  Cut ThisCut = cut_numufd && kInCosmicTimingWindow && HadEFracQuantCuts[quant];
64 
65  pred_cosmic_numu.push_back(new Spectrum(loaders, axis_numu, ThisCut, kNoShift));
66  }
67 
68  loaders.Go();
69 
70  TFile* outFile = new TFile(("fd_numu_cosmics_"+beam+".root").c_str(),"RECREATE");
71  outFile->cd();
72  for(int quant=0; quant<5; quant++){
73  pred_cosmic_numu[quant]->SaveTo(outFile, Form("numu_cos_q%d", quant));
74  }
75  outFile->Close();
76 }
const HistAxis kHadEFracAxis("E_{had.} / E_{#nu}", Binning::Simple(200, 0, 1), kHadEFrac)
HistAxis that implements Hadronic Energy fraction binning used by L.Vinton to derive Hadronic Energy ...
Definition: HistAxes.h:30
const Cut cut_numufd
const Cut kInCosmicTimingWindow
Is the event far from the start and ends of the spill ? For FD cosmic selection.
Definition: TimingCuts.cxx:165
TFile * outFile
Definition: PlotXSec.C:135
string infile
std::vector< float > Spectrum
Definition: Constants.h:728
const HistAxis kNumuCCOptimisedAxis("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kCCE)
HistAxis that implements optimised numuCCE from L. Vinton. See docdb 16332. This was close to &#39;custC&#39;...
Definition: HistAxes.h:24
static bool isFHC
const SystShifts kNoShift
Definition: SystShifts.cxx:22
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const HistAxis axis_numu
std::vector< Loaders * > loaders
Definition: syst_header.h:386
std::vector< Cut > QuantileCutsFromTH2(TH2 *quantileHist, const HistAxis &independentAxis, const HistAxis &quantileAxis, const unsigned int &numQuantiles, const bool verbose)
: Do the same as the QuantileCuts function but taking in the TH2 instead of making it...
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
enum BeamMode string