ChannelMapCRMAlg.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ChannelMapCRMAlg.h
3 /// \brief Interface to algorithm class for a dual-phase detector channel mapping
4 ///
5 /// \version $Id: $
6 /// \author brebel@fnal.gov vgalymov@ipnl.in2p3.fr
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef GEO_CHANNELMAPCRMALG_H
9 #define GEO_CHANNELMAPCRMALG_H
10 
11 #include <vector>
12 #include <set>
13 #include <iostream>
14 
19 #include "fhiclcpp/ParameterSet.h"
20 
21 namespace geo{
22 
24 
25  public:
26 
27 
29 
30  void Initialize( GeometryData_t const& geodata ) override;
31  void Uninitialize() override;
32  std::vector<WireID> ChannelToWire(raw::ChannelID_t channel) const override;
33  unsigned int Nchannels() const override;
34  /// @brief Returns the number of channels in the specified ROP
35  /// @return number of channels in the specified ROP, 0 if non-existent
36  /// @todo Needs to be implemented
37  virtual unsigned int Nchannels(readout::ROPID const& ropid) const override;
38 
39 
40 
41  //@{
42  virtual double WireCoordinate
43  (double YPos, double ZPos, geo::PlaneID const& planeID) const override;
44  virtual double WireCoordinate(double YPos, double ZPos,
45  unsigned int PlaneNo,
46  unsigned int TPCNo,
47  unsigned int cstat) const override
48  { return WireCoordinate(YPos, ZPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
49  //@}
50 
51  //@{
52  virtual WireID NearestWireID
53  (const TVector3& worldPos, geo::PlaneID const& planeID) const override;
54  virtual WireID NearestWireID(const TVector3& worldPos,
55  unsigned int PlaneNo,
56  unsigned int TPCNo,
57  unsigned int cstat) const override
58  { return NearestWireID(worldPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
59  //@}
60 
61  //@{
63  (geo::WireID const& wireID) const override;
64  virtual raw::ChannelID_t PlaneWireToChannel(unsigned int plane,
65  unsigned int wire,
66  unsigned int tpc,
67  unsigned int cstat) const override
68  { return PlaneWireToChannel(geo::WireID(cstat, tpc, plane, wire)); }
69  //@}
70 
71  virtual SigType_t SignalTypeForChannelImpl( raw::ChannelID_t const channel ) const override;
72  virtual std::set<PlaneID> const& PlaneIDs() const override;
73 
74 
75 
76  //
77  // TPC set interface
78  //
79  /// @name TPC set mapping
80  /// @{
81  /**
82  * @brief Returns the total number of TPC sets in the specified cryostat
83  * @param cryoid cryostat ID
84  * @return number of TPC sets in the cryostat, or 0 if no cryostat found
85  */
86  virtual unsigned int NTPCsets(readout::CryostatID const& cryoid) const override;
87 
88  /// Returns the largest number of TPC sets any cryostat in the detector has
89  virtual unsigned int MaxTPCsets() const override;
90 
91  /// Returns whether we have the specified TPC set
92  /// @return whether the TPC set is valid and exists
93  virtual bool HasTPCset(readout::TPCsetID const& tpcsetid) const override;
94 
95  /// Returns the ID of the TPC set tpcid belongs to
96  virtual readout::TPCsetID TPCtoTPCset(geo::TPCID const& tpcid) const override;
97 
98  /**
99  * @brief Returns a list of ID of TPCs belonging to the specified TPC set
100  * @param tpcsetid ID of the TPC set to convert into TPC IDs
101  * @return the list of TPCs, empty if TPC set is invalid
102  *
103  * Note that the check is performed on the validity of the TPC set ID, that
104  * does not necessarily imply that the TPC set specified by the ID actually
105  * exists. Check the existence of the TPC set first (HasTPCset()).
106  * Behaviour on valid, non-existent TPC set IDs is undefined.
107  */
108  virtual std::vector<geo::TPCID> TPCsetToTPCs
109  (readout::TPCsetID const& tpcsetid) const override;
110 
111  /// Returns the ID of the first TPC belonging to the specified TPC set
113  (readout::TPCsetID const& tpcsetid) const override;
114 
115  /// @} TPC set mapping
116 
117 
118  //
119  // Readout plane interface
120  //
121  /// @name Readout plane mapping
122  /// @{
123  /**
124  * @brief Returns the total number of ROP in the specified TPC set
125  * @param tpcsetid TPC set ID
126  * @return number of readout planes in the TPC set, or 0 if no TPC set found
127  *
128  * Note that this methods explicitly check the existence of the TPC set.
129  */
130  virtual unsigned int NROPs(readout::TPCsetID const& tpcsetid) const override;
131 
132  /// Returns the largest number of ROPs a TPC set in the detector has
133  virtual unsigned int MaxROPs() const override;
134 
135  /// Returns whether we have the specified ROP
136  /// @return whether the readout plane is valid and exists
137  virtual bool HasROP(readout::ROPID const& ropid) const override;
138 
139  /// Returns the ID of the ROP planeid belongs to
141  (geo::PlaneID const& planeid) const override;
142 
143  /// Returns a list of ID of planes belonging to the specified ROP
144  virtual std::vector<geo::PlaneID> ROPtoWirePlanes
145  (readout::ROPID const& ropid) const override;
146 
147  /// Returns the ID of the first plane belonging to the specified ROP
149  (readout::ROPID const& ropid) const override;
150 
151  /**
152  * @brief Returns a list of ID of TPCs the specified ROP spans
153  * @param ropid ID of the readout plane
154  * @return the list of TPC IDs, empty if readout plane ID is invalid
155  *
156  * Note that this check is performed on the validity of the readout plane
157  * ID, that does not necessarily imply that the readout plane specified by
158  * the ID actually exists. Check if the ROP exists with HasROP().
159  * The behaviour on non-existing readout planes is undefined.
160  */
161  virtual std::vector<geo::TPCID> ROPtoTPCs
162  (readout::ROPID const& ropid) const override;
163 
164  /// Returns the ID of the ROP the channel belongs to
165  /// @throws cet::exception (category: "Geometry") if non-existent channel
166  virtual readout::ROPID ChannelToROP(raw::ChannelID_t channel) const override;
167 
168  /**
169  * @brief Returns the ID of the first channel in the specified readout plane
170  * @param ropid ID of the readout plane
171  * @return ID of first channel, or raw::InvalidChannelID if ID is invalid
172  *
173  * Note that this check is performed on the validity of the readout plane
174  * ID, that does not necessarily imply that the readout plane specified by
175  * the ID actually exists. Check if the ROP exists with HasROP().
176  * The behaviour for non-existing readout planes is undefined.
177  */
179  (readout::ROPID const& ropid) const override;
180 
181  /// @} Readout plane mapping
182 
183  /// Returns the object to sort geometry with
184  virtual geo::GeoObjectSorter const& Sorter() const override
185  { return fSorter; }
186 
187  private:
188 
189  unsigned int fNcryostat; ///< number of cryostats in the detector
190  unsigned int fNchannels; ///< number of channels in the detector
191  raw::ChannelID_t fTopChannel; ///< book keeping highest channel #
192  std::vector<unsigned int> fNTPC; ///< number of TPCs in each cryostat
193  std::set<View_t> fViews; ///< vector of the views present in the detector
194  std::set<PlaneID> fPlaneIDs; ///< vector of the PlaneIDs present in the detector
195  PlaneInfoMap_t<float> fFirstWireProj; ///< Distance (0,0,0) to first wire
196  ///< along orth vector per plane per TPC
197  PlaneInfoMap_t<float> fOrthVectorsY; ///< Unit vectors orthogonal to wires in
198  PlaneInfoMap_t<float> fOrthVectorsZ; ///< each plane - stored as 2 components
199  ///< to avoid having to invoke any bulky
200  ///< TObjects / CLHEP vectors etc
201  PlaneInfoMap_t<float> fWireCounts; ///< Number of wires in each plane - for
202  ///< range checking after calculation
203  TPCInfoMap_t<unsigned int> fNPlanes; ///< Number of planes in each TPC - for
204  ///< range checking after calculation
205  PlaneInfoMap_t<unsigned int> fPlaneBaselines; ///< The number of wires in all the
206  ///< tpcs and planes up to this one
207  ///< in the heirachy
208  PlaneInfoMap_t<unsigned int> fWiresPerPlane; ///< The number of wires in this plane
209  ///< in the heirachy
210  geo::GeoObjectSorterCRM fSorter; ///< class to sort geo objects
211 
212 
213  /// Retrieved the wire cound for the specified plane ID
214  unsigned int WireCount(geo::PlaneID const& id) const
215  { return AccessElement(fWireCounts, id); }
216 
217  /// Returns the largest number of TPCs in a single cryostat
218  unsigned int MaxTPCs() const;
219 
220  /// Converts a TPC ID into a TPC set ID using the same numerical indices
221  static readout::TPCsetID ConvertTPCtoTPCset(geo::TPCID const& tpcid);
222 
223  /// Converts a TPC set ID into a TPC ID using the same numerical indices
224  static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const& tpcsetid);
225 
226  /// Converts a ROP ID into a wire plane ID using the same numerical indices
227  static readout::ROPID ConvertWirePlaneToROP(geo::PlaneID const& planeid);
228 
229  /// Converts a wire plane ID into a ROP ID using the same numerical indices
231 
232  };
233 }
234 #endif // GEO_CHANNELMAPCRMDALG_H
235 
Interface for a class providing readout channel mapping to geometry.
Definition: ChannelMapAlg.h:48
virtual std::vector< geo::PlaneID > ROPtoWirePlanes(readout::ROPID const &ropid) const override
Returns a list of ID of planes belonging to the specified ROP.
virtual unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
Classes identifying readout-related concepts.
virtual SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const override
Return the signal type of the specified channel.
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROP in the specified TPC set.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
PlaneInfoMap_t< unsigned int > fPlaneBaselines
virtual readout::TPCsetID TPCtoTPCset(geo::TPCID const &tpcid) const override
Returns the ID of the TPC set tpcid belongs to.
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:70
virtual geo::TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
uint8_t channel
Definition: CRTFragment.hh:201
std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
virtual double WireCoordinate(double YPos, double ZPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const override
Returns the index of the wire nearest to the specified position.
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const override
Returns the ID of the first channel in the specified readout plane.
std::vector< std::vector< T >> TPCInfoMap_t
Data type for per-TPC information.
TPCInfoMap_t< std::vector< T >> PlaneInfoMap_t
Data type for per-plane information.
geo::GeoObjectSorterCRM fSorter
class to sort geo objects
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
void Initialize(GeometryData_t const &geodata) override
Geometry initialisation.
virtual std::set< PlaneID > const & PlaneIDs() const override
Returns a list of the plane IDs in the whole detector.
enum geo::_plane_sigtype SigType_t
virtual unsigned int MaxROPs() const override
Returns the largest number of ROPs a TPC set in the detector has.
unsigned int fNchannels
number of channels in the detector
virtual WireID NearestWireID(const TVector3 &worldPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const override
Returns the ID of the wire nearest to the specified position.
p
Definition: test.py:223
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
virtual bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
static geo::PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
static readout::TPCsetID ConvertTPCtoTPCset(geo::TPCID const &tpcid)
Converts a TPC ID into a TPC set ID using the same numerical indices.
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
Definition of data types for geometry description.
virtual unsigned int MaxTPCsets() const override
Returns the largest number of TPC sets any cryostat in the detector has.
Interface to algorithm class for sorting dual-phase CRM of geo::XXXGeo objects.
Class identifying a set of planes sharing readout channels.
raw::ChannelID_t fTopChannel
book keeping highest channel #
PlaneInfoMap_t< unsigned int > fWiresPerPlane
unsigned int fNcryostat
number of cryostats in the detector
virtual raw::ChannelID_t PlaneWireToChannel(unsigned int plane, unsigned int wire, unsigned int tpc, unsigned int cstat) const override
Returns the channel ID a wire is connected to.
PlaneInfoMap_t< float > fOrthVectorsZ
unsigned int WireCount(geo::PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
virtual raw::ChannelID_t PlaneWireToChannel(geo::WireID const &wireID) const override
Returns the channel ID a wire is connected to.
virtual readout::ROPID ChannelToROP(raw::ChannelID_t channel) const override
static readout::ROPID ConvertWirePlaneToROP(geo::PlaneID const &planeid)
Converts a ROP ID into a wire plane ID using the same numerical indices.
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
ChannelMapCRMAlg(fhicl::ParameterSet const &p)
TPCInfoMap_t< unsigned int > fNPlanes
virtual bool HasROP(readout::ROPID const &ropid) const override
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
unsigned int Nchannels() const override
Returns the total number of channels present (not necessarily contiguous)
virtual std::vector< geo::TPCID > ROPtoTPCs(readout::ROPID const &ropid) const override
Returns a list of ID of TPCs the specified ROP spans.
Data in the geometry description.
Definition: GeometryData.h:31
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
virtual geo::GeoObjectSorter const & Sorter() const override
Returns the object to sort geometry with.
Interface to algorithm class for a specific detector channel mapping.
PlaneInfoMap_t< float > fWireCounts
PlaneInfoMap_t< float > fFirstWireProj
virtual readout::ROPID WirePlaneToROP(geo::PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
std::set< View_t > fViews
vector of the views present in the detector
The data type to uniquely identify a cryostat.
Definition: geo_types.h:190
virtual WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
virtual std::vector< geo::TPCID > TPCsetToTPCs(readout::TPCsetID const &tpcsetid) const override
Returns a list of ID of TPCs belonging to the specified TPC set.