NuSLoadMacroDefs.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdio.h>
4 #include <string>
5 
6 #include "CAFAna/Core/Binning.h"
7 #include "CAFAna/Core/Cut.h"
8 #include "CAFAna/Core/Spectrum.h"
10 #include "CAFAna/Cuts/Cuts.h"
11 #include "NuXAna/Cuts/NusCuts.h"
12 #include "CAFAna/Cuts/TruthCuts.h"
13 #include "CAFAna/Vars/Vars.h"
14 #include "OscLib/IOscCalc.h"
15 
16 
17 #include "TVector3.h"
18 
19 #define MAXSPEC 5
20 
21 class TDirectory;
22 
23 void Preliminary();
24 void Simulation();
25 void CenterTitles(TH1* histo);
26 
27 namespace ana
28 {
29  // Strings to file paths
30 
31  // PNFS concat directory
32  const std::string diskdir = "/pnfs/nova/persistent/users/gsdavies/nus/concat/S16-04-08/";
33  const std::string diskdirFD = "/pnfs/nova/persistent/users/gsdavies/nus/concat/S16-05-20/";
34  // feature_caf_size (fcs)
35  const std::string diskdir_fcs = "/pnfs/nova/persistent/production/concat/R16-11-12-feature_caf_size.a/";
36  // I put the bluearc location here for reference but one should just
37  // use the /pnfs directory, it's just as quick (if not quicker)
38  // The bluearc location is good to have in case of SAM issues.
39  //const std::string diskdir = "/nova/ana/steriles/concat/S16-04-08/";
40 
41  // MC decafs
42  const std::string fnamenear = "defname: prod_decaf_S16-04-08_nd_genie_nonswap_genierw_fhc_nova_v08_full_nus_or_numu_contain_v1 with stride 2 with limit 10000";
43  const std::string fnamefar = "prod_decaf_S16-04-08_fd_genie_nonswap_fhc_nova_v08_full_nus_contain_v1";
44  const std::string fnameswap = "prod_decaf_S16-04-08_fd_genie_fluxswap_fhc_nova_v08_full_nus_contain_v1";
45  const std::string fnametau = "prod_decaf_S16-04-08_fd_genie_tau_fhc_nova_v08_full_nus_contain_v1";
46 
47  // MC cafs
48  const std::string fnamenearcaf = "defname: prod_caf_R16-03-03-prod2reco.a_nd_genie_nonswap_genierw_fhc_nova_v08_full_v1 with limit 10000";
49  const std::string fnamefarcaf = "prod_caf_R16-03-03-prod2reco.a_fd_genie_nonswap_fhc_nova_v08_full_v1";
50  const std::string fnameswapcaf = "prod_caf_R16-03-03-prod2reco.a_fd_genie_fluxswap_fhc_nova_v08_full_v1";
51  const std::string fnametaucaf = "prod_caf_R16-03-03-prod2reco.a_fd_genie_tau_fhc_nova_v08_full_v1";
52 
53  // MC concats
54  const std::string fnamenear_concat = diskdir + "prod_decaf_S16-04-08_nd_genie_nonswap_genierw_fhc_nova_v08_full_nus_or_numu_contain_v1/*.root";
55 
56  const std::string fnamenear_concat_fcs = diskdir_fcs + "prod_decaf_R16-11-12-feature_decaf_size.a_nd_genie_nonswap_genierw_fhc_nova_v08_full_v1_nue_or_numu/*.root";
57  //const std::string fnamenear_concat_fcs = "bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_nd_genie_nonswap_genierw_fhc_nova_v08_full_v1";
58  // FD nominal MC by period/epoch incl. veto information
59  // First a vector of strings of period1+period2+epoch3b
60  const std::vector<std::string> fFDMC_non = {diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_nonswap_fhc_nova_v08_period1_nus_contain_v1_prod2-snapshot.root",
61  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_nonswap_fhc_nova_v08_period2_nus_contain_v1_prod2-snapshot.root",
62  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_nonswap_fhc_nova_v08_epoch3b_nus_contain_v1_prod2-snapshot.root"};
63 
64  const std::vector<std::string> fFDMC_swp = {diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_fluxswap_fhc_nova_v08_period1_nus_contain_v1_prod2-snapshot.root",
65  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_fluxswap_fhc_nova_v08_period2_nus_contain_v1_prod2-snapshot.root",
66  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_fluxswap_fhc_nova_v08_epoch3b_nus_contain_v1_prod2-snapshot.root"};
67 
68  const std::vector<std::string> fFDMC_tau = {diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_tau_fhc_nova_v08_period1_nus_contain_v1_prod2-snapshot.root",
69  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_tau_fhc_nova_v08_period2_nus_contain_v1_prod2-snapshot.root",
70  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_tau_fhc_nova_v08_epoch3b_nus_contain_v1_prod2-snapshot.root"};
71 
72  // Then a string for epoch3c alone
73  const std::string fFDMC_non_3c = diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_nonswap_fhc_nova_v08_epoch3c_nus_contain_v1_prod2-snapshot.root";
74  const std::string fFDMC_swp_3c = diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_fluxswap_fhc_nova_v08_epoch3c_nus_contain_v1_prod2-snapshot.root";
75  const std::string fFDMC_tau_3c = diskdirFD + "by_period/prod_decaf_S16-05-20_fd_genie_tau_fhc_nova_v08_epoch3c_nus_contain_v1_prod2-snapshot.root";
76 
77  const std::string fFDMC_non_fcs = "defname: bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_fd_genie_nonswap_fhc_nova_v08_period1_v1 OR defname: bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_fd_genie_nonswap_fhc_nova_v08_period2_v1 OR defname: bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_fd_genie_nonswap_fhc_nova_v08_epoch3b_v1";
78  const std::string fFDMC_swp_fcs = "defname: bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_fd_genie_fluxswap_fhc_nova_v08_period1_v1 OR defname: bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_fd_genie_fluxswap_fhc_nova_v08_period2_v1 OR defname: bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_fd_genie_fluxswap_fhc_nova_v08_epoch3b_v1";
79 
80  const std::string fFDMC_non_3c_fcs = "prod_caf_R16-11-12-feature_caf_size.a_fd_genie_nonswap_fhc_nova_v08_epoch3c_v1";
81  const std::string fFDMC_swp_3c_fcs = "prod_caf_R16-11-12-feature_caf_size.a_fd_genie_fluxswap_fhc_nova_v08_epoch3c_v1";
82 
83 
84  // These are the old versions. In theory, only use these for the 14db
85  const std::string fnamefar_concat = diskdir + "prod_decaf_S16-04-08_fd_genie_nonswap_fhc_nova_v08_full_nus_contain_v1.root";
86  const std::string fnameswap_concat = diskdir + "prod_decaf_S16-04-08_fd_genie_fluxswap_fhc_nova_v08_full_nus_contain_v1.root";
87  const std::string fnametau_concat = diskdir + "prod_decaf_S16-04-08_fd_genie_tau_fhc_nova_v08_full_nus_contain_v1.root";
88 
89  // FD data cosmics
90  std::vector<std::string> MakeCosOutOfTimeList()
91  {
92  std::vector<std::string> fnamecos_concat_1 = Wildcard(
93  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_numi_fhc_period1_nus_contain_v1_goodruns_prod2-snapshot/"
94  + "prod_decaf_S16-05-20_fd_numi_fhc_period1_nus_contain_v1_goodruns_prod2-snapshot*.root"
95  );
96  std::vector<std::string> fnamecos_concat_2 = Wildcard(
97  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_numi_fhc_period2_nus_contain_v1_goodruns_prod2-snapshot/"
98  + "prod_decaf_S16-05-20_fd_numi_fhc_period2_nus_contain_v1_goodruns_prod2-snapshot*.root"
99  );
100  std::vector<std::string> fnamecos_concat_3bc = Wildcard(
101  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_numi_fhc_epoch3*_nus_contain_v1_goodruns_prod2-snapshot.root"
102  );
103  std::vector<std::string> fnamecos_concat_3d = Wildcard(
104  diskdirFD + "by_period/prod_decaf_S16-05-20_fd_numi_fhc_epoch3d_nus_contain_v1_goodruns_prod2-snapshot/"
105  + "prod_decaf_S16-05-20_fd_numi_fhc_epoch3d_nus_contain_v1_goodruns_prod2-snapshot*.root"
106  );
107  std::vector<std::string> ret;
108  for(const auto& file : fnamecos_concat_1) { ret.push_back(file); }
109  for(const auto& file : fnamecos_concat_2) { ret.push_back(file); }
110  for(const auto& file : fnamecos_concat_3bc) { ret.push_back(file); }
111  for(const auto& file : fnamecos_concat_3d) { ret.push_back(file); }
112  return ret;
113  }
114  const std::vector<std::string> fnameblind_concat(MakeCosOutOfTimeList());
115  const std::string fnamecos_concat = diskdir + "nus_decaf_S16-04-08_fd_data_cosmic/*.root"; // SA cosmic trigger concats, includes nus sandbox and nueveto
116  const std::string fnamecos_fcs = "prod_caf_R16-11-12-feature_caf_size.a_fd_cosmic_full_nueveto_v1_goodruns";
117  const std::string fnamecosnueveto = "defname:nus_decaf_S16-04-08_fd_data_cosmic with limit 10000"; // SA cosmics decafs, nueveto was ran as a preselection.
118 
119  // concats are actual ND NuMI data
120  const std::string fnameneardata_concat = diskdir + "prod_decaf_S16-04-08_nd_numi_fhc_full_nus_or_numu_contain_v1_goodruns/*.root";
121  // Note: nue or numu only - testing only!
122  const std::string fnameneardata_concat_fcs = diskdir_fcs + "prod_decaf_R16-11-12-feature_decaf_size.a_nd_numi_fhc_full_v1_goodruns_nue_or_numu/*.root";
123  //const std::string fnameneardata_concat_fcs = "bckhouse_newcaf_overlap_prod_caf_R16-11-12-feature_caf_size.a_nd_numi_fhc_full_v1_goodruns";
124  // FD NuMI data
126 
127  // MC decaf small sample
128  const std::string fnamenearsmall = "defname: prod_decaf_S16-04-08_nd_genie_nonswap_genierw_fhc_nova_v08_full_nus_or_numu_contain_v1 with stride 2 with limit 100";
129  const std::string fnamefarsmall = "defname: prod_decaf_S16-04-08_fd_genie_nonswap_fhc_nova_v08_full_nus_contain_v1 with limit 100";
130  const std::string fnameswapsmall = "defname: prod_decaf_S16-04-08_fd_genie_fluxswap_fhc_nova_v08_full_nus_contain_v1 with limit 100";
131  const std::string fnametausmall = "defname: prod_decaf_S16-04-08_fd_genie_tau_fhc_nova_v08_full_nus_contain_v1 with limit 100";
132 
133  // Data small samples
134  const std::string fnamecossmall = "defname: nus_decaf_S16-04-08_fd_data_cosmic with limit 100";
135  const std::string fnameneardatasmall = "defname: prod_decaf_S16-04-08_nd_genie_nonswap_genierw_fhc_nova_v08_full_nus_contain_v1 with stride 2 with offset 1 with limit 100";
136 
137  //......................................................................
138  const Binning kAngleCosBins = Binning::Simple(200, -1., 1.); // Binning for -1 to 1 in CosTheta
139  const Binning kAngleDegBins = Binning::Simple(360, 0., 360.); // Binning for angles in degrees
140 
141  const Binning kBooleanBins = Binning::Simple(3, -1.5, 1.5);
142 
143  const Binning kExtendedEBins = Binning::Simple(300, 0., 30.); // Binning for going to higher energies
144 
145  const Binning kFinePIDBins = Binning::Simple(100, 0., 1.); // Binning for PID plots (BUT NOT REMID!!!)
146 
147  const Binning kRatioBins = Binning::Simple(100, 0., 1.);
148 
149  // Short hand for following macros
150  const Cut FlavSel[4] = {kNoCut, kIsNC, (kIsNumuCC || kIsNumuApp), (kIsBeamNue || kIsSig)};
151 
152  const Cut kNDTruthFull(
153  [](const caf::SRProxy* sr)
154  {
155  if(sr->hdr.ismc == false) { return true; }
156  if(sr->mc.nnu < 1) { return false; }
157  if(sr->mc.nu[0].vtx.X() < NDL) { return false; }
158  if(sr->mc.nu[0].vtx.X() > NDR) { return false; }
159  if(sr->mc.nu[0].vtx.Y() < NDB) { return false; }
160  if(sr->mc.nu[0].vtx.Y() > NDT) { return false; }
161  if(sr->mc.nu[0].vtx.Z() < NDF) { return false; }
162 
163  double NDM = 1587.;
164  if(sr->mc.nu[0].vtx.Z() > NDM) { return false; }
165  if(sr->mc.nu[0].vtx.Z() > NDE) {
166  double MCT = (2./3.)*(NDT - NDB) + NDB;
167  if(sr->mc.nu[0].vtx.Y() > MCT) { return false; }
168  }
169  return true;
170  });
171 
172  // Macros to quickly generate arrays of Spectrum objects
173  // The macros make sure the spectra are in a consistent order for plotting functions
174 #define SPECARR(label, bins, loaderbeam, loadercos, var, cut) {Spectrum(label, bins, loaderbeam, var, cut && FlavSel[0]), Spectrum(label, bins, loaderbeam, var, cut && FlavSel[1]), Spectrum(label, bins, loaderbeam, var, cut && FlavSel[2]), Spectrum(label, bins, loaderbeam, var, cut && FlavSel[3]), Spectrum(label, bins, loadercos, var, cut)}
175 
176 #define SPECARR2D(label, loaderbeam, loadercos, binsX, varX, binsY, varY, cut) {Spectrum(label, loaderbeam, binsX, varX, binsY, varY, cut && FlavSel[0]), Spectrum(label, loaderbeam, binsX, varX, binsY, varY, cut && FlavSel[1]), Spectrum(label, loaderbeam, binsX, varX, binsY, varY, cut && FlavSel[2]), Spectrum(label, loaderbeam, binsX, varX, binsY, varY, cut && FlavSel[3]), Spectrum(label, loadercos, binsX, varX, binsY, varY, cut)}
177 }
const double NDT
Definition: NusCuts.cxx:12
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
const Cut kNDTruthFull([](const caf::SRProxy *sr){if(sr->hdr.ismc==false){return true;}if(sr->mc.nnu< 1){return false;}if(sr->mc.nu[0].vtx.X()< NDL){return false;}if(sr->mc.nu[0].vtx.X() > NDR){return false;}if(sr->mc.nu[0].vtx.Y()< NDB){return false;}if(sr->mc.nu[0].vtx.Y() > NDT){return false;}if(sr->mc.nu[0].vtx.Z()< NDF){return false;}double NDM=1587.;if(sr->mc.nu[0].vtx.Z() > NDM){return false;}if(sr->mc.nu[0].vtx.Z() > NDE){double MCT=(2./3.)*(NDT-NDB)+NDB;if(sr->mc.nu[0].vtx.Y() > MCT){return false;}}return true;})
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
const std::string fnamefarcaf
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void Simulation()
Definition: tools.h:16
const std::string fnamefar
const std::string fnametau_concat
const std::string fnamecosnueveto
const std::string fnamefarsmall
const std::string fnamecossmall
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
const std::string fnamecos_concat
const std::string fnamecos_fcs
const double NDR
Definition: NusCuts.cxx:10
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const std::string fnamenear_concat_fcs
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
const std::string fnameneardatasmall
const Cut kIsBeamNue(CCFlavSel(12, 12))
Select CC .
const Cut kIsNumuApp(CCFlavSel(14, 12))
Select CC .
const std::vector< std::string > fFDMC_non
void CenterTitles(TH1 *histo)
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
const Binning kAngleDegBins
Definition: NusLoadProd3.h:96
const double NDL
Definition: NusCuts.cxx:9
const std::string fnamenear
const std::string diskdir
void Preliminary()
Put NOvA Preliminary on plots.
const Binning kExtendedEBins
Definition: NusLoadProd3.h:100
const std::string fnamefardata
const std::string fnameswap
const std::string fFDMC_non_3c_fcs
const std::string fnamenear_concat
std::vector< std::string > Wildcard(const std::string &wildcardString)
Find files matching a UNIX glob, plus expand environment variables.
Definition: UtilsExt.cxx:268
const std::string fFDMC_swp_3c_fcs
const std::string fnameswapcaf
const std::string fnameneardata_concat
const std::vector< std::string > fFDMC_swp
const Cut kIsNC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return!sr->mc.nu[0].iscc;})
Is this a Neutral Current event?
Definition: TruthCuts.h:8
const std::string fFDMC_non_fcs
const std::string fFDMC_non_3c
const Cut kIsSig(CCFlavSel(12, 14))
Select CC .
const Binning kBooleanBins
Definition: NusLoadProd3.h:98
const std::string diskdirFD
caf::StandardRecord * sr
TH2D * histo
std::vector< std::string > MakeCosOutOfTimeList()
const std::string fnameneardata_concat_fcs
const std::vector< std::string > fnameblind_concat(MakeCosOutOfTimeList())
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
const double NDF
Definition: NusCuts.cxx:13
const std::string fFDMC_tau_3c
const Binning kRatioBins
Definition: NusLoadProd3.h:104
const std::string fFDMC_swp_fcs
const std::string fnametau
const double NDB
Definition: NusCuts.cxx:11
const std::vector< std::string > fFDMC_tau
const std::string fnameswapsmall
caf::Proxy< bool > ismc
Definition: SRProxy.h:242
const Binning kFinePIDBins
Definition: NusLoadProd3.h:102
const std::string fFDMC_swp_3c
TFile * file
Definition: cellShifts.C:17
const std::string fnamenearsmall
const std::string diskdir_fcs
const std::string fnametausmall
const double NDE
Definition: NusCuts.cxx:14
const std::string fnametaucaf
const std::string fnameswap_concat
const Cut FlavSel[4]
Definition: NusLoadProd3.h:107
const std::string fnamefar_concat
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:109
const Binning kAngleCosBins
Definition: NusLoadProd3.h:95
const std::string fnamenearcaf
enum BeamMode string