|
1 | 1 | #include "StubMergeAlgorithms.h" |
2 | 2 |
|
3 | 3 | #include "larcorealg/Geometry/WireReadoutGeom.h" |
| 4 | +#include "larcore/Geometry/Geometry.h" |
| 5 | +#include "larcore/CoreUtils/ServiceUtil.h" |
| 6 | +#include "larcorealg/Geometry/GeometryCore.h" |
4 | 7 |
|
5 | 8 | geo::Point_t sbn::GetLocation(const spacecharge::SpaceCharge *sce, geo::Point_t loc_w, geo::TPCID TPC, float xsign) { |
6 | 9 | if (sce && sce->EnableCalSpatialSCE()) { |
@@ -49,14 +52,17 @@ geo::Point_t sbn::GetLocationAtWires(const spacecharge::SpaceCharge *sce, geo::P |
49 | 52 | double sbn::GetPitch( |
50 | 53 | const geo::WireReadoutGeom &wireReadout, const spacecharge::SpaceCharge *sce, |
51 | 54 | geo::Point_t loc, geo::Vector_t dir, |
52 | | - geo::View_t view, geo::TPCGeo const& tpc, |
| 55 | + geo::View_t view, geo::PlaneID const& plane_id, |
53 | 56 | bool correct_sce, bool track_is_sce_corrected, float xsign) { |
54 | 57 |
|
55 | | - double angleToVert = wireReadout.WireAngleToVertical(view, tpc.ID()) - 0.5*::util::pi<>(); |
| 58 | + const geo::GeometryCore *geo = lar::providerFrom<geo::Geometry>(); |
| 59 | + |
| 60 | + double angleToVert = wireReadout.WireAngleToVertical(view, plane_id) - 0.5*::util::pi<>(); |
56 | 61 |
|
57 | 62 | geo::Vector_t dir_w; |
58 | 63 |
|
59 | | - geo::PlaneGeo const& plane = wireReadout.Plane(geo::PlaneID{0, 0, view}); |
| 64 | + geo::PlaneGeo const& plane = wireReadout.Plane(plane_id); |
| 65 | + geo::TPCGeo const& tpc = geo->TPC(plane_id); |
60 | 66 | // "dir_w" should be the direction that the wires see. If the track already has the field |
61 | 67 | // distortion corrections applied, then we need to de-apply them to get the direction as |
62 | 68 | // seen by the wire planes |
@@ -92,8 +98,8 @@ double sbn::GetPitch( |
92 | 98 | loc_w = sbn::GetLocationAtWires(sce, loc, tpc.DriftDir(), xsign); |
93 | 99 | } |
94 | 100 |
|
95 | | - geo::Point_t locw_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w, tpc.ID(), xsign) : loc_w; |
96 | | - geo::Point_t locw_pdx_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w + pitch * dir_w, tpc.ID(), xsign) : (loc_w + pitch * dir_w); |
| 101 | + geo::Point_t locw_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w, plane_id, xsign) : loc_w; |
| 102 | + geo::Point_t locw_pdx_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w + pitch * dir_w, plane_id, xsign) : (loc_w + pitch * dir_w); |
97 | 103 |
|
98 | 104 | pitch = (locw_traj - locw_pdx_traj).R(); |
99 | 105 |
|
@@ -222,8 +228,8 @@ float sbn::StubPeakdQdxOffset(const sbn::StubInfo &A, const sbn::StubInfo &B, |
222 | 228 | geo::Vector_t dir((end-vtx).Unit()); |
223 | 229 |
|
224 | 230 | // Input point, dir are always space charge corrected here |
225 | | - float Apitch = GetPitch(wireReadout, sce, end, dir, A.vhit_hit->View(), geometry.TPC(A.vhit_hit->WireID()), true, true); |
226 | | - float Bpitch = GetPitch(wireReadout, sce, end, dir, B.vhit_hit->View(), geometry.TPC(B.vhit_hit->WireID()), true, true); |
| 231 | + float Apitch = GetPitch(wireReadout, sce, end, dir, A.vhit_hit->View(), A.vhit_hit->WireID(), true, true); |
| 232 | + float Bpitch = GetPitch(wireReadout, sce, end, dir, B.vhit_hit->View(), B.vhit_hit->WireID(), true, true); |
227 | 233 |
|
228 | 234 | return abs(A.vhit->charge / Apitch - B.vhit->charge / Bpitch); |
229 | 235 | } |
0 commit comments