All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbndcode/sbndcode/CRT/CRTGeoObjectSorter.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file CRTGeoObjectSorter.cxx
3 /// \brief Interface to algorithm class for sorting of AuxDetGeo objects
4 ///
5 /// Ported from AuxDetGeoObjectSorterLArIAT.cxx (Author: brebel@fnal.gov)
6 ///
7 /// \version $Id: $
8 /// \author mastbaum@uchicago.edu
9 ////////////////////////////////////////////////////////////////////////
10 
14 
15 namespace geo {
16 
17  //----------------------------------------------------------------------------
18  // Define sort order for AuxDets in standard configuration
19  static bool sortAuxDetSBND(const AuxDetGeo& ad1, const AuxDetGeo& ad2) {
20  // Sort using the center of the detector - primary ordering by z,
21  // then y, and x
22  double c1[3] = {0, 0, 0};
23  double c2[3] = {0, 0, 0};
24  ad1.GetCenter(c1);
25  ad2.GetCenter(c2);
26 
27  for (int i=2; i>0; i--) {
28  if (c1[i] != c2[i]){
29  return c1[i] < c2[i];
30  }
31  }
32 
33  return c1[0] < c2[0];
34 
35  }
36 
37  //----------------------------------------------------------------------------
38  // Define sort order for AuxDetSensitives in standard configuration
40  const AuxDetSensitiveGeo& ad2)
41  {
42  // Sort using the center of the detector - primary ordering by z,
43  // then y, and x
44  double c1[3] = {0, 0, 0};
45  double c2[3] = {0, 0, 0};
46  ad1.GetCenter(c1);
47  ad2.GetCenter(c2);
48 
49  for (int i=2; i>0; i--) {
50  if (c1[i] != c2[i]) {
51  return c1[i] < c2[i];
52  }
53  }
54 
55  return c1[0] < c2[0];
56  }
57 
58  //----------------------------------------------------------------------------
60  fhicl::ParameterSet const&) {}
61 
62  //----------------------------------------------------------------------------
64  std::vector<geo::AuxDetGeo> & adgeo) const {
65  std::sort(adgeo.begin(), adgeo.end(), sortAuxDetSBND);
66  }
67 
68  //----------------------------------------------------------------------------
70  std::vector<geo::AuxDetSensitiveGeo> & adsgeo) const {
71  std::sort(adsgeo.begin(), adsgeo.end(), sortAuxDetSensitiveSBND);
72  }
73 
74 } // namespace geo
Encapsulate the geometry of the sensitive portion of an auxiliary detector.
void SortAuxDets(std::vector< geo::AuxDetGeo > &adgeo) const
static bool sortAuxDetSBND(const AuxDetGeo &ad1, const AuxDetGeo &ad2)
Encapsulate the geometry of an auxiliary detector.
static bool sortAuxDetSensitiveSBND(const AuxDetSensitiveGeo &ad1, const AuxDetSensitiveGeo &ad2)
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.
void SortAuxDetSensitive(std::vector< geo::AuxDetSensitiveGeo > &adsgeo) const
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.
Definition: AuxDetGeo.cxx:62