@@ -3677,17 +3677,15 @@ bool sbnd::AnalysisTree::TrackIdToMCTruth( Int_t const trkID, art::Ptr<simb::MCT
36773677double sbnd::AnalysisTree::bdist (const recob::Track::Point_t& pos)
36783678{
36793679 // Get geometry.
3680- art::ServiceHandle<geo::Geometry> geom;
3681-
3680+ geo::TPCGeo const & tpc = art::ServiceHandle<geo::Geometry>()->TPC ({0 , 0 });
36823681 double d1 = pos.X (); // Distance to right side (wires).
3683- double d2 = 2 .*geom-> DetHalfWidth () - pos.X (); // Distance to left side (cathode).
3684- double d3 = pos.Y () + geom-> DetHalfHeight (); // Distance to bottom.
3685- double d4 = geom-> DetHalfHeight () - pos.Y (); // Distance to top.
3682+ double d2 = 2 .*tpc. HalfWidth () - pos.X (); // Distance to left side (cathode).
3683+ double d3 = pos.Y () + tpc. HalfHeight (); // Distance to bottom.
3684+ double d4 = tpc. HalfHeight () - pos.Y (); // Distance to top.
36863685 double d5 = pos.Z (); // Distance to front.
3687- double d6 = geom-> DetLength () - pos.Z (); // Distance to back.
3686+ double d6 = tpc. Length () - pos.Z (); // Distance to back.
36883687
3689- double result = std::min (std::min (std::min (std::min (std::min (d1, d2), d3), d4), d5), d6);
3690- return result;
3688+ return std::min ({d1, d2, d3, d4, d5, d6});
36913689}
36923690
36933691
@@ -3701,16 +3699,14 @@ double sbnd::AnalysisTree::length(const recob::Track& track)
37013699// Length of MC particle, trajectory by trajectory.
37023700double sbnd::AnalysisTree::length (const simb::MCParticle& part, TVector3& start, TVector3& end)
37033701{
3704- // Get geometry.
3705- art::ServiceHandle<geo::Geometry> geom;
3706-
37073702 // Get active volume boundary.
3708- double xmin = -2.0 * geom->DetHalfWidth () - 1e-8 ;
3709- double xmax = 2.0 * geom->DetHalfWidth () + 1e-8 ;
3710- double ymin = -geom->DetHalfHeight () -1e-8 ;
3711- double ymax = geom->DetHalfHeight () + 1e-8 ;
3703+ geo::TPCGeo const & tpc = art::ServiceHandle<geo::Geometry>()->TPC ({0 , 0 });
3704+ double xmin = -2.0 * tpc.HalfWidth () - 1e-8 ;
3705+ double xmax = 2.0 * tpc.HalfWidth () + 1e-8 ;
3706+ double ymin = -tpc.HalfHeight () -1e-8 ;
3707+ double ymax = tpc.HalfHeight () + 1e-8 ;
37123708 double zmin = 0 . -1e-8 ;
3713- double zmax = geom-> DetLength () + 1e-8 ;
3709+ double zmax = tpc. Length () + 1e-8 ;
37143710
37153711 // Get number traj points
37163712 int n = part.NumberTrajectoryPoints ();
0 commit comments