Helper.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <algorithm>
5 #include <TLine.h>
6 #include <TString.h>
7 #include "CAFAna/Core/Binning.h"
11 
12 using namespace ana;
13 
14 class Helper {
15 
16 public:
17 
18  bool IsSpecial (TString const &s_Obj);
19 
20  std::string Def (std::string const &s_Sample, std::string const &s_Condition);
21  std::string VarLabel(std::string s_DirName, bool isNice);
22  std::string CutLabel(std::string s_DirName);
23  std::string getNiceCutLabel(std::string const &s_Cut);
24  std::vector<std::string> CutFlow(std::string const &s_Selection, bool useAnaTrueECut, bool getDetailed);
25  std::vector<TLine*> PlotSpecial(TString const &s_Obj, std::string const &s_Selection, double const &yMin, double const &yMax, bool loosePresel);
26  void furtherBENBreakdown(std::map<std::string,const Cut> &map_Cuts, Cut kBaseCut);
27 
28  const Cut Sig_Cut (std::string s_Selection);
29  const NuTruthCut Sig_NuCut(std::string s_Selection);
30 
31  const Cut Quality_Cut (std::string s_Selection);
32  const Cut Containment_Cut(std::string s_Selection);
33  const Cut Presel_Cut (std::string s_Selection);
34  const Cut Selection_Cut (std::string s_Selection);
35 
36  const Binning Bins (std::string s_Var);
37  unsigned int fNbins;
38 
39 private:
40 
41  std::string getNiceLabel(std::string s_Var);
42 
43  void specifyValid();
44 
45 };
46 
47 
48 std::string Helper::Def(std::string const &s_Sample, std::string const &s_Condition){
49 
50  std::string s_Samdef="";
51  //MINIDEFS, TESTING OF TEST.
52  if(s_Sample=="mcdata_fhc_test_testdef")
53  s_Samdef="abooth_caf_mix_data_abooth_prod_artdaq_nd_numi_fhc_12359_v1_snapshot_goodruns_stride135_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200122_125156_testdef";
54  else if(s_Sample=="mcmc_fhc_test_testdef")
55  s_Samdef="abooth_caf_mix_mc_abooth_prod_artdaq_R19-10-07-prod5genie.d_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_resfix_stride573_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200122_125156_testdef";
56  else if(s_Sample=="mcdata_fhc_ben_test_testdef")
57  s_Samdef="abooth_caf_mix_data_abooth_prod_artdaq_nd_numi_fhc_12359_v1_snapshot_goodruns_stride135_ben_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200217_124902_testdef";
58  else if(s_Sample=="mcmc_fhc_ben_test_testdef")
59  s_Samdef="abooth_caf_mix_mc_abooth_prod_artdaq_R19-10-07-prod5genie.d_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_resfix_stride573_ben_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200217_124902_testdef";
60 
61  //FULL TEST DEFINITIONS.
62  if(s_Sample=="mcdata_fhc_test")
63  s_Samdef="abooth_caf_mix_data_abooth_prod_artdaq_nd_numi_fhc_12359_v1_snapshot_goodruns_stride135_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200122_125156";
64  else if(s_Sample=="mcmc_fhc_test")
65  s_Samdef="abooth_caf_mix_mc_abooth_prod_artdaq_R19-10-07-prod5genie.d_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_resfix_stride573_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200122_125156";
66  else if(s_Sample=="mcdata_fhc_ben_test")
67  s_Samdef="abooth_caf_mix_data_abooth_prod_artdaq_nd_numi_fhc_12359_v1_snapshot_goodruns_stride135_ben_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200217_124902";
68  else if(s_Sample=="mcmc_fhc_ben_test")
69  s_Samdef="abooth_caf_mix_mc_abooth_prod_artdaq_R19-10-07-prod5genie.d_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_v1_resfix_stride573_ben_nd_genie_N1810j0211a_fhc_nonswap_3000_bn1_v1_20200217_124902";
70 
71  //GRID TESTS.
72  if(s_Sample=="mcdata_fhc_gridtest")
73  s_Samdef="temp_cafs_singles_numu_fhc_mixed_with_data_metafix_limit5";
74  else if(s_Sample=="mcmc_fhc_gridtest")
75  s_Samdef="temp_cafs_old_metadata_numu_fhc_mixed_with_mc_snapshot1901165_limit5";
76  else if(s_Sample=="mcdata_fhc_nuegridtest")
77  s_Samdef="abooth_prod_caf_R19-11-18-prod5reco.m_nd_numi_fhc_full_singles_ben_data_v1_limit2";
78 
79  //OFFICIAL.
80  //NONSWAP.
81  if(s_Sample=="mcdata_fhc_nonswap")
82  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_numi_fhc_full_singles_numu_data_v1";
83  //s_Samdef="temp_cafs_singles_numu_fhc_mixed_with_data_metafix";
84  else if(s_Sample=="mcmc_fhc_nonswap")
85  s_Samdef="prod_caf_R19-11-18-prod5reco.m_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_singles_numu_mc_v1";
86  //s_Samdef="temp_cafs_old_metadata_numu_fhc_mixed_with_mc_snapshot1901165";
87  //s_Samdef="temp_cafs_singles_numu_fhc_mixed_with_mc_metafix";
88  else if(s_Sample=="mcdata_rhc_nonswap")
89  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_numi_rhc_full_singles_numu_data_v1";
90  //s_Samdef="temp_cafs_singles_numu_rhc_mixed_with_data_metafix";
91  else if(s_Sample=="mcmc_rhc_nonswap")
92  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_genie_N1810j0211a_nonswap_rhc_nova_v08_full_singles_numu_mc_v1";
93  //s_Samdef="temp_cafs_singles_numu_rhc_mixed_with_mc_metafix";
94 
95  //BEN.
96  if(s_Sample=="mcdata_fhc_ben")
97  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_numi_fhc_full_singles_ben_data_v1";
98  //s_Samdef="temp_cafs_singles_ben_fhc_mixed_with_data_metafix";
99  else if(s_Sample=="mcmc_fhc_ben")
100  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_genie_N1810j0211a_nonswap_fhc_nova_v08_full_singles_ben_mc_v1";
101  //s_Samdef="temp_cafs_singles_ben_fhc_mixed_with_mc_metafix ";
102  else if(s_Sample=="mcdata_rhc_ben")
103  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_numi_rhc_full_singles_ben_data_v1";
104  //s_Samdef="temp_cafs_singles_ben_rhc_mixed_with_data_metafix";
105  else if(s_Sample=="mcmc_rhc_ben")
106  s_Samdef = "prod_caf_R19-11-18-prod5reco.m_nd_genie_N1810j0211a_nonswap_rhc_nova_v08_full_singles_ben_mc_v1";
107  //s_Samdef="temp_cafs_singles_ben_rhc_mixed_with_mc_metafix ";
108 
109  /*
110  else if(s_Sample=="datanom_fhc_test")
111  s_Samdef="";
112  else if(s_Sample=="mcnom_fhc_test")
113  s_Samdef="";
114  else if(s_Sample=="datanom_rhc_test")
115  s_Samdef="";
116  else if(s_Sample=="mcnom_rhc_test")
117  s_Samdef="";
118  */
119 
120  if(s_Condition!=""){
121  s_Samdef = "defname: " + s_Samdef + " " + s_Condition;
122  }
123 
124  return s_Samdef;
125 }
126 
127 
128 bool Helper::IsSpecial(TString const &s_Obj)
129 {
130  std::vector<TString> vec_IsSpecial = {"dir_-CUT-over-VAR-kOTrueVtxX_Nu",
131  "dir_-CUT-over-VAR-kOTrueVtxY_Nu",
132  "dir_-CUT-over-VAR-kOTrueVtxZ_Nu",
133  "dir_-CUT-over-VAR-kPDG_Nu",
134  "dir_-CUT-over-VAR-kIsCC_Nu",
135  "dir_-CUT-special_overnoeff_fid_sig-VAR-kSlcEff"};
136 
137  return (std::find(vec_IsSpecial.begin(), vec_IsSpecial.end(), s_Obj) != vec_IsSpecial.end());
138 }
139 
140 
141 std::vector<TLine*> Helper::PlotSpecial(TString const &s_Obj, std::string const &s_Selection, double const &yMin, double const &yMax, bool loosePresel)
142 {
143  bool isCC;
144  bool isNumu;
145  if(s_Selection.find("numu2020")!=std::string::npos){
146  isCC = true;
147  isNumu = true;
148  }
149  else if(s_Selection.find("nue2020")!=std::string::npos){
150  isCC = true;
151  isNumu = false;
152  }
153  else{
154  specifyValid();
155  }
156 
157  std::vector<TLine*> vec_CutLines;
158  if((s_Obj.Contains("kOTrueVtxX_Nu")) || (s_Obj.Contains("kOTrueVtxY_Nu"))){
159  double presel = loosePresel ? 220. : 180.;
160  TLine *l_low = new TLine(-1.*presel, yMin, -1.*presel, yMax);
161  TLine *l_high = new TLine( presel, yMin, presel, yMax);
162  vec_CutLines.push_back(l_low);
163  vec_CutLines.push_back(l_high);
164  }
165  else if(s_Obj.Contains("kOTrueVtxZ_Nu")){
166  double presel = loosePresel ? 0. : 25.;
167  TLine *l_low = new TLine(presel, yMin, presel, yMax);
168  TLine *l_high = new TLine( 1150., yMin, 1150., yMax);
169  vec_CutLines.push_back(l_low);
170  vec_CutLines.push_back(l_high);
171  }
172  else if(s_Obj.Contains("kPDG")){
173  double pdg = 0.;
174  if(isNumu){
175  pdg = 14.;
176  }
177  else{
178  pdg = 12.;
179  }
180  TLine *l_lowl = new TLine(-1.*pdg-0.5, yMin, -1.*pdg-0.5, yMax);
181  TLine *l_lowh = new TLine(-1.*pdg+0.5, yMin, -1.*pdg+0.5, yMax);
182  TLine *l_highl = new TLine( 1.*pdg-0.5, yMin, 1.*pdg-0.5, yMax);
183  TLine *l_highh = new TLine( 1.*pdg+0.5, yMin, 1.*pdg+0.5, yMax);
184  vec_CutLines.push_back(l_lowl);
185  vec_CutLines.push_back(l_lowh);
186  vec_CutLines.push_back(l_highl);
187  vec_CutLines.push_back(l_highh);
188  }
189  else if(s_Obj.Contains("kIsCC")){
190  double CC = 0.;
191  if(isCC){
192  CC = 1.;
193  }
194  else{
195  CC = 0.;
196  }
197  TLine *l_lowl = new TLine(-1.*CC-0.5, yMin, -1.*CC-0.5, yMax);
198  TLine *l_lowh = new TLine(-1.*CC+0.5, yMin, -1.*CC+0.5, yMax);
199  TLine *l_highl = new TLine( 1.*CC-0.5, yMin, 1.*CC-0.5, yMax);
200  TLine *l_highh = new TLine( 1.*CC+0.5, yMin, 1.*CC+0.5, yMax);
201  vec_CutLines.push_back(l_lowl);
202  vec_CutLines.push_back(l_lowh);
203  vec_CutLines.push_back(l_highl);
204  vec_CutLines.push_back(l_highh);
205  }
206  else if(s_Obj.Contains("special_fid_sig-VAR-kSlcEff")){
207  TLine *l = new TLine(0.51, yMin, 0.51, yMax);
208  vec_CutLines.push_back(l);
209  }
210 
211 
212  for(unsigned int line = 0; line < vec_CutLines.size(); line++){
213  vec_CutLines.at(line)->SetLineWidth(2);
214  vec_CutLines.at(line)->SetLineColor(kViolet-6);
215  vec_CutLines.at(line)->SetLineStyle(kDashed);
216  }
217 
218  return vec_CutLines;
219 }
220 
221 
222 std::string Helper::VarLabel(std::string s_DirName, bool isNice)
223 {
224  std::string s_Var = "";
225  if(s_DirName.find("_Sp")!=std::string::npos){
226  if(isNice){
227  return getNiceLabel(s_DirName);
228  }
229  else{
230  return s_DirName.substr(0, s_DirName.length()-3);
231  }
232  }
233  unsigned first = s_DirName.find("-VAR-");
234  unsigned last = s_DirName.length();
235  s_Var = s_DirName.substr(first+5, last-first-5);
236 
237  if(isNice){
238  return getNiceLabel(s_Var);
239  }
240  else{
241  return s_Var;
242  }
243 }
244 
245 
247 {
248  std::string s_Cut = "";
249  if(s_DirName.find("_Sp")!=std::string::npos){
250  if(s_DirName.find("NSC")!=std::string::npos){
251  return "NSC";
252  }
253  else{
254  return "SSC";
255  }
256  }
257  unsigned first = s_DirName.find("-CUT-");
258  unsigned last = s_DirName.find("-VAR-");
259  s_Cut = s_DirName.substr(first+5, last-first-5);
260 
261  return s_Cut;
262 }
263 
264 
265 const Cut Helper::Sig_Cut(std::string s_Selection)
266 {
267  Cut cut_Temp = kNoCut;
268 
269  if(s_Selection=="numu2020"){
270  cut_Temp = kTrueNumuCC;
271  }
272  else if(s_Selection=="nue2020"){
273  cut_Temp = kTrueNueCC;
274  }
275  else{
276  specifyValid();
277  }
278 
279  const Cut Sig_Cut = cut_Temp;
280  return Sig_Cut;
281 }
282 
283 
284 std::vector<std::string> Helper::CutFlow(std::string const &s_Selection, bool useAnaTrueECut, bool getDetailed)
285 {
286  std::vector<std::string> vec_CutFlow;
287 
288  if(useAnaTrueECut){
289  if(s_Selection.find("numu2020")!=std::string::npos){
290  vec_CutFlow = {"over_fid_sig_ATE", "over_fid_sig_ATE_rec", "over_fid_sig_ATE_rec_qual", "over_fid_sig_ATE_rec_cont_qual", "over_fid_sig_ATE_rec_sel"};
291  }
292  else if(s_Selection.find("nue2020")!=std::string::npos){
293  vec_CutFlow = {"over_fid_sig_ATE", "over_fid_sig_ATE_rec", "over_fid_sig_ATE_rec_presel", "over_fid_sig_ATE_rec_sel"};
294  }
295  else{
296  specifyValid();
297  }
298  }
299  else{
300  if(s_Selection.find("numu2020")!=std::string::npos){
301  vec_CutFlow = {"over_fid_sig", "over_fid_sig_rec", "over_fid_sig_rec_qual", "over_fid_sig_rec_cont_qual", "over_fid_sig_rec_sel"};
302  }
303  else if(s_Selection.find("nue2020")!=std::string::npos){
304  vec_CutFlow = {"over_fid_sig", "over_fid_sig_rec", "over_fid_sig_rec_presel", "over_fid_sig_rec_sel"};
305  }
306  else{
307  specifyValid();
308  }
309  }
310 
311  if(getDetailed){
312  if(s_Selection.find("numu2020")!=std::string::npos){
313  std::cout << "THERE IS NO DETAILED NUMU BREAKDOWN" << std::endl;
314  }
315  else if(s_Selection.find("nue2020")!=std::string::npos){
316  if(!useAnaTrueECut) std::cout << "\n\nWARNING!!! DETAILED NUE BREAKDOWN ALWAYS IMPOSES THE TRUE E CUT.\n\n" << std::endl;
317 
318  std::vector<std::string> vec_AdditionalDetail = {"over_fid_sig_ATE_rec_presel_minus_fidana", "over_fid_sig_ATE_rec_presel_minus_cont", "over_fid_sig_ATE_rec_presel_minus_nhit", "over_fid_sig_ATE_rec_presel_minus_energy", "over_fid_sig_ATE_rec_presel_minus_prongl"};
319  for(auto addcut : vec_AdditionalDetail){
320  vec_CutFlow.insert(vec_CutFlow.end()-2, addcut);
321  }
322  }
323  else{
324  specifyValid();
325  }
326  }
327 
328  return vec_CutFlow;
329 }
330 
331 
333 {
334  NuTruthCut cut_Temp = kNoCut_NT;
335 
336  if(s_Selection=="numu2020"){
337  cut_Temp = kTrueNumuCC_Nu;
338  }
339  else if(s_Selection=="nue2020"){
340  cut_Temp = kTrueNueCC_Nu;
341  }
342  else{
343  specifyValid();
344  }
345 
346  const NuTruthCut Sig_NuCut = cut_Temp;
347  return Sig_NuCut;
348 }
349 
350 
352 {
353  Cut cut_Temp = kNoCut;
354 
355  if(s_Selection=="numu2020"){
356  cut_Temp = kNumuQuality;
357  }
358  else{
359  specifyValid();
360  }
361 
362  const Cut Quality_Cut = cut_Temp;
363  return Quality_Cut;
364 }
365 
366 
368 {
369  Cut cut_Temp = kNoCut;
370 
371  if(s_Selection=="numu2020"){
372  cut_Temp = kNumuContainND2020;
373  }
374  else{
375  specifyValid();
376  }
377 
378  const Cut Containment_Cut = cut_Temp;
379  return Containment_Cut;
380 }
381 
382 
384 {
385  Cut cut_Temp = kNoCut;
386 
387  if(s_Selection=="nue2020"){
388  cut_Temp = kNue2020NDPresel;
389  }
390  else{
391  specifyValid();
392  }
393 
394  const Cut Containment_Cut = cut_Temp;
395  return Containment_Cut;
396 }
397 
398 
400 {
401  Cut cut_Temp = kNoCut;
402 
403  if(s_Selection=="numu2020"){
404  cut_Temp = kNumu2020ND;
405  }
406  else if(s_Selection=="nue2020"){
407  cut_Temp = kNue2020ND;
408  }
409  else{
410  specifyValid();
411  }
412 
413  const Cut Selection_Cut = cut_Temp;
414  return Selection_Cut;
415 }
416 
417 
419 {
420  if((s_Var.find("kSpillCount")!=std::string::npos) || (s_Var.find("kSliceCount")!=std::string::npos)) return Binning::Simple(1, -0.5, 0.5);
421  if( s_Var.find("kPOTWeight")!=std::string::npos) return Binning::Simple(fNbins, 0., 2);
422  if((s_Var.find("kSpillPOT")!=std::string::npos) || (s_Var.find("kSpillPOT_Sp")!=std::string::npos))
423  {
424  return Binning::Simple(fNbins, 10.e12, 70.e12);
425  }
426  if( s_Var.find("kCCElong")!=std::string::npos) return Binning::Simple(fNbins, 0, 25.);
427  if( s_Var.find("kCCE")!=std::string::npos) return Binning::Simple(fNbins, 0, 5. );
428  if( s_Var.find("kMuE")!=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
429  if( s_Var.find("kHadEFrac")!=std::string::npos) return Binning::Simple(fNbins, 0, 1. );
430  if( s_Var.find("kHadE")!=std::string::npos) return Binning::Simple(fNbins, 0, 3. );
431  if( s_Var.find("kCaloE")!=std::string::npos) return Binning::Simple(fNbins, 0, 5. );
432  if( s_Var.find("kNHit")!=std::string::npos) return Binning::Simple(fNbins, 0, 300.);
433 
434  if( s_Var.find("kNueEnergy2020") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
435  if( s_Var.find("kNueElectronE2020") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
436  if( s_Var.find("kHADE2020") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
437  if( s_Var.find("kLongestProng") !=std::string::npos) return Binning::Simple(fNbins, 0, 800.);
438 
439  if( s_Var.find("kSlcMeanTime") !=std::string::npos ||
440  s_Var.find("kSlcStartTime") !=std::string::npos ||
441  s_Var.find("kSlcEndTime" ) !=std::string::npos) return Binning::Simple(fNbins, 216, 231);
442  if( s_Var.find("kSliceDuration")!=std::string::npos) return Binning::Simple(fNbins, 0, 250);
443  if( s_Var.find("kSlcNoiseFrac") !=std::string::npos) return Binning::Simple(fNbins, 0, 1 );
444  if( s_Var.find("kSlcEff") !=std::string::npos) return Binning::Simple(fNbins, 0, 1 );
445 
446  if( s_Var.find("kRun") !=std::string::npos) return Binning::Simple(fNbins, 10377, 13509);
447  if( s_Var.find("kSubRun")!=std::string::npos) return Binning::Simple(25, -0.5, 24.5 );
448  if( s_Var.find("kEvt") !=std::string::npos) return Binning::Simple(2601, -0.5, 2600.5);
449  if( s_Var.find("kSlc") !=std::string::npos) return Binning::Simple(fNbins, 0, 20);
450 
451  if(s_Var.find("kTrueLepE") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
452  if(s_Var.find("kTrueQ2") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
453  if(s_Var.find("kTrueW2") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
454  if(s_Var.find("kTrueXbj") !=std::string::npos) return Binning::Simple(fNbins, 0, 1);
455  if(s_Var.find("kTrueYbj") !=std::string::npos) return Binning::Simple(fNbins, 0, 1);
456  if(s_Var.find("kOTrueVtxX")!=std::string::npos) return Binning::Simple(fNbins, -220, 220);
457  if(s_Var.find("kOTrueVtxY")!=std::string::npos) return Binning::Simple(fNbins, -220, 220);
458  if(s_Var.find("kOTrueVtxZ")!=std::string::npos) return Binning::Simple(fNbins, -50, 1500);
459  if(s_Var.find("kMode") !=std::string::npos) return Binning::Simple(11, -0.5, 10.5);
460  if(s_Var.find("kIsCC") !=std::string::npos) return Binning::Simple(2, -0.5, 1.5);
461  if(s_Var.find("kTrueElong")!=std::string::npos) return Binning::Simple(fNbins, 0, 25.);
462  //if(s_Var.find("kTrueEben") !=std::string::npos) return Binning::Simple(fNbins, 0, 4.5);
463  if(s_Var.find("kTrueEben") !=std::string::npos) return Binning::Simple(fNbins, 0, 6.0);
464  //if(s_Var.find("kTrueE") !=std::string::npos) return Binning::Simple(fNbins, 0, 5.);
465  if(s_Var.find("kTrueE") !=std::string::npos) return Binning::Simple(fNbins, 0, 7.);
466  if(s_Var.find("kPDG") !=std::string::npos) return Binning::Simple(41, -20.5, 20.5);
467 
468  return Binning::Simple(fNbins, -100, 100);
469 }
470 
471 
473 {
474  if(s_Var=="kSliceCount") return "Number of Slices";
475  if(s_Var=="kPOTWeight") return "Weight";
476  if(s_Var=="kSpillPOT") return "POT/Spill #times10^{12}";
477  if(s_Var=="kTrueLepE") return "True Primary Lepton Energy, (GeV)";
478  if(s_Var=="kTrueQ2") return "True Q^{2}";
479  if(s_Var=="kTrueW2") return "True W^{2}";
480  if(s_Var=="kTrueXbj") return "True Bjorken X";
481  if(s_Var=="kTrueYbj") return "True Bjorken Y";
482  if(s_Var=="kOTrueVtxX") return "True Vertex X, (cm)";
483  if(s_Var=="kOTrueVtxY") return "True Vertex Y, (cm)";
484  if(s_Var=="kOTrueVtxZ") return "True Vertex Z, (cm)";
485  if(s_Var=="kMode") return "Interaction Mode";
486  if(s_Var=="kIsCC") return "Is CC";
487  if(s_Var=="kPDG") return "Particle PDG Code. [NT]";
488  if(s_Var=="kTrueE") return "True Neutrino Energy, (GeV)";
489  if(s_Var=="kTrueEben") return "True Neutrino Energy, (GeV)";
490  if(s_Var=="kTrueElong") return "True Neutrino Energy, (GeV)";
491  if(s_Var=="kTrueElong_ben") return "True Neutrino Energy, (GeV)";
492 
493  if( s_Var=="kNHit") return "Number of Hits";
494  if( s_Var=="kNueEnergy2020") return "Reconstructed Neutrino Energy, (GeV)";
495  if( s_Var=="kNueElectronE2020") return "Electron Energy, (GeV)";
496  if( s_Var=="kHADE2020") return "Hadronic Energy, (GeV)";
497  if( s_Var=="kLongestProng") return "Longest Prong Length, (cm)";
498 
499  if(s_Var=="kSlcNoiseFrac") return "Slice Noise Fraction?";
500  if(s_Var=="kSlcNoiseFracN") return "Slice Noise Fraction Hits?";
501  if(s_Var=="kSlcNoiseFracPE") return "Slice Noise Fraction PE?";
502 
503  if(s_Var=="kCCE") return "Reconstructed Neutrino Energy, (GeV)";
504  if(s_Var=="kCCElong") return "Reconstructed Neutrino Energy, (GeV)";
505  if(s_Var=="kMuE") return "Reconstructed Muon Energy, (GeV)";
506  if(s_Var=="kHadE") return "Reconstructed Hadronic Energy, (GeV)";
507  if(s_Var=="kHadEFrac") return "Reconstructed Hadronic Energy Fraction, (GeV)";
508  if(s_Var=="kCaloE") return "Calorimetric Energy, (GeV)";
509 
510  if(s_Var=="kSlcMeanTime") return "Slice Mean Time (#mus)";
511  if(s_Var=="kSlcStartTime") return "Slice Start Time (#mus)";
512  if(s_Var=="kSlcEndTime") return "Slice End Time (#mus)";
513  if(s_Var=="kSliceDuration") return "Slice Duration (#mus)";
514  if(s_Var=="kSlcEff") return "Slice Efficiency";
515 
516  if(s_Var=="kRun") return "Run Number";
517  if(s_Var=="kEvt") return "Event Number";
518  if(s_Var=="kSlc") return "Slice Number";
519 
520 
521  if(s_Var=="kTrueLepE_Nu") return "True Primary Lepton Energy, (GeV). [NT]";
522  if(s_Var=="kTrueQ2_Nu") return "True Q^{2}. [NT]";
523  if(s_Var=="kTrueW2_Nu") return "True W^{2}. [NT]";
524  if(s_Var=="kTrueXbj_Nu") return "True Bjorken X. [NT]";
525  if(s_Var=="kTrueYbj_Nu") return "True Bjorken Y. [NT]";
526  if(s_Var=="kOTrueVtxX_Nu") return "True Vertex X, (cm). [NT]";
527  if(s_Var=="kOTrueVtxY_Nu") return "True Vertex Y, (cm). [NT]";
528  if(s_Var=="kOTrueVtxZ_Nu") return "True Vertex Z, (cm). [NT]";
529  if(s_Var=="kMode_Nu") return "Interaction Mode. [NT]";
530  if(s_Var=="kIsCC_Nu") return "Is CC. [NT]";
531  if(s_Var=="kTrueE_Nu") return "True Neutrino Energy, (GeV). [NT]";
532  if(s_Var=="kTrueEben_Nu") return "True Neutrino Energy, (GeV). [NT]";
533  if(s_Var=="kTrueElong_Nu") return "True Neutrino Energy, (GeV). [NT]";
534  if(s_Var=="kPDG_Nu") return "Particle PDG Code. [NT]";
535  if(s_Var=="kSpillPOTInNuTruth_Nu") return "POT/Spill #times10^{12}. [NT]";
536 
537  if(s_Var=="kSpillPOT_Sp") return "POT/Spill #times10^{12}. [ST]";
538  if(s_Var=="kSpillPOTRatioWeight_Sp") return "Weight. [ST]";
539  if(s_Var=="kSpillCount_Sp") return "Number of Spills";
540  if(s_Var=="kSpillPOTNSC_Sp") return "POT/Spill #times10^{12}. [ST]";
541  if(s_Var=="kSpillPOTRatioWeightNSC_Sp") return "Weight. [ST]";
542  if(s_Var=="kSpillCountNSC_Sp") return "Number of Spills";
543 
544  return "Unrecognised Var!";
545 }
546 
547 
549 {
550  std::string s_NiceLabl = "";
551 
552  if((s_Cut=="over_fid_sig") || (s_Cut=="over_fid_sig_ATE")){
553  s_NiceLabl = "Overlaid";
554  }
555  else if((s_Cut=="over_fid_sig_rec") || (s_Cut=="over_fid_sig_ATE_rec")){
556  s_NiceLabl = "Sliced";
557  }
558  else if((s_Cut=="over_fid_sig_rec_qual") || (s_Cut=="over_fid_sig_ATE_rec_qual")){
559  s_NiceLabl = "Quality";
560  }
561  else if((s_Cut=="over_fid_sig_rec_cont_qual") || (s_Cut=="over_fid_sig_ATE_rec_cont_qual")){
562  s_NiceLabl = "Quality \\& Containment";
563  }
564  else if((s_Cut=="over_fid_sig_rec_presel") || (s_Cut=="over_fid_sig_ATE_rec_presel")){
565  s_NiceLabl = "Pre-selected";
566  }
567  else if((s_Cut=="over_fid_sig_rec_sel") || (s_Cut=="over_fid_sig_ATE_rec_sel")){
568  s_NiceLabl = "Selected";
569  }
570  else if((s_Cut=="special_fid_sig")){
571  s_NiceLabl = "No Cut";
572  }
573  else{
574  s_NiceLabl = s_Cut;
575  if(s_Cut.find("_")!=std::string::npos){
576  std::vector<std::string> vec_StrParts;
577  int start;
578  int end = 0;
579  while((start = s_NiceLabl.find_first_not_of("_", end)) != (signed int)std::string::npos){
580  end = s_NiceLabl.find("_", start);
581  vec_StrParts.push_back(s_NiceLabl.substr(start, end - start));
582  }
583  s_NiceLabl = "\\footnotesize ";
584  for(unsigned int part = vec_StrParts.size()-3; part < vec_StrParts.size(); part++){
585  s_NiceLabl += vec_StrParts.at(part);
586  if(part != vec_StrParts.size()-1){
587  s_NiceLabl += "\\_";
588  }
589  }
590  }
591  }
592 
593  return s_NiceLabl;
594 }
595 
596 
597 void furtherBENBreakdown(std::map<std::string,const Cut> &map_Cuts, Cut kBaseCut)
598 {
599  std::map<std::string,const Cut> map_FurtherBenBreakdown;
600  /*map_FurtherBenBreakdown.emplace("over_fid_sig_ATE_rec_presel_minus_recoqual",
601  kNue2020NDFiducial && kNue2020NDContain && kNue2020NDNHits && kNue2020NDEnergy && kNue2020NDProngLength);*/
602  map_FurtherBenBreakdown.emplace("over_fid_sig_ATE_rec_presel_minus_fidana",
604  map_FurtherBenBreakdown.emplace("over_fid_sig_ATE_rec_presel_minus_cont",
606  map_FurtherBenBreakdown.emplace("over_fid_sig_ATE_rec_presel_minus_nhit",
608  map_FurtherBenBreakdown.emplace("over_fid_sig_ATE_rec_presel_minus_energy",
610  map_FurtherBenBreakdown.emplace("over_fid_sig_ATE_rec_presel_minus_prongl",
612 
613  for(auto furthercut : map_FurtherBenBreakdown){
614  Cut kFurtherCut = furthercut.second;
615  const Cut kThisCut = kBaseCut && kFurtherCut;
616  map_Cuts.emplace(furthercut.first, kThisCut);
617  }
618 
619  return;
620 }
621 
622 
624 {
625  std::cout << "\nPLEASE SPECIFY A VALID SELECTION\n" << std::endl;
626  std::abort();
627 
628  return;
629 }
const NuTruthCut kTrueNueCC_Nu([](const caf::SRNeutrinoProxy *truth){return( truth->iscc && abs(truth->pdg)==12 );})
Definition: OverlayCuts.h:25
Preselection Object.
Definition: FillPIDs.h:20
std::vector< std::string > CutFlow(std::string const &s_Selection, bool useAnaTrueECut, bool getDetailed)
Definition: Helper.h:284
unsigned int fNbins
Definition: Helper.h:37
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 Containment_Cut(std::string s_Selection)
Definition: Helper.h:367
const Cut Sig_Cut(std::string s_Selection)
Definition: Helper.h:265
std::string Def(std::string const &s_Sample, std::string const &s_Condition)
Definition: Helper.h:48
const Cut kNue2020NDNHits
Definition: NueCuts2020.h:160
const NuTruthCut Sig_NuCut(std::string s_Selection)
Definition: Helper.h:332
const Cut kNumu2020ND
Definition: NumuCuts2020.h:57
const NuTruthCut kNoCut_NT([](const caf::SRNeutrinoProxy *nu){return true;})
Definition: OverlayCuts.h:7
std::vector< TLine * > PlotSpecial(TString const &s_Obj, std::string const &s_Selection, double const &yMin, double const &yMax, bool loosePresel)
Definition: Helper.h:141
const Cut kNue2020ND
Definition: NueCuts2020.h:178
const NuTruthCut kTrueNumuCC_Nu([](const caf::SRNeutrinoProxy *truth){return( truth->iscc && abs(truth->pdg)==14 );})
Definition: OverlayCuts.h:22
std::string getNiceCutLabel(std::string const &s_Cut)
Definition: Helper.h:548
TString part[npart]
Definition: Style.C:32
const Cut kTrueNueCC
Definition: OverlayCuts.cxx:74
const Cut Quality_Cut(std::string s_Selection)
Definition: Helper.h:351
const Cut kNue2020NDContain([](const caf::SRProxy *sr){for(unsigned int ix=0;ix< sr->vtx.elastic.fuzzyk.nshwlid;++ix){const caf::SRVector3DProxy &start=sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;const caf::SRVector3DProxy &stop=sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;if(std::min(start.X(), stop.X())< -150.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()) > 150.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;}if(sr->sel.contain.nplanestofront< 10) return false;return true;})
Definition: NueCuts2020.h:167
const Cut kNue2020NDPresel
Definition: NueCuts2020.h:169
const Cut kNue2020NDProngLength
Definition: NueCuts2020.h:162
std::string VarLabel(std::string s_DirName, bool isNice)
Definition: Helper.h:222
const Binning Bins(std::string s_Var)
Definition: Helper.h:418
OStream cout
Definition: OStream.cxx:6
const Cut kNue2020NDEnergy
Definition: NueCuts2020.h:161
const Cut kNue2020RecoQuality([](const caf::SRProxy *sr){if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(!sr->vtx.elastic.IsValid) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return true;})
Definition: NueCuts2020.h:16
bool IsSpecial(TString const &s_Obj)
Definition: Helper.h:128
enum BeamMode kViolet
const Cut kNue2020NDFiducial([](const caf::SRProxy *sr){assert(sr->vtx.elastic.IsValid &&"Must apply DQ cuts");if(sr->vtx.elastic.vtx.X()< -100.0) return false;if(sr->vtx.elastic.vtx.X() > 160.0) return false;if(sr->vtx.elastic.vtx.Y()< -160.0) return false;if(sr->vtx.elastic.vtx.Y() > 100.0) return false;if(sr->vtx.elastic.vtx.Z()< 150.0) return false;if(sr->vtx.elastic.vtx.Z() > 900.0) return false;return true;})
Definition: NueCuts2020.h:166
const Cut Presel_Cut(std::string s_Selection)
Definition: Helper.h:383
const Cut kTrueNumuCC
Definition: OverlayCuts.cxx:65
void furtherBENBreakdown(std::map< std::string, const Cut > &map_Cuts, Cut kBaseCut)
Definition: Helper.h:597
Definition: Helper.h:14
void specifyValid()
Definition: Helper.h:623
const Cut kNumuQuality
Definition: NumuCuts.h:18
std::string CutLabel(std::string s_DirName)
Definition: Helper.h:246
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Cut kNumuContainND2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;++i){const caf::SRVector3DProxy &start=sr->vtx.elastic.fuzzyk.png[i].shwlid.start;const caf::SRVector3DProxy &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())< 40.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: NumuCuts2020.h:31
const Cut kNoCut
The simplest possible cut: pass everything, used as a default.
Definition: Cut.h:109
std::string getNiceLabel(std::string s_Var)
Definition: Helper.h:472
const Cut Selection_Cut(std::string s_Selection)
Definition: Helper.h:399
enum BeamMode string