-
Notifications
You must be signed in to change notification settings - Fork 35
Fix bugs in v10 upgrade. #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| #include "StubMergeAlgorithms.h" | ||
|
|
||
| #include "larcorealg/Geometry/WireReadoutGeom.h" | ||
| #include "larcore/Geometry/Geometry.h" | ||
| #include "larcore/CoreUtils/ServiceUtil.h" | ||
| #include "larcorealg/Geometry/GeometryCore.h" | ||
|
|
||
| geo::Point_t sbn::GetLocation(const spacecharge::SpaceCharge *sce, geo::Point_t loc_w, geo::TPCID TPC, float xsign) { | ||
| if (sce && sce->EnableCalSpatialSCE()) { | ||
|
|
@@ -49,14 +52,17 @@ geo::Point_t sbn::GetLocationAtWires(const spacecharge::SpaceCharge *sce, geo::P | |
| double sbn::GetPitch( | ||
| const geo::WireReadoutGeom &wireReadout, const spacecharge::SpaceCharge *sce, | ||
| geo::Point_t loc, geo::Vector_t dir, | ||
| geo::View_t view, geo::TPCGeo const& tpc, | ||
| geo::View_t view, geo::PlaneID const& plane_id, | ||
| bool correct_sce, bool track_is_sce_corrected, float xsign) { | ||
|
|
||
| double angleToVert = wireReadout.WireAngleToVertical(view, tpc.ID()) - 0.5*::util::pi<>(); | ||
| const geo::GeometryCore *geo = lar::providerFrom<geo::Geometry>(); | ||
|
|
||
| double angleToVert = wireReadout.WireAngleToVertical(view, plane_id) - 0.5*::util::pi<>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, this is the direction from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds right. I prefer this method, because other pieces of code (like the Calorimetry) also use it to compute the pitch. So more people would notice if something breaks. |
||
|
|
||
| geo::Vector_t dir_w; | ||
|
|
||
| geo::PlaneGeo const& plane = wireReadout.Plane(geo::PlaneID{0, 0, view}); | ||
| geo::PlaneGeo const& plane = wireReadout.Plane(plane_id); | ||
| geo::TPCGeo const& tpc = geo->TPC(plane_id); | ||
| // "dir_w" should be the direction that the wires see. If the track already has the field | ||
| // distortion corrections applied, then we need to de-apply them to get the direction as | ||
| // seen by the wire planes | ||
|
|
@@ -92,8 +98,8 @@ double sbn::GetPitch( | |
| loc_w = sbn::GetLocationAtWires(sce, loc, tpc.DriftDir(), xsign); | ||
| } | ||
|
|
||
| geo::Point_t locw_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w, tpc.ID(), xsign) : loc_w; | ||
| geo::Point_t locw_pdx_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w + pitch * dir_w, tpc.ID(), xsign) : (loc_w + pitch * dir_w); | ||
| geo::Point_t locw_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w, plane_id, xsign) : loc_w; | ||
| geo::Point_t locw_pdx_traj = (correct_sce) ? sbn::GetLocation(sce, loc_w + pitch * dir_w, plane_id, xsign) : (loc_w + pitch * dir_w); | ||
|
|
||
| pitch = (locw_traj - locw_pdx_traj).R(); | ||
|
|
||
|
|
@@ -222,8 +228,8 @@ float sbn::StubPeakdQdxOffset(const sbn::StubInfo &A, const sbn::StubInfo &B, | |
| geo::Vector_t dir((end-vtx).Unit()); | ||
|
|
||
| // Input point, dir are always space charge corrected here | ||
| float Apitch = GetPitch(wireReadout, sce, end, dir, A.vhit_hit->View(), geometry.TPC(A.vhit_hit->WireID()), true, true); | ||
| float Bpitch = GetPitch(wireReadout, sce, end, dir, B.vhit_hit->View(), geometry.TPC(B.vhit_hit->WireID()), true, true); | ||
| float Apitch = GetPitch(wireReadout, sce, end, dir, A.vhit_hit->View(), A.vhit_hit->WireID(), true, true); | ||
| float Bpitch = GetPitch(wireReadout, sce, end, dir, B.vhit_hit->View(), B.vhit_hit->WireID(), true, true); | ||
|
|
||
| return abs(A.vhit->charge / Apitch - B.vhit->charge / Bpitch); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this an existing bug, or a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to change the GetPitch interface in order to fix introduced by the v10 transition.