All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbnana/sbnanalysis/ana/SBNOsc/Utilities.cxx
Go to the documentation of this file.
1 #include <iostream>
2 
3 #include "TDatabasePDG.h"
4 
5 #include "nusimdata/SimulationBase/MCTruth.h"
6 #include "nusimdata/SimulationBase/MCNeutrino.h"
7 #include "core/Event.hh"
8 
9 #include "Utilities.h"
10 
11 #include "ubcore/LLBasicTool/GeoAlgo/GeoAABox.h"
12 #include "ubcore/LLBasicTool/GeoAlgo/GeoAlgo.h"
13 #include "ubcore/LLBasicTool/GeoAlgo/GeoLineSegment.h"
14 
15 #include <TMath.h>
16 #include <TRandom3.h>
17 
18 namespace ana {
19  namespace SBNOsc {
20 
21 void hello() {
22  std::cout << "Hello SBNOsc!" << std::endl;
23 }
24 
25 
26 event::Interaction TruthReco(const simb::MCTruth& mctruth) {
27  event::Interaction interaction;
28 
29  // Neutrino
30  const simb::MCNeutrino& nu = mctruth.GetNeutrino();
31  interaction.neutrino.energy = nu.Nu().EndMomentum().Energy();
32 
33  // Primary lepton
34  const simb::MCParticle& lepton = nu.Lepton();
35  interaction.lepton.pdg = lepton.PdgCode();
36  interaction.lepton.energy = lepton.Momentum(0).Energy();
37  interaction.lepton.momentum = lepton.Momentum(0).Vect();
38 
39  // Hadronic system
40  for (int iparticle=0; iparticle<interaction.finalstate.size(); iparticle++) {
42  const simb::MCParticle& particle = mctruth.GetParticle(iparticle);
43 
44  if (particle.Process() != "primary") {
45  continue;
46  }
47 
48  fsp.pdg = particle.PdgCode();
49  fsp.energy = particle.Momentum(0).Energy();
50  fsp.momentum = particle.Momentum(0).Vect();
51 
52  interaction.finalstate.push_back(fsp);
53  }
54 
55  return interaction;
56 }
57 
58 
59 double ECCQE(const TVector3& l_momentum, double l_energy,
60  double energy_distortion, double angle_distortion) {
61  // Based on D. Kaleko, LowEnergyExcess LArLite module ECCQECalculator
62  double M_n = 0.939565; // GeV/c^2
63  double M_p = 0.938272; // GeV/c^2
64  double M_e = 0.000511; // GeV/c^2
65  double bindingE = 0.0300; // GeV
66 
67  double mp2 = M_p * M_p;
68  double me2 = M_e * M_e;
69  double mnb = M_n - bindingE;
70 
71  // mess around with lorentz vector
72  TVector3 v(l_momentum);
73  v.SetTheta( v.Theta() + angle_distortion);
74  l_energy = l_energy + energy_distortion;
75  double l_mom = sqrt(l_energy*l_energy - me2);
76  double l_theta = \
77  acos(v.Pz() / sqrt(v.Px()*v.Px() + v.Py()*v.Py() + v.Pz()*v.Pz()));
78  double enu_top = mp2 - mnb*mnb - me2 + 2.0 * mnb * l_energy;
79  double enu_bot = 2.0 * (mnb - l_energy + l_mom * cos(l_theta));
80  return enu_top / enu_bot;
81 }
82 
83 
84 double NuMuOscillation(double numu_energy, double numu_dist,
85  double osc_dm2, double osc_angle) {
86  double overlap = sin(2*osc_angle);
87  double energy_factor = sin(1.27 * osc_dm2 * numu_dist / numu_energy);
88  return 1 - overlap * overlap * energy_factor * energy_factor;
89 }
90 
91 
92 double containedLength(const TVector3 &v0, const TVector3 &v1,
93  const std::vector<geoalgo::AABox> &boxes) {
94  static const geoalgo::GeoAlgo algo;
95 
96  // if points are the same, return 0
97  if ((v0 - v1).Mag() < 1e-6) return 0;
98 
99  // construct individual points
100  geoalgo::Point_t p0(v0);
101  geoalgo::Point_t p1(v1);
102 
103  // construct line segment
104  geoalgo::LineSegment line(p0, p1);
105 
106  double length = 0;
107 
108  // total contained length is sum of lengths in all boxes
109  // assuming they are non-overlapping
110  for (auto const &box: boxes) {
111  int n_contained = box.Contain(p0) + box.Contain(p1);
112  // both points contained -- length is total length (also can break out of loop)
113  if (n_contained == 2) {
114  length = (v1 - v0).Mag();
115  break;
116  }
117  // one contained -- have to find intersection point (which must exist)
118  if (n_contained == 1) {
119  auto intersections = algo.Intersection(line, box);
120  // Because of floating point errors, it can sometimes happen
121  // that there is 1 contained point but no "Intersections"
122  // if one of the points is right on the edge
123  if (intersections.size() == 0) {
124  // determine which point is on the edge
125  double tol = 1e-5;
126  bool p0_edge = algo.SqDist(p0, box) < tol;
127  bool p1_edge = algo.SqDist(p1, box) < tol;
128  assert(p0_edge || p1_edge);
129  // contained one is on edge -- can treat both as not contained
130  //
131  // In this case, no length
132  if ((p0_edge && box.Contain(p0)) || (box.Contain(p1) && p1_edge))
133  continue;
134  // un-contaned one is on edge -- treat both as contained
135  else if ((p0_edge && box.Contain(p1)) || (box.Contain(p0) && p1_edge)) {
136  length = (v1 - v0).Mag();
137  break;
138  }
139  else {
140  assert(false); // bad
141  }
142  }
143  // floating point errors can also falsely cause 2 intersection points
144  //
145  // in this case, one of the intersections must be very close to the
146  // "contained" point, so the total contained length will be about
147  // the same as the distance between the two intersection points
148  else if (intersections.size() == 2) {
149  length += (intersections.at(0).ToTLorentzVector().Vect() - intersections.at(1).ToTLorentzVector().Vect()).Mag();
150  continue;
151  }
152  // "Correct"/ideal case -- 1 intersection point
153  else if (intersections.size() == 1) {
154  // get TVector at intersection point
155  TVector3 int_tv(intersections.at(0).ToTLorentzVector().Vect());
156  length += ( box.Contain(p0) ? (v0 - int_tv).Mag() : (v1 - int_tv).Mag() );
157  }
158  else assert(false); // bad
159  }
160  // none contained -- either must have zero or two intersections
161  if (n_contained == 0) {
162  auto intersections = algo.Intersection(line, box);
163  if (!(intersections.size() == 0 || intersections.size() == 2)) {
164  // more floating point error fixes...
165  //
166  // figure out which points are near the edge
167  double tol = 1e-5;
168  bool p0_edge = algo.SqDist(p0, box) < tol;
169  bool p1_edge = algo.SqDist(p1, box) < tol;
170  // and which points are near the intersection
171  TVector3 vint = intersections.at(0).ToTLorentzVector().Vect();
172  bool p0_int = (v0 - vint).Mag() < tol;
173  bool p1_int = (v1 - vint).Mag() < tol;
174  // exactly one of them should produce the intersection
175  assert((p0_int && p0_edge) != (p1_int && p1_edge));
176  // both close to edge -- full length is contained
177  if (p0_edge && p1_edge) {
178  length += (v0 - v1).Mag();
179  }
180  // otherwise -- one of them is not on an edge, no length is contained
181  else {}
182  }
183  // assert(intersections.size() == 0 || intersections.size() == 2);
184  else if (intersections.size() == 2) {
185  TVector3 start(intersections.at(0).ToTLorentzVector().Vect());
186  TVector3 end(intersections.at(1).ToTLorentzVector().Vect());
187  length += (start - end).Mag();
188  }
189  }
190  }
191 
192  return length;
193 }
194 
195 // run the proposal energy smearing w/ MCParticles
196 double visibleEnergyProposalMCParticles(TRandom &rand, const simb::MCTruth &mctruth, const std::vector<sim::MCTrack> mctrack_list, const VisibleEnergyCalculator &calculator) {
197  double total = 0;
198  for (int iparticle=0; iparticle<mctruth.NParticles(); iparticle++) {
199  const simb::MCParticle& particle = mctruth.GetParticle(iparticle);
200 
201  int pdg = particle.PdgCode();
202 
203  // if there's no mass entry, we probably don't care about it
204  if (PDGMass(pdg) < 0) continue;
205 
206  double track_energy = (particle.Momentum().E() - PDGMass(pdg) / 1000. /* MeV -> GeV */);
207  double smear_energy = track_energy;
208 
209  // In the proposal, different PDG codes got different energies
210 
211  // kaons did not have the mass subtracted
212  if (abs(pdg) == 321) {
213  track_energy = particle.Momentum().E();
214  smear_energy = track_energy;
215  }
216  // pions did not have mass subtracted in the smearing
217  if (abs(pdg) == 211) {
218  smear_energy = particle.Momentum().E();
219  }
220 
221  bool skip = false;
222 
223  // threshold -- only for protons
224  if (abs(pdg) == 2212 && track_energy < calculator.track_threshold) {
225  skip = true;
226  }
227 
228  // add in smeared energy
229  double this_smeared_energy = rand.Gaus(track_energy, smear_energy * calculator.track_energy_distortion);
230  // clamp to zero
231  this_smeared_energy = std::max(this_smeared_energy, 0.);
232 
233  // Ignore particles not from nu vertex
234  if (!isFromNuVertex(mctruth, particle) || particle.Process() != "primary") {
235  skip = true;
236  }
237  // ignore everything except for protons and kaons and pions
238  if (!(abs(pdg) == 2212 || abs(pdg) == 211 || abs(pdg) == 321)) {
239  skip = true;
240  }
241  // double distance = (mctruth.GetNeutrino().Nu().Trajectory().Position(0).Vect() - mct.Start().Position().Vect()).Mag();
242  // double l_distance = (mctruth.GetNeutrino().Nu().Trajectory().Position(0) - mct.Start().Position()).Mag();
243  // std::cout << "New particle -- true E: " << track_energy << " smeared E: " << this_smeared_energy << " PDG: " << pdg << " is primary: " << (calculator.lepton_index == ind) << " is skipped: " << skip << " distance: " << distance << " lorentz distance: " << l_distance << " process: " << mct.Process() << std::endl;
244  if (skip) continue;
245 
246  total += this_smeared_energy;
247  }
248 
249  // ...and primary lepton energy (for CC events)
250  // only add in extra here if identified "lepton" is actually a lepton
251  if (calculator.lepton_index >= 0 && (abs(mctrack_list[calculator.lepton_index].PdgCode()) == 13 || abs(mctrack_list[calculator.lepton_index].PdgCode()) == 11)) {
252  double lepton_energy = smearLeptonEnergy(rand, mctrack_list[calculator.lepton_index], calculator);
253  total += lepton_energy;
254  }
255  // std::cout << "Reco Energy: " << total << std::endl;
256 
257  return total;
258 
259  }
260 
261 // copies the exact energy smearing used in the proposal
262 double visibleEnergyProposal(TRandom &rand, const simb::MCTruth &mctruth, const std::vector<sim::MCTrack> &mctrack_list, const VisibleEnergyCalculator &calculator) {
263  double total = 0.;
264 
265  // std::cout << "\n\nNew Interaction" << std::endl;
266  // std::cout << "True E: " << mctruth.GetNeutrino().Nu().E() << std::endl;
267  for (unsigned ind = 0; ind < mctrack_list.size(); ind++) {
268  auto const &mct = mctrack_list[ind];
269  int pdg = mct.PdgCode();
270 
271  double track_energy = (mct.Start().E() - PDGMass(pdg)) / 1000. /* MeV -> GeV */;
272  double smear_energy = track_energy;
273 
274  // In the proposal, different PDG codes got different energies
275 
276  // kaons did not have the mass subtracted
277  if (abs(pdg) == 321) {
278  track_energy = mct.Start().E() / 1000.;
279  smear_energy = track_energy;
280  }
281  // pions did not have mass subtracted in the smearing
282  if (abs(pdg) == 211) {
283  smear_energy = mct.Start().E() / 1000.;
284  }
285 
286  bool skip = false;
287 
288  // threshold -- only for protons
289  if (abs(pdg) == 2212 && track_energy < calculator.track_threshold) {
290  skip = true;
291  }
292 
293  // add in smeared energy
294  double this_smeared_energy = rand.Gaus(track_energy, smear_energy * calculator.track_energy_distortion);
295  // clamp to zero
296  this_smeared_energy = std::max(this_smeared_energy, 0.);
297 
298  // Ignore particles not from nu vertex
299  if (!isFromNuVertex(mctruth, mct) || mct.Process() != "primary") {
300  skip = true;
301  }
302  // ignore everything except for protons and kaons and pions
303  if (!(abs(pdg) == 2212 || abs(pdg) == 211 || abs(pdg) == 321)) {
304  skip = true;
305  }
306  // account for primary track later
307  if ((abs(pdg) == 13 || abs(pdg) == 11) && calculator.lepton_index == ind) {
308  skip = true;
309  }
310  // double distance = (mctruth.GetNeutrino().Nu().Trajectory().Position(0).Vect() - mct.Start().Position().Vect()).Mag();
311  // double l_distance = (mctruth.GetNeutrino().Nu().Trajectory().Position(0) - mct.Start().Position()).Mag();
312  // std::cout << "New particle -- true E: " << track_energy << " smeared E: " << this_smeared_energy << " PDG: " << pdg << " is primary: " << (calculator.lepton_index == ind) << " is skipped: " << skip << " distance: " << distance << " lorentz distance: " << l_distance << " process: " << mct.Process() << std::endl;
313  if (skip) continue;
314 
315  total += this_smeared_energy;
316  }
317 
318  // ...and primary lepton energy (for CC events)
319  // only add in extra here if identified "lepton" is actually a lepton
320  if (calculator.lepton_index >= 0 && (abs(mctrack_list[calculator.lepton_index].PdgCode()) == 13 || abs(mctrack_list[calculator.lepton_index].PdgCode()) == 11)) {
321  double lepton_energy = smearLeptonEnergy(rand, mctrack_list[calculator.lepton_index], calculator);
322  total += lepton_energy;
323  }
324  // std::cout << "Reco Energy: " << total << std::endl;
325 
326  return total;
327 }
328 
329 
330 double visibleEnergy(TRandom &rand, const simb::MCTruth &mctruth, const std::vector<sim::MCTrack> &mctrack_list, const std::vector<sim::MCShower> &mcshower_list,
331  const VisibleEnergyCalculator &calculator, bool include_showers) {
332  double visible_E = 0;
333 
334  // primary leptron track
335  const sim::MCTrack *lepton_track = NULL;
336  bool lepton_track_exists = false;
337 
338  // total up visible energy from tracks...
339  double track_visible_energy = 0.;
340  for (unsigned ind = 0; ind < mctrack_list.size(); ind++) {
341  auto const &mct = mctrack_list[ind];
342  // ignore particles not from nu vertex, non primary particles, and uncharged particles
343  if (!isFromNuVertex(mctruth, mct) || abs(PDGCharge(mct.PdgCode())) < 1e-4 || mct.Process() != "primary")
344  continue;
345  // account for primary lepton later
346  if ((abs(mct.PdgCode()) == 13 || abs(mct.PdgCode()) == 11) && calculator.lepton_index == ind) {
347  continue;
348  }
349  // ignore non-primary pion??
350  //if ((abs(mct.PdgCode()) == 211) && calculator.lepton_index != ind) {
351  // continue;
352  //}
353 
354  double mass = PDGMass(mct.PdgCode());
355  double this_visible_energy = (mct.Start().E() - mass) / 1000. /* MeV to GeV */;
356  if (this_visible_energy > calculator.track_threshold) {
357  track_visible_energy += this_visible_energy;
358  }
359  }
360 
361  // do energy smearing
362  if (calculator.track_energy_distortion > 1e-4) {
363  track_visible_energy = rand.Gaus(track_visible_energy, track_visible_energy*calculator.track_energy_distortion);
364  // clamp to 0
365  track_visible_energy = std::max(track_visible_energy, 0.);
366  }
367 
368  // ...and showers
369  double shower_visible_energy = 0.;
370  if (include_showers) {
371  for (auto const &mcs: mcshower_list) {
372  // ignore particles not from nu vertex, non primary particles, and uncharged particles
373  if (!isFromNuVertex(mctruth, mcs) || abs(PDGCharge(mcs.PdgCode())) < 1e-4 || mcs.Process() != "primary")
374  continue;
375  // account for primary lepton later
376  if ((abs(mcs.PdgCode()) == 13 || abs(mcs.PdgCode()) == 11) && isFromNuVertex(mctruth, mcs))
377  continue;
378 
379  double mass = PDGMass(mcs.PdgCode());
380  double this_visible_energy = (mcs.Start().E() - mass) / 1000. /* MeV to GeV */;
381 
382  if (this_visible_energy > calculator.shower_threshold) {
383  shower_visible_energy += this_visible_energy;
384  }
385  }
386  }
387 
388  // do energy smearing
389  if (calculator.shower_energy_distortion > 1e-4) {
390  shower_visible_energy = rand.Gaus(shower_visible_energy, shower_visible_energy*calculator.shower_energy_distortion);
391  // clamp to 0
392  shower_visible_energy = std::max(shower_visible_energy, 0.);
393  }
394 
395  visible_E = track_visible_energy + shower_visible_energy;
396 
397  // ...and primary lepton energy (for CC events)
398  // only add in extra here if identified "lepton" is actually a lepton
399  if (calculator.lepton_index >= 0 && (abs(mctrack_list[calculator.lepton_index].PdgCode()) == 13 || abs(mctrack_list[calculator.lepton_index].PdgCode()) == 11)) {
400  visible_E += smearLeptonEnergy(rand, mctrack_list[calculator.lepton_index], calculator);
401  }
402 
403  return visible_E;
404 }
405 
406 
407 double smearLeptonEnergy(TRandom &rand, const sim::MCTrack &mct, const VisibleEnergyCalculator &calculator) {
408  // if not contained and zero length, return
409  if (!calculator.lepton_contained && calculator.lepton_contained_length < 1e-4) {
410  // std::cout << "Out of detector lepton\n";
411  return 0;
412  }
413 
414  double smearing_percentage;
415  if (calculator.lepton_contained) {
416  smearing_percentage = calculator.lepton_energy_distortion_contained;
417  } else {
418  double A = calculator.lepton_energy_distortion_leaving_A;
419  double B = calculator.lepton_energy_distortion_leaving_B;
420  smearing_percentage = -A * TMath::Log(B * calculator.lepton_contained_length);
421  }
422  // smear visible energy
423  double lepton_visible_energy = (mct.Start().E()) / 1000.; /* MeV to GeV */
424  double smeared_lepton_visible_energy = rand.Gaus(lepton_visible_energy, smearing_percentage * lepton_visible_energy);
425  // clamp to 0
426  smeared_lepton_visible_energy = std::max(smeared_lepton_visible_energy, 0.);
427 
428  // std::cout << "Lepton -- is_contained: " << calculator.lepton_contained << " length: " << calculator.lepton_contained_length << " smearing: " << smearing_percentage << " true E: " << lepton_visible_energy << " smeared E: " << smeared_lepton_visible_energy << std::endl;
429 
430  return smeared_lepton_visible_energy;
431 }
432 
433 
434 // define global static const PDGTable to be used by helper functions
435 static const TDatabasePDG *PDGTable(new TDatabasePDG);
436 
437 
438 double PDGMass(int pdg) {
439  // regular particle
440  if (pdg < 1000000000) {
441  TParticlePDG* ple = PDGTable->GetParticle(pdg);
442  if (ple == NULL) return -1;
443  return ple->Mass() * 1000.0;
444  }
445  // ion
446  else {
447  int p = (pdg % 10000000) / 10000;
448  int n = (pdg % 10000) / 10 - p;
449  return (PDGTable->GetParticle(2212)->Mass() * p +
450  PDGTable->GetParticle(2112)->Mass() * n) * 1000.0;
451  }
452 }
453 
454 
455 double PDGCharge(int pdg) {
456  // regular particle
457  if (pdg < 1000000000) {
458  TParticlePDG* ple = PDGTable->GetParticle(pdg);
459  return ple->Charge();
460  }
461  // ion
462  else {
463  int p = (pdg % 10000000) / 10000;
464  return p * 3;
465  }
466 }
467 
468 bool isFromNuVertex(const simb::MCTruth& mc, const simb::MCParticle& mcp, float distance) {
469  TVector3 nuVtx = mc.GetNeutrino().Nu().Position().Vect();
470  TVector3 partStart = mcp.Position().Vect();
471  return (partStart - nuVtx).Mag() < distance;
472 }
473 
474 bool isFromNuVertex(const simb::MCTruth& mc, const sim::MCShower& show,
475  float distance) {
476  TVector3 nuVtx = mc.GetNeutrino().Nu().Trajectory().Position(0).Vect();
477  TVector3 showStart = show.Start().Position().Vect();
478  return (showStart - nuVtx).Mag() < distance;
479 }
480 
481 
482 bool isFromNuVertex(const simb::MCTruth& mc, const sim::MCTrack& track,
483  float distance) {
484  TVector3 nuVtx = mc.GetNeutrino().Nu().Trajectory().Position(0).Vect();
485  TVector3 trkStart = track.Start().Position().Vect();
486  return (trkStart - nuVtx).Mag() < distance;
487 }
488 
489 // taken from: https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
490 double closestDistance(const TVector3 &line0, const TVector3 &line1, const TVector3 &p) {
491  // Return minimum distance between line segment vw and point p
492  // const float l2 = length_squared(v, w); // i.e. |w-v|^2 - avoid a sqrt
493  double length2 = (line0 - line1).Mag2();
494  if (length2 == 0.0) return (line0 - p).Mag();
495  // Consider the line extending the segment, parameterized as v + t (w - v).
496  // We find projection of point p onto the line.
497  // It falls where t = [(p-v) . (w-v)] / |w-v|^2
498  // We clamp t from [0,1] to handle points outside the segment vw.
499  double t = std::max(0., std::min(1., (p - line0).Dot(line1 - line0) / length2));
500  TVector3 projection = line0 + t * (line1 - line0);
501  return (projection - p).Mag();
502 }
503 
504 double closestDistanceDim(const TVector3 &line0, const TVector3 &line1, const TVector3 &p, int dim) {
505  double l0 = line0[dim];
506  double l1 = line1[dim];
507  double pp = p[dim];
508 
509  if ((l0 < pp && pp < l1) || (l1 < pp && pp < l0)) return 0.;
510  return std::min(abs(l0 - pp) , abs(l1 - pp));
511 }
512 
513  } // namespace SBNOsc
514 } // namespace ana
double visibleEnergyProposalMCParticles(TRandom &rand, const simb::MCTruth &mctruth, const std::vector< sim::MCTrack > mctrack_list, const VisibleEnergyCalculator &calculator)
int lepton_index
Index of lepton in the mctrack object.
Algorithm to compute various geometrical relation among geometrical objects. In particular functions ...
double track_energy_distortion
Distortion of energies of tracks (%).
double visibleEnergyProposal(TRandom &rand, const simb::MCTruth &mctruth, const std::vector< sim::MCTrack > &mctrack_list, const VisibleEnergyCalculator &calculator)
TVector3 momentum
Three-momentum.
Definition: Event.hh:129
var pdg
Definition: selectors.fcl:14
float energy
Energy.
Definition: Event.hh:128
int pdg
PDG Code.
Definition: Event.hh:127
double lepton_energy_distortion_leaving_A
Parameter in function to calculate primary lepton energy resolution.
Final state particle information.
Definition: Event.hh:104
FinalStateParticle lepton
The primary final state lepton.
Definition: Event.hh:153
auto const tol
Definition: SurfXYZTest.cc:16
bool isFromNuVertex(const simb::MCTruth &mc, const simb::MCParticle &mcp, float distance)
double SqDist(const Line_t &line, const Point_t &pt) const
double closestDistance(const TVector3 &line0, const TVector3 &line1, const TVector3 &p)
pdgs p
Definition: selectors.fcl:22
Representation of a simple 3D line segment Defines a finite 3D straight line by having the start and ...
Neutrino neutrino
The neutrino.
Definition: Event.hh:152
double lepton_energy_distortion_contained
Distortion of energies of primary lepton whose tracks are contained within the TPC (%)...
process_name use argoneut_mc_hitfinder track
double visibleEnergy(TRandom &rand, const simb::MCTruth &mctruth, const std::vector< sim::MCTrack > &mctrack_list, const std::vector< sim::MCShower > &mcshower_list, const VisibleEnergyCalculator &calculator, bool include_showers)
process_name opflashCryoW ana
double shower_threshold
Energy threshold of shower energy counted in calculation [GeV].
T abs(T value)
double lepton_energy_distortion_leaving_B
Parameter in function to calculate primary lepton energy resolution.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
double smearLeptonEnergy(TRandom &rand, const sim::MCTrack &mct, const VisibleEnergyCalculator &calculator)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
event::Interaction TruthReco(const simb::MCTruth &mctruth)
double track_threshold
Energy threshold of track energy counted in calculation [GeV].
const MCStep & Start() const
Definition: MCShower.h:55
double shower_energy_distortion
Distortion of energies of showers (%).
double NuMuOscillation(double numu_energy, double numu_dist, double osc_dm2, double osc_angle)
std::vector< FinalStateParticle > finalstate
Other final state particles.
Definition: Event.hh:154
static const TDatabasePDG * PDGTable(new TDatabasePDG)
double ECCQE(const TVector3 &l_momentum, double l_energy, double energy_distortion, double angle_distortion)
double containedLength(const TVector3 &v0, const TVector3 &v1, const std::vector< geoalgo::AABox > &boxes)
float energy
Neutrino energy (GeV)
Definition: Event.hh:90
float mass
Definition: dedx.py:47
double lepton_contained_length
Length of section of primary lepton&#39;s track that is contained within the TPC.
do i e
double E() const
Definition: MCStep.h:49
double closestDistanceDim(const TVector3 &line0, const TVector3 &line1, const TVector3 &p, int dim)
const MCStep & Start() const
Definition: MCTrack.h:44
const TLorentzVector & Position() const
Definition: MCStep.h:40
float A
Definition: dedx.py:137
std::vector< Point_t > Intersection(const AABox_t &box, const HalfLine_t &line, bool back=false) const
Intersection between a HalfLine and an AABox.
BEGIN_PROLOG SN nu
physics associatedGroupsWithLeft p1
All truth information associated with one neutrino interaction.
Definition: Event.hh:150
BEGIN_PROLOG could also be cout
bool lepton_contained
True if primary lepton&#39;s track is contained within TPC.