Classes | Functions
CutFlow_Data.C File Reference
#include "CAFAna/Cuts/Cuts.h"
#include "3FlavorAna/Cuts/NumuCuts.h"
#include "3FlavorAna/Cuts/NumuCuts2017.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Cuts/TimingCuts.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Core/ReweightableSpectrum.h"
#include "CAFAna/Vars/Vars.h"
#include "3FlavorAna/Vars/Binnings.h"
#include "3FlavorAna/Vars/NumuVars.h"
#include "CAFAna/Analysis/Exposures.h"
#include "CAFAna/Analysis/Prod3Loaders.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TH1.h"
#include "TLegend.h"
#include "TLatex.h"
#include <fstream>

Go to the source code of this file.

Classes

struct  Plot
 ====================================================================== /// More...
 

Functions

void CutFlow_Data ()
 

Function Documentation

void CutFlow_Data ( )

Definition at line 35 of file CutFlow_Data.C.

References Plot::bins, cd(), cut, CutNames, ana::SpectrumLoader::Go(), ana::kCCE, ana::kInBeamSpill, ana::kInTimingSideband, ana::kNoCut, ana::kNoShift, ana::kNumu2017Veto, ana::kNumuCCEOptimisedBinning, ana::kNumuContainFD2017, ana::kNumuCosmicRej2017, ana::kNumuPID2017, ana::kNumuQuality, ana::kStandardSpillCuts, ana::kUnweighted, Plot::label, demo0::loader, NCuts, OutFile, plot(), ana::SaveTo(), ana::SpectrumLoaderBase::SetSpillCut(), string, and Plot::var.

36 {
37  // --- Set my loader.
38  SpectrumLoader loader( "prod_restrictedcaf_R17-03-01-prod3reco.k_fd_numi_fhc_full_v1_goodruns" );
39  //SpectrumLoader loader( "/pnfs/nova/production/R17-03-01-prod3reco.k/numi/fd/numu_contain_sa_2017/prod_sumrestricteddecaf*.root" );
40  loader.SetSpillCut(kStandardSpillCuts);
41 
42  // --- Define my cuts and their names.
43  std::vector<Cut> TieredCuts;
44  std::vector<std::string> CutNames;
45  CutNames.emplace_back("NoCut"); TieredCuts.emplace_back(kNumu2017Veto && kNoCut);
46  CutNames.emplace_back("Quality"); TieredCuts.emplace_back(kNumu2017Veto && kNumuQuality);
47  CutNames.emplace_back("Containment"); TieredCuts.emplace_back(kNumu2017Veto && kNumuQuality && kNumuContainFD2017);
48  CutNames.emplace_back("Cosmic_Rej"); TieredCuts.emplace_back(kNumu2017Veto && kNumuQuality && kNumuContainFD2017 && kNumuCosmicRej2017);
49  CutNames.emplace_back("Particle_ID"); TieredCuts.emplace_back(kNumu2017Veto && kNumuQuality && kNumuContainFD2017 && kNumuCosmicRej2017 && kNumuPID2017 );
50 
51  size_t NCuts = TieredCuts.size();
52 
53  // --- Define my objects.
54  Plot plot = {"CC Energy [GeV]", "NuMuCCEnergy", kNumuCCEOptimisedBinning, kCCE};
55  Spectrum* Cosmics[NCuts];
56  Spectrum* BeamNus[NCuts];
57 
58  // --- Set my objects.
59  for(size_t cut = 0; cut < NCuts; ++cut) {
60  const Cut Cut_Cosm = TieredCuts[cut] && kInTimingSideband;
61  const Cut Cut_Beam = TieredCuts[cut] && kInBeamSpill;
62  Cosmics[cut] = new Spectrum( plot.label, plot.bins, loader, plot.var, Cut_Cosm, kNoShift, kTimingSidebandWeight );
63  BeamNus[cut] = new Spectrum( plot.label, plot.bins, loader, plot.var, Cut_Beam, kNoShift, kUnweighted );
64  }
65 
66  // --- Set the loader off!
67  loader.Go();
68 
69  // --- Define an outfile.
70  std::string OutName = "DataCutFlow.root";
71  TFile *OutFile = new TFile(OutName.c_str(), "RECREATE");
72  OutFile -> cd();
73  for(size_t cut = 0; cut < NCuts; ++cut){
74  Cosmics[cut] -> SaveTo( OutFile, TString(CutNames[cut])+TString("_Cosmics") ) ;
75  BeamNus[cut] -> SaveTo( OutFile, TString(CutNames[cut])+TString("_BeamNus") ) ;
76  }
77 } // End of function
size_t NCuts
Definition: MakeCutFlow.C:50
void SaveTo(const osc::IOscCalc &x, TDirectory *dir, const std::string &name)
std::string label
Definition: CutFlow_Data.C:29
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Cut kInTimingSideband([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return(kInTimingSideband_before(sr)|| kInTimingSideband_after(sr));else return(kInTimingSideband_before(sr)|| kInTimingSideband_afterA(sr)|| kInTimingSideband_afterB(sr));}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return(kInTimingSideband_before.Livetime(spill)+ kInTimingSideband_after.Livetime(spill));else return(kInTimingSideband_before.Livetime(spill)+ kInTimingSideband_afterA.Livetime(spill)+ kInTimingSideband_afterB.Livetime(spill));}, [](const caf::SRSpillProxy *spill){return 0;})
Definition: TimingCuts.h:12
const Cut kNumu2017Veto([](const caf::SRProxy *sr){return sr->sel.veto.keep;})
cosmic veto cut for FD
Definition: NumuCuts2017.h:30
====================================================================== ///
Definition: CutFlow_Data.C:28
const Cut kNumuContainFD2017
Definition: NumuCuts2017.h:21
const Var kCCE
Definition: NumuVars.h:21
loader
Definition: demo0.py:10
const Cut kNumuPID2017([](const caf::SRProxy *sr){return(sr->sel.remid.pid > 0.5 &&sr->sel.cvn.numuid > 0.5);})
Definition: NumuCuts2017.h:27
std::vector< float > Spectrum
Definition: Constants.h:759
const Cut kNumuCosmicRej2017([](const caf::SRProxy *sr){return(sr->sel.cosrej.anglekal > 0.5 && sr->sel.cosrej.numucontpid2020 > 0.5 && sr->slc.nhit< 400);})
Definition: NumuCuts2017.h:24
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 Cut kInBeamSpill([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return kInBeamSpill_main(sr);else return kInBeamSpill_main(sr)||kInBeamSpill_shifted(sr);}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return kInBeamSpill_main.Livetime(spill);else return kInBeamSpill_main.Livetime(spill)+kInBeamSpill_shifted.Livetime(spill);}, [](const caf::SRSpillProxy *spill) -> double{return spill->spillpot;})
Does the event fall inside the window we call the beam spill?
Definition: TimingCuts.h:8
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
TFile * OutFile
Binning bins
Definition: CutFlow_Data.C:31
const Cut kNumuQuality
Definition: NumuCuts.h:18
Var var
Definition: CutFlow_Data.C:32
const Var kUnweighted
The simplest possible Var, always 1. Used as a default weight.
Definition: Var.h:96
c cd(1)
void plot(std::string label, std::map< std::string, std::map< std::string, Spectrum * >> &plots, bool log)
std::vector< std::string > CutNames
Definition: MakeCutFlow.C:49
enum BeamMode string