prod4_pid.C
Go to the documentation of this file.
1 #include "CAFAna/Core/Spectrum.h"
3 #include "CAFAna/Core/Cut.h"
5 
6 #include "NuXAna/Cuts/NusCuts.h"
7 #include "NuXAna/Cuts/NusCuts18.h"
8 #include "CAFAna/Cuts/NumuCuts.h" // kNumuDecafPresel
9 #include "CAFAna/Cuts/NumuCuts2017.h" // kNumuOptimizedContainFD2017, kNumuContainND2017
10 #include "CAFAna/Cuts/NueCuts2018.h" // kNue2017ProngContainment, kNue2018Presel
11 #include "CAFAna/Cuts/Cuts.h" // kIsFarDet
12 #include "CAFAna/Cuts/AnalysisMasks.h" // kApplySecondAnalysisMask
13 #include "NuXAna/Cuts/NusCuts.h"
14 
15 #include "Prod4ProngCVNScores.h"
16 
17 #include "TFile.h"
18 
19 using namespace ana;
20 
21 ////////////////////////////// Slice Quality ////////////////////////////////////
22 const ana::Cut kHasVtx([](const caf::SRProxy * sr)
23  {
24  return sr->vtx.nelastic > 0;
25  });
26 const ana::Cut kHasPng([](const caf::SRProxy * sr)
27  {
28  return sr->vtx.elastic[0].fuzzyk.npng > 0;
29  });
30 const ana::Cut kSliceQuality([](const caf::SRProxy * sr)
31  {
32  if(kIsFarDet(sr))
33  return kHasVtx(sr) && kHasPng(sr);
34  else
35  return kHasVtx(sr) && kHasPng(sr) && kNDRockFilter(sr);
36  });
37 
38 ////////////////////////////// Numu Cuts ////////////////////////////////////////
39 const ana::Cut kNumuPreselMinusCCE([](const caf::SRProxy * sr)
40  {
41  if(kIsFarDet(sr))
43  else
44  return kNumuBasicQuality(sr) && kNumuContainND2017(sr);
45  });
46 const ana::Cut kNumuContain([](const caf::SRProxy * sr)
47  {
48  if(kIsFarDet(sr))
49  return kNumuOptimizedContainFD2017(sr);
50  else
51  return kNumuContainND2017(sr);
52  });
53 
54 ////////////////////////////// Nue Cuts /////////////////////////////////////////
55 const ana::Var kHitsPerPlane([](const caf::SRProxy * sr)
56  {
57  return sr->sel.nuecosrej.hitsperplane;
58  });
62 const ana::Cut kNueContain([](const caf::SRProxy * sr)
63  {
64  if(kIsFarDet(sr))
65  return kNueContainFD(sr);
66  else
67  return kNue2017NDContain(sr);
68  });
69 const ana::Cut kNuePresel([](const caf::SRProxy * sr)
70  {
71  if(kIsFarDet(sr))
72  return kNue2018CorePresel(sr);
73  else
74  return kNue2018NDPresel(sr);
75  });
76 
77 ////////////////////////////// Nus Cuts /////////////////////////////////////////
78 const ana::Cut kNusContain([](const caf::SRProxy * sr)
79  {
80  if(kIsFarDet(sr))
81  return kNus18FDContain(sr);
82  else
83  return kNus18NDContain(sr);
84  });
85 const ana::Cut kNusPresel([](const caf::SRProxy * sr)
86  {
87  if(kIsFarDet(sr))
88  return kNus18FDPresel(sr);
89  else
90  return kNus18NDPresel(sr);
91  });
92 
93 ////////////////////////////// ORd Cuts /////////////////////////////////////////
96 
97 
98 
99 void prod4_pid()
100 {
101  std::map<std::string, const MultiVar &> prong_vars;
102  std::map<std::string, const Cut &> selection_cuts;
103  std::map<std::string, SpectrumLoader *> loaders;
104  /// pid vars
105  // muonid
106  prong_vars.insert({"muonid_true_muon", kMuonPIDTrueMuon});
107  prong_vars.insert({"muonid_true_electron", kMuonPIDTrueElectron});
108  prong_vars.insert({"muonid_true_pion", kMuonPIDTruePion});
109  prong_vars.insert({"muonid_true_proton", kMuonPIDTrueProton});
110  prong_vars.insert({"muonid_true_photon", kMuonPIDTruePhoton});
111 
112  // electronid
113  prong_vars.insert({"electronid_true_muon", kElectronPIDTrueMuon});
114  prong_vars.insert({"electronid_true_electron", kElectronPIDTrueElectron});
115  prong_vars.insert({"electronid_true_pion", kElectronPIDTruePion});
116  prong_vars.insert({"electronid_true_proton", kElectronPIDTrueProton});
117  prong_vars.insert({"electronid_true_photon", kElectronPIDTruePhoton});
118 
119  // pionid
120  prong_vars.insert({"pionid_true_muon", kPionPIDTrueMuon});
121  prong_vars.insert({"pionid_true_electron", kPionPIDTrueElectron});
122  prong_vars.insert({"pionid_true_pion", kPionPIDTruePion});
123  prong_vars.insert({"pionid_true_proton", kPionPIDTrueProton});
124  prong_vars.insert({"pionid_true_photon", kPionPIDTruePhoton});
125 
126  // protonid
127  prong_vars.insert({"protonid_true_muon", kProtonPIDTrueMuon});
128  prong_vars.insert({"protonid_true_electron", kProtonPIDTrueElectron});
129  prong_vars.insert({"protonid_true_pion", kProtonPIDTruePion});
130  prong_vars.insert({"protonid_true_proton", kProtonPIDTrueProton});
131  prong_vars.insert({"protonid_true_photon", kProtonPIDTruePhoton});
132 
133  // photonid
134  prong_vars.insert({"photonid_true_muon", kPhotonPIDTrueMuon});
135  prong_vars.insert({"photonid_true_electron", kPhotonPIDTrueElectron});
136  prong_vars.insert({"photonid_true_pion", kPhotonPIDTruePion});
137  prong_vars.insert({"photonid_true_proton", kPhotonPIDTrueProton});
138  prong_vars.insert({"photonid_true_photon", kPhotonPIDTruePhoton});
139 
140  // photonid
141  prong_vars.insert({"emid_true_muon", kEMPIDTrueMuon});
142  prong_vars.insert({"emid_true_electron", kEMPIDTrueElectron});
143  prong_vars.insert({"emid_true_pion", kEMPIDTruePion});
144  prong_vars.insert({"emid_true_proton", kEMPIDTrueProton});
145  prong_vars.insert({"emid_true_photon", kEMPIDTruePhoton});
146 
147  /// selection cuts
148  /// CutVarCache doesn't like this....
149  // selection_cuts.insert({"Veto", Cut(kVeto)});
150  // selection_cuts.insert({"Containment", Cut(kVeto && kOrContainment)});
151  // selection_cuts.insert({"Preselection", Cut(kVeto && kOrContainment && kOrPreselection)});
152  // dont know why this has to be so complicated
153  std::vector<const Cut *> cuts = {new Cut(kVeto),
154  new Cut(kVeto && kOrContainment),
155  new Cut(kVeto && kOrContainment && kOrPreselection)};
156  std::vector<std::string> cut_labels = {"Veto", "Containment", "Preselection"};
157 
158 
159  /// loaders
160  loaders.insert({"FD_Fluxswap_FHC", new SpectrumLoader("prod_caf_R17-11-14-prod4reco.d_fd_genie_fluxswap_fhc_nova_v08_full_v1")});
161  loaders.insert({"FD_Nonswap_FHC", new SpectrumLoader("prod_caf_R17-11-14-prod4reco.d_fd_genie_nonswap_fhc_nova_v08_full_v1")});
162  // loaders.insert({"ND_Nonswap_RHC", new SpectrumLoader("prod_caf_R17-11-14-prod4reco.CVNprong-respin.a_nd_genie_nonswap_rhc_nova_v08_full_v1")});
163  // loaders.insert({"ND_Nonswap_FHC", new SpectrumLoader("prod_caf_R17-11-14-prod4reco.CVNprong-respin.a_nd_genie_nonswap_fhc_nova_v08_full_v1")});
164  loaders.insert({"ND_Nonswap_RHC", new SpectrumLoader("prod_caf_R17-11-14-prod4reco.neutron-respin.b_nd_genie_nonswap_rhc_nova_v08_full_v1")});
165  loaders.insert({"ND_Nonswap_FHC", new SpectrumLoader("prod_caf_R17-11-14-prod4reco.neutron-respin.b_nd_genie_nonswap_fhc_nova_v08_full_v1")});
166 
167 
168  const Binning pid_bins = Binning::Simple(30, 0, 1);
169 
170  std::cout << "Prong Vars: " << prong_vars.size() << std::endl;
171  std::cout << "Selection Cuts: " << cuts.size() << std::endl;
172  std::cout << "Loaders: " << loaders.size() << std::endl;
173 
174  std::vector<Spectrum*> spectra;
175  int start_cut = 1;
176  int end_cut = 2;
177  for(std::map<std::string, const MultiVar &>::iterator var = prong_vars.begin(); var != prong_vars.end();var++) {
178  for(int icut = 0; icut < (int) cuts.size(); icut++) {
179  //for(int icut = start_cut; icut < end_cut; icut++) {
180  for(std::map<std::string, SpectrumLoader*>::iterator loader = loaders.begin(); loader != loaders.end(); loader++) {
181  spectra.push_back(new Spectrum(cut_labels[icut] + "_" + loader->first + "_" + var->first,
182  pid_bins,
183  *loader->second,
184  var->second,
185  kSliceQuality && *cuts[icut]));
186  }
187  }
188  }
189 
190  for(std::map<std::string, SpectrumLoader*>::iterator loader = loaders.begin(); loader != loaders.end(); loader++) {
191  loader->second->Go();
192  }
193 
194  TFile * output = new TFile("prod4_pid.root", "recreate");
195  for(int i = 0; i < (int) spectra.size(); i++) {
196  spectra[i]->SaveTo(output->mkdir(spectra[i]->GetLabels()[0].c_str()));
197  }
198 
199 }
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
const ana::Cut kNDRockFilter([](const caf::SRProxy *sr){if(sr->vtx.nelastic==0) return false;return sr->vtx.elastic[0].vtx.x >-180 &&sr->vtx.elastic[0].vtx.x< 180 &&sr->vtx.elastic[0].vtx.y >-180 &&sr->vtx.elastic[0].vtx.y< 180 &&sr->vtx.elastic[0].vtx.z > 20;})
ofstream output
const Cut kNus18FDContain
FD Containment, nue-inspired, from docdb 21113.
Definition: NusCuts18.h:49
const ana::MultiVar kMuonPIDTrueElectron([](const caf::SRProxy *sr){std::vector< double > muonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsElectronPng(png_idx, sr)) muonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.muonid);}}return muonid;})
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
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
const Cut kNus18FDPresel
The Nus18 preselection cuts for the Far Detector from docdb 21113.
Definition: NusCuts18.h:58
const Cut kApplySecondAnalysisMask([](const caf::SRProxy *sr){if(sr->hdr.det!=caf::kFARDET) return true; std::bitset< 14 > binary(sr->hdr.dibmask);std::pair< int, int > planesA=calcFirstLastLivePlane(sr->slc.firstplane, binary);std::pair< int, int > planesB=calcFirstLastLivePlane(sr->slc.lastplane, binary);if((planesA.first!=planesB.first)||(planesA.second!=planesB.second)) return false;return((planesA.second-planesA.first+1)/64 >=4);})
Definition: AnalysisMasks.h:18
const ana::Cut kNueContain([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kNueContainFD(sr);else return kNue2017NDContain(sr);})
const Cut kNumuContainND2017([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;++i){TVector3 start=sr->vtx.elastic.fuzzyk.png[i].shwlid.start;TVector3 stop=sr->vtx.elastic.fuzzyk.png[i].shwlid.stop;if(std::min(start.X(), stop.X())< -180.0) return false;if(std::max(start.X(), stop.X()) > 180.0) return false;if(std::min(start.Y(), stop.Y())< -180.0) return false;if(std::max(start.Y(), stop.Y()) > 180.0) return false;if(std::min(start.Z(), stop.Z())< 20.0) return false;if(std::max(start.Z(), stop.Z()) > 1525.0) return false;}if(sr->trk.kalman.ntracks< 1) return false;for(unsigned int i=0;i< sr->trk.kalman.ntracks;++i){if(i==sr->trk.kalman.idxremid) continue;else if(sr->trk.kalman.tracks[i].start.Z() > 1275||sr->trk.kalman.tracks[i].stop.Z() > 1275) return false;}return(sr->trk.kalman.ntracks > sr->trk.kalman.idxremid &&sr->slc.firstplane > 1 &&sr->slc.lastplane< 212 &&sr->trk.kalman.tracks[0].start.Z()< 1100 &&(sr->trk.kalman.tracks[0].stop.Z()< 1275 ||sr->sel.contain.kalyposattrans< 55) &&sr->sel.contain.kalfwdcellnd > 5 &&sr->sel.contain.kalbakcellnd > 10);})
Definition: NumuCuts2017.h:11
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
const ana::Cut kSliceQuality([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kHasVtx(sr)&&kHasPng(sr);else return kHasVtx(sr)&&kHasPng(sr)&&kNDRockFilter(sr);})
const ana::MultiVar kMuonPIDTruePhoton([](const caf::SRProxy *sr){std::vector< double > muonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPhotonPng(png_idx, sr)) muonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.muonid);}}return muonid;})
const ana::Cut kNuePresel([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kNue2018CorePresel(sr);else return kNue2018NDPresel(sr);})
const ana::MultiVar kElectronPIDTruePion([](const caf::SRProxy *sr){std::vector< double > electronid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPionPng(png_idx, sr)) electronid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.electronid);}}return electronid;})
const ana::Cut kNumuContain([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kNumuOptimizedContainFD2017(sr);else return kNumuContainND2017(sr);})
const ana::MultiVar kEMPIDTruePhoton([](const caf::SRProxy *sr){std::vector< double > emid_scores;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPhotonPng(png_idx, sr)) emid_scores.push_back(emid(vtx_idx, png_idx, sr));}}return emid_scores;})
const ana::MultiVar kPhotonPIDTrueProton([](const caf::SRProxy *sr){std::vector< double > photonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsProtonPng(png_idx, sr)) photonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.photonid);}}return photonid;})
const ana::MultiVar kProtonPIDTruePion([](const caf::SRProxy *sr){std::vector< double > protonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPionPng(png_idx, sr)) protonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.protonid);}}return protonid;})
const ana::MultiVar kPionPIDTruePion([](const caf::SRProxy *sr){std::vector< double > pionid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPionPng(png_idx, sr)) pionid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.pionid);}}return pionid;})
const ana::MultiVar kProtonPIDTrueProton([](const caf::SRProxy *sr){std::vector< double > protonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsProtonPng(png_idx, sr)) protonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.protonid);}}return protonid;})
const Cut kNue2017ProngContainment
FD containment cuts, inherited from Second Analysis.
Definition: NueCuts2017.h:79
const Cut kIsFarDet([](const caf::SRProxy *sr){return sr->hdr.det==caf::kFARDET;})
Definition: Cuts.h:94
const ana::Cut kHasVtx([](const caf::SRProxy *sr){return sr->vtx.nelastic > 0;})
const Cut kNue2018NDPresel
Definition: NueCuts2018.h:145
const ana::MultiVar kMuonPIDTruePion([](const caf::SRProxy *sr){std::vector< double > muonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPionPng(png_idx, sr)) muonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.muonid);}}return muonid;})
std::vector< std::string > cut_labels
const ana::Cut kNueBasicPart
Definition: prod4_pid.C:60
const ana::MultiVar kMuonPIDTrueProton([](const caf::SRProxy *sr){std::vector< double > muonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsProtonPng(png_idx, sr)) muonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.muonid);}}return muonid;})
const Cut kNus18NDPresel
Definition: NusCuts18.h:131
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< caf::SRNueCosRej > nuecosrej
Definition: SRProxy.h:1265
const ana::Cut kNusPresel([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kNus18FDPresel(sr);else return kNus18NDPresel(sr);})
const ana::MultiVar kPhotonPIDTruePhoton([](const caf::SRProxy *sr){std::vector< double > photonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPhotonPng(png_idx, sr)) photonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.photonid);}}return photonid;})
const Var kHitsPerPlane
const ana::MultiVar kPionPIDTrueProton([](const caf::SRProxy *sr){std::vector< double > pionid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsProtonPng(png_idx, sr)) pionid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.pionid);}}return pionid;})
const ana::MultiVar kPhotonPIDTrueMuon([](const caf::SRProxy *sr){std::vector< double > photonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsMuonPng(png_idx, sr)) photonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.photonid);}}return photonid;})
const Cut kNumuOptimizedContainFD2017([](const caf::SRProxy *sr){std::pair< int, int > planes=calcFirstLastLivePlane(sr->slc.firstplane, std::bitset< 14 >(sr->hdr.dibmask));int planestofront=sr->slc.firstplane-planes.first;int planestoback=planes.second-sr->slc.lastplane;return(sr->sel.contain.kalfwdcell > 6 &&sr->sel.contain.kalbakcell > 6 &&sr->sel.contain.cosfwdcell > 0 &&sr->sel.contain.cosbakcell > 7 &&planestofront > 1 &&planestoback > 1);})
Definition: NumuCuts2017.h:16
const ana::MultiVar kElectronPIDTrueElectron([](const caf::SRProxy *sr){std::vector< double > electronid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsElectronPng(png_idx, sr)) electronid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.electronid);}}return electronid;})
const ana::MultiVar kEMPIDTrueElectron([](const caf::SRProxy *sr){std::vector< double > emid_scores;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsElectronPng(png_idx, sr)) emid_scores.push_back(emid(vtx_idx, png_idx, sr));}}return emid_scores;})
caf::Proxy< float > hitsperplane
Definition: SRProxy.h:1046
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
const ana::MultiVar kEMPIDTrueProton([](const caf::SRProxy *sr){std::vector< double > emid_scores;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsProtonPng(png_idx, sr)) emid_scores.push_back(emid(vtx_idx, png_idx, sr));}}return emid_scores;})
const ana::MultiVar kProtonPIDTrueElectron([](const caf::SRProxy *sr){std::vector< double > protonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsElectronPng(png_idx, sr)) protonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.protonid);}}return protonid;})
caf::StandardRecord * sr
const ana::Cut kOrContainment
Definition: prod4_pid.C:94
loader
Definition: demo0.py:10
const Cut kNue2018CorePresel
Definition: NueCuts2018.h:37
const ana::MultiVar kProtonPIDTruePhoton([](const caf::SRProxy *sr){std::vector< double > protonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPhotonPng(png_idx, sr)) protonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.protonid);}}return protonid;})
const ana::MultiVar kProtonPIDTrueMuon([](const caf::SRProxy *sr){std::vector< double > protonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsMuonPng(png_idx, sr)) protonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.protonid);}}return protonid;})
std::vector< float > Spectrum
Definition: Constants.h:610
const ana::Cut kOrPreselection
Definition: prod4_pid.C:95
const ana::Cut kNueDQ
Definition: prod4_pid.C:59
const ana::MultiVar kEMPIDTruePion([](const caf::SRProxy *sr){std::vector< double > emid_scores;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPionPng(png_idx, sr)) emid_scores.push_back(emid(vtx_idx, png_idx, sr));}}return emid_scores;})
const ana::Cut kNumuPreselMinusCCE([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kNumuBasicQuality(sr)&&kNumuOptimizedContainFD2017(sr);else return kNumuBasicQuality(sr)&&kNumuContainND2017(sr);})
const ana::MultiVar kPionPIDTrueElectron([](const caf::SRProxy *sr){std::vector< double > pionid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsElectronPng(png_idx, sr)) pionid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.pionid);}}return pionid;})
OStream cout
Definition: OStream.cxx:6
const Cut kNumuBasicQuality([](const caf::SRProxy *sr){return(sr->energy.numu.trkccE > 0 && sr->sel.remid.pid > 0 && sr->slc.nhit > 20 && sr->slc.ncontplanes > 4 && sr->trk.cosmic.ntracks > 0);})
Definition: NumuCuts.h:14
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
std::vector< Loaders * > loaders
Definition: syst_header.h:386
const Cut kNue2017NDContain([](const caf::SRProxy *sr){for(unsigned int ix=0;ix< sr->vtx.elastic.fuzzyk.nshwlid;++ix){TVector3 start=sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;TVector3 stop=sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;if(std::min(start.X(), stop.X())< -170.0) return false;if(std::max(start.X(), stop.X()) > 170.0) return false;if(std::min(start.Y(), stop.Y())< -170.0) return false;if(std::max(start.Y(), stop.Y()) > 170.0) return false;if(std::min(start.Z(), stop.Z())< 100.0) return false;if(std::max(start.Z(), stop.Z()) > 1225.0) return false;}return true;})
Loose containtment on start and end of all showers, docdb-12943.
Definition: NueCuts2017.h:259
const ana::MultiVar kEMPIDTrueMuon([](const caf::SRProxy *sr){std::vector< double > emid_scores;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsMuonPng(png_idx, sr)) emid_scores.push_back(emid(vtx_idx, png_idx, sr));}}return emid_scores;})
const ana::Cut kNueContainFD
Definition: prod4_pid.C:61
const ana::Cut kNusContain([](const caf::SRProxy *sr){if(kIsFarDet(sr)) return kNus18FDContain(sr);else return kNus18NDContain(sr);})
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
const ana::MultiVar kPionPIDTrueMuon([](const caf::SRProxy *sr){std::vector< double > pionid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsMuonPng(png_idx, sr)) pionid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.pionid);}}return pionid;})
const ana::MultiVar kElectronPIDTruePhoton([](const caf::SRProxy *sr){std::vector< double > electronid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPhotonPng(png_idx, sr)) electronid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.electronid);}}return electronid;})
const ana::Cut kHasPng([](const caf::SRProxy *sr){return sr->vtx.elastic[0].fuzzyk.npng > 0;})
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const ana::MultiVar kPhotonPIDTrueElectron([](const caf::SRProxy *sr){std::vector< double > photonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsElectronPng(png_idx, sr)) photonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.photonid);}}return photonid;})
const ana::MultiVar kPhotonPIDTruePion([](const caf::SRProxy *sr){std::vector< double > photonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPionPng(png_idx, sr)) photonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.photonid);}}return photonid;})
const Cut kNus18NDContain
Definition: NusCuts18.h:122
const ana::MultiVar kPionPIDTruePhoton([](const caf::SRProxy *sr){std::vector< double > pionid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsPhotonPng(png_idx, sr)) pionid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.pionid);}}return pionid;})
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const ana::MultiVar kElectronPIDTrueMuon([](const caf::SRProxy *sr){std::vector< double > electronid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsMuonPng(png_idx, sr)) electronid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.electronid);}}return electronid;})
void prod4_pid()
Definition: prod4_pid.C:99
const ana::MultiVar kMuonPIDTrueMuon([](const caf::SRProxy *sr){std::vector< double > muonid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsMuonPng(png_idx, sr)) muonid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.muonid);}}return muonid;})
const ana::MultiVar kElectronPIDTrueProton([](const caf::SRProxy *sr){std::vector< double > electronid;for(unsigned int vtx_idx=0;vtx_idx< sr->vtx.elastic.size();vtx_idx++){for(unsigned int png_idx=0;png_idx< sr->vtx.elastic[vtx_idx].fuzzyk.png.size();png_idx++){if(IsProtonPng(png_idx, sr)) electronid.push_back(sr->vtx.elastic[vtx_idx].fuzzyk.png[png_idx].cvnpart.electronid);}}return electronid;})