LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo::AuxDetGeoObjectSorterStandard Class Reference

#include "AuxDetGeoObjectSorterStandard.h"

Inheritance diagram for geo::AuxDetGeoObjectSorterStandard:
geo::AuxDetGeoObjectSorter

Public Member Functions

 AuxDetGeoObjectSorterStandard ()
 
 AuxDetGeoObjectSorterStandard (fhicl::ParameterSet const &)
 
void sort (std::vector< AuxDetGeo > &ads) const
 
void sort (std::vector< AuxDetSensitiveGeo > &adss) const
 

Private Member Functions

bool compareAuxDets (AuxDetGeo const &ad1, AuxDetGeo const &ad2) const override
 
bool compareAuxDetSensitives (AuxDetSensitiveGeo const &ad1, AuxDetSensitiveGeo const &ad2) const override
 

Detailed Description

Definition at line 17 of file AuxDetGeoObjectSorterStandard.h.

Constructor & Destructor Documentation

geo::AuxDetGeoObjectSorterStandard::AuxDetGeoObjectSorterStandard ( )
default
geo::AuxDetGeoObjectSorterStandard::AuxDetGeoObjectSorterStandard ( fhicl::ParameterSet const &  )
explicit

Definition at line 16 of file AuxDetGeoObjectSorterStandard.cxx.

16 {}

Member Function Documentation

bool geo::AuxDetGeoObjectSorterStandard::compareAuxDets ( AuxDetGeo const &  ad1,
AuxDetGeo const &  ad2 
) const
overrideprivatevirtual

Implements geo::AuxDetGeoObjectSorter.

Definition at line 19 of file AuxDetGeoObjectSorterStandard.cxx.

References geo::AuxDetGeo::TotalVolume().

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  }
bool geo::AuxDetGeoObjectSorterStandard::compareAuxDetSensitives ( AuxDetSensitiveGeo const &  ad1,
AuxDetSensitiveGeo const &  ad2 
) const
overrideprivatevirtual

Implements geo::AuxDetGeoObjectSorter.

Definition at line 34 of file AuxDetGeoObjectSorterStandard.cxx.

References geo::AuxDetSensitiveGeo::TotalVolume().

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  }
void geo::AuxDetGeoObjectSorter::sort ( std::vector< AuxDetGeo > &  ads) const
inherited

Definition at line 18 of file AuxDetGeoObjectSorter.cxx.

References geo::AuxDetGeoObjectSorter::compareAuxDets().

Referenced by geo::AuxDetGeo::SortSubVolumes().

19  {
20  std::sort(ads.begin(), ads.end(), bind(&AuxDetGeoObjectSorter::compareAuxDets, this));
21  }
virtual bool compareAuxDets(AuxDetGeo const &ad1, AuxDetGeo const &ad2) const =0
void geo::AuxDetGeoObjectSorter::sort ( std::vector< AuxDetSensitiveGeo > &  adss) const
inherited

Definition at line 23 of file AuxDetGeoObjectSorter.cxx.

References geo::AuxDetGeoObjectSorter::compareAuxDetSensitives().

24  {
25  std::sort(
26  adss.begin(), adss.end(), bind(&AuxDetGeoObjectSorter::compareAuxDetSensitives, this));
27  }
virtual bool compareAuxDetSensitives(AuxDetSensitiveGeo const &ads1, AuxDetSensitiveGeo const &ads2) const =0

The documentation for this class was generated from the following files: