Functions
make_pid.C File Reference
#include "TCanvas.h"
#include "TH1.h"
#include "TF1.h"
#include "TFile.h"
#include "TLegend.h"
#include "TLegendEntry.h"
#include "TArrayD.h"
#include "TAxis.h"
#include "TLatex.h"
#include "CAFAna/Core/Cut.h"
#include "CAFAna/Cuts/NueCutsFirstAna.h"
#include "CAFAna/Analysis/Plots.h"
#include "CAFAna/Analysis/Style.h"
#include "CAFAna/Core/SpectrumLoader.h"
#include "CAFAna/Core/Spectrum.h"
#include "CAFAna/Cuts/SpillCuts.h"
#include "CAFAna/Vars/Vars.h"
#include "CAFAna/Vars/GenieWeights.h"
#include "CAFAna/Vars/PPFXWeights.h"
#include "StandardRecord/Proxy/SRProxy.h"
#include "CAFAna/reco/prongID/make_pid.h"

Go to the source code of this file.

Functions

void make_pid (bool isFHC=1)
 

Function Documentation

void make_pid ( bool  isFHC = 1)

Definition at line 35 of file make_pid.C.

References ana::bins, om::cout, cut, allTimeWatchdog::endl, submit_syst::fout, ana::SpectrumLoaderBase::Go(), MECModelEnuComparisons::i, isFHC, calib::j, ana::kNoShift, kNPlots, kNSels, ana::kPPFXFluxCVWgt, ana::kStandardDQCuts, ana::kTightBeamQualityCuts, ana::kXSecCVWgt2017, label, demo0::loader, plots, ana::Spectrum::SaveTo(), ana::sels, ana::SpectrumLoaderBase::SetSpillCut(), string, and PandAna.Demos.tute_pid_validation::var.

35  {
36  const std::string fData = isFHC ?
37  "prod_decaf_R17-03-01-prod3reco.d_nd_numi_fhc_full_nue_or_numu_or_nus_contain_v1_goodruns" :
38  "prod_decaf_R17-03-01-prod3reco.l_nd_numi_rhc_full_nue_or_numu_or_nus_contain_v1_goodruns" ;
39 
40  const std::string fMC = isFHC ?
41  "prod_decaf_R17-03-01-prod3reco.d_nd_genie_nonswap_fhc_nova_v08_full_nue_or_numu_or_nus_contain_v1" :
42  "prod_decaf_R17-03-01-prod3reco.l_nd_genie_nonswap_rhc_nova_v08_full_nue_or_numu_or_nus_contain_v1" ;
43 
45  SpectrumLoaderBase* loaderMC = new SpectrumLoader(fMC);
46 
47  std::cout << "MC: " << fMC << std::endl;
48  std::cout << "Data: " << fData << std::endl;
49 
51  loaderMC->SetSpillCut(kStandardDQCuts);
52 
53  // One spectrum per selection, per Var (see .h)
54 
55  Spectrum* spect[kNSels][kNPlots];
56 
57  for(unsigned int i = 0;i < kNSels;++i){
58  for(unsigned int j = 0;j < kNPlots;++j){
59  if(j < 5)
60  spect[i][j] = new Spectrum(plots[j].label,plots[j].bins,
61  *loader,plots[j].var,sels[i].cut);
62  else
63  spect[i][j] = new Spectrum(plots[j].label,plots[j].bins,
64  *loaderMC,plots[j].var,sels[i].cut,
66  }
67  }
68 
69  // Go, loaders, go!
70 
71  loader->Go();
72  loaderMC->Go();
73 
74 
75  // Save output
76 
77  std::string cStr = isFHC ? "FHC" : "RHC";
78  TFile fout(("make_pid_output_"+cStr+".root").c_str(),"RECREATE");
79 
80  for(unsigned int i = 0;i < kNSels;++i){
81  for(unsigned int j = 0;j < kNPlots;++j){
82  spect[i][j]->SaveTo(&fout, sels[i].suffix+"_"+plots[j].suffix);
83  }
84  }
85 
86 
87 }
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const unsigned int kNSels
void SetSpillCut(const SpillCut &cut)
const unsigned int kNPlots
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const char * label
const SpillCut kTightBeamQualityCuts([](const caf::SRSpillProxy *s){if(s->ismc) return true; if(s->trigger==2) return true;if(s->spilltimesec==0 &&s->deltaspilltimensec==0 &&s->widthx==0) return bool(s->isgoodspill);if(std::abs(s->deltaspilltimensec) > 0.5e9) return false;if(s->spillpot< 2e12) return false;if(s->hornI< -202|| s->hornI >-198) return false;if(s->posx< -2.00|| s->posx >+2.00) return false;if(s->posy< -2.00|| s->posy >+2.00) return false;return kBeamWidthCut(s);})
Definition: SpillCuts.h:10
virtual void Go()=0
Load all the registered spectra.
const Cut sels[kNumSels]
Definition: vars.h:44
const std::vector< Plot > plots
const SpillCut kStandardDQCuts([](const caf::SRSpillProxy *spill){if(spill->dcmedgematchfrac==0 &&spill->fracdcm3hits==0 &&spill->nmissingdcmslg==0) return bool(spill->isgoodspill); if(spill->det==caf::kNEARDET && (spill->fracdcm3hits > 0.45|| spill->nmissingdcms > 0)) return false; if(spill->eventincomplete) return false; if(spill->det==caf::kFARDET && spill->nmissingdcmslg > 0) return false; if(spill->det==caf::kFARDET && !spill->ismc && spill->dcmedgematchfrac<=0.2) return false;return true;})
Cut out events with a noisy detector or with parts missing.
Definition: SpillCuts.h:16
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
const double j
Definition: BetheBloch.cxx:29
const Binning bins
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:728
static bool isFHC
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
Base class for the various types of spectrum loader.
const Cut cut
Definition: exporter_fd.C:30
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
const Var kXSecCVWgt2017
Definition: XsecTunes.h:36
enum BeamMode string