7 double ECCQE(
const TVector3& l_momentum,
double l_energy) {
10 double M_p = 0.938272;
11 double M_e = 0.000511;
12 double bindingE = 0.0300;
14 double mp2 = M_p * M_p;
15 double me2 = M_e * M_e;
16 double mnb = M_n - bindingE;
18 TVector3 v(l_momentum);
19 double l_mom = sqrt(l_energy * l_energy - me2);
21 acos(v.Pz() / sqrt(v.Px()*v.Px() + v.Py()*v.Py() + v.Pz()*v.Pz()));
22 double enu_top = mp2 - mnb*mnb - me2 + 2.0 * mnb * l_energy;
23 double enu_bot = 2.0 * (mnb - l_energy + l_mom * cos(l_theta));
25 return enu_top / enu_bot;
29 const std::vector<geo::BoxBoundedGeo> &boxes) {
31 if ((v0 - v1).Mag() < 1
e-6)
return 0;
37 for (
auto const &box: boxes) {
38 int n_contained = box.ContainsPosition(v0) + box.ContainsPosition(v1);
40 if (n_contained == 2) {
41 length = (v1 - v0).Mag();
45 else if (n_contained == 1) {
46 std::vector<TVector3> intersections = box.GetIntersections(v0, v1);
47 assert(intersections.size() == 1);
49 length += ( box.ContainsPosition(v0) ? (v0 - intersections[0]).Mag() : (v1 - intersections[0]).Mag() );
51 else if (n_contained == 0) {
52 std::vector<TVector3> intersections = box.GetIntersections(v0, v1);
54 if (intersections.size() == 2) {
55 length += (intersections[0] - intersections[1]).Mag();
57 else assert(intersections.size() == 0);
67 TVector3 last = particle.Position().Vect();
68 for (
int i = 1; i < particle.NumberTrajectoryPoints(); i++) {
69 TVector3 current = particle.Position(i).Vect();
70 length += (current - last).Mag();
78 double contained_length = 0;
79 bool outside_AV =
true;
80 TVector3 start = particle.Position().Vect();
83 int volume_index = -1;
85 for (
int i = 0; i < active_volumes.size(); i++) {
86 if (outside_AV && active_volumes[i].ContainsPosition(start)) {
94 if (outside_AV)
return 0.;
97 std::vector<geo::BoxBoundedGeo> volume { active_volumes.at(volume_index) };
99 TVector3 last = start;
100 for (
int i = 1; i < particle.NumberTrajectoryPoints(); i++) {
101 TVector3 current = particle.Position(i).Vect();
102 if (!volume[0].ContainsPosition(current)) {
109 return contained_length;
double ContainedLength(const TVector3 &v0, const TVector3 &v1, const std::vector< geo::BoxBoundedGeo > &boxes)
double MCParticleLength(const simb::MCParticle &particle)
double ECCQE(const TVector3 &l_momentum, double l_energy)
double MCParticleContainedLength(const simb::MCParticle &particle, const std::vector< geo::BoxBoundedGeo > &active_volumes)