NuMu2020_BasicPIDPlots_FD.C
Go to the documentation of this file.
2 
6 
7 #include "CAFAna/Core/Loaders.h"
8 #include "CAFAna/Core/Spectrum.h"
10 
14 #include "CAFAna/Vars/XsecTunes.h"
15 
17 
18 #include "TH2.h"
19 #include "TFile.h"
21 #include <iostream>
22 
23 using namespace ana;
24 
25 
27 
28  std::string polarity = "fhc"; if (!isFHC) polarity = "rhc";
29  std::string data = "mc" ;
30  std::string detector = "fd" ;
31 
32  std::cout << "\n================================= \n"
33  << "\n\t isFHC --> " << isFHC << " --> " << polarity
34  << "\n\t Period --> " << period
35  << "\n\t Far detector isFD --> " << detector
36  << "\n================================= \n"
37  << std::endl;
38 
39  // Make my vector of cuts.
40  std::vector<std::pair<Cut, std::string> > MyCuts = BasicPIDPlots_Cuts( isFHC, true, false );
41  const size_t NCuts = MyCuts.size();
42 
43  // What XSec and PPFX weights am I using?
44  const Var kMyWeight = kXSecCVWgt2020 * kPPFXFluxCVWgt;
45 
46  // Figure out my definition, and then declare my spectrum loader.
47  std::string MyNonSwapDef = "prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_nonswap_" +polarity+"_nova_v08_"+period+"_v1";
48  std::string MyFluxSwapDef = "prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_fluxswap_"+polarity+"_nova_v08_"+period+"_v1";
49  std::string MyTauSwapDef = "prod_caf_R19-11-18-prod5reco.f_fd_genie_N1810j0211a_tau_" +polarity+"_nova_v08_"+period+"_v1";
50  Loaders *loader = new Loaders();
54  loader->SetSpillCut ( kStandardSpillCuts );
55 
56  // Declare my spectra
57  PredictionNoExtrap *sNuRecoE [NCuts];
58  PredictionNoExtrap *sReMIdScore [NCuts];
59  PredictionNoExtrap *sProngScoremuon[NCuts];
60  PredictionNoExtrap *sCosRejScoreP4 [NCuts];
61  PredictionNoExtrap *sCosRejScoreP5 [NCuts];
62  PredictionNoExtrap *sOldPreselmuon [NCuts];
63  PredictionNoExtrap *sOldPreselcosm [NCuts];
64  PredictionNoExtrap *sLoosePTPmuon [NCuts];
65  PredictionNoExtrap *sLoosePTPcosm [NCuts];
66 
67  for (size_t cc=0; cc < NCuts; ++cc) {
68  Cut kThisCut = MyCuts[cc].first;
69 
70  sNuRecoE [cc] = new PredictionNoExtrap( *loader, "Reco Nu E" , kOptEnBins , kCCE , kThisCut, kNoShift, kMyWeight );
71  /*
72  sReMIdScore [cc] = new PredictionNoExtrap( *loader, "ReMId Score" , kRemidBinning, kRemID , kThisCut, kNoShift, kMyWeight );
73  sProngScoremuon[cc] = new PredictionNoExtrap( *loader, "Prong CVN Muon Score" , kSimpBins , kCVNBestMuonScore, kThisCut, kNoShift, kMyWeight );
74  sCosRejScoreP4 [cc] = new PredictionNoExtrap( *loader, "Prod4 CosRej Score" , kSimpBins , kNumuContPID2019 , kThisCut, kNoShift, kMyWeight );
75  sCosRejScoreP5 [cc] = new PredictionNoExtrap( *loader, "Prod5 CosRej Score" , kSimpBins , kNumuContPID , kThisCut, kNoShift, kMyWeight );
76  sOldPreselmuon [cc] = new PredictionNoExtrap( *loader, "Old Presel Muon Score", kSimpBins , kCVNm_oldpresel , kThisCut, kNoShift, kMyWeight );
77  sOldPreselcosm [cc] = new PredictionNoExtrap( *loader, "Old Presel Cosm Score", kSimpBins , kCVNcos_oldpresel, kThisCut, kNoShift, kMyWeight );
78  sLoosePTPmuon [cc] = new PredictionNoExtrap( *loader, "Loose Pt/p Muon Score", kSimpBins , kCVNm_looseptp , kThisCut, kNoShift, kMyWeight );
79  sLoosePTPcosm [cc] = new PredictionNoExtrap( *loader, "Loose Pt/p Cosm Score", kSimpBins , kCVNcos_looseptp , kThisCut, kNoShift, kMyWeight );
80  */
81  }
82 
83  // Set my loader going.
84  loader->Go();
85 
86  SpectrumLoader SimpLoad(MyNonSwapDef.c_str());
88  Spectrum* NoCutRecoNu = new Spectrum("NoCutRecoNu", kOptEnBins, SimpLoad, kCCE, kNoCut, kNoShift, kMyWeight );
89  SimpLoad.Go();
90 
91  // Make my Output file
92  std::string OutName = "BasicPIDPlots_2020_"+detector+"_"+data+"_"+polarity+"_"+period+".root";
93  TFile *OutFile = TFile::Open(OutName.c_str(), "RECREATE");
94  for (size_t cc=0; cc < NCuts; ++cc) {
95  std::string ThisCutNa = MyCuts[cc].second;
96 
97  sNuRecoE [cc] -> SaveTo( OutFile, TString("RecoNuE" )+TString(ThisCutNa) ) ;
98  /*
99  sReMIdScore [cc] -> SaveTo( OutFile, TString("ReMIdScore" )+TString(ThisCutNa) ) ;
100  sProngScoremuon[cc] -> SaveTo( OutFile, TString("ProngCVNMuonScore" )+TString(ThisCutNa) ) ;
101  sCosRejScoreP4 [cc] -> SaveTo( OutFile, TString("Prod4CosRejScore" )+TString(ThisCutNa) ) ;
102  sCosRejScoreP5 [cc] -> SaveTo( OutFile, TString("Prod5CosRejScore" )+TString(ThisCutNa) ) ;
103  sOldPreselmuon [cc] -> SaveTo( OutFile, TString("OldPreselMuonScore")+TString(ThisCutNa) ) ;
104  sOldPreselcosm [cc] -> SaveTo( OutFile, TString("OldPreselCosmScore")+TString(ThisCutNa) ) ;
105  sLoosePTPmuon [cc] -> SaveTo( OutFile, TString("LoosePtpMuonScore" )+TString(ThisCutNa) ) ;
106  sLoosePTPcosm [cc] -> SaveTo( OutFile, TString("LoosePtpCosmScore" )+TString(ThisCutNa) ) ;
107  */
108  }
109  NoCutRecoNu -> SaveTo( OutFile, TString("NoCutRecoNu" ) ) ;
110 
111  OutFile -> Close();
112 }
size_t NCuts
Definition: MakeCutFlow.C:50
Far Detector at Ash River.
Definition: SREnums.h:11
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)
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
std::vector< std::pair< Cut, std::string > > BasicPIDPlots_Cuts(bool isFHC, bool isFD, bool isData)
void SetSpillCut(const SpillCut &cut)
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
void Go()
Call Go() on all the loaders.
Definition: Loaders.cxx:162
const XML_Char const XML_Char * data
Definition: expat.h:268
void SetSpillCut(const SpillCut &cut)
Definition: Loaders.cxx:121
const Var kCCE
Definition: NumuVars.h:21
void NuMu2020_BasicPIDPlots_FD(bool isFHC, std::string period="full")
loader
Definition: demo0.py:10
std::vector< float > Spectrum
Definition: Constants.h:610
c1 Close()
static bool isFHC
const SystShifts kNoShift
Definition: SystShifts.cxx:22
OStream cout
Definition: OStream.cxx:6
const Binning kOptEnBins
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
void cc()
Definition: test_ana.C:28
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
TFile * OutFile
Prediction that just uses FD MC, with no extrapolation.
void SetLoaderPath(const std::string &path, caf::Det_t det, DataMC datamc, DataSource src=kBeam, SwappingConfig swap=kNonSwap)
Configure loader via wildcard path.
Definition: Loaders.cxx:25
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:109
const Var kXSecCVWgt2020
Definition: XsecTunes.h:106
enum BeamMode string