All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
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 icarus::ICARUSChannelMapAlg geo::ChannelMapSBNDAlg

Public Member Functions

virtual ~ChannelMapAlg ()=default
 Virtual destructor. More...
 
virtual geo::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, geo::PlaneID const &planeID) const
 Returns the index of the wire nearest to the specified position. More...
 
virtual double WireCoordinate (double YPos, double ZPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const =0
 Returns the index of the wire nearest to the specified position. More...
 
virtual geo::WireID NearestWireID (const TVector3 &worldPos, geo::PlaneID const &planeID) const
 Returns the ID of the wire nearest to the specified position. More...
 
virtual geo::WireID NearestWireID (const TVector3 &worldPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const =0
 Returns the ID of the wire nearest to the specified position. More...
 
unsigned int NearestWire (const TVector3 &worldPos, geo::PlaneID const &planeID) const
 Returns the index of the wire nearest to the specified position. More...
 
unsigned int NearestWire (const TVector3 &worldPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const
 Returns the index of the wire nearest to the specified position. More...
 
Auxiliary detectors
virtual size_t NearestAuxDet (const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
 Returns the auxiliary detector closest to the specified point. More...
 
virtual size_t NearestSensitiveAuxDet (const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
 Returns sensitive auxiliary detector closest to specified point. More...
 
virtual size_t ChannelToAuxDet (std::vector< geo::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< geo::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 (geo::TPCID const &tpcid) const =0
 Returns the ID of the TPC set tpcid belongs to. More...
 
virtual std::vector< geo::TPCIDTPCsetToTPCs (readout::TPCsetID const &tpcsetid) const =0
 Returns a list of ID of TPCs belonging to the specified TPC set. More...
 
virtual geo::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 (geo::PlaneID const &planeid) const =0
 Returns the ID of the ROP planeid belongs to. More...
 
virtual std::vector< geo::PlaneIDROPtoWirePlanes (readout::ROPID const &ropid) const =0
 Returns a list of ID of planes belonging to the specified ROP. More...
 
virtual geo::PlaneID FirstWirePlaneInROP (readout::ROPID const &ropid) const =0
 Returns the ID of the first plane belonging to the specified ROP. More...
 
virtual std::vector< geo::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)
const std::vector< std::vector
< std::vector
< raw::ChannelID_t > > > 
FirstChannelInNextPlane () const
 Retrieve the private fFirstChannelInNextPlane vector for testing. More...
 
const std::vector< std::vector
< std::vector
< raw::ChannelID_t > > > 
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, geo::PlaneID const &id) const
 Returns the specified element of the plane map. More...
 
template<typename T >
size_t AccessElementSize (PlaneInfoMap_t< T > const &map, geo::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, geo::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, geo::TPCID const &id) const
 Returns the specified element of the TPC map. More...
 
template<typename T >
size_t AccessElementSize (TPCInfoMap_t< T > const &map, geo::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, geo::CryostatID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::CryostatID const &id) const
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::TPCID const &id) const
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
 

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
 
geo::SigType_t SignalTypeForChannel (raw::ChannelID_t const channel) const
 Return the signal type of the specified channel. More...
 
geo::SigType_t SignalTypeForROPID (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 
virtual std::set< geo::PlaneID >
const & 
PlaneIDs () const =0
 Returns a list of the plane IDs in the whole detector. More...
 
virtual raw::ChannelID_t PlaneWireToChannel (geo::WireID const &wireID) const
 Returns the channel ID a wire is connected to. More...
 
virtual raw::ChannelID_t PlaneWireToChannel (unsigned int plane, unsigned int wire, unsigned int tpc, unsigned int cstat) const =0
 Returns the channel ID a wire is connected to. More...
 
virtual geo::SigType_t SignalTypeForChannelImpl (raw::ChannelID_t const channel) const =0
 Return the signal type of the specified channel. More...
 
virtual geo::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 605 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 601 of file ChannelMapAlg.h.

Constructor & Destructor Documentation

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

Virtual destructor.

Member Function Documentation

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

Returns the specified element of the TPC map.

Definition at line 628 of file ChannelMapAlg.h.

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

Returns the specified element of the plane map.

Definition at line 655 of file ChannelMapAlg.h.

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

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

Definition at line 634 of file ChannelMapAlg.h.

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

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

Definition at line 661 of file ChannelMapAlg.h.

662  { return map[id.Cryostat][id.TPC].size(); }
size_t geo::ChannelMapAlg::ChannelToAuxDet ( std::vector< geo::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 152 of file ChannelMapAlg.cxx.

155  {
156  // loop over the map of AuxDet names to Geo object numbers to determine which auxdet
157  // we have. If no name in the map matches the provided string, throw an exception
158  for(auto itr : fADNameToGeo)
159  if( itr.first.compare(detName) == 0 ) return itr.second;
160 
161 
162  throw cet::exception("Geometry") << "No AuxDetGeo matching name: " << detName;
163 
164  return UINT_MAX;
165  }
std::map< std::string, size_t > fADNameToGeo
map the names of the dets to the AuxDetGeo objects
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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

std::pair< size_t, size_t > geo::ChannelMapAlg::ChannelToSensitiveAuxDet ( std::vector< geo::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 170 of file ChannelMapAlg.cxx.

173  {
174  size_t adGeoIdx = this->ChannelToAuxDet(auxDets, detName, channel);
175 
176  // look for the index of the sensitive volume for the given channel
177  if( fADChannelToSensitiveGeo.count(adGeoIdx) > 0 ){
178 
179  auto itr = fADChannelToSensitiveGeo.find(adGeoIdx);
180 
181  // get the vector of channels to AuxDetSensitiveGeo index
182  if( channel < itr->second.size() )
183  return std::make_pair(adGeoIdx, itr->second[channel]);
184 
185  throw cet::exception("Geometry") << "Given AuxDetSensitive channel, " << channel
186  << ", cannot be found in vector associated to AuxDetGeo index: "
187  << adGeoIdx << ". Vector has size " << itr->second.size();
188  }
189 
190  throw cet::exception("Geometry") << "Given AuxDetGeo with index " << adGeoIdx
191  << " does not correspond to any vector of sensitive volumes";
192 
193  return std::make_pair(adGeoIdx, UINT_MAX);
194  }
std::map< size_t, std::vector< size_t > > fADChannelToSensitiveGeo
virtual size_t ChannelToAuxDet(std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
Returns the index of the detector containing the specified channel.
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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Retrieve the private fFirstChannelInNextPlane vector for testing.

Definition at line 586 of file ChannelMapAlg.h.

587  { return fFirstChannelInThisPlane; }
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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Retrieve the private fFirstChannelInThisPlane vector for testing.

Definition at line 590 of file ChannelMapAlg.h.

591  { return fFirstChannelInNextPlane; }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
virtual geo::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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

virtual geo::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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

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

Definition at line 688 of file ChannelMapAlg.h.

689  {
690  if (id.Cryostat >= map.size()) return nullptr;
691  auto const& cryo_map = map[id.Cryostat];
692  if (id.TPC >= cryo_map.size()) return nullptr;
693  auto const& TPC_map = cryo_map[id.TPC];
694  if (id.Plane >= TPC_map.size()) return nullptr;
695  auto const& plane_map = TPC_map[id.Plane];
696  return &plane_map;
697  } // GetElementPtr()
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
BEGIN_PROLOG TPC
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 57 of file ChannelMapAlg.cxx.

58  {
59  return 0;
60  }
virtual bool geo::ChannelMapAlg::HasChannel ( raw::ChannelID_t  channel) const
inlinevirtual

Returns whether the specified channel is valid This default implementation assumes all channels up to Nchannels() valid.

Definition at line 83 of file ChannelMapAlg.h.

84  { return raw::isValidChannelID(channel)? channel < Nchannels(): false; }
virtual unsigned int Nchannels() const =0
Returns the total number of channels present (not necessarily contiguous)
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:37
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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Geometry initialisation.

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Returns whether the ID specifies a valid entry.

Definition at line 641 of file ChannelMapAlg.h.

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

Definition at line 644 of file ChannelMapAlg.h.

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

Returns whether the ID specifies a valid entry.

Definition at line 668 of file ChannelMapAlg.h.

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

Definition at line 671 of file ChannelMapAlg.h.

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

Definition at line 678 of file ChannelMapAlg.h.

679  {
680  return isValidElement(map, id.asTPCID())
681  && (id.Plane < AccessSize(map, id.asTPCID()));
682  }
bool isValidElement(TPCInfoMap_t< T > const &map, geo::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 63 of file ChannelMapAlg.cxx.

64  {
65  // Check channel number
66  if ( opChannel >= this->NOpChannels(NOpDets) ) return false;
67 
68  // Check opdet number
69  unsigned int opdet = this->OpDetFromOpChannel(opChannel);
70  if (opdet >= NOpDets) return false;
71 
72  // Check hardware channel number
73  unsigned int hChan = this->HardwareChannelFromOpChannel(opChannel);
74  if (hChan >= this->NOpHardwareChannels(opdet)) return false;
75 
76  return true;
77  }
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 29 of file ChannelMapAlg.cxx.

30  {
31  // By default just return the number of optical detectos
32  return NOpChannels(NOpDets);
33  }
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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

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

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

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

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

size_t geo::ChannelMapAlg::NearestAuxDet ( const double *  point,
std::vector< geo::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

Reimplemented in geo::ChannelMapSBNDAlg.

Definition at line 80 of file ChannelMapAlg.cxx.

82  {
83  double HalfCenterWidth = 0.;
84  double localPoint[3] = {0.};
85 
86 
87  for(size_t a = 0; a < auxDets.size(); ++a) {
88 
89  auxDets[a].WorldToLocal(point, localPoint);
90 
91  HalfCenterWidth = 0.5 * (auxDets[a].HalfWidth1() + auxDets[a].HalfWidth2());
92 
93  if( localPoint[2] >= - (auxDets[a].Length()/2 + tolerance) &&
94  localPoint[2] <= (auxDets[a].Length()/2 + tolerance) &&
95  localPoint[1] >= - auxDets[a].HalfHeight() - tolerance &&
96  localPoint[1] <= auxDets[a].HalfHeight() + tolerance &&
97  // if AuxDet a is a box, then HalfSmallWidth = HalfWidth
98  localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - auxDets[a].HalfWidth2())/(0.5 * auxDets[a].Length()) - tolerance &&
99  localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - auxDets[a].HalfWidth2())/(0.5 * auxDets[a].Length()) + tolerance
100  ) return a;
101 
102  }// for loop over AudDet a
103 
104  // throw an exception because we couldn't find the sensitive volume
105  throw cet::exception("ChannelMap") << "Can't find AuxDet for position ("
106  << point[0] << ","
107  << point[1] << ","
108  << point[2] << ")\n";
109 
110  return UINT_MAX;
111 
112  }
float Length(const PFPStruct &pfp)
Definition: PFPUtils.cxx:3304
auto const tolerance
process_name gaushit a
size_t geo::ChannelMapAlg::NearestSensitiveAuxDet ( const double *  point,
std::vector< geo::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

Reimplemented in geo::ChannelMapSBNDAlg.

Definition at line 115 of file ChannelMapAlg.cxx.

117  {
118  double HalfCenterWidth = 0.;
119  double localPoint[3] = {0.};
120 
121  size_t auxDetIdx = this->NearestAuxDet(point, auxDets, tolerance);
122 
123  geo::AuxDetGeo const& adg = auxDets[auxDetIdx];
124 
125  for(size_t a = 0; a < adg.NSensitiveVolume(); ++a) {
126 
127  geo::AuxDetSensitiveGeo const& adsg = adg.SensitiveVolume(a);
128  adsg.WorldToLocal(point, localPoint);
129 
130  HalfCenterWidth = 0.5 * (adsg.HalfWidth1() + adsg.HalfWidth2());
131 
132  if( localPoint[2] >= - (adsg.Length()/2 + tolerance) &&
133  localPoint[2] <= (adsg.Length()/2 + tolerance) &&
134  localPoint[1] >= - adsg.HalfHeight() - tolerance &&
135  localPoint[1] <= adsg.HalfHeight() + tolerance &&
136  // if AuxDet a is a box, then HalfSmallWidth = HalfWidth
137  localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - adsg.HalfWidth2())/(0.5 * adsg.Length()) - tolerance &&
138  localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - adsg.HalfWidth2())/(0.5 * adsg.Length()) + tolerance
139  ) return a;
140  }// for loop over AuxDetSensitive a
141 
142  // throw an exception because we couldn't find the sensitive volume
143  throw cet::exception("Geometry") << "Can't find AuxDetSensitive for position ("
144  << point[0] << ","
145  << point[1] << ","
146  << point[2] << ")\n";
147 
148  return UINT_MAX;
149  }
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
Definition: AuxDetGeo.h:171
auto const tolerance
process_name gaushit a
size_t NSensitiveVolume() const
Definition: AuxDetGeo.h:172
void WorldToLocal(const double *world, double *auxdet) const
Transform point from world frame to local auxiliary detector frame.
virtual size_t NearestAuxDet(const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
Returns the auxiliary detector closest to the specified point.
unsigned int geo::ChannelMapAlg::NearestWire ( const TVector3 &  worldPos,
geo::PlaneID const &  planeID 
) const

Returns the index 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
See Also
NearestWireID(const TVector3&, geo::PlaneID const&)
Deprecated:
Use NearestWireID(const TVector3&, geo::PlaneID const&) instead.

Definition at line 15 of file ChannelMapAlg.cxx.

17  {
18  return NearestWireID(worldPos, planeID).Wire;
19  }
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
virtual geo::WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const
Returns the ID of the wire nearest to the specified position.
unsigned int geo::ChannelMapAlg::NearestWire ( const TVector3 &  worldPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) const
inline

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

Parameters
worldPosposition to be tested
PlaneNonumber of plane containing the wire
TPCNonumber of TPC containing the wire
cstatnumber of cryostat containing the wire
Returns
the ID of the wire closest to worldPos in the specified plane
See Also
NearestWireID(const TVector3&, geo::PlaneID const&)
Deprecated:
Use NearestWireID(const TVector3&, geo::PlaneID const&) instead.

Definition at line 401 of file ChannelMapAlg.h.

405  { return NearestWire(worldPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
unsigned int NearestWire(const TVector3 &worldPos, geo::PlaneID const &planeID) const
Returns the index of the wire nearest to the specified position.
virtual geo::WireID geo::ChannelMapAlg::NearestWireID ( const TVector3 &  worldPos,
geo::PlaneID const &  planeID 
) const
inlinevirtual

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.

Reimplemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

Definition at line 354 of file ChannelMapAlg.h.

355  {
356  return
357  NearestWireID(worldPos, planeID.Plane, planeID.TPC, planeID.Cryostat);
358  }
virtual geo::WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const
Returns the ID of the wire nearest to the specified position.
virtual geo::WireID geo::ChannelMapAlg::NearestWireID ( const TVector3 &  worldPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) const
pure virtual

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

Parameters
worldPosposition to be tested
PlaneNonumber of plane containing the wire
TPCNonumber of TPC containing the wire
cstatnumber of cryostat containing the wire
Returns
the ID of the wire closest to worldPos in the specified plane
See Also
NearestWireID(const TVector3&, geo::PlaneID const&)
Deprecated:
Use the version with geo::PlaneID instead

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 22 of file ChannelMapAlg.cxx.

23  {
24  // By default just return the number of optical detectos
25  return NOpDets;
26  }
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 36 of file ChannelMapAlg.cxx.

37  {
38  // By defualt, 1 channel per optical detector
39  return 1;
40  }
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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 45 of file ChannelMapAlg.cxx.

46  {
47  return detNum;
48  }
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 51 of file ChannelMapAlg.cxx.

52  {
53  return opChannel;
54  }
virtual std::set<geo::PlaneID> const& geo::ChannelMapAlg::PlaneIDs ( ) const
pure virtual

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

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

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.

Deprecated:
Use the version with geo::WireID

Reimplemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

Definition at line 160 of file ChannelMapAlg.h.

161  {
162  return PlaneWireToChannel
163  (wireID.Plane, wireID.Wire, wireID.TPC, wireID.Cryostat);
164  }
virtual raw::ChannelID_t PlaneWireToChannel(geo::WireID const &wireID) const
Returns the channel ID a wire is connected to.
virtual raw::ChannelID_t geo::ChannelMapAlg::PlaneWireToChannel ( unsigned int  plane,
unsigned int  wire,
unsigned int  tpc,
unsigned int  cstat 
) const
pure virtual

Returns the channel ID a wire is connected to.

Parameters
planenumber of plane
wirenumber of wire
tpcnumber of TPC
cstatnumber of cryostat
Returns
the ID of the channel
See Also
PlaneWireToChannel(geo::WireID const&)
Deprecated:
Use the version with geo::WireID

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

virtual std::vector<geo::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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

virtual std::vector<geo::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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 196 of file ChannelMapAlg.cxx.

197  {
198  return SignalTypeForChannelImpl(channel);
199  }
virtual geo::SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const =0
Return the signal type of the specified channel.
virtual geo::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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 201 of file ChannelMapAlg.cxx.

202  {
203  return SignalTypeForROPIDImpl(ropid);
204  }
virtual geo::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 206 of file ChannelMapAlg.cxx.

207  {
209  }
geo::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 geo::GeoObjectSorter const& geo::ChannelMapAlg::Sorter ( ) const
pure virtual

Returns the object to sort geometry with.

Implemented in icarus::ICARUSChannelMapAlg, geo::ChannelMapStandardAlg, and geo::ChannelMapSBNDAlg.

virtual std::vector<geo::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 icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Returns the ID of the TPC set tpcid belongs to.

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Deconfiguration: prepare for a following call of Initialize()

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

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.

Reimplemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

Definition at line 310 of file ChannelMapAlg.h.

313  {
314  return WireCoordinate
315  (YPos, ZPos, planeID.Plane, planeID.TPC, planeID.Cryostat);
316  }
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const
Returns the index of the wire nearest to the specified position.
virtual double geo::ChannelMapAlg::WireCoordinate ( double  YPos,
double  ZPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) 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
PlaneNonumber of plane
TPCNonumber of TPC
cstatnumber of cryostat
Returns
an index interpolation between the two nearest wires
See Also
WireCoordinate(double, double, geo::PlaneID const&)
Deprecated:
Use the version with geo::PlaneID instead

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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

Returns the ID of the ROP planeid belongs to.

Implemented in icarus::ICARUSChannelMapAlg, and geo::ChannelMapStandardAlg.

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 613 of file ChannelMapAlg.h.

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

map the names of the dets to the AuxDetGeo objects

Definition at line 612 of file ChannelMapAlg.h.

PlaneInfoMap_t<raw::ChannelID_t> geo::ChannelMapAlg::fFirstChannelInNextPlane
protected

Definition at line 610 of file ChannelMapAlg.h.

PlaneInfoMap_t<raw::ChannelID_t> geo::ChannelMapAlg::fFirstChannelInThisPlane
protected

Definition at line 609 of file ChannelMapAlg.h.


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