CutFlow_Cosmic.C
Go to the documentation of this file.
4 
5 #include "CAFAna/Core/Loaders.h"
6 #include "CAFAna/Core/Spectrum.h"
9 
15 #include "CAFAna/Vars/XsecTunes.h"
16 
18 
19 #include "TH1.h"
20 #include "TH2.h"
21 #include "TCanvas.h"
22 
23 using namespace ana;
24 
25 #include <fstream>
26 
27 void CutFlow_Cosmic( bool isFHC ) {
28 
29  std::string sFHC = "fhc";
30  if (!isFHC) {
31  sFHC = "rhc";
32  }
33 
34  // --- Set my loader
35  SpectrumLoader loader( "prod_caf_R19-11-18-prod5reco.i_fd_cosmic_"+sFHC+"_full_v1_goodruns" );
37 
38  // --- Define my cuts and their names.
39  std::vector<std::string> NuMu_CutNames; std::vector<Cut> NuMu_TieredCuts;
40  std::vector<std::string> Nue_CutNames; std::vector<Cut> Nue_TieredCuts;
41  MakeCutFlowVecs( NuMu_CutNames, NuMu_TieredCuts, Nue_CutNames, Nue_TieredCuts );
42 
43  size_t NuMuCuts = NuMu_TieredCuts.size();
44  size_t NueCuts = Nue_TieredCuts .size();
45 
46  // --- Define my objects.
47  Spectrum* NuMu_ReconEnergy[NuMuCuts];
48  Spectrum* Nue_ReconEnergy [NueCuts ];
49 
50  const Var kMyWgt = kUnweighted;
51  const Binning kSimpBins = Binning::Simple(102, -0.01, 1.01 );
52 
53  // --- Set my objects.
54  for(size_t cut = 0; cut < NuMuCuts; ++cut) {
55  const Cut kThisCut = NuMu_TieredCuts[cut] && kInCosmicTimingWindow;
56  const std::string kThisName = "NuMuCCEnergy_"+NuMu_CutNames[cut];
57  NuMu_ReconEnergy[cut] = new Spectrum( kThisName, kNumuCCEOptimisedBinning, loader, kCCE , kThisCut, kNoShift, kMyWgt );
58  }
59  for(size_t cut = 0; cut < NueCuts; ++cut) {
60  const Cut kThisCut = Nue_TieredCuts[cut] && kInCosmicTimingWindow;
61  const std::string kThisName = "NueCCEnergy_"+Nue_CutNames[cut];
62  Nue_ReconEnergy [cut] = new Spectrum( kThisName, kSimpBins , loader, kCVNe_looseptp, kThisCut, kNoShift, kMyWgt );
63  }
64 
65  // --- Set the loader off!
66  loader.Go();
67 
68  // --- Define an outfile.
69  std::string OutName = "CosmicCutFlow_"+sFHC+".root";
70  TFile *OutFile = new TFile(OutName.c_str(), "RECREATE");
71  OutFile -> cd();
72  for(size_t cut = 0; cut < NuMuCuts; ++cut){
73  NuMu_ReconEnergy[cut] -> SaveTo( OutFile, TString("NuMuCCEnergy_")+TString(NuMu_CutNames[cut]) ) ;
74  }
75  for(size_t cut = 0; cut < NueCuts; ++cut) {
76  Nue_ReconEnergy [cut] -> SaveTo( OutFile, TString("NueCCEnergy_" )+TString(Nue_CutNames [cut]) ) ;
77  }
78 } // End of function
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void SaveTo(const osc::IOscCalc &x, TDirectory *dir, const std::string &name)
void MakeCutFlowVecs(std::vector< std::string > &NuMu_CutNames, std::vector< Cut > &NuMu_TieredCuts, std::vector< std::string > &Nue_CutNames, std::vector< Cut > &Nue_TieredCuts)
Definition: CutFlow_header.h:6
std::vector< double > Spectrum
Definition: Constants.h:746
void SetSpillCut(const SpillCut &cut)
void CutFlow_Cosmic(bool isFHC)
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:39
const Cut kInCosmicTimingWindow
Is the event far from the start and ends of the spill ? For FD cosmic selection.
Definition: TimingCuts.cxx:165
std::string sFHC
Definition: MakeCutFlow.C:35
const Var kCCE
Definition: NumuVars.h:21
const Binning kSimpBins
virtual void Go() override
Load all the registered spectra.
loader
Definition: demo0.py:10
static bool isFHC
const SystShifts kNoShift
Definition: SystShifts.cxx:22
const Cut cut
Definition: exporter_fd.C:30
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Binning kNumuCCEOptimisedBinning
Optimised binning for numuCCE from L. Vinton. See docdb 16332. This was close to &#39;custC&#39; in that talk...
Definition: Binnings.cxx:28
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
TFile * OutFile
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Var kCVNe_looseptp
Definition: Vars.cxx:36
const Var kUnweighted
Definition: Var.h:14
c cd(1)
enum BeamMode string