NueEnergy2018.cxx
Go to the documentation of this file.
2 
3 #include "CAFAna/Vars/Vars.h"
4 
6 
7 namespace ana
8 {
9 
10  double NueRecoE_2018RHCFit(double rawEM, double rawHA)
11  {
12  if(rawEM < 0. || rawHA < 0.) return -5.;
13  const double p0 = 0.0;
14  const double p1 = 0.980479;
15  const double p2 = 1.45170;
16  const double p3 = 0.0;
17  const double p4 = -5.82609e-03;
18  const double p5 = -2.27599e-01;
19  const double recoEn = 1./(1+0.001766)*(rawHA*rawHA*p5 + rawEM*rawEM*p4 + rawEM*rawHA*p3 + rawHA*p2 + rawEM*p1 + p0);
20  return recoEn;
21  }
22 
23  double NueRecoE_2018FHCFit(double rawEM, double rawHA)
24  {
25  if(rawEM < 0. || rawHA < 0.) return -5.;
26  const double p0 = 0.0;
27  const double p1 = 1.00756;
28  const double p2 = 1.07093;
29  const double p3 = 0.0;
30  const double p4 = 1.28608e-02;
31  const double p5 = 2.27129e-01;
32  const double recoEn = 1./(1+0.0501206)*(rawHA*rawHA*p5 + rawEM*rawEM*p4 + rawEM*rawHA*p3 + rawHA*p2 + rawEM*p1 + p0);
33  return recoEn;
34  }
35 
36 
37 
38  const Var kFHCEME([](const caf::SRProxy* sr)
39  {
40  if(!sr->vtx.elastic.IsValid) return -1.0;
41  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
42  double CVNem_CalE = 0.0;
43  const caf::SRFuzzyKProngProxy& prim_png = sr->vtx.elastic.fuzzyk.png[0];
44  for (const caf::SRFuzzyKProngProxy& png: sr->vtx.elastic.fuzzyk.png ){
45  double png_CalE = png.shwlid.calE;
46 
47  double emPID = ( (double)png.cvnpart.photonid +
48  (double)png.cvnpart.pizeroid +
49  (double)png.cvnpart.electronid);
50  double haPID = ( (double)png.cvnpart.protonid +
51  (double)png.cvnpart.pionid +
52  (double)png.cvnpart.neutronid +
53  (double)png.cvnpart.otherid +
54  (double)png.cvnpart.muonid);
55 
56  if ( emPID < 0 ) continue;
57  if ( emPID >= haPID ) CVNem_CalE += png_CalE;
58 
59  else continue;
60  }//ipng
61  if (kLongestProng(sr) >= 500 ) CVNem_CalE = prim_png.shwlid.calE;
62  return CVNem_CalE* CalibrationBugCorrectionFactor(sr->hdr);
63  });
64 
65  const Var kFHCHADE([](const caf::SRProxy* sr)
66  {
67  if(!sr->vtx.elastic.IsValid) return -1.0;
68  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
69 
70  const double CVNha_CalE = sr->slc.calE* CalibrationBugCorrectionFactor(sr->hdr);
71  return std::max (CVNha_CalE-kFHCEME(sr), 0.);
72 
73  });
74 
75 
76  const Var kNueEnergyFHC(
77  [](const caf::SRProxy* sr)
78  {
79  if(!sr->vtx.elastic.IsValid) return -1.0;
80  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
81 
82  return NueRecoE_2018FHCFit(kFHCEME(sr), kFHCHADE(sr));
83  });
84 
85 
86  const Var kRecoEME([](const caf::SRProxy* sr)
87  {
88  if(!sr->vtx.elastic.IsValid) return -1.0;
89  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
90  double CVNem_CalE = 0.0;
91  const caf::SRFuzzyKProngProxy& prim_png = sr->vtx.elastic.fuzzyk.png[0];
92  for (const caf::SRFuzzyKProngProxy& png: sr->vtx.elastic.fuzzyk.png ){
93  double png_CalE = png.shwlid.calE;
94 
95  double emPID = ( (double)png.cvnpart.photonid +
96  (double)png.cvnpart.pizeroid +
97  (double)png.cvnpart.electronid);
98  double haPID = ( (double)png.cvnpart.protonid +
99  (double)png.cvnpart.pionid +
100  (double)png.cvnpart.neutronid +
101  (double)png.cvnpart.otherid +
102  (double)png.cvnpart.muonid);
103 
104  if ( emPID < 0 ) continue;
105  if ( emPID >= haPID ) CVNem_CalE += png_CalE;
106 
107  else continue;
108  }//ipng
109 
110  if (CVNem_CalE == 0.0 ) CVNem_CalE = prim_png.shwlid.calE;
111 
112  return CVNem_CalE* CalibrationBugCorrectionFactor(sr->hdr);
113  });
114 
115  const Var kRecoHADE([](const caf::SRProxy* sr)
116  {
117  if(!sr->vtx.elastic.IsValid) return -1.0;
118  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
119 
120  const double CVNha_CalE = sr->slc.calE* CalibrationBugCorrectionFactor(sr->hdr);
121  return std::max (CVNha_CalE-kRecoEME(sr), 0.);
122 
123  });
124 
125 
126  const Var kNueEnergyRHC(
127  [](const caf::SRProxy* sr)
128  {
129  if(!sr->vtx.elastic.IsValid) return -1.0;
130  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
131 
132  return NueRecoE_2018RHCFit(kRecoEME(sr), kRecoHADE(sr));
133  });
134 
135 
136  const Var kNueEnergy2018(
137  [](const caf::SRProxy* sr)
138  {
139  if(!sr->vtx.elastic.IsValid) return -1.0;
140  if(sr->vtx.elastic.fuzzyk.npng < 1) return -1.0;
141 
142  if(kIsRHC(sr)) return kNueEnergyRHC(sr);
143  else return kNueEnergyFHC(sr);
144  });
145 }
146 
caf::Proxy< size_t > npng
Definition: SRProxy.h:2038
T max(const caf::Proxy< T > &a, T b)
caf::Proxy< caf::SRFuzzyK > fuzzyk
Definition: SRProxy.h:2059
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
const Var kFHCHADE([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;const double CVNha_CalE=sr->slc.calE *CalibrationBugCorrectionFactor(sr->hdr);return std::max(CVNha_CalE-kFHCEME(sr), 0.);})
Definition: NueEnergy2018.h:12
double CalibrationBugCorrectionFactor(const caf::SRHeaderProxy &hdr)
See docdb 23597.
Definition: Vars.cxx:141
double NueRecoE_2018RHCFit(double rawEM, double rawHA)
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
Proxy for caf::SRFuzzyKProng.
Definition: SRProxy.h:2003
const Var kNueEnergyFHC([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;return NueRecoE_2018FHCFit(kFHCEME(sr), kFHCHADE(sr));})
Definition: NueEnergy2018.h:14
caf::Proxy< caf::SRElastic > elastic
Definition: SRProxy.h:2118
caf::Proxy< std::vector< caf::SRFuzzyKProng > > png
Definition: SRProxy.h:2043
const Var kNueEnergyRHC([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;return NueRecoE_2018RHCFit(kRecoEME(sr), kRecoHADE(sr));})
Definition: NueEnergy2018.h:23
const Var kLongestProng([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return 0.f;if(sr->vtx.elastic.fuzzyk.npng==0) return 0.f;auto idx=sr->vtx.elastic.fuzzyk.longestidx;return float(sr->vtx.elastic.fuzzyk.png[idx].len);})
Definition: Vars.h:89
if(dump)
const Var kNueEnergy2018([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;if(kIsRHC(sr)) return kNueEnergyRHC(sr);else return kNueEnergyFHC(sr);})
Definition: NueEnergy2018.h:25
const Var kRecoEME([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;double CVNem_CalE=0.0;const caf::SRFuzzyKProngProxy &prim_png=sr->vtx.elastic.fuzzyk.png[0];for(const caf::SRFuzzyKProngProxy &png:sr->vtx.elastic.fuzzyk.png){double png_CalE=png.shwlid.calE;double emPID=((double) png.cvnpart.photonid+ (double) png.cvnpart.pizeroid+ (double) png.cvnpart.electronid);double haPID=((double) png.cvnpart.protonid+ (double) png.cvnpart.pionid+ (double) png.cvnpart.neutronid+ (double) png.cvnpart.otherid+ (double) png.cvnpart.muonid);if(emPID< 0) continue;if(emPID >=haPID ) CVNem_CalE+=png_CalE;else continue;}if(CVNem_CalE==0.0) CVNem_CalE=prim_png.shwlid.calE;return CVNem_CalE *CalibrationBugCorrectionFactor(sr->hdr);})
Definition: NueEnergy2018.h:17
caf::StandardRecord * sr
double NueRecoE_2018FHCFit(double rawEM, double rawHA)
const Cut kIsRHC([](const caf::SRProxy *sr){return sr->spill.isRHC;})
Definition: Vars.h:16
caf::Proxy< bool > IsValid
Definition: SRProxy.h:2058
caf::Proxy< caf::SRSlice > slc
Definition: SRProxy.h:2142
caf::Proxy< float > calE
Definition: SRProxy.h:1292
caf::Proxy< caf::SRVertexBranch > vtx
Definition: SRProxy.h:2146
#define for
Definition: msvc_pragmas.h:3
const Var kFHCEME([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;double CVNem_CalE=0.0;const caf::SRFuzzyKProngProxy &prim_png=sr->vtx.elastic.fuzzyk.png[0];for(const caf::SRFuzzyKProngProxy &png:sr->vtx.elastic.fuzzyk.png){double png_CalE=png.shwlid.calE;double emPID=((double) png.cvnpart.photonid+ (double) png.cvnpart.pizeroid+ (double) png.cvnpart.electronid);double haPID=((double) png.cvnpart.protonid+ (double) png.cvnpart.pionid+ (double) png.cvnpart.neutronid+ (double) png.cvnpart.otherid+ (double) png.cvnpart.muonid);if(emPID< 0) continue;if(emPID >=haPID ) CVNem_CalE+=png_CalE;else continue;}if(kLongestProng(sr) >=500) CVNem_CalE=prim_png.shwlid.calE;return CVNem_CalE *CalibrationBugCorrectionFactor(sr->hdr);})
Definition: NueEnergy2018.h:11
const Var kRecoHADE([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;const double CVNha_CalE=sr->slc.calE *CalibrationBugCorrectionFactor(sr->hdr);return std::max(CVNha_CalE-kRecoEME(sr), 0.);})
Definition: NueEnergy2018.h:18