77// //////////////////////////////////////////////////////////////////////
88
99#include " icarusalg/Geometry/GeoObjectSorterICARUS.h"
10- #include " icarusalg/Geometry/details/AuxDetSorting.h"
1110
12- #include " larcorealg/Geometry/AuxDetGeo.h"
13- #include " larcorealg/Geometry/AuxDetSensitiveGeo.h"
1411#include " larcorealg/Geometry/CryostatGeo.h"
1512#include " larcorealg/Geometry/TPCGeo.h"
16- #include " larcorealg/Geometry/PlaneGeo.h"
17- #include " larcorealg/Geometry/WireGeo.h"
1813
1914namespace geo {
2015
2116 // ----------------------------------------------------------------------------
22- // Define sort order for cryostats in standard configuration
23- static bool sortCryoStandard (const CryostatGeo& c1, const CryostatGeo& c2)
17+ GeoObjectSorterICARUS::GeoObjectSorterICARUS (fhicl::ParameterSet const &)
18+ {
19+ }
20+
21+ // ----------------------------------------------------------------------------
22+ bool GeoObjectSorterICARUS::compareCryostats (CryostatGeo const & c1, CryostatGeo const & c2) const
2423 {
2524 auto const xyz1 = c1.GetCenter ();
2625 auto const xyz2 = c2.GetCenter ();
2726
2827 return xyz1.X () < xyz2.X ();
2928 }
3029
31-
3230 // ----------------------------------------------------------------------------
33- // Define sort order for tpcs in standard configuration.
34- static bool sortTPCStandard (const TPCGeo& t1, const TPCGeo& t2)
31+ bool GeoObjectSorterICARUS::compareTPCs (TPCGeo const & t1, TPCGeo const & t2) const
3532 {
3633 auto const xyz1 = t1.GetCenter ();
3734 auto const xyz2 = t2.GetCenter ();
@@ -40,83 +37,4 @@ namespace geo{
4037 return xyz1.X () < xyz2.X ();
4138 }
4239
43- const double EPSILON = 0.000001 ;
44-
45- // ----------------------------------------------------------------------------
46- // Define sort order for planes in standard configuration
47- static bool sortPlaneStandard (const PlaneGeo& p1, const PlaneGeo& p2)
48- {
49- auto const xyz1 = p1.GetBoxCenter ();
50- auto const xyz2 = p2.GetBoxCenter ();
51-
52- // if the planes are in the same drift coordinate, lower Z is first plane
53- if ( std::abs (xyz1.X () - xyz2.X ()) < EPSILON)
54- return xyz1.Z () < xyz2.Z ();
55-
56- // else
57- // drift direction is negative, plane number increases in drift direction
58- return xyz1.X () > xyz2.X ();
59- }
60-
61-
62- // ----------------------------------------------------------------------------
63- static bool sortWireStandard (WireGeo const & w1, WireGeo const & w2){
64- auto const [xyz1, xyz2] = std::pair{w1.GetCenter (), w2.GetCenter ()};
65-
66- // we have horizontal wires...
67- if ( std::abs (xyz1.Z ()-xyz2.Z ()) < EPSILON)
68- return xyz1.Y () < xyz2.Y ();
69-
70- // in the other cases...
71- return xyz1.Z () < xyz2.Z ();
72- }
73-
74- // ----------------------------------------------------------------------------
75- GeoObjectSorterICARUS::GeoObjectSorterICARUS (fhicl::ParameterSet const & p)
76- {
77- }
78-
79- // ----------------------------------------------------------------------------
80- void GeoObjectSorterICARUS::SortAuxDets (std::vector<geo::AuxDetGeo> & adgeo) const
81- {
82- icarus::SortAuxDetsStandard (adgeo);
83- }
84-
85- // ----------------------------------------------------------------------------
86- void GeoObjectSorterICARUS::SortAuxDetSensitive (std::vector<geo::AuxDetSensitiveGeo> & adsgeo) const
87- {
88- icarus::SortAuxDetSensitiveStandard (adsgeo);
89- }
90-
91- // ----------------------------------------------------------------------------
92- void GeoObjectSorterICARUS::SortCryostats (std::vector<geo::CryostatGeo> & cgeo) const
93- {
94- std::sort (cgeo.begin (), cgeo.end (), sortCryoStandard);
95- }
96-
97- // ----------------------------------------------------------------------------
98- void GeoObjectSorterICARUS::SortTPCs (std::vector<geo::TPCGeo> & tgeo) const
99- {
100- std::sort (tgeo.begin (), tgeo.end (), sortTPCStandard);
101- }
102-
103- // ----------------------------------------------------------------------------
104- void GeoObjectSorterICARUS::SortPlanes (std::vector<geo::PlaneGeo> & pgeo,
105- geo::DriftDirection_t const driftDir) const
106- {
107- // sort the planes to increase in drift direction
108- // The drift direction has to be set before this method is called. It is set when
109- // the CryostatGeo objects are sorted by the CryostatGeo::SortSubVolumes method
110- if (driftDir == geo::kPosX ) std::sort (pgeo.rbegin (), pgeo.rend (), sortPlaneStandard);
111- else if (driftDir == geo::kNegX ) std::sort (pgeo.begin (), pgeo.end (), sortPlaneStandard);
112- else if (driftDir == geo::kUnknownDrift )
113- throw cet::exception (" TPCGeo" ) << " Drift direction is unknown, can't sort the planes\n " ;
114- }
115-
116- // ----------------------------------------------------------------------------
117- void GeoObjectSorterICARUS::SortWires (std::vector<geo::WireGeo> & wgeo) const
118- {
119- std::sort (wgeo.begin (), wgeo.end (), sortWireStandard);
120- }
121-
12240}
0 commit comments