LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GeoObjectSorter.cxx
Go to the documentation of this file.
1 
10 
11 #include <algorithm>
12 #include <vector>
13 
14 namespace {
15  bool sortorderOpDets(const geo::OpDetGeo& t1, const geo::OpDetGeo& t2)
16  {
17  geo::OpDetGeo::LocalPoint_t const local{};
18  auto const xyz1 = t1.toWorldCoords(local);
19  auto const xyz2 = t2.toWorldCoords(local);
20 
21  if (xyz1.Z() != xyz2.Z()) return xyz1.Z() > xyz2.Z();
22  if (xyz1.Y() != xyz2.Y()) return xyz1.Y() > xyz2.Y();
23  return xyz1.X() > xyz2.X();
24  }
25 }
26 
27 namespace geo {
28  void GeoObjectSorter::SortOpDets(std::vector<geo::OpDetGeo>& opdet) const
29  {
30  std::sort(opdet.begin(), opdet.end(), sortorderOpDets);
31  }
32 }
TTree * t1
Definition: plottest35.C:26
virtual void SortOpDets(std::vector< geo::OpDetGeo > &opdet) const
Interface to algorithm class for sorting geo::XXXGeo objects.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local optical detector frame to world frame.
Definition: OpDetGeo.h:106
TTree * t2
Definition: plottest35.C:36
Encapsulate the geometry of an optical detector.
geo::OpticalPoint_t LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: OpDetGeo.h:60
Namespace collecting geometry-related classes utilities.