All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
icarus::PMTsorterStandard Class Reference

Sorter sorting PMT to follow the same order as TPC (standard). More...

#include <PMTsorting.h>

Classes

struct  Config
 
struct  OpDetGeoCenterCoordComparer
 

Public Member Functions

 PMTsorterStandard (Config const &config)
 Constructor: passes the configuration to the base class. More...
 
void sort (std::vector< geo::OpDetGeo > &opDets) const
 Sorts the specified optical detectors. More...
 
void operator() (std::vector< geo::OpDetGeo > &opDets) const
 

Private Types

using OpDetList_t = std::vector< geo::OpDetGeo >
 List of optical detector pointers for sorting. More...
 
using OpDetSpan_t = util::span< OpDetList_t::iterator >
 Part of list of optical detector pointers for sorting. More...
 

Private Member Functions

void sortInPlane (OpDetSpan_t const &opDets) const
 Sorts the geo::OpDetGeo assuming they belong to the same plane. More...
 

Private Attributes

OpDetGeoCenterCoordComparer
<&geo::Point_t::X > const 
fSmallerCenterX
 Sorting criterium according to x coordinate of geo::OpDetGeo center. More...
 
OpDetGeoCenterCoordComparer
<&geo::Point_t::Y > const 
fSmallerCenterY
 Sorting criterium according to y coordinate of geo::OpDetGeo center. More...
 
OpDetGeoCenterCoordComparer
<&geo::Point_t::Z > const 
fSmallerCenterZ
 Sorting criterium according to z coordinate of geo::OpDetGeo center. More...
 

Detailed Description

Sorter sorting PMT to follow the same order as TPC (standard).

This class sorts the elements of the LArSoft detector description. The "standard" algorithm (geo::GeoObjectSorterStandard) arranges TPC elements with x, then z, then y. The PMT are arranged so that their channels mimic the order of the TPC channels.

The algorithm for assigning channels to the PMT follows the criteria:

PMT channels are assigned by a fixed LArSoft algorithm, cryostat by cryostat with increasing cryostat number (first C:0, then C:1, ...).

Configuration parameters

This sorter supports the following parameters:

Definition at line 63 of file PMTsorting.h.

Member Typedef Documentation

List of optical detector pointers for sorting.

Definition at line 66 of file PMTsorting.h.

using icarus::PMTsorterStandard::OpDetSpan_t = util::span<OpDetList_t::iterator>
private

Part of list of optical detector pointers for sorting.

Definition at line 69 of file PMTsorting.h.

Constructor & Destructor Documentation

icarus::PMTsorterStandard::PMTsorterStandard ( Config const &  config)
inline

Constructor: passes the configuration to the base class.

Definition at line 100 of file PMTsorting.h.

101  : fSmallerCenterX{ config.ToleranceX() }
102  , fSmallerCenterY{ config.ToleranceY() }
103  , fSmallerCenterZ{ config.ToleranceZ() }
104  {}
OpDetGeoCenterCoordComparer<&geo::Point_t::X > const fSmallerCenterX
Sorting criterium according to x coordinate of geo::OpDetGeo center.
Definition: PMTsorting.h:152
OpDetGeoCenterCoordComparer<&geo::Point_t::Y > const fSmallerCenterY
Sorting criterium according to y coordinate of geo::OpDetGeo center.
Definition: PMTsorting.h:155
OpDetGeoCenterCoordComparer<&geo::Point_t::Z > const fSmallerCenterZ
Sorting criterium according to z coordinate of geo::OpDetGeo center.
Definition: PMTsorting.h:158

Member Function Documentation

void icarus::PMTsorterStandard::operator() ( std::vector< geo::OpDetGeo > &  opDets) const
inline

Definition at line 124 of file PMTsorting.h.

124 { sort(opDets); }
void sort(std::vector< geo::OpDetGeo > &opDets) const
Sorts the specified optical detectors.
Definition: PMTsorting.cxx:24
void icarus::PMTsorterStandard::sort ( std::vector< geo::OpDetGeo > &  opDets) const

Sorts the specified optical detectors.

Parameters
opDetscollection of pointers to all optical detectors in a cryostat

The collection opDets of optical detectors is sorted in place. Sorting criteria are documented in icarus::GeoObjectSorterPMTasTPC class documentation.

This algorithm requires all optical detectors to have their center defined (geo::OpDetGeo::GetCenter()). No other information is used.

Note
The current implementation is very sensitive to rounding errors!

Definition at line 24 of file PMTsorting.cxx.

24  {
25  assert(opDets.size() % 2 == 0); // must be even!
26 
27  /*
28  * 1. sort all optical detectors by _x_
29  * 2. split them by plane
30  * 3. sort the detectors within each plane.
31  */
32 
33  //
34  // 1. sort all optical detectors by _x_
35  //
36  std::sort(begin(opDets), end(opDets), fSmallerCenterX);
37 
38  //
39  // 2. split them by plane: we take a horrible shortcut here...
40  //
41 
42  std::vector<OpDetSpan_t> OpDetsPerPlane;
43 
44  // just split the list in two
45  auto const middle = std::next(opDets.begin(), opDets.size() / 2U);
46  assert(fSmallerCenterX(*std::prev(middle), *middle));
47 
48  OpDetsPerPlane.emplace_back(opDets.begin(), middle);
49  OpDetsPerPlane.emplace_back(middle, opDets.end());
50  assert(OpDetsPerPlane[0].size() == OpDetsPerPlane[1].size());
51 
52  //
53  // 3. sort the detectors within each plane.
54  //
55  for (auto const& planeOpDets: OpDetsPerPlane)
56  sortInPlane(util::make_span(planeOpDets));
57 
58  // all done in place, no return
59 
60 } // icarus::PMTsorterStandard::sort()
OpDetGeoCenterCoordComparer<&geo::Point_t::X > const fSmallerCenterX
Sorting criterium according to x coordinate of geo::OpDetGeo center.
Definition: PMTsorting.h:152
auto make_span(BIter begin, EIter end)
Creates a span from specified iterators (can use constructor instead).
Definition: span.h:197
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void sortInPlane(OpDetSpan_t const &opDets) const
Sorts the geo::OpDetGeo assuming they belong to the same plane.
Definition: PMTsorting.cxx:64
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
void icarus::PMTsorterStandard::sortInPlane ( OpDetSpan_t const &  opDets) const
private

Sorts the geo::OpDetGeo assuming they belong to the same plane.

Definition at line 64 of file PMTsorting.cxx.

64  {
65  /*
66  * 0. assume it's already sorted by _x_
67  * 1. sort by vertical coordinate (_y_)
68  * 2. stable sort by beam coordinate (_z_)
69  */
70 
71  // 1. sort by vertical coordinate (_y_)
72  std::stable_sort(begin(opDets), end(opDets), fSmallerCenterY);
73 
74  // 2. stable sort by beam coordinate (_z_)
75  std::stable_sort(begin(opDets), end(opDets), fSmallerCenterZ);
76 
77 } // icarus::PMTsorterStandard::sortInPlane()
OpDetGeoCenterCoordComparer<&geo::Point_t::Y > const fSmallerCenterY
Sorting criterium according to y coordinate of geo::OpDetGeo center.
Definition: PMTsorting.h:155
OpDetGeoCenterCoordComparer<&geo::Point_t::Z > const fSmallerCenterZ
Sorting criterium according to z coordinate of geo::OpDetGeo center.
Definition: PMTsorting.h:158
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573

Member Data Documentation

OpDetGeoCenterCoordComparer<&geo::Point_t::X> const icarus::PMTsorterStandard::fSmallerCenterX
private

Sorting criterium according to x coordinate of geo::OpDetGeo center.

Definition at line 152 of file PMTsorting.h.

OpDetGeoCenterCoordComparer<&geo::Point_t::Y> const icarus::PMTsorterStandard::fSmallerCenterY
private

Sorting criterium according to y coordinate of geo::OpDetGeo center.

Definition at line 155 of file PMTsorting.h.

OpDetGeoCenterCoordComparer<&geo::Point_t::Z> const icarus::PMTsorterStandard::fSmallerCenterZ
private

Sorting criterium according to z coordinate of geo::OpDetGeo center.

Definition at line 158 of file PMTsorting.h.


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