NueCCIncVars.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/Var.h"
4 #include "CAFAna/Core/Cut.h"
5 #include "CAFAna/Core/HistAxis.h"
8 #include "Utilities/func/MathUtil.h"
9 
10 #include "3FlavorAna/Cuts/NueCutsSecondAna.h"
11 #include "CAFAna/Cuts/SpillCuts.h"
12 
15 
19 
22 
23 #include "TMath.h"
24 #include "TVector3.h"
25 
26 #include "TFile.h"
27 namespace ana
28 {
29  namespace nueccinc
30  {
31  ////////////////////////////////////////////////////////////////////
32  ////////////////////////////////////////////////////////////////////
33  //Analysis Variables CVN Event ID
34  ////////////////////////////////////////////////////////////////////
35  ////////////////////////////////////////////////////////////////////
36 
37  const Var kvCVN([](const caf::SRProxy* sr){
38  return (sr->sel.cvn.nueid);
39  });
40 
41  const Var kvCVN2017([](const caf::SRProxy* sr){
42  return (sr->sel.cvn2017.nueid);
43  });
44 
45  const Var kvRecoE = kNueEnergy2017; //3A reco Energy
46 
47  const Var kvRecoCos([](const caf::SRProxy* sr)->float
48  {
49  if (sr->vtx.nelastic < 1) return -1000.f;
50  if (sr->vtx.elastic[0].fuzzyk.npng < 1)
51  return -1000.f;
52 
53  TVector3 elecdir =
54  (TVector3) sr->vtx.elastic[0].fuzzyk.png[0].dir;
55  TVector3 beamdir =
57  return elecdir.Dot(beamdir);
58  });
59 
60  const Var kvRecoTheta([](const caf::SRProxy* sr)->float
61  {
62  if (sr->vtx.nelastic < 1) return -1000.f;
63  if (sr->vtx.elastic[0].fuzzyk.npng < 1)
64  return -1000.f;
65 
66  TVector3 elecdir =
67  (TVector3) sr->vtx.elastic[0].fuzzyk.png[0].dir;
68  TVector3 beamdir =
70  float theta = elecdir.Angle(beamdir);
71  return theta;
72  });
73 
74  const Var kThetaSystShift = Constant(0.0025);
77 
78  const Var kvRecoCosthetaUp([](const caf::SRProxy* sr)
79  {
80  return (float)std::cos(kvRecoThetaUp(sr));
81  });
82 
83  const Var kvRecoCosthetaDw([](const caf::SRProxy* sr)
84  {
85  return (float)std::cos(kvRecoThetaDw(sr));
86  });
87 
88 
89  //Electron Energy w/ Bias Correction
90  const Var kvElecE([](const caf::SRProxy* sr) ->float
91  {
92  double p0 = -0.10588;
93  double p1 = 0.57885;
94  double p2 = -0.408767;
95  double p3 = 0.153795;
96  double p4 = -0.0270565;
97  double p5 = 0.00171687;
98 
99  float energy = -1000.f;
100  if (sr->vtx.nelastic < 1) return -1000.f;
101  if (sr->vtx.elastic[0].fuzzyk.npng < 1) return -1000.f;
102  float x =
103  (sr->vtx.elastic[0].fuzzyk.png[0].shwlid.shwE);
104 
105  if(x < 0) return 0.0f;
106 
107  if(x <= 6)
108  energy = x - (p0 + x*p1 + p2*pow(x,2) +
109  p3*pow(x,3) + p4*pow(x,4) +
110  p5*pow(x,5));
111  else energy = x;
112 
113  if(energy < 0) energy = x;
114 
115  return energy;
116  });
117 
118  const ana::Var kRecoQ2
119  ([] (const caf::SRProxy * sr)
120  {
121  const double M_e_sqrd = util::sqr(0.000511); //(0.511MeV)
122  double E_e = ana::nueccinc::kvElecE(sr);
123  double E_nu= ana::nueccinc::kvRecoE(sr);
124  double cos_e = ana::nueccinc::kvRecoCos(sr);
125  double p_e = sqrt(util::sqr(E_e) - M_e_sqrd);
126  return 2 * E_nu * (E_e - p_e * cos_e) - M_e_sqrd;
127  });
128 
130  costhetabins,
131  kvElecE,
132  eelecbins);
134  costhetabins,
135  kvElecE,
136  eelecbins);
138  costhetabins,
139  kvElecE,
140  eelecbins);
141 
143  costhetabins,
144  kvElecE,
145  eelecbins,
146  kvRecoE,
147  enubins);
148 
149 
150  ////////////////////////////////////////////////////////////////////
151  ////////////////////////////////////////////////////////////////////
152  //Prong CVN stuff
153  ////////////////////////////////////////////////////////////////////
154  ////////////////////////////////////////////////////////////////////
155 
156  const Var kvProngCVN([](const caf::SRProxy* sr){
157  if (sr->vtx.nelastic < 1) return -1000.f;
158  if (sr->vtx.elastic[0].fuzzyk.npng < 1) return -1000.f;
159 
160  int nProngs = sr->vtx.elastic[0].fuzzyk.npng;
161  float maxProngCVNe = -5.;
162  for(int iProng = 0; iProng < nProngs; iProng++){
163  if(sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart.electronid >
164  maxProngCVNe) {
165  maxProngCVNe =
166  sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart.electronid;
167  }
168  }
169  return maxProngCVNe;
170  });
171 
172  const Var kflatfluxCVNe([](const caf::SRProxy* sr){
173  if (sr->vtx.nelastic < 1) return -1000.f;
174  if (sr->vtx.elastic[0].fuzzyk.npng < 1) return -1000.f;
175 
176  int nProngs = sr->vtx.elastic[0].fuzzyk.npng;
177  float maxProngCVNe = -5.;
178  for(int iProng = 0; iProng < nProngs; iProng++){
179  if(sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid > maxProngCVNe) {
180  maxProngCVNe =
181  sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid;
182  }
183  }
184  return maxProngCVNe;
185  });
186 
187  const Var kflatfluxCVNem([](const caf::SRProxy* sr){
188  if (sr->vtx.nelastic < 1) return -1000.f;
189  if (sr->vtx.elastic[0].fuzzyk.npng < 1) return -1000.f;
190 
191  int nProngs = sr->vtx.elastic[0].fuzzyk.npng;
192  float maxProngCVNe = -5.;
193  for(int iProng = 0; iProng < nProngs; iProng++){
194  if(sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid +
195  sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.photonid >
196  maxProngCVNe) {
197  maxProngCVNe =
198  sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid +
199  sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.photonid;
200  }
201  }
202  return maxProngCVNe;
203  });
204 
205 
206  ////////////////////////////////////////////////////////////////////
207  ////////////////////////////////////////////////////////////////////
208  //LID Event Selection
209  ////////////////////////////////////////////////////////////////////
210  ////////////////////////////////////////////////////////////////////
211  const Var kvLID([](const caf::SRProxy* sr){
212  return sr->sel.lid.ann;
213  });
216 
217  ////////////////////////////////////////////////////////////////////
218  ////////////////////////////////////////////////////////////////////
219  //MC Truth Variables
220  ////////////////////////////////////////////////////////////////////
221  ////////////////////////////////////////////////////////////////////
222  const NuTruthVar kTrueElecEST([](const caf::SRNeutrinoProxy* nu)
223  {
224  float ee = -5;
225 
226  if(abs(nu->pdg) != 12 ||
227  !nu->iscc)
228  return ee;
229 
230  int nprims = nu->prim.size();
231  for(int iprim = 0; iprim < nprims; iprim++){
232  if(abs(nu->prim[iprim].pdg) == 11
233  || abs(nu->prim[iprim].pdg) == 13){
234  double E= nu->prim[iprim].p.E;
235  ee = E;
236  }
237  }//end loop over primaries
238 
239  return ee;
240  });
241 
242  const NuTruthVar kTrueEST([](const caf::SRNeutrinoProxy* nu)->float
243  {
244  float ee = -5;
245  if(abs(nu->pdg) != 12 ||
246  !nu->iscc)
247  return ee;
248  return (float)nu->E;
249  });
250 
252  {
253 
254  if(abs(nu->pdg) != 12 ||
255  !nu->iscc)
256  return -5.0;
257  int nprims = nu->prim.size();
258  for(int iprim = 0; iprim < nprims; iprim++){
259  if(abs(nu->prim[iprim].pdg) == 11 ||
260  abs(nu->prim[iprim].pdg) == 13){
261 
262  TVector3 edir = nu->prim[iprim].p.Vect();
263  TVector3 beamdir = NuMIBeamDirection(caf::kNEARDET);
264 
265  return edir.Unit().Dot(beamdir.Unit());
266 
267  }
268  }
269  return -5.0;
270  });
271 
272  // True hadronic y
273  const NuTruthVar kTrueYST([](const caf::SRNeutrinoProxy* sr)
274  {
275  return float(sr->y);
276  });
277  // True hadronic energy
278  const NuTruthVar kTrueHadEST([](const caf::SRNeutrinoProxy* sr)
279  {
280  return float(sr->y * sr->E);
281  });
282 
283  //True W
285  ([](const caf::SRNeutrinoProxy * nu)
286  {
287  // some events don't have W set?
288  if (std::isnan(1.*nu->W2))
289  return -5.f;
290  return float(sqrt(nu->W2));
291  });
292 
293  //True Q2
294  const NuTruthVar kTrueQ2NT
295  ([] (const caf::SRNeutrinoProxy *nu)
296  {
297  return nu->q2;
298  });
299 
300 
301 
302 
303 
305  {
306 
307  if(abs(nu->pdg) != 12 ||
308  !nu->iscc)
309  return -5.0;
310  int nprims = nu->prim.size();
311  for(int iprim = 0; iprim < nprims; iprim++){
312  if(abs(nu->prim[iprim].pdg) == 11){
313 
314  TVector3 edir = nu->prim[iprim].p.Vect();
315  TVector3 beamdir = NuMIBeamDirection(caf::kNEARDET);
316 
317  float theta = edir.Unit().Dot(beamdir.Unit());
318  return (float)TMath::ACos(theta)*180/TMath::Pi();
319  }
320  }
321  return -5.0;
322  });
323 
324  const Var kTrueElecE = VarFromSpillTruthVar(kTrueElecEST);
325  const Var kTrueNuE = VarFromSpillTruthVar(kTrueEST);
326  const Var kTrueElecCostheta = VarFromSpillTruthVar(kTrueElecCosthetaST);
327  const Var kTrueElecTheta = VarFromSpillTruthVar(kTrueElecThetaST);
328 
330  costhetabins,
331  kTrueElecEST,
332  eelecbins);
333 
334  const Var kTrueElecEVsCos = VarFromNuTruthVar(kTrueElecEVsCosST);
335 
337  costhetabins,
338  kTrueElecEST,
339  eelecbins,
340  kTrueEST,
341  enubins);
342 
343  ////////////////////////////////////////////////////////////////////
344  ////////////////////////////////////////////////////////////////////
345  //Resolution Variables
346  ////////////////////////////////////////////////////////////////////
347  ////////////////////////////////////////////////////////////////////
348  const Var kFracResE = (kvRecoE - kTrueNuE)/kTrueNuE;
350  (kvRecoCos - kTrueElecCostheta)/kTrueElecCostheta;
352  (kvElecE - kTrueElecE)/kTrueElecE;
353  const Var kFracResTheta = (kvRecoTheta - kTrueElecTheta)/kTrueElecTheta;
354 
355 
356  const Var kAbsResE = (kvRecoE - kTrueNuE);
360 
361 
362  ////////////////////////////////////////////////////////////////////
363  ////////////////////////////////////////////////////////////////////
364  //Defining Hist Axis
365  ////////////////////////////////////////////////////////////////////
366  ////////////////////////////////////////////////////////////////////
368  {
371  };
372 
374  {
377  };
378 
379  const int kvAllVars = 33;
380  const int kvResolutionVars = 12;
381  const int kvAnalysisVars = 6;
382  const int kvAnalysisVarsST = 6+3;
383  const int kvNumTruthVarsST = 6;
384 
386  {"cvne", {"CVNe", Binning::Simple(40,0,1), kvCVN2017}},
387  {"remid",{"ReMID", Binning::Simple(81,-1/160,1+1/160), kRemID}},
388  {"electronid", {"ElectronID", Binning::Simple(21,-0.7,0.7),
389  kElectronID}},
390  {"prong_cvn", {"Electron Prong Selector", Binning::Simple(40,0,1),
391  kvProngCVN}},
392  {"lid", {"LID", Binning::Simple(40,-0.1,1.1),kvLID}},
393  {"recoE_2017", {"E_{#nu} (GeV)", Binning::Simple(100,0,5), kvRecoE}},
394  {"costheta", {"cos #theta_{e}", Binning::Simple(25,0,1.01), kvRecoCos}},
395  {"electronE", {"E_{e} (GeV)", Binning::Simple(100,0,5), kvElecE}},
396  {"nhits", {"Number of Hits in Slice", Binning::Simple(50,0,250), kNHit}},
397  {"nshw", {"Number of Showers in Slice",
398  Binning::Simple(10,0,10), kNShwLID}},
399  {"shw_nhit",{"Number of hits in primary shower",
400  Binning::Simple(50,0,300), kShwNHit}},
401  {"shw_len", {"Length of primary shower (cm)",
402  Binning::Simple(50,0,500), kShwLen}},
403  {"shw_width", {"width of primary shower (cm)",
404  Binning::Simple(20,0,20), kShwWidth}},
405  {"shw_e", {"Primary shower calorimetric energy (GeV)",
406  Binning::Simple(50,0,5), kShwCalE}},
407  {"had_e", {"(Slice - Shower) calorimetric energy (GeV)",
408  Binning::Simple(50,0,5), kHadCalE}},
409  {"vtxx",{"Vertex X", Binning::Simple(50, -200, +200), kVtxX}},
410  {"vtxy", {"Vertex Y", Binning::Simple(50, -200, +200), kVtxY}},
411  {"vtxz", {"Vertex Z", Binning::Simple(40, 0, +800), kVtxZ}},
412  {"shwstartx", {"Shower X Start", Binning::Simple(50, -200, +200),
413  kShwStartX}},//20
414  {"shwstarty", {"Shower Y Start", Binning::Simple(50, -200, +200),
415  kShwStartY}},
416  {"shwstartz", {"Shower Z Start", Binning::Simple(50, 0, +1000),
417  kShwStartZ}},
418  {"shwstopx", {"Shower X Stop", Binning::Simple(50, -200, +200),
419  kShwStopX}},
420  {"shwstopy", {"Shower Y Stop", Binning::Simple(50, -200, +200),
421  kShwStopY}},
422  {"shwstopz", {"Shower Z Stop", Binning::Simple(70, 0, +1400),
423  kShwStopZ}},
424  {"theta", {"#theta_{#text{Beam}} #degree", Binning::Simple(90,0,180),
425  kvRecoTheta}},
426  {"recoE_ana_bin", {"E_{#nu} (GeV)", enubins, kvRecoE}},
427  {"costheta_ana_bin", {"cos #theta_{e}", costhetabins, kvRecoCos}},
428  {"electronE_ana_bin",{"E_{e} (GeV)", eelecbins, kvElecE}},
429  {"muonid", {"MuonID", Binning::Simple(100,-1,1), kMuonID}},
430  {"cvne2017", {"CVNe 2017", Binning::Simple(40,0,1), kvCVN2017}},
431  {"flatflux_e", {"Flat Flux Prong CVN Electron", Binning::Simple(40,0,1),
432  kflatfluxCVNe}},
433  {"flatflux_em", {"Flat Flux Prong CVN EM", Binning::Simple(40,0,1),
434  kflatfluxCVNem}},
435  {"double_diff", {"cos #theta_{e}", costhetabins, kvRecoCos,
436  "E_{e} (GeV)", eelecbins, kvElecE}},
437  };
438 
440  {"st_nu_e_ana_bin", {"True Neutrino Energy (GeV)",
441  enubins, kTrueEST}},
442  {"st_elec_e_ana_bin", {"True Electron Energy (GeV)",
444  {"st_costheta_e_ana_bin", {"True #cos #theta_{e}",
446  {"st_nu_e", {"True Neutrino Energy (GeV)",
447  Binning::Simple(100,0,10), kTrueEST}},
448  {"st_elec_e", {"True Electron Energy (GeV)",
449  Binning::Simple(100,0,10), kTrueElecEST}},
450  {"st_costheta_e", {"True #cos #theta_{e}",
451  Binning::Simple(25,0,1.01) , kTrueElecCosthetaST}},
452  };
453 
454 
456  {"recoE_2017", {"E_{#nu} (GeV)", Binning::Simple(100,0,10), kvRecoE}},
457  {"costheta", {"cos #theta_{e}", Binning::Simple(50,0,1.01), kvRecoCos}},
458  {"electronE", {"E_{e} (GeV)", Binning::Simple(100,0,10), kvElecE}},
459  {"true_E", {"True E_{#nu} (GeV)", Binning::Simple(100,0,10), kTrueNuE}},
460  {"true_costheta", {"True #cos #theta_{e}",
461  Binning::Simple(50,0,1.01), kTrueElecCostheta}},
462  {"true_electron_e", {"True Electron Energy (GeV)",
463  Binning::Simple(100,0,10), kTrueElecE}},
464  {"frac_res_e", {"Fractional Resolution Neutrino Energy",
465  Binning::Simple(100,-1,1), kFracResE}},
466  {"frac_res_cos", {"Fractional Resolution #cos #theta_{e}",
467  Binning::Simple(1000,-0.5,0.5), kFracResCosElec}},
468  {"frac_res_elec", {"Fractional Resolution Electron Energy",
469  Binning::Simple(100,-1,1), kFracResElecE}},
470  {"abs_res_e", {"Absolute Resolution Neutrino Energy",
471  Binning::Simple(100,-1,1), kAbsResE}},
472  {"abs_res_cos", {"Absolute Resolution #cos #theta_{e}",
473  Binning::Simple(1000,-0.5,0.5), kAbsResCosElec}},
474  {"abs_res_elec", {"Absolute Resolution Electron Energy",
475  Binning::Simple(100,-1,1), kAbsResElecE}},
476  };
477 
479  {"recoE_2017", {"E_{#nu} (GeV)", enubins, kvRecoE}},
480  {"costheta", {"cos #theta_{e}", costhetabins, kvRecoCos}},
481  {"electronE", {"E_{e} (GeV)", eelecbins, kvElecE}},
482  {"true_E", {"True E_{#nu} (GeV)", enubins, kTrueNuE}},
483  {"true_costheta", {"True cos #theta_{e}",
484  costhetabins, kTrueElecCostheta}},
485  {"true_electron_e", {"True Electron Energy (GeV)",
486  eelecbins, kTrueElecE}},
487  };
488 
490  {"st_nu_e", {"True Neutrino Energy (GeV)", enubins, kTrueEST}},
491  {"st_costheta_e", {"True cos #theta_{e}",
493  {"st_elec_e", {"True Electron Energy (GeV)",eelecbins, kTrueElecEST}},
494  {"st_double_diff", {"cos #theta_{e}", costhetabins, kTrueElecCosthetaST,
495  "Electron Energy (GeV)", eelecbins, kTrueElecEST}},
496  {"st_inelasticity", {"True Inelasticity", Binning::Simple(26,-0.02,1.02), kTrueYST}},
497  {"st_hadE", {"True Hadronic Energy (GeV)", Binning::Simple(20,0,3),kTrueHadEST}},
498  {"st_double_diff2", {"cos #theta_{e}", costhetabins, kTrueElecCosthetaST,
499  "Electron Energy (GeV)", eelecbins, kTrueElecEST}},
500  {"st_W", {"W (GeV)", Binning::Simple(25,0,4),
501  kTrueWNT}},
502  {"st_Q2", {"Q^{2} (GeV^{2})", q2bins,
503  kTrueQ2NT}},
504  };
505 
506 
507  const int kvAnalysisVariables = 4;
509  {"recoE_2017", {"E_{#nu} (GeV)", enubins, kvRecoE}},
510  {"costheta", {"cos #theta_{e}", costhetabins, kvRecoCos}},
511  {"electronE", {"E_{e} (GeV)", eelecbins, kvElecE}},
512  {"q2", {"Q^{2} (GeV^{2})", q2bins, kRecoQ2}},
513  };
514 
516  {"st_nu_e", {"True Neutrino Energy (GeV)", enubins, kTrueEST}},
517  {"st_costheta_e", {"True cos #theta_{e}",
519  {"st_elec_e", {"True Electron Energy (GeV)",eelecbins, kTrueElecEST}},
520  {"st_Q2", {"Q^{2} (GeV^{2})", q2bins,
521  kTrueQ2NT}},
522  };
523 
524 
525  //Multidimension Hist Axes
526  const HistAxis kRecoElecEVsCosStandardAxis("Reconstructed E_{e} vs cos #theta; Elec_{e} (GeV); cos #{theta}", double_diff_bins, kRecoElecEVsCos);
527 
528  const HistAxis kRecoElecEVsCosStandardAxisAngleUp("Reconstructed E_{e} vs cos #theta; Elec_{e} (GeV); cos #{theta}", double_diff_bins, kRecoElecEVsCosAngleUp);
529  const HistAxis kRecoElecEVsCosStandardAxisAngleDw("Reconstructed E_{e} vs cos #theta; Elec_{e} (GeV); cos #{theta}", double_diff_bins, kRecoElecEVsCosAngleDw);
530 
531  const NuTruthHistAxis kTrueElecEVsCosStandardAxisST("True E_{e} vs cos #theta;cs Elec_{e} (GeV); cos #{theta}", double_diff_bins, kTrueElecEVsCosST);
532 
534  HistAxisFromNuTruthHistAxis(kTrueElecEVsCosStandardAxisST);
535 
536  const NuTruthHistAxis kTrueElecEVsCosVsEnuStandardAxisST("True E_{e} vs cos #{theta} vs Neutrino Energy (GeV)", three_d_bins,kTrueElecEVsCosVsEnuST);
537 
540 
541  const HistAxis kRecoElecEVsCosVsEnuStandardAxis("Reco. E_{e} vs cos #{theta} vs Neutrino Energy (GeV)", three_d_bins,kRecoElecEVsCosVsEnu);
542 
543 
544  //PID Var Axis
545  const int kNumPIDVars = 1;
547  {"electronid", {"ElectronID", pidbins_electronid,kElectronID}},
548  //{"cvne2017", {"CVNe 2017", pidbins, kvCVN2017}},
549  //{"cvneProd3", {"CVNe Prod 3", pidbins, kcvnProd3}},
550  //{"lid", {"LID", pidbinslid, kvLID}},
551  //{"prongCVN", {"Electron Prong Selector", pidbins, kvProngCVN}},
552  //{"flatfluxCVN", {"Electron Prong Selector Flat Flux",
553  // pidbins, kflatfluxCVN}},
554  };
555  }//end of namespace nueccinc
556 } //end of namespace
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
Near Detector underground.
Definition: SREnums.h:10
const Var kShwNHit
const Binning enubins
Definition: NueCCIncBins.h:18
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const HistAxis kRecoElecEVsCosStandardAxisAngleUp("Reconstructed E_{e} vs cos #theta; Elec_{e} (GeV); cos #{theta}", double_diff_bins, kRecoElecEVsCosAngleUp)
const Var kvRecoThetaUp
Definition: NueCCIncVars.h:75
const mHistAxisDef analysis_vars[kvAnalysisVars]
Definition: NueCCIncVars.h:478
const int kvAllVars
Definition: NueCCIncVars.h:379
const int kvNumTruthVarsST
Definition: NueCCIncVars.h:383
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
const Var kAbsResTheta
Definition: NueCCIncVars.h:359
const mHistAxisDef analysis_vars_final[kvAnalysisVariables]
Definition: NueCCIncVars.h:508
const Var kShwStopX
const mHistAxisSTDef nu_truth_axis[kvNumTruthVarsST]
Definition: NueCCIncVars.h:439
const Var kShwCalE
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
T sqrt(T number)
Definition: d0nt_math.hpp:156
_Var< T > Var2D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb)
Variable formed from two input variables.
Definition: Var.cxx:247
constexpr T pow(T x)
Definition: pow.h:75
const mHistAxisSTDef analysis_vars_truth[kvAnalysisVarsST]
Definition: NueCCIncVars.h:489
const Var kAbsResElecE
Definition: NueCCIncVars.h:358
const Var kElectronID
const Var kShwStartY
const mHistAxisDef all_vars[kvAllVars]
Definition: NueCCIncVars.h:385
void abs(TH1 *hist)
const mHistAxisDef resolution_vars[kvResolutionVars]
Definition: NueCCIncVars.h:455
const NuTruthVar kTrueYST([](const caf::SRNeutrinoProxy *sr){return float(sr->y);})
const int kNumPIDVars
Definition: NueCCIncVars.h:545
const NuTruthVar kTrueElecCosthetaST([](const caf::SRNeutrinoProxy *nu){if(abs(nu->pdg)!=12|| !nu->iscc) return-5.0;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==11||abs(nu->prim[iprim].pdg)==13){TVector3 edir=nu->prim[iprim].p.Vect();TVector3 beamdir=NuMIBeamDirection(caf::kNEARDET);return edir.Unit().Dot(beamdir.Unit());}}return-5.0;})
const Var kTrueElecCostheta
Definition: NueCCIncVars.h:326
caf::Proxy< float > E
Definition: SRProxy.h:520
const Var kTrueElecEVsCos
Definition: NueCCIncVars.h:334
const Var kVtxX
const Var kThetaSystShift
Definition: NueCCIncVars.h:74
const Binning eelecbins
Definition: NueCCIncBins.h:23
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
const Var kRecoElecEVsCosVsEnu
Definition: NueCCIncVars.h:142
const Var kvLID([](const caf::SRProxy *sr){return sr->sel.lid.ann;})
const int kvAnalysisVarsST
Definition: NueCCIncVars.h:382
const Var kvRecoTheta([](const caf::SRProxy *sr) ->float{if(sr->vtx.nelastic< 1) return-1000.f;if(sr->vtx.elastic[0].fuzzyk.npng< 1) return-1000.f;TVector3 elecdir=(TVector3) sr->vtx.elastic[0].fuzzyk.png[0].dir;TVector3 beamdir=NuMIBeamDirection(caf::kNEARDET);float theta=elecdir.Angle(beamdir);return theta;})
const Var kHadCalE([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return float(sr->slc.calE);if(sr->vtx.elastic.fuzzyk.nshwlid< 1) return float(sr->slc.calE);return((sr->slc.calE- sr->vtx.elastic.fuzzyk.png[0].shwlid.calE));})
Definition: NueVarsExtra.h:40
const mHistAxisDef pid_vars[kNumPIDVars]
Definition: NueCCIncVars.h:546
_Var< T > Var3D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb, const _Var< T > &c, const Binning &binsc)
This is just like a Var2D, but useful for 3D Spectra.
Definition: Var.cxx:273
_Var< caf::SRProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
Definition: Var.h:74
Var Constant(double c)
Use to weight events up and down by some factor.
Definition: Var.cxx:313
const Var kvRecoCosthetaUp([](const caf::SRProxy *sr){return(float) std::cos(kvRecoThetaUp(sr));})
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
const Var kShwWidth
const int kvAnalysisVars
Definition: NueCCIncVars.h:381
const Var kvRecoThetaDw
Definition: NueCCIncVars.h:76
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
const Var kflatfluxCVNe([](const caf::SRProxy *sr){if(sr->vtx.nelastic< 1) return-1000.f;if(sr->vtx.elastic[0].fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic[0].fuzzyk.npng;float maxProngCVNe=-5.;for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid;}}return maxProngCVNe;})
const NuTruthVar kTrueElecEVsCosVsEnuST
Definition: NueCCIncVars.h:336
const Var kvCVN2017([](const caf::SRProxy *sr){return(sr->sel.cvn2017.nueid);})
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Var kTrueNuE
Definition: NueCCIncVars.h:325
const Var kMuonID
Definition: NDXSecMuonPID.h:32
const Var kShwStopY
const Var kNueEnergy2017([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;return NueRecoE_2017FDFit(kCVNemE(sr), kCVNhadE(sr));})
Definition: NueEnergy2017.h:11
const Var kShwStartX
if(dump)
const NuTruthVar kTrueElecEST([](const caf::SRNeutrinoProxy *nu){float ee=-5;if(abs(nu->pdg)!=12|| !nu->iscc) return ee;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==11||abs(nu->prim[iprim].pdg)==13){double E=nu->prim[iprim].p.E;ee=E;}}return ee;})
const Var kRemID
PID
Definition: Vars.cxx:81
const int kvResolutionVars
Definition: NueCCIncVars.h:380
Float_t E
Definition: plot.C:20
caf::Proxy< caf::SRCVNResult > cvn
Definition: SRProxy.h:1253
const HistAxis kRecoElecEVsCosVsEnuStandardAxis("Reco. E_{e} vs cos #{theta} vs Neutrino Energy (GeV)", three_d_bins, kRecoElecEVsCosVsEnu)
const NuTruthVar kTrueHadEST([](const caf::SRNeutrinoProxy *sr){return float(sr->y *sr->E);})
caf::Proxy< float > nueid
Definition: SRProxy.h:906
const Var kNHit
Definition: Vars.cxx:71
const Var kFracResE
Definition: NueCCIncVars.h:348
caf::Proxy< bool > iscc
Definition: SRProxy.h:538
double energy
Definition: plottest35.C:25
const Binning double_diff_bins
Definition: NueCCIncBins.h:63
const Var kvProngCVN([](const caf::SRProxy *sr){if(sr->vtx.nelastic< 1) return-1000.f;if(sr->vtx.elastic[0].fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic[0].fuzzyk.npng;float maxProngCVNe=-5.;for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart.electronid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart.electronid;}}return maxProngCVNe;})
const Var kvLID_ElectronE
Definition: NueCCIncVars.h:214
const Var kvCVN([](const caf::SRProxy *sr){return(sr->sel.cvn.nueid);})
caf::StandardRecord * sr
HistAxis HistAxisFromNuTruthHistAxis(NuTruthHistAxis ntha, double _default)
Definition: HistAxis.cxx:9
const Var kShwStopZ
const Binning costhetabins
Definition: NueCCIncBins.h:27
const Var kTrueElecTheta
Definition: NueCCIncVars.h:327
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_e_sqrd=util::sqr(0.000511);double E_e=ana::nueccinc::kvElecE(sr);double E_nu=ana::nueccinc::kvRecoE(sr);double cos_e=ana::nueccinc::kvRecoCos(sr);double p_e=sqrt(util::sqr(E_e)-M_e_sqrd);return 2 *E_nu *(E_e-p_e *cos_e)-M_e_sqrd;})
const HistAxis kTrueElecEVsCosStandardAxis
Definition: NueCCIncVars.h:533
caf::Proxy< float > y
Definition: SRProxy.h:577
const Var kAbsResCosElec
Definition: NueCCIncVars.h:357
const ana::NuTruthVar kTrueWNT([](const caf::SRNeutrinoProxy *nu){if(std::isnan(1.*nu->W2)) return-5.f;return float(sqrt(nu->W2));})
const Var kvRecoCos([](const caf::SRProxy *sr) ->float{if(sr->vtx.nelastic< 1) return-1000.f;if(sr->vtx.elastic[0].fuzzyk.npng< 1) return-1000.f;TVector3 elecdir=(TVector3) sr->vtx.elastic[0].fuzzyk.png[0].dir;TVector3 beamdir=NuMIBeamDirection(caf::kNEARDET);return elecdir.Dot(beamdir);})
const Var kRecoElecEVsCosAngleUp
Definition: NueCCIncVars.h:133
const Var kFracResElecE
Definition: NueCCIncVars.h:351
caf::Proxy< caf::SRELid > lid
Definition: SRProxy.h:1261
const HistAxis kRecoElecEVsCosStandardAxis("Reconstructed E_{e} vs cos #theta; Elec_{e} (GeV); cos #{theta}", double_diff_bins, kRecoElecEVsCos)
const NuTruthVar kTrueQ2NT([](const caf::SRNeutrinoProxy *nu){return nu->q2;})
caf::Proxy< float > ann
Definition: SRProxy.h:971
const Var kAbsResE
Definition: NueCCIncVars.h:356
const Var kvRecoE
Definition: NueCCIncVars.h:45
Var VarFromNuTruthVar(const NuTruthVar &stv, double _default)
Definition: Var.cxx:7
const Binning three_d_bins
Definition: NueCCIncBins.h:70
const Var kRecoElecEVsCos
Definition: NueCCIncVars.h:129
const Var kVtxY
const int kvAnalysisVariables
Definition: NueCCIncVars.h:507
const NuTruthHistAxis kTrueElecEVsCosVsEnuStandardAxisST("True E_{e} vs cos #{theta} vs Neutrino Energy (GeV)", three_d_bins, kTrueElecEVsCosVsEnuST)
const HistAxis kTrueElecEVsCosVsEnuStandardAxis
Definition: NueCCIncVars.h:538
const Var kvLID_CosElec
Definition: NueCCIncVars.h:215
const NuTruthVar kTrueElecThetaST([](const caf::SRNeutrinoProxy *nu){if(abs(nu->pdg)!=12|| !nu->iscc) return-5.0;int nprims=nu->prim.size();for(int iprim=0;iprim< nprims;iprim++){if(abs(nu->prim[iprim].pdg)==11){TVector3 edir=nu->prim[iprim].p.Vect();TVector3 beamdir=NuMIBeamDirection(caf::kNEARDET);float theta=edir.Unit().Dot(beamdir.Unit());return(float) TMath::ACos(theta)*180/TMath::Pi();}}return-5.0;})
const Var kVtxZ
T cos(T number)
Definition: d0nt_math.hpp:78
const Var kTrueElecE
Definition: NueCCIncVars.h:324
TVector3 NuMIBeamDirection(caf::Det_t det)
Average direction of NuMI neutrinos in a given detector This function is a copy of geo::GeometryBase:...
Definition: Utilities.cxx:329
const NuTruthVar kTrueElecEVsCosST
Definition: NueCCIncVars.h:329
caf::Proxy< float > q2
Definition: SRProxy.h:557
caf::Proxy< short int > pdg
Definition: SRProxy.h:552
caf::Proxy< float > W2
Definition: SRProxy.h:522
const Var kNShwLID([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return 0u;return(unsigned int) sr->vtx.elastic.fuzzyk.nshwlid;})
Definition: NueVarsExtra.h:108
caf::Proxy< caf::SRIDBranch > sel
Definition: SRProxy.h:2141
const NuTruthHistAxis kTrueElecEVsCosStandardAxisST("True E_{e} vs cos #theta;cs Elec_{e} (GeV); cos #{theta}", double_diff_bins, kTrueElecEVsCosST)
const Var kCosTheta
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
const mHistAxisSTDef analysis_vars_truth_final[kvAnalysisVariables]
Definition: NueCCIncVars.h:515
const Var kShwStartZ
const HistAxis kRecoElecEVsCosStandardAxisAngleDw("Reconstructed E_{e} vs cos #theta; Elec_{e} (GeV); cos #{theta}", double_diff_bins, kRecoElecEVsCosAngleDw)
const Var kShwLen
const NuTruthVar kTrueEST([](const caf::SRNeutrinoProxy *nu) ->float{float ee=-5;if(abs(nu->pdg)!=12|| !nu->iscc) return ee;return(float) nu->E;})
const Var kFracResCosElec
Definition: NueCCIncVars.h:349
const Var kflatfluxCVNem([](const caf::SRProxy *sr){if(sr->vtx.nelastic< 1) return-1000.f;if(sr->vtx.elastic[0].fuzzyk.npng< 1) return-1000.f;int nProngs=sr->vtx.elastic[0].fuzzyk.npng;float maxProngCVNe=-5.;for(int iProng=0;iProng< nProngs;iProng++){if(sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid+ sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.photonid > maxProngCVNe){maxProngCVNe=sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.electronid+sr->vtx.elastic[0].fuzzyk.png[iProng].cvnpart2FlatFluxBal.photonid;}}return maxProngCVNe;})
const Var kvElecE([](const caf::SRProxy *sr) ->float{double p0=-0.10588;double p1=0.57885;double p2=-0.408767;double p3=0.153795;double p4=-0.0270565;double p5=0.00171687;float energy=-1000.f;if(sr->vtx.nelastic< 1) return-1000.f;if(sr->vtx.elastic[0].fuzzyk.npng< 1) return-1000.f;float x=(sr->vtx.elastic[0].fuzzyk.png[0].shwlid.shwE);if(x< 0) return 0.0f;if(x<=6) energy=x-(p0+x *p1+p2 *pow(x, 2)+p3 *pow(x, 3)+p4 *pow(x, 4)+p5 *pow(x, 5));else energy=x;if(energy< 0) energy=x;return energy;})
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Definition: Binning.cxx:107
const Var kRecoElecEVsCosAngleDw
Definition: NueCCIncVars.h:137
const Var kvRecoCosthetaDw([](const caf::SRProxy *sr){return(float) std::cos(kvRecoThetaDw(sr));})
caf::Proxy< std::vector< caf::SRTrueParticle > > prim
Definition: SRProxy.h:555
const Binning q2bins
Definition: NueCCIncBins.h:32
const Var kFracResTheta
Definition: NueCCIncVars.h:353
const Binning pidbins_electronid
Definition: NueCCIncBins.h:55
enum BeamMode string