LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
AuxDetGeoObjectSorterStandard.cxx
Go to the documentation of this file.
1 
9 
10 #include <cstdlib>
11 #include <string>
12 
13 namespace geo {
14 
17 
18  //----------------------------------------------------------------------------
20  AuxDetGeo const& ad2) const
21  {
22  // sort based off of GDML name, assuming ordering is encoded
23  std::string const ad1name = ad1.TotalVolume()->GetName();
24  std::string const ad2name = ad2.TotalVolume()->GetName();
25 
26  // assume volume name is "volAuxDet##"
27  int ad1Num = std::atoi(ad1name.substr(9, ad1name.size()).c_str());
28  int ad2Num = std::atoi(ad2name.substr(9, ad2name.size()).c_str());
29 
30  return ad1Num < ad2Num;
31  }
32 
33  //----------------------------------------------------------------------------
35  AuxDetSensitiveGeo const& ad2) const
36  {
37  // sort based off of GDML name, assuming ordering is encoded
38  std::string const ad1name = ad1.TotalVolume()->GetName();
39  std::string const ad2name = ad2.TotalVolume()->GetName();
40 
41  // assume volume name is "volAuxDetSensitive##"
42  int ad1Num = std::atoi(ad1name.substr(18, ad1name.size()).c_str());
43  int ad2Num = std::atoi(ad2name.substr(18, ad2name.size()).c_str());
44 
45  return ad1Num < ad2Num;
46  }
47 
48 }
Encapsulate the geometry of the sensitive portion of an auxiliary detector .
const TGeoVolume * TotalVolume() const
Encapsulate the geometry of an auxiliary detector.
const TGeoVolume * TotalVolume() const
Returns the distance of point from the center of the detector.
Definition: AuxDetGeo.h:87
bool compareAuxDets(AuxDetGeo const &ad1, AuxDetGeo const &ad2) const override
ROOT libraries.
bool compareAuxDetSensitives(AuxDetSensitiveGeo const &ad1, AuxDetSensitiveGeo const &ad2) const override