All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeometryObjectCollections.h
Go to the documentation of this file.
1 /**
2  * @file icarusalg/Geometry/details/GeometryObjectCollections.h
3  * @brief A few simple data type definitions.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date October 10, 2019
6  */
7 
8 #ifndef ICARUSALG_GEOMETRY_DETAILS_GEOMETRYOBJECTCOLLECTIONS_H
9 #define ICARUSALG_GEOMETRY_DETAILS_GEOMETRYOBJECTCOLLECTIONS_H
10 
11 
12 // LArSoft libraries
15 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
16 
17 // C/C++ standard library
18 #include <vector>
19 
20 
21 // -----------------------------------------------------------------------------
22 namespace icarus::details {
23 
24  // forward declarations
25  struct ChannelRange_t;
26 
27  //
28  // data type definitions
29  //
30 
31  /// Type of collection of TPCs (pointers to `geo::TPCGeo`).
32  using TPCColl_t = std::vector<geo::TPCGeo const*>;
33 
34  /// Type of collection of planes (pointers to `geo::PlaneGeo`).
35  using PlaneColl_t = std::vector<geo::PlaneGeo const*>;
36 
37 } // namespace icarus::details
38 
39 
40 // -----------------------------------------------------------------------------
41 // --- icarus::details::ChannelRange_t
42 // -----------------------------------------------------------------------------
43 namespace icarus::details { struct ChannelRange_t; }
44 
45 
46 /// A simple range of channels.
48  : std::pair<raw::ChannelID_t, raw::ChannelID_t>
49 {
50 
51  using std::pair<raw::ChannelID_t, raw::ChannelID_t>::pair;
52 
53  /// Returns the ID of the first channel in the range.
54  constexpr raw::ChannelID_t begin() const { return first; }
55 
56  /// Returns the ID of the channel after the last one in the range.
57  constexpr raw::ChannelID_t end() const { return second; }
58 
59  /// Returns whether this range includes the specified `channel`.
60  constexpr bool contains(raw::ChannelID_t channel) const
61  { return (channel >= begin()) && (channel < end()); }
62 
63 }; // struct icarus::details::ChannelRange_t
64 
65 
66 // ----------------------------------------------------------------------------
67 
68 #endif // ICARUSALG_GEOMETRY_DETAILS_GEOMETRYOBJECTCOLLECTIONS_H
constexpr raw::ChannelID_t end() const
Returns the ID of the channel after the last one in the range.
constexpr raw::ChannelID_t begin() const
Returns the ID of the first channel in the range.
std::vector< geo::PlaneGeo const * > PlaneColl_t
Type of collection of planes (pointers to geo::PlaneGeo).
Encapsulate the construction of a single detector plane.
constexpr bool contains(raw::ChannelID_t channel) const
Returns whether this range includes the specified channel.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::vector< geo::TPCGeo const * > TPCColl_t
Type of collection of TPCs (pointers to geo::TPCGeo).
Encapsulate the construction of a single detector plane.