LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::ChannelMapAlg Class Referenceabstract

Interface for a class providing readout channel mapping to geometry. More...

#include "ChannelMapAlg.h"

Inheritance diagram for geo::ChannelMapAlg:
geo::ChannelMapStandardAlg

Public Member Functions

virtual ~ChannelMapAlg ()=default
 
virtual GeoObjectSorter const & Sorter () const =0
 Returns the object to sort geometry with. More...
 
Geometry and mapping initialization and management
virtual void Initialize (GeometryData_t const &geodata)=0
 Geometry initialisation. More...
 
virtual void Uninitialize ()=0
 Deconfiguration: prepare for a following call of Initialize() More...
 
Optical detector channel mapping
virtual unsigned int NOpChannels (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
virtual unsigned int MaxOpChannel (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
virtual unsigned int NOpHardwareChannels (unsigned int opDet) const
 Returns the number of channels in the specified optical detectors. More...
 
virtual bool IsValidOpChannel (unsigned int opChannel, unsigned int NOpDets) const
 Returns whether the ID identifies a valid optical detector channel. More...
 
virtual unsigned int OpChannel (unsigned int detNum, unsigned int hwchannel=0) const
 Returns the channel ID of the specified hardware channel. More...
 
virtual unsigned int OpDetFromOpChannel (unsigned int opChannel) const
 Returns the optical detector the specified optical channel belongs. More...
 
virtual unsigned int HardwareChannelFromOpChannel (unsigned int opChannel) const
 Returns the hardware channel number of specified optical channel. More...
 
Mapping of position to wires
virtual double WireCoordinate (double YPos, double ZPos, PlaneID const &planeID) const =0
 Returns the index of the wire nearest to the specified position. More...
 
virtual WireID NearestWireID (Point_t const &worldPos, PlaneID const &planeID) const =0
 Returns the ID of the wire nearest to the specified position. More...
 
Auxiliary detectors
virtual size_t NearestAuxDet (Point_t const &point, std::vector< AuxDetGeo > const &auxDets, double tolerance=0) const
 Returns the auxiliary detector closest to the specified point. More...
 
virtual size_t NearestSensitiveAuxDet (Point_t const &point, std::vector< AuxDetGeo > const &auxDets, double tolerance=0) const
 Returns sensitive auxiliary detector closest to specified point. More...
 
virtual size_t ChannelToAuxDet (std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
 Returns the index of the detector containing the specified channel. More...
 
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet (std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
 Returns the index of the sensitive detector containing the channel. More...
 
TPC set mapping
virtual unsigned int NTPCsets (readout::CryostatID const &cryoid) const =0
 Returns the total number of TPC sets in the specified cryostat. More...
 
virtual unsigned int MaxTPCsets () const =0
 Returns the largest number of TPC sets any cryostat in the detector has. More...
 
virtual bool HasTPCset (readout::TPCsetID const &tpcsetid) const =0
 
virtual readout::TPCsetID TPCtoTPCset (TPCID const &tpcid) const =0
 Returns the ID of the TPC set tpcid belongs to. More...
 
virtual std::vector< TPCIDTPCsetToTPCs (readout::TPCsetID const &tpcsetid) const =0
 Returns a list of ID of TPCs belonging to the specified TPC set. More...
 
virtual TPCID FirstTPCinTPCset (readout::TPCsetID const &tpcsetid) const =0
 Returns the ID of the first TPC belonging to the specified TPC set. More...
 
Readout plane mapping
virtual unsigned int NROPs (readout::TPCsetID const &tpcsetid) const =0
 Returns the total number of ROP in the specified TPC set. More...
 
virtual unsigned int MaxROPs () const =0
 Returns the largest number of ROPs a TPC set in the detector has. More...
 
virtual bool HasROP (readout::ROPID const &ropid) const =0
 
virtual readout::ROPID WirePlaneToROP (PlaneID const &planeid) const =0
 Returns the ID of the ROP planeid belongs to. More...
 
virtual std::vector< PlaneIDROPtoWirePlanes (readout::ROPID const &ropid) const =0
 Returns a list of ID of planes belonging to the specified ROP. More...
 
virtual PlaneID FirstWirePlaneInROP (readout::ROPID const &ropid) const =0
 Returns the ID of the first plane belonging to the specified ROP. More...
 
virtual std::vector< TPCIDROPtoTPCs (readout::ROPID const &ropid) const =0
 Returns a list of ID of TPCs the specified ROP spans. More...
 
virtual readout::ROPID ChannelToROP (raw::ChannelID_t channel) const =0
 Returns the ID of the ROP the channel belongs to. More...
 
virtual raw::ChannelID_t FirstChannelInROP (readout::ROPID const &ropid) const =0
 Returns the ID of the first channel in the specified readout plane. More...
 
Testing (not in the interface)
std::vector< std::vector< std::vector< raw::ChannelID_t > > > const & FirstChannelInNextPlane () const
 Retrieve the private fFirstChannelInNextPlane vector for testing. More...
 
std::vector< std::vector< std::vector< raw::ChannelID_t > > > const & FirstChannelInThisPlane () const
 Retrieve the private fFirstChannelInThisPlane vector for testing. More...
 

Protected Types

template<typename T >
using TPCInfoMap_t = std::vector< std::vector< T >>
 Data type for per-TPC information. More...
 
template<typename T >
using PlaneInfoMap_t = TPCInfoMap_t< std::vector< T >>
 Data type for per-plane information. More...
 

Protected Member Functions

template<typename T >
T const & AccessElement (PlaneInfoMap_t< T > const &map, PlaneID const &id) const
 Returns the specified element of the plane map. More...
 
template<typename T >
size_t AccessElementSize (PlaneInfoMap_t< T > const &map, TPCID const &id) const
 Returns the number of elements in the specified TPC of the plane map. More...
 
template<typename T >
T const * GetElementPtr (PlaneInfoMap_t< T > const &map, PlaneID const &id) const
 Returns a pointer to the specified element, or nullptr if invalid. More...
 
Internal structure data access

These functions allow access to the XxxInfoMap_t types based on geometry element IDs. They are strictly internal.

template<typename T >
T const & AccessElement (TPCInfoMap_t< T > const &map, TPCID const &id) const
 Returns the specified element of the TPC map. More...
 
template<typename T >
size_t AccessElementSize (TPCInfoMap_t< T > const &map, CryostatID const &id) const
 Returns the number of elements in the specified cryostat of the TPC map. More...
 
template<typename T >
bool isValidElement (TPCInfoMap_t< T > const &map, CryostatID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (TPCInfoMap_t< T > const &map, TPCID const &id) const
 Returns the specified element of the TPC map. More...
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, CryostatID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, TPCID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, PlaneID const &id) const
 Returns whether the ID specifies a valid entry. More...
 

Protected Attributes

PlaneInfoMap_t< raw::ChannelID_tfFirstChannelInThisPlane
 
PlaneInfoMap_t< raw::ChannelID_tfFirstChannelInNextPlane
 
std::map< std::string, size_t > fADNameToGeo
 map the names of the dets to the AuxDetGeo objects More...
 
std::map< size_t, std::vector< size_t > > fADChannelToSensitiveGeo
 

TPC channel mapping

virtual unsigned int Nchannels () const =0
 Returns the total number of channels present (not necessarily contiguous) More...
 
virtual unsigned int Nchannels (readout::ROPID const &ropid) const =0
 Returns the number of channels in the specified ROP. More...
 
virtual bool HasChannel (raw::ChannelID_t channel) const
 Returns whether the specified channel is valid This default implementation assumes all channels up to Nchannels() valid. More...
 
virtual std::vector< WireIDChannelToWire (raw::ChannelID_t channel) const =0
 
SigType_t SignalTypeForChannel (raw::ChannelID_t const channel) const
 Return the signal type of the specified channel. More...
 
SigType_t SignalTypeForROPID (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 
virtual std::set< PlaneID > const & PlaneIDs () const =0
 Returns a list of the plane IDs in the whole detector. More...
 
virtual raw::ChannelID_t PlaneWireToChannel (WireID const &wireID) const =0
 Returns the channel ID a wire is connected to. More...
 
virtual SigType_t SignalTypeForChannelImpl (raw::ChannelID_t const channel) const =0
 Return the signal type of the specified channel. More...
 
virtual SigType_t SignalTypeForROPIDImpl (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 

Detailed Description

Interface for a class providing readout channel mapping to geometry.

Note
A number of methods react specifically when provided with invalid IDs as arguments. An invalid ID is an ID with the isValid flag unset, or, in case of channel IDs, an ID with value raw::InvalidChannelID. An ID that does not present this feature is by definition "valid"; this does not imply that the represented entity (channel, geometry entity or readout group) actually exists. The behaviour of the methods to valid, non-existent IDs should be considered undefined, and it is recommended that the existence of the entity is checked beforehand. Unless the documentation explicitly defines a behaviour, an undefined behaviour should be assumed; nevertheless, the documentation of some of the methods still reminds of this.

Definition at line 48 of file ChannelMapAlg.h.

Member Typedef Documentation

template<typename T >
using geo::ChannelMapAlg::PlaneInfoMap_t = TPCInfoMap_t<std::vector<T>>
protected

Data type for per-plane information.

Definition at line 484 of file ChannelMapAlg.h.

template<typename T >
using geo::ChannelMapAlg::TPCInfoMap_t = std::vector<std::vector<T>>
protected

Data type for per-TPC information.

Definition at line 480 of file ChannelMapAlg.h.

Constructor & Destructor Documentation

virtual geo::ChannelMapAlg::~ChannelMapAlg ( )
virtualdefault

Member Function Documentation

template<typename T >
T const& geo::ChannelMapAlg::AccessElement ( TPCInfoMap_t< T > const &  map,
TPCID const &  id 
) const
inlineprotected

Returns the specified element of the TPC map.

Definition at line 508 of file ChannelMapAlg.h.

Referenced by geo::ChannelMapStandardAlg::FirstChannelInROP(), geo::ChannelMapStandardAlg::NROPs(), geo::ChannelMapStandardAlg::WireCoordinate(), and geo::ChannelMapStandardAlg::WireCount().

509  {
510  return map[id.Cryostat][id.TPC];
511  }
template<typename T >
T const& geo::ChannelMapAlg::AccessElement ( PlaneInfoMap_t< T > const &  map,
PlaneID const &  id 
) const
inlineprotected

Returns the specified element of the plane map.

Definition at line 536 of file ChannelMapAlg.h.

537  {
538  return map[id.Cryostat][id.TPC][id.Plane];
539  }
template<typename T >
size_t geo::ChannelMapAlg::AccessElementSize ( TPCInfoMap_t< T > const &  map,
CryostatID const &  id 
) const
inlineprotected

Returns the number of elements in the specified cryostat of the TPC map.

Definition at line 515 of file ChannelMapAlg.h.

516  {
517  return map[id.Cryostat].size();
518  }
template<typename T >
size_t geo::ChannelMapAlg::AccessElementSize ( PlaneInfoMap_t< T > const &  map,
TPCID const &  id 
) const
inlineprotected

Returns the number of elements in the specified TPC of the plane map.

Definition at line 543 of file ChannelMapAlg.h.

544  {
545  return map[id.Cryostat][id.TPC].size();
546  }
size_t geo::ChannelMapAlg::ChannelToAuxDet ( std::vector< AuxDetGeo > const &  auxDets,
std::string const &  detName,
uint32_t const &  channel 
) const
virtual

Returns the index of the detector containing the specified channel.

Parameters
auxDetslist of the auxiliary detectors
detNamename of the auxiliary detector being investigated
channelnumber of the channel within that auxiliary detector
Returns
index of the sought auxiliary detector within auxDets
Bug:
This function is somehow broken in that it ignores the auxDets in the arguments and instead relies on a cache that is never filled by this class (derived classes can fill it though).

Definition at line 137 of file ChannelMapAlg.cxx.

References fADNameToGeo.

Referenced by ChannelToSensitiveAuxDet(), and HasChannel().

140  {
141  // loop over the map of AuxDet names to Geo object numbers to determine which auxdet
142  // we have. If no name in the map matches the provided string, throw an exception
143  for (auto itr : fADNameToGeo)
144  if (itr.first.compare(detName) == 0) return itr.second;
145 
146  throw cet::exception("Geometry") << "No AuxDetGeo matching name: " << detName;
147  }
std::map< std::string, size_t > fADNameToGeo
map the names of the dets to the AuxDetGeo objects
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual readout::ROPID geo::ChannelMapAlg::ChannelToROP ( raw::ChannelID_t  channel) const
pure virtual

Returns the ID of the ROP the channel belongs to.

Returns
the ID of the ROP the channel belongs to (invalid if channel is)
See also
HasChannel()

The channel must exist, or be the invalid channel value. With a channel that is not present in the mapping and that is not the invalid channel (raw::InvalidChannelID), the result is undefined.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

std::pair< size_t, size_t > geo::ChannelMapAlg::ChannelToSensitiveAuxDet ( std::vector< AuxDetGeo > const &  auxDets,
std::string const &  detName,
uint32_t const &  channel 
) const
virtual

Returns the index of the sensitive detector containing the channel.

Parameters
auxDetslist of the sensitive auxiliary detectors
detNamename of the auxiliary detector being investigated
channelnumber of the channel within that auxiliary detector
Returns
index of the sought sensitive auxiliary detector within auxDets

Definition at line 152 of file ChannelMapAlg.cxx.

References ChannelToAuxDet(), and fADChannelToSensitiveGeo.

Referenced by HasChannel().

156  {
157  size_t adGeoIdx = this->ChannelToAuxDet(auxDets, detName, channel);
158 
159  // look for the index of the sensitive volume for the given channel
160  if (fADChannelToSensitiveGeo.count(adGeoIdx) > 0) {
161 
162  auto itr = fADChannelToSensitiveGeo.find(adGeoIdx);
163 
164  // get the vector of channels to AuxDetSensitiveGeo index
165  if (channel < itr->second.size()) return std::make_pair(adGeoIdx, itr->second[channel]);
166 
167  throw cet::exception("Geometry")
168  << "Given AuxDetSensitive channel, " << channel
169  << ", cannot be found in vector associated to AuxDetGeo index: " << adGeoIdx
170  << ". Vector has size " << itr->second.size();
171  }
172 
173  throw cet::exception("Geometry") << "Given AuxDetGeo with index " << adGeoIdx
174  << " does not correspond to any vector of sensitive volumes";
175  }
virtual size_t ChannelToAuxDet(std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
Returns the index of the detector containing the specified channel.
std::map< size_t, std::vector< size_t > > fADChannelToSensitiveGeo
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual std::vector<WireID> geo::ChannelMapAlg::ChannelToWire ( raw::ChannelID_t  channel) const
pure virtual

Returns a list of TPC wires connected to the specified readout channel ID

Exceptions
cet::exception(category: "Geometry") if non-existent channel

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

std::vector<std::vector<std::vector<raw::ChannelID_t> > > const& geo::ChannelMapAlg::FirstChannelInNextPlane ( ) const
inline

Retrieve the private fFirstChannelInNextPlane vector for testing.

Definition at line 462 of file ChannelMapAlg.h.

References fFirstChannelInThisPlane.

463  {
465  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
virtual raw::ChannelID_t geo::ChannelMapAlg::FirstChannelInROP ( readout::ROPID const &  ropid) const
pure virtual

Returns the ID of the first channel in the specified readout plane.

Parameters
ropidID of the readout plane
Returns
ID of first channel, or raw::InvalidChannelID if ID is invalid

Note that this check is performed on the validity of the readout plane ID, that does not necessarily imply that the readout plane specified by the ID actually exists. Check if the ROP exists with HasROP(). The behaviour for non-existing readout planes is undefined.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel(), and SignalTypeForROPIDImpl().

std::vector<std::vector<std::vector<raw::ChannelID_t> > > const& geo::ChannelMapAlg::FirstChannelInThisPlane ( ) const
inline

Retrieve the private fFirstChannelInThisPlane vector for testing.

Definition at line 468 of file ChannelMapAlg.h.

References fFirstChannelInNextPlane.

469  {
471  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
virtual TPCID geo::ChannelMapAlg::FirstTPCinTPCset ( readout::TPCsetID const &  tpcsetid) const
pure virtual

Returns the ID of the first TPC belonging to the specified TPC set.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual PlaneID geo::ChannelMapAlg::FirstWirePlaneInROP ( readout::ROPID const &  ropid) const
pure virtual

Returns the ID of the first plane belonging to the specified ROP.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

template<typename T >
T const* geo::ChannelMapAlg::GetElementPtr ( PlaneInfoMap_t< T > const &  map,
PlaneID const &  id 
) const
inlineprotected

Returns a pointer to the specified element, or nullptr if invalid.

Definition at line 569 of file ChannelMapAlg.h.

Referenced by geo::ChannelMapStandardAlg::PlaneWireToChannel().

570  {
571  if (id.Cryostat >= map.size()) return nullptr;
572  auto const& cryo_map = map[id.Cryostat];
573  if (id.TPC >= cryo_map.size()) return nullptr;
574  auto const& TPC_map = cryo_map[id.TPC];
575  if (id.Plane >= TPC_map.size()) return nullptr;
576  auto const& plane_map = TPC_map[id.Plane];
577  return &plane_map;
578  } // GetElementPtr()
recob::tracking::Plane Plane
Definition: TrackState.h:17
unsigned int geo::ChannelMapAlg::HardwareChannelFromOpChannel ( unsigned int  opChannel) const
virtual

Returns the hardware channel number of specified optical channel.

Parameters
opChannelthe optical detector channel being queried
Returns
the optical detector the specified optical channel belongs to

If the specified optical channel is invalid, behaviour is undefined.

Definition at line 47 of file ChannelMapAlg.cxx.

Referenced by HasChannel(), and IsValidOpChannel().

48  {
49  return 0;
50  }
virtual bool geo::ChannelMapAlg::HasChannel ( raw::ChannelID_t  channel) const
inlinevirtual
virtual bool geo::ChannelMapAlg::HasROP ( readout::ROPID const &  ropid) const
pure virtual

Returns whether we have the specified ROP

Returns
whether the readout plane is valid and exists

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual bool geo::ChannelMapAlg::HasTPCset ( readout::TPCsetID const &  tpcsetid) const
pure virtual

Returns whether we have the specified TPC set

Returns
whether the TPC set is valid and exists

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual void geo::ChannelMapAlg::Initialize ( GeometryData_t const &  geodata)
pure virtual

Geometry initialisation.

Implemented in geo::ChannelMapStandardAlg.

template<typename T >
bool geo::ChannelMapAlg::isValidElement ( TPCInfoMap_t< T > const &  map,
CryostatID const &  id 
) const
inlineprotected

Returns whether the ID specifies a valid entry.

Definition at line 523 of file ChannelMapAlg.h.

Referenced by isValidElement().

524  {
525  return id.Cryostat < map.size();
526  }
template<typename T >
bool geo::ChannelMapAlg::isValidElement ( TPCInfoMap_t< T > const &  map,
TPCID const &  id 
) const
inlineprotected

Returns the specified element of the TPC map.

Definition at line 528 of file ChannelMapAlg.h.

References isValidElement().

529  {
530  return isValidElement(map, id.asCryostatID()) && (id.TPC < map[id.Cryostat].size());
531  }
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
template<typename T >
bool geo::ChannelMapAlg::isValidElement ( PlaneInfoMap_t< T > const &  map,
CryostatID const &  id 
) const
inlineprotected

Returns whether the ID specifies a valid entry.

Definition at line 551 of file ChannelMapAlg.h.

552  {
553  return id.Cryostat < map.size();
554  }
template<typename T >
bool geo::ChannelMapAlg::isValidElement ( PlaneInfoMap_t< T > const &  map,
TPCID const &  id 
) const
inlineprotected

Returns whether the ID specifies a valid entry.

Definition at line 556 of file ChannelMapAlg.h.

References isValidElement().

557  {
558  return isValidElement(map, id.asCryostatID()) && (id.TPC < map[id.Cryostat].size());
559  }
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
template<typename T >
bool geo::ChannelMapAlg::isValidElement ( PlaneInfoMap_t< T > const &  map,
PlaneID const &  id 
) const
inlineprotected

Returns whether the ID specifies a valid entry.

Definition at line 561 of file ChannelMapAlg.h.

References isValidElement().

562  {
563  return isValidElement(map, id.asTPCID()) && (id.Plane < AccessSize(map, id.asTPCID()));
564  }
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
bool geo::ChannelMapAlg::IsValidOpChannel ( unsigned int  opChannel,
unsigned int  NOpDets 
) const
virtual

Returns whether the ID identifies a valid optical detector channel.

Parameters
opChannelchannel number
NOpDetsnumber of optical detectors in the detector
Returns
whether opChannel would be a valid channel

The specification of the number of optical channels reflects the logic described in NOpChannel().

Definition at line 53 of file ChannelMapAlg.cxx.

References HardwareChannelFromOpChannel(), NOpChannels(), NOpHardwareChannels(), and OpDetFromOpChannel().

Referenced by HasChannel().

54  {
55  // Check channel number
56  if (opChannel >= this->NOpChannels(NOpDets)) return false;
57 
58  // Check opdet number
59  unsigned int opdet = this->OpDetFromOpChannel(opChannel);
60  if (opdet >= NOpDets) return false;
61 
62  // Check hardware channel number
63  unsigned int hChan = this->HardwareChannelFromOpChannel(opChannel);
64  if (hChan >= this->NOpHardwareChannels(opdet)) return false;
65 
66  return true;
67  }
virtual unsigned int NOpChannels(unsigned int NOpDets) const
Returns the number of optical channels contained in some detectors.
virtual unsigned int OpDetFromOpChannel(unsigned int opChannel) const
Returns the optical detector the specified optical channel belongs.
virtual unsigned int HardwareChannelFromOpChannel(unsigned int opChannel) const
Returns the hardware channel number of specified optical channel.
virtual unsigned int NOpHardwareChannels(unsigned int opDet) const
Returns the number of channels in the specified optical detectors.
unsigned int geo::ChannelMapAlg::MaxOpChannel ( unsigned int  NOpDets) const
virtual

Returns the number of optical channels contained in some detectors.

Parameters
NOpDetsnumber of optical detectors
Returns
optical channels contained in NOpDets detectors

This function returns the first optical channel ID larger than the last channel ID in a detector with NOpDets optical detectors (with the same logic as NOpChannels()). For example, in a detector with 32 channels with contiguous IDs starting at 0, this function would return 32. If the channels started with ID 1, this function would instead return 33 and if there were a 16 channel gap, so that valid channels are from 0 to 15 and from 32 to 47, this function would return 48.

Definition at line 21 of file ChannelMapAlg.cxx.

References NOpChannels().

Referenced by HasChannel().

22  {
23  // By default just return the number of optical detectos
24  return NOpChannels(NOpDets);
25  }
virtual unsigned int NOpChannels(unsigned int NOpDets) const
Returns the number of optical channels contained in some detectors.
virtual unsigned int geo::ChannelMapAlg::MaxROPs ( ) const
pure virtual

Returns the largest number of ROPs a TPC set in the detector has.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual unsigned int geo::ChannelMapAlg::MaxTPCsets ( ) const
pure virtual

Returns the largest number of TPC sets any cryostat in the detector has.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual unsigned int geo::ChannelMapAlg::Nchannels ( ) const
pure virtual

Returns the total number of channels present (not necessarily contiguous)

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual unsigned int geo::ChannelMapAlg::Nchannels ( readout::ROPID const &  ropid) const
pure virtual

Returns the number of channels in the specified ROP.

Returns
number of channels in the specified ROP, 0 if non-existent

Implemented in geo::ChannelMapStandardAlg.

size_t geo::ChannelMapAlg::NearestAuxDet ( Point_t const &  point,
std::vector< AuxDetGeo > const &  auxDets,
double  tolerance = 0 
) const
virtual

Returns the auxiliary detector closest to the specified point.

Parameters
pointcoordinates of the position to be investigated (x, y, z)
auxDetslist of the sought auxiliary detectors
tolerancetolerance for comparison. Default 0.
Returns
index of auxiliary detector within auxDets

Definition at line 70 of file ChannelMapAlg.cxx.

References tca::Length().

Referenced by HasChannel(), and NearestSensitiveAuxDet().

73  {
74  for (size_t a = 0; a < auxDets.size(); ++a) {
75  auto const localPoint = auxDets[a].toLocalCoords(point);
76 
77  double const HalfCenterWidth = 0.5 * (auxDets[a].HalfWidth1() + auxDets[a].HalfWidth2());
78 
79  if (localPoint.Z() >= -(auxDets[a].Length() / 2 + tolerance) &&
80  localPoint.Z() <= (auxDets[a].Length() / 2 + tolerance) &&
81  localPoint.Y() >= -auxDets[a].HalfHeight() - tolerance &&
82  localPoint.Y() <= auxDets[a].HalfHeight() + tolerance &&
83  // if AuxDet a is a box, then HalfSmallWidth = HalfWidth
84  localPoint.X() >= -HalfCenterWidth +
85  localPoint.Z() * (HalfCenterWidth - auxDets[a].HalfWidth2()) /
86  (0.5 * auxDets[a].Length()) -
87  tolerance &&
88  localPoint.X() <= HalfCenterWidth -
89  localPoint.Z() * (HalfCenterWidth - auxDets[a].HalfWidth2()) /
90  (0.5 * auxDets[a].Length()) +
91  tolerance)
92  return a;
93 
94  } // for loop over AudDet a
95 
96  // throw an exception because we couldn't find the sensitive volume
97  throw cet::exception("ChannelMap") << "Can't find AuxDet for position (" << point.X() << ","
98  << point.Y() << "," << point.Z() << ")\n";
99  }
float Length(const PFPStruct &pfp)
Definition: PFPUtils.cxx:3269
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
size_t geo::ChannelMapAlg::NearestSensitiveAuxDet ( Point_t const &  point,
std::vector< AuxDetGeo > const &  auxDets,
double  tolerance = 0 
) const
virtual

Returns sensitive auxiliary detector closest to specified point.

Parameters
pointcoordinates of the position to be investigated (x, y, z)
auxDetslist of the auxiliary detectors
tolerancetolerance for comparison. Default 0.
Returns
index of sought sensitive auxiliary detector within auxDets

Definition at line 102 of file ChannelMapAlg.cxx.

References geo::AuxDetSensitiveGeo::HalfHeight(), geo::AuxDetSensitiveGeo::HalfWidth1(), geo::AuxDetSensitiveGeo::HalfWidth2(), geo::AuxDetSensitiveGeo::Length(), NearestAuxDet(), geo::AuxDetGeo::NSensitiveVolume(), geo::AuxDetGeo::SensitiveVolume(), and geo::AuxDetSensitiveGeo::toLocalCoords().

Referenced by HasChannel().

105  {
106  size_t auxDetIdx = NearestAuxDet(point, auxDets, tolerance);
107  geo::AuxDetGeo const& adg = auxDets[auxDetIdx];
108 
109  for (size_t a = 0; a < adg.NSensitiveVolume(); ++a) {
110  geo::AuxDetSensitiveGeo const& adsg = adg.SensitiveVolume(a);
111  auto const localPoint = adsg.toLocalCoords(point);
112 
113  double const HalfCenterWidth = 0.5 * (adsg.HalfWidth1() + adsg.HalfWidth2());
114 
115  if (localPoint.Z() >= -(adsg.Length() / 2 + tolerance) &&
116  localPoint.Z() <= (adsg.Length() / 2 + tolerance) &&
117  localPoint.Y() >= -adsg.HalfHeight() - tolerance &&
118  localPoint.Y() <= adsg.HalfHeight() + tolerance &&
119  // if AuxDet a is a box, then HalfSmallWidth = HalfWidth
120  localPoint.X() >=
121  -HalfCenterWidth +
122  localPoint.Z() * (HalfCenterWidth - adsg.HalfWidth2()) / (0.5 * adsg.Length()) -
123  tolerance &&
124  localPoint.X() <=
125  HalfCenterWidth -
126  localPoint.Z() * (HalfCenterWidth - adsg.HalfWidth2()) / (0.5 * adsg.Length()) +
127  tolerance)
128  return a;
129  } // for loop over AuxDetSensitive a
130 
131  // throw an exception because we couldn't find the sensitive volume
132  throw cet::exception("Geometry") << "Can't find AuxDetSensitive for position (" << point.X()
133  << "," << point.Y() << "," << point.Z() << ")\n";
134  }
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
Definition: AuxDetGeo.h:143
size_t NSensitiveVolume() const
Definition: AuxDetGeo.h:144
virtual size_t NearestAuxDet(Point_t const &point, std::vector< AuxDetGeo > const &auxDets, double tolerance=0) const
Returns the auxiliary detector closest to the specified point.
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local auxiliary detector frame.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual WireID geo::ChannelMapAlg::NearestWireID ( Point_t const &  worldPos,
PlaneID const &  planeID 
) const
pure virtual

Returns the ID of the wire nearest to the specified position.

Parameters
worldPosposition to be tested
planeIDplane containing the wire
Returns
the ID of the wire closest to worldPos in the specified plane
Exceptions
InvalidWireIDErrorthe ID found is not present in the detector
See also
WireCoordinate(double, double, geo::PlaneID const&)

The plane is required to be valid and exist in the detector. Otherwise, the behaviour is undefined. An exception is thrown if the wire that would be the closest is actually not present; but no check is performed whether the specified position is outside the wire plane: wires are extrapolated to be infinitely long. In other words, the result can be trusted only as long as the position is within the specified wire plane.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

unsigned int geo::ChannelMapAlg::NOpChannels ( unsigned int  NOpDets) const
virtual

Returns the number of optical channels contained in some detectors.

Parameters
NOpDetsnumber of optical detectors
Returns
optical channels contained in NOpDets detectors

This function returns how many channels can be expected to be present in a detector with NOpDets optical detectors. This is an upper limit, as not all channels have necessarily to be present.

For example: if a detector has four channels per optical detector, the returned value will be four times the argument NOpDets. If there is a single channel on each optical detector, the return value will be the value NOpDets (this is in fact the fallback implementation). If each optical detector can have anywhere between 2 and 12 channels, the returned value is 12 times NOpDets, and it will be an overestimation of the number of channels.

Definition at line 14 of file ChannelMapAlg.cxx.

Referenced by HasChannel(), IsValidOpChannel(), and MaxOpChannel().

15  {
16  // By default just return the number of optical detectos
17  return NOpDets;
18  }
unsigned int geo::ChannelMapAlg::NOpHardwareChannels ( unsigned int  opDet) const
virtual

Returns the number of channels in the specified optical detectors.

Parameters
opDetID of the chosen optical detector
Returns
optical channels contained in optical detector with ID opDet

This function returns how many channels are actually present in the optical detector with the specified ID.

For example: if a detector has four channels per optical detector, the returned value will be four, regardless opDet, and . If there is a single channel on each optical detector, the return value will be 1, again ignoring opDet (this is in fact the fallback implementation). If each optical detector can have anywhere between 2 and 12 channels, the returned value will be 2, 12, etc., that is the exact number of channels in opDet.

Although implementations are encouraged to return 0 on invalid optical detectors, the actual return value in that case is undefined.

Definition at line 28 of file ChannelMapAlg.cxx.

Referenced by HasChannel(), and IsValidOpChannel().

29  {
30  // By defualt, 1 channel per optical detector
31  return 1;
32  }
virtual unsigned int geo::ChannelMapAlg::NROPs ( readout::TPCsetID const &  tpcsetid) const
pure virtual

Returns the total number of ROP in the specified TPC set.

Parameters
tpcsetidTPC set ID
Returns
number of readout planes in the TPC set, or 0 if no TPC set found

Note that this methods explicitly check the existence of the TPC set.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual unsigned int geo::ChannelMapAlg::NTPCsets ( readout::CryostatID const &  cryoid) const
pure virtual

Returns the total number of TPC sets in the specified cryostat.

Parameters
cryoidcryostat ID
Returns
number of TPC sets in the cryostat, or 0 if no cryostat found

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

unsigned int geo::ChannelMapAlg::OpChannel ( unsigned int  detNum,
unsigned int  hwchannel = 0 
) const
virtual

Returns the channel ID of the specified hardware channel.

Parameters
detNumoptical detector ID
hwchannelhardware channel within the specified optical detector
Returns
ID of the channel identified by detector and hardware channel IDs

If the input IDs identify a non-existing channel, the result is undefined.

Definition at line 35 of file ChannelMapAlg.cxx.

Referenced by HasChannel().

36  {
37  return detNum;
38  }
unsigned int geo::ChannelMapAlg::OpDetFromOpChannel ( unsigned int  opChannel) const
virtual

Returns the optical detector the specified optical channel belongs.

Parameters
opChannelthe optical detector channel being queried
Returns
the optical detector the specified optical channel belongs to

If the specified optical channel is invalid, behaviour is undefined.

Definition at line 41 of file ChannelMapAlg.cxx.

Referenced by HasChannel(), and IsValidOpChannel().

42  {
43  return opChannel;
44  }
virtual std::set<PlaneID> const& geo::ChannelMapAlg::PlaneIDs ( ) const
pure virtual

Returns a list of the plane IDs in the whole detector.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual raw::ChannelID_t geo::ChannelMapAlg::PlaneWireToChannel ( WireID const &  wireID) const
pure virtual

Returns the channel ID a wire is connected to.

Parameters
wireIDID of the wire
Returns
the ID of the channel
See also
PlaneWireToChannel(geo::WireID const&)

Behaviour on an invalid or not present wires is undefined.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual std::vector<TPCID> geo::ChannelMapAlg::ROPtoTPCs ( readout::ROPID const &  ropid) const
pure virtual

Returns a list of ID of TPCs the specified ROP spans.

Parameters
ropidID of the readout plane
Returns
the list of TPC IDs, empty if readout plane ID is invalid

Note that this check is performed on the validity of the readout plane ID, that does not necessarily imply that the readout plane specified by the ID actually exists. Check if the ROP exists with HasROP(). The behaviour on non-existing readout planes is undefined.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual std::vector<PlaneID> geo::ChannelMapAlg::ROPtoWirePlanes ( readout::ROPID const &  ropid) const
pure virtual

Returns a list of ID of planes belonging to the specified ROP.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

geo::SigType_t geo::ChannelMapAlg::SignalTypeForChannel ( raw::ChannelID_t const  channel) const

Return the signal type of the specified channel.

Parameters
channelID of the channel
Returns
signal type of the channel, or geo::kMysteryType if not known

On any type of error (e.g., invalid or unknown channel ID), geo::kMysteryType is returned.

Definition at line 177 of file ChannelMapAlg.cxx.

References SignalTypeForChannelImpl().

Referenced by HasChannel(), and SignalTypeForROPIDImpl().

178  {
179  return SignalTypeForChannelImpl(channel);
180  }
virtual SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const =0
Return the signal type of the specified channel.
virtual SigType_t geo::ChannelMapAlg::SignalTypeForChannelImpl ( raw::ChannelID_t const  channel) const
protectedpure virtual

Return the signal type of the specified channel.

Parameters
channelID of the channel
Returns
signal type of the channel, or geo::kMysteryType if not known

On any type of error (e.g., invalid or unknown channel ID), geo::kMysteryType is returned.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel(), and SignalTypeForChannel().

geo::SigType_t geo::ChannelMapAlg::SignalTypeForROPID ( readout::ROPID const &  ropid) const

Return the signal type on the specified readout plane.

Parameters
ropidID of the readout plane
Returns
signal type on the plane, or geo::kMysteryType if not known

If the readout plane ID is marked invalid, geo::kMysteryType is returned. If the readout plane is not marked invalid, but it does not match an existing readout plane, the result is undefined.

The default implementation uses readout plane to channel mapping. Other implementation may decide to do the opposite.

Definition at line 182 of file ChannelMapAlg.cxx.

References SignalTypeForROPIDImpl().

Referenced by HasChannel().

183  {
184  return SignalTypeForROPIDImpl(ropid);
185  }
virtual SigType_t SignalTypeForROPIDImpl(readout::ROPID const &ropid) const
Return the signal type on the specified readout plane.
geo::SigType_t geo::ChannelMapAlg::SignalTypeForROPIDImpl ( readout::ROPID const &  ropid) const
protectedvirtual

Return the signal type on the specified readout plane.

Parameters
ropidID of the readout plane
Returns
signal type on the plane, or geo::kMysteryType if not known

If the readout plane ID is marked invalid, geo::kMysteryType is returned. If the readout plane is not marked invalid, but it does not match an existing readout plane, the result is undefined.

The default implementation uses readout plane to channel mapping. Other implementation may decide to do the opposite.

Definition at line 187 of file ChannelMapAlg.cxx.

References FirstChannelInROP(), and SignalTypeForChannel().

Referenced by HasChannel(), and SignalTypeForROPID().

188  {
190  }
SigType_t SignalTypeForChannel(raw::ChannelID_t const channel) const
Return the signal type of the specified channel.
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const =0
Returns the ID of the first channel in the specified readout plane.
virtual GeoObjectSorter const& geo::ChannelMapAlg::Sorter ( ) const
pure virtual

Returns the object to sort geometry with.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual std::vector<TPCID> geo::ChannelMapAlg::TPCsetToTPCs ( readout::TPCsetID const &  tpcsetid) const
pure virtual

Returns a list of ID of TPCs belonging to the specified TPC set.

Parameters
tpcsetidID of the TPC set to convert into TPC IDs
Returns
the list of TPCs, empty if TPC set is invalid

Note that the check is performed on the validity of the TPC set ID, that does not necessarily imply that the TPC set specified by the ID actually exists. Check the existence of the TPC set first (HasTPCset()). Behaviour on valid, non-existent TPC set IDs is undefined.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual readout::TPCsetID geo::ChannelMapAlg::TPCtoTPCset ( TPCID const &  tpcid) const
pure virtual

Returns the ID of the TPC set tpcid belongs to.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual void geo::ChannelMapAlg::Uninitialize ( )
pure virtual

Deconfiguration: prepare for a following call of Initialize()

Implemented in geo::ChannelMapStandardAlg.

virtual double geo::ChannelMapAlg::WireCoordinate ( double  YPos,
double  ZPos,
PlaneID const &  planeID 
) const
pure virtual

Returns the index of the wire nearest to the specified position.

Parameters
YPosy coordinate on the wire plane
ZPosz coordinate on the wire plane
planeIDID of the plane
Returns
an index interpolation between the two nearest wires
See also
NearestWireID()

Respect to NearestWireID(), this method returns a real number, representing a continuous coordinate in the wire axis, with the round values corresponding to the actual wires.

The plane is required to be valid and exist in the detector. Otherwise, the behaviour is undefined.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

virtual readout::ROPID geo::ChannelMapAlg::WirePlaneToROP ( PlaneID const &  planeid) const
pure virtual

Returns the ID of the ROP planeid belongs to.

Implemented in geo::ChannelMapStandardAlg.

Referenced by HasChannel().

Member Data Documentation

std::map<size_t, std::vector<size_t> > geo::ChannelMapAlg::fADChannelToSensitiveGeo
protected

map the AuxDetGeo index to a vector of indices corresponding to the AuxDetSensitiveGeo index

Definition at line 494 of file ChannelMapAlg.h.

Referenced by ChannelToSensitiveAuxDet().

std::map<std::string, size_t> geo::ChannelMapAlg::fADNameToGeo
protected

map the names of the dets to the AuxDetGeo objects

Definition at line 492 of file ChannelMapAlg.h.

Referenced by ChannelToAuxDet().


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