All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeoObjectSorterPMTasTPC.h
Go to the documentation of this file.
1 /**
2  * @file icarusalg/Geometry/GeoObjectSorterPMTasTPC.h
3  * @brief Geometry object sorter with PMT following TPC wire order.
4  * @date April 26, 2020
5  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
6  * @see icarusalg/Geometry/GeoObjectSorterPMTasTPC.cxx
7  */
8 
9 #ifndef ICARUSCODE_GEOMETRY_GEOOBJECTSORTERPMTASTPC_H
10 #define ICARUSCODE_GEOMETRY_GEOOBJECTSORTERPMTASTPC_H
11 
12 // ICARUS libraries
13 #include "icarusalg/Geometry/details/PMTsorting.h" // icarus::PMTsorterStandard
14 
15 // LArSoft libraries
19 #include "larcorealg/CoreUtils/span.h" // util::span
20 
21 // framework libraries
22 #include "fhiclcpp/types/Table.h"
23 #include "fhiclcpp/ParameterSet.h"
24 
25 // C/C++ standard libraries
26 #include <vector>
27 
28 
29 // -----------------------------------------------------------------------------
30 namespace icarus { class GeoObjectSorterPMTasTPC; }
31 
32 /**
33  * @brief Geometry sorter having PMT channels follow the same order as TPC.
34  *
35  * This class sorts the elements of the LArSoft detector description.
36  * The TPC elements are sorted according to the "standard" algorithm
37  * (`geo::GeoObjectSorterStandard`). The PMT are arranged so that their channels
38  * mimic the order of the TPC channels (delegated to `icarus::PMTsorter`
39  * algorithm).
40  *
41  * The algorithm for assigning channels to the wires follows the criteria:
42  *
43  * * TPC are ordered by increasing _x_ (related to drift direction);
44  * * channels are assigned value ranges increasing with the TPC number,
45  * i.e. with increasing _x_ coordinate;
46  * * within a wire plane, channel number increases with the _z_ (beam direction)
47  * coordinate of the wire(s) behind the channel;
48  * * in case of same _z_ (as for ICARUS first induction plane), an increasing
49  * _y_ order (geographical vertical, toward the sky) is chosen.
50  *
51  * PMT channels are assigned by a fixed LArSoft algorithm, cryostat by cryostat
52  * with increasing cryostat number (first `C:0`, then `C:1`, ...).
53  * Each cryostat has its set of optical detectors, sorted by a customizable
54  * geometric sorting algorithm, and the channel number assignment follows the
55  * sequence of optical detectors as sorted by that algorithm.
56  *
57  * This class reimplements the geometric sorting algorithm following criteria
58  * similar to the TPC wires:
59  *
60  * * optical detectors are split by plane (_x_ direction);
61  * * starting with the plane with lower _x_, optical detectors are sorted
62  * by _z_ coordinate, then by _y_ coordinate.
63  *
64  *
65  * Configuration parameters
66  * -------------------------
67  *
68  * In addition to the parameters for the standard sorter
69  * (`geo::GeoObjectSorterStandard`), this sorter supports the following
70  * parameters:
71  *
72  * * `OpDetSorter` (configuration table; default: empty): configures the
73  * PMT sorter object (see `icarus::PMTsorter` for details)
74  *
75  */
77 
78  /// The sorting algorithm we use.
80 
81  using PMTsorterConfigTable = fhicl::Table<PMTsorter_t::Config>;
82 
83  public:
84 
85  /// Constructor: passes the configuration to the base class.
86  GeoObjectSorterPMTasTPC(fhicl::ParameterSet const& pset)
87  : geo::GeoObjectSorterStandard(pset)
88  , fPMTsorter
89  (PMTsorterConfigTable{ pset.get("OpDetSorter", fhicl::ParameterSet{}) }())
90  {}
91 
92 
93  /**
94  * @brief Sorts the specified optical detectors.
95  * @param opDets collection of pointers to all optical detectors in a cryostat
96  *
97  * The collection `opDets` of optical detectors is sorted in place.
98  * Sorting criteria are documented in `icarus::GeoObjectSorterPMTasTPC` class
99  * documentation.
100  *
101  * This algorithm requires all optical detectors to have their center defined
102  * (`geo::OpDetGeo::GetCenter()`). No other information is used.
103  *
104  * @note The current implementation is very sensitive to rounding errors!
105  *
106  */
107  virtual void SortOpDets(std::vector<geo::OpDetGeo>& opDets) const override
108  { fPMTsorter.sort(opDets); }
109 
110 
111  /// Custom ICARUS sorting of CRT.
112  virtual void SortAuxDets(std::vector<geo::AuxDetGeo>& adgeo) const override;
113 
114  /// Custom ICARUS sorting of CRT submodules.
115  virtual void SortAuxDetSensitive
116  (std::vector<geo::AuxDetSensitiveGeo> & adsgeo) const override;
117 
118  private:
119 
120  PMTsorter_t fPMTsorter; ///< PMT sorting algorithm.
121 
122 }; // icarus::GeoObjectSorterPMTasTPC
123 
124 
125 static_assert(std::is_base_of_v<geo::GeoObjectSorter, icarus::GeoObjectSorterPMTasTPC>);
126 
127 
128 // -----------------------------------------------------------------------------
129 
130 #endif // ICARUSCODE_GEOMETRY_GEOOBJECTSORTERPMTASTPC_H
virtual void SortAuxDetSensitive(std::vector< geo::AuxDetSensitiveGeo > &adsgeo) const override
Custom ICARUS sorting of CRT submodules.
An object with a begin and end iterator.
fhicl::Table< PMTsorter_t::Config > PMTsorterConfigTable
Class for approximate comparisons.
Interface to algorithm class for standard sorting of geo::XXXGeo objects.
virtual void SortOpDets(std::vector< geo::OpDetGeo > &opDets) const override
Sorts the specified optical detectors.
Sorter sorting PMT to follow the same order as TPC (standard).
Definition: PMTsorting.h:63
Encapsulate the geometry of an optical detector.
GeoObjectSorterStandard(fhicl::ParameterSet const &p)
virtual void SortAuxDets(std::vector< geo::AuxDetGeo > &adgeo) const override
Custom ICARUS sorting of CRT.
PMTsorter_t fPMTsorter
PMT sorting algorithm.
Geometry obect sorter with PMT following TPC wire order.
void sort(std::vector< geo::OpDetGeo > &opDets) const
Sorts the specified optical detectors.
Definition: PMTsorting.cxx:24
GeoObjectSorterPMTasTPC(fhicl::ParameterSet const &pset)
Constructor: passes the configuration to the base class.
Geometry sorter having PMT channels follow the same order as TPC.