LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
geo::ChannelMapStandardAlg Class Reference

#include "ChannelMapStandardAlg.h"

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

Public Member Functions

 ChannelMapStandardAlg (fhicl::ParameterSet const &p)
 
virtual void Initialize (GeometryData_t const &geodata) override
 Geometry initialisation. More...
 
virtual void Uninitialize () override
 Deconfiguration: prepare for a following call of Initialize() More...
 
virtual std::vector< WireIDChannelToWire (raw::ChannelID_t channel) const override
 
virtual unsigned int Nchannels () const override
 Returns the total number of channels present (not necessarily contiguous) More...
 
virtual unsigned int Nchannels (readout::ROPID const &ropid) const override
 Returns the number of channels in the specified ROP. More...
 
virtual std::set< PlaneID > const & PlaneIDs () const override
 Returns a list of the plane IDs in the whole detector. More...
 
virtual geo::GeoObjectSorter const & Sorter () const override
 Return the sorter. More...
 
virtual double WireCoordinate (double YPos, double ZPos, geo::PlaneID const &planeID) const override
 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 override
 Returns the index of the wire nearest to the specified position. More...
 
virtual WireID NearestWireID (const TVector3 &worldPos, geo::PlaneID const &planeID) const override
 Returns the ID of the wire nearest to the specified position. More...
 
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. More...
 
virtual raw::ChannelID_t PlaneWireToChannel (geo::WireID const &wireID) const override
 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 override
 Returns the channel ID a wire is connected to. More...
 
TPC set mapping
virtual unsigned int NTPCsets (readout::CryostatID const &cryoid) const override
 Returns the total number of TPC sets in the specified cryostat. More...
 
virtual unsigned int MaxTPCsets () const override
 Returns the largest number of TPC sets any cryostat in the detector has. More...
 
virtual bool HasTPCset (readout::TPCsetID const &tpcsetid) const override
 
virtual readout::TPCsetID TPCtoTPCset (geo::TPCID const &tpcid) const override
 Returns the ID of the TPC set the specified TPC belongs to. More...
 
virtual std::vector< geo::TPCIDTPCsetToTPCs (readout::TPCsetID const &tpcsetid) const override
 Returns a list of ID of TPCs belonging to the specified TPC set. More...
 
virtual geo::TPCID FirstTPCinTPCset (readout::TPCsetID const &tpcsetid) const override
 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 override
 Returns the total number of ROPs in the specified TPC set. More...
 
virtual unsigned int MaxROPs () const override
 Returns the largest number of ROPs a TPC set in the detector has. More...
 
virtual bool HasROP (readout::ROPID const &ropid) const override
 
virtual readout::ROPID WirePlaneToROP (geo::PlaneID const &planeid) const override
 Returns the ID of the ROP planeid belongs to, or invalid if none. More...
 
virtual std::vector< geo::PlaneIDROPtoWirePlanes (readout::ROPID const &ropid) const override
 Returns a list of ID of wire planes belonging to the specified ROP. More...
 
virtual std::vector< geo::TPCIDROPtoTPCs (readout::ROPID const &ropid) const override
 Returns a list of ID of TPCs the specified ROP spans. More...
 
virtual readout::ROPID ChannelToROP (raw::ChannelID_t channel) const override
 Returns the ID of the ROP the channel belongs to (invalid if none) More...
 
virtual raw::ChannelID_t FirstChannelInROP (readout::ROPID const &ropid) const override
 Returns the ID of the first channel in the specified readout plane. More...
 
virtual geo::PlaneID FirstWirePlaneInROP (readout::ROPID const &ropid) const override
 Returns the ID of the first plane belonging to the specified ROP. 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
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) const
 Returns the auxiliary detector closest to the specified point. More...
 
virtual size_t NearestSensitiveAuxDet (const double *point, std::vector< geo::AuxDetGeo * > const &auxDets) 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...
 
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
 Returns the specified element of the TPC map. More...
 
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
 Returns whether the ID specifies a valid entry. More...
 
template<typename T >
bool isValidElement (PlaneInfoMap_t< T > const &map, geo::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
 

Private Member Functions

virtual SigType_t SignalTypeForChannelImpl (raw::ChannelID_t const channel) const override
 Return the signal type of the specified channel. More...
 
unsigned int WireCount (geo::PlaneID const &id) const
 Retrieved the wire cound for the specified plane ID. More...
 
unsigned int MaxTPCs () const
 Returns the largest number of TPCs in a single cryostat. More...
 

Static Private Member Functions

static readout::TPCsetID ConvertTPCtoTPCset (geo::TPCID const &tpcid)
 Converts a TPC ID into a TPC set ID using the same numerical indices. More...
 
static geo::TPCID ConvertTPCsetToTPC (readout::TPCsetID const &tpcsetid)
 Converts a TPC set ID into a TPC ID using the same numerical indices. More...
 
static readout::ROPID ConvertWirePlaneToROP (geo::PlaneID const &planeid)
 Converts a ROP ID into a wire plane ID using the same numerical indices. More...
 
static geo::PlaneID ConvertROPtoWirePlane (readout::ROPID const &ropid)
 Converts a wire plane ID into a ROP ID using the same numerical indices. More...
 

Private Attributes

unsigned int fNcryostat
 number of cryostats in the detector More...
 
unsigned int fNchannels
 number of channels in the detector More...
 
raw::ChannelID_t fTopChannel
 book keeping highest channel # More...
 
std::vector< unsigned int > fNTPC
 number of TPCs in each cryostat More...
 
std::set< View_tfViews
 vector of the views present in the detector More...
 
std::set< PlaneIDfPlaneIDs
 vector of the PlaneIDs present in the detector More...
 
PlaneInfoMap_t< float > fFirstWireProj
 
PlaneInfoMap_t< float > fOrthVectorsY
 Unit vectors orthogonal to wires in. More...
 
PlaneInfoMap_t< float > fOrthVectorsZ
 
PlaneInfoMap_t< float > fWireCounts
 
TPCInfoMap_t< unsigned int > fNPlanes
 
PlaneInfoMap_t< unsigned int > fPlaneBaselines
 
PlaneInfoMap_t< unsigned int > fWiresPerPlane
 
geo::GeoObjectSorterStandard fSorter
 class to sort geo objects More...
 

TPC channel mapping

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...
 
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 geo::SigType_t SignalTypeForROPIDImpl (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 

Detailed Description

Definition at line 21 of file ChannelMapStandardAlg.h.

Member Typedef Documentation

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

Data type for per-plane information.

Definition at line 610 of file ChannelMapAlg.h.

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

Data type for per-TPC information.

Definition at line 606 of file ChannelMapAlg.h.

Constructor & Destructor Documentation

geo::ChannelMapStandardAlg::ChannelMapStandardAlg ( fhicl::ParameterSet const &  p)

Definition at line 21 of file ChannelMapStandardAlg.cxx.

23  {
24  }
geo::GeoObjectSorterStandard fSorter
class to sort geo objects

Member Function Documentation

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

Returns the specified element of the TPC map.

Definition at line 633 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::AccessElementSize().

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

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

Returns the specified element of the plane map.

Definition at line 660 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::AccessElementSize().

661  { 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
inlineprotectedinherited

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

Definition at line 639 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::isValidElement().

Referenced by geo::ChannelMapAlg::AccessElement().

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

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

Definition at line 666 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::isValidElement().

667  { 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
virtualinherited

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

References geo::ChannelMapAlg::fADNameToGeo.

Referenced by geo::ChannelMapAlg::ChannelToSensitiveAuxDet(), and geo::ChannelMapAlg::NearestWire().

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

Returns the ID of the ROP the channel belongs to (invalid if none)

Implements geo::ChannelMapAlg.

Definition at line 430 of file ChannelMapStandardAlg.cxx.

References ChannelToWire(), FirstChannelInROP(), raw::isValidChannelID(), and WirePlaneToROP().

Referenced by PlaneWireToChannel(), and ROPtoTPCs().

431  {
432  if (!raw::isValidChannelID(channel)) return {}; // invalid ROP returned
433 
434  // which wires does the channel cover?
435  std::vector<geo::WireID> wires = ChannelToWire(channel);
436 
437  // - none:
438  if (wires.empty()) return {}; // invalid ROP returned
439 
440  // - one: maps its plane ID into a ROP ID
441  return WirePlaneToROP(wires[0]);
442  } // ChannelMapStandardAlg::ROPtoTPCs()
virtual readout::ROPID WirePlaneToROP(geo::PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to, or invalid if none.
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:36
virtual std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
std::pair< size_t, size_t > geo::ChannelMapAlg::ChannelToSensitiveAuxDet ( std::vector< geo::AuxDetGeo * > const &  auxDets,
std::string const &  detName,
uint32_t const &  channel 
) const
virtualinherited

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

References geo::ChannelMapAlg::ChannelToAuxDet(), and geo::ChannelMapAlg::fADChannelToSensitiveGeo.

Referenced by geo::ChannelMapAlg::NearestWire().

172  {
173  size_t adGeoIdx = this->ChannelToAuxDet(auxDets, detName, channel);
174 
175  // look for the index of the sensitive volume for the given channel
176  if( fADChannelToSensitiveGeo.count(adGeoIdx) > 0 ){
177 
178  auto itr = fADChannelToSensitiveGeo.find(adGeoIdx);
179 
180  // get the vector of channels to AuxDetSensitiveGeo index
181  if( channel < itr->second.size() )
182  return std::make_pair(adGeoIdx, itr->second[channel]);
183 
184  throw cet::exception("Geometry") << "Given AuxDetSensitive channel, " << channel
185  << ", cannot be found in vector associated to AuxDetGeo index: "
186  << adGeoIdx << ". Vector has size " << itr->second.size();
187  }
188 
189  throw cet::exception("Geometry") << "Given AuxDetGeo with index " << adGeoIdx
190  << " does not correspond to any vector of sensitive volumes";
191 
192  return std::make_pair(adGeoIdx, UINT_MAX);
193  }
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.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< geo::WireID > geo::ChannelMapStandardAlg::ChannelToWire ( raw::ChannelID_t  channel) const
overridevirtual

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

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

Implements geo::ChannelMapAlg.

Definition at line 143 of file ChannelMapStandardAlg.cxx.

References geo::ChannelMapAlg::fFirstChannelInNextPlane, geo::ChannelMapAlg::fFirstChannelInThisPlane, fNcryostat, fNTPC, and fTopChannel.

Referenced by ChannelToROP().

144  {
145  std::vector< geo::WireID > AllSegments;
146  unsigned int cstat = 0;
147  unsigned int tpc = 0;
148  unsigned int plane = 0;
149  unsigned int wire = 0;
150 
151  // first check if this channel ID is legal
152  if(channel > fTopChannel)
153  throw cet::exception("Geometry") << "ILLEGAL CHANNEL ID for channel " << channel << "\n";
154 
155  // then go find which plane, tpc and cryostat it is in from the information we stored earlier
156  bool foundWid(false);
157  for(unsigned int csloop = 0; csloop != fNcryostat; ++csloop){
158  for(unsigned int tpcloop = 0; tpcloop != fNTPC[csloop]; ++tpcloop){
159  for(unsigned int planeloop = 0; planeloop != fFirstChannelInNextPlane[csloop][tpcloop].size(); ++planeloop){
160  if(channel < fFirstChannelInNextPlane[csloop][tpcloop][planeloop]){
161  cstat = csloop;
162  tpc = tpcloop;
163  plane = planeloop;
164  wire = channel - fFirstChannelInThisPlane[cstat][tpcloop][planeloop];
165  foundWid = true;
166  break;
167  }
168  if(foundWid) break;
169  }// end plane loop
170  if(foundWid) break;
171  }// end tpc loop
172  if(foundWid) break;
173  }// end cryostat loop
174 
175  geo::WireID CodeWire(cstat, tpc, plane, wire);
176 
177  AllSegments.push_back(CodeWire);
178 
179  return AllSegments;
180  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
unsigned int fNcryostat
number of cryostats in the detector
raw::ChannelID_t fTopChannel
book keeping highest channel #
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
geo::PlaneID geo::ChannelMapStandardAlg::ConvertROPtoWirePlane ( readout::ROPID const &  ropid)
staticprivate

Converts a wire plane ID into a ROP ID using the same numerical indices.

Definition at line 503 of file ChannelMapStandardAlg.cxx.

References geo::CryostatID::Cryostat, geo::CryostatID::isValid, readout::ROPID::ROP, and readout::TPCsetID::TPCset.

Referenced by ConvertWirePlaneToROP(), FirstChannelInROP(), FirstWirePlaneInROP(), and WireCount().

504  {
505  if (!ropid.isValid) return {};
506  return {
507  (geo::CryostatID::CryostatID_t) ropid.Cryostat,
508  (geo::TPCID::TPCID_t) ropid.TPCset,
509  (geo::PlaneID::PlaneID_t) ropid.ROP
510  };
511  } // ChannelMapStandardAlg::ConvertROPtoWirePlane()
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:121
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:251
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:196
geo::TPCID geo::ChannelMapStandardAlg::ConvertTPCsetToTPC ( readout::TPCsetID const &  tpcsetid)
staticprivate

Converts a TPC set ID into a TPC ID using the same numerical indices.

Definition at line 477 of file ChannelMapStandardAlg.cxx.

References ConvertWirePlaneToROP(), geo::CryostatID::Cryostat, geo::CryostatID::isValid, and readout::TPCsetID::TPCset.

Referenced by ConvertTPCtoTPCset(), FirstTPCinTPCset(), ROPtoTPCs(), TPCsetToTPCs(), and WireCount().

478  {
479  if (!tpcsetid.isValid) return {};
480  return {
481  (geo::CryostatID::CryostatID_t) tpcsetid.Cryostat,
482  (geo::TPCID::TPCID_t) tpcsetid.TPCset
483  };
484  } // ChannelMapStandardAlg::ConvertTPCsetToTPC()
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:121
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:196
readout::TPCsetID geo::ChannelMapStandardAlg::ConvertTPCtoTPCset ( geo::TPCID const &  tpcid)
staticprivate

Converts a TPC ID into a TPC set ID using the same numerical indices.

Definition at line 465 of file ChannelMapStandardAlg.cxx.

References ConvertTPCsetToTPC(), geo::CryostatID::Cryostat, geo::CryostatID::isValid, and geo::TPCID::TPC.

Referenced by FirstWirePlaneInROP(), TPCtoTPCset(), and WireCount().

466  {
467  if (!tpcid.isValid) return {}; // invalid ID, default-constructed
468  return {
469  (readout::CryostatID::CryostatID_t) tpcid.Cryostat,
471  };
472  } // ChannelMapStandardAlg::ConvertTPCtoTPCset()
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:121
unsigned short TPCsetID_t
type for the ID number
Definition: readout_types.h:42
readout::ROPID geo::ChannelMapStandardAlg::ConvertWirePlaneToROP ( geo::PlaneID const &  planeid)
staticprivate

Converts a ROP ID into a wire plane ID using the same numerical indices.

Definition at line 489 of file ChannelMapStandardAlg.cxx.

References ConvertROPtoWirePlane(), geo::CryostatID::Cryostat, geo::CryostatID::isValid, geo::PlaneID::Plane, and geo::TPCID::TPC.

Referenced by ConvertTPCsetToTPC(), WireCount(), and WirePlaneToROP().

490  {
491  if (!planeid.isValid) return {}; // invalid ID, default-constructed
492  return {
493  (readout::CryostatID::CryostatID_t) planeid.Cryostat,
494  (readout::TPCsetID::TPCsetID_t) planeid.TPC,
495  (readout::ROPID::ROPID_t) planeid.Plane
496  };
497 
498  } // ChannelMapStandardAlg::ConvertWirePlaneToROP()
unsigned int ROPID_t
type for the ID number
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:121
unsigned short TPCsetID_t
type for the ID number
Definition: readout_types.h:42
const std::vector<std::vector<std::vector<raw::ChannelID_t> > > geo::ChannelMapAlg::FirstChannelInNextPlane ( ) const
inlineinherited

Retrieve the private fFirstChannelInNextPlane vector for testing.

Definition at line 591 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::fFirstChannelInThisPlane.

592  { return fFirstChannelInThisPlane; }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
raw::ChannelID_t geo::ChannelMapStandardAlg::FirstChannelInROP ( readout::ROPID const &  ropid) const
overridevirtual

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.

Implements geo::ChannelMapAlg.

Definition at line 447 of file ChannelMapStandardAlg.cxx.

References geo::ChannelMapAlg::AccessElement(), ConvertROPtoWirePlane(), FirstWirePlaneInROP(), fPlaneBaselines, raw::InvalidChannelID, and geo::CryostatID::isValid.

Referenced by ChannelToROP(), and PlaneWireToChannel().

448  {
449  if (!ropid.isValid) return raw::InvalidChannelID;
450  return (raw::ChannelID_t)
452  } // ChannelMapStandardAlg::FirstChannelInROP()
static geo::PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
PlaneInfoMap_t< unsigned int > fPlaneBaselines
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
const std::vector<std::vector<std::vector<raw::ChannelID_t> > > geo::ChannelMapAlg::FirstChannelInThisPlane ( ) const
inlineinherited

Retrieve the private fFirstChannelInThisPlane vector for testing.

Definition at line 595 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::fFirstChannelInNextPlane.

596  { return fFirstChannelInNextPlane; }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
geo::TPCID geo::ChannelMapStandardAlg::FirstTPCinTPCset ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 359 of file ChannelMapStandardAlg.cxx.

References ConvertTPCsetToTPC().

Referenced by NROPs(), PlaneWireToChannel(), and TPCsetToTPCs().

360  {
361  return ConvertTPCsetToTPC(tpcsetid);
362  } // ChannelMapStandardAlg::FirstTPCinTPCset()
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
geo::PlaneID geo::ChannelMapStandardAlg::FirstWirePlaneInROP ( readout::ROPID const &  ropid) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 457 of file ChannelMapStandardAlg.cxx.

References ConvertROPtoWirePlane(), and ConvertTPCtoTPCset().

Referenced by FirstChannelInROP(), Nchannels(), PlaneWireToChannel(), and ROPtoWirePlanes().

458  {
459  return ConvertROPtoWirePlane(ropid);
460  } // ChannelMapStandardAlg::FirstWirePlaneInROP()
static geo::PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
template<typename T >
T const* geo::ChannelMapAlg::GetElementPtr ( PlaneInfoMap_t< T > const &  map,
geo::PlaneID const &  id 
) const
inlineprotectedinherited

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

Definition at line 693 of file ChannelMapAlg.h.

Referenced by geo::ChannelMapAlg::isValidElement(), and PlaneWireToChannel().

694  {
695  if (id.Cryostat >= map.size()) return nullptr;
696  auto const& cryo_map = map[id.Cryostat];
697  if (id.TPC >= cryo_map.size()) return nullptr;
698  auto const& TPC_map = cryo_map[id.TPC];
699  if (id.Plane >= TPC_map.size()) return nullptr;
700  auto const& plane_map = TPC_map[id.Plane];
701  return &plane_map;
702  } // GetElementPtr()
recob::tracking::Plane Plane
Definition: TrackState.h:17
unsigned int geo::ChannelMapAlg::HardwareChannelFromOpChannel ( unsigned int  opChannel) const
virtualinherited

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.

Referenced by geo::ChannelMapAlg::IsValidOpChannel(), and geo::ChannelMapAlg::PlaneWireToChannel().

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

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

Definition at line 90 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::ChannelToWire(), raw::isValidChannelID(), geo::ChannelMapAlg::Nchannels(), geo::ChannelMapAlg::PlaneIDs(), geo::ChannelMapAlg::SignalTypeForChannel(), geo::ChannelMapAlg::SignalTypeForChannelImpl(), geo::ChannelMapAlg::SignalTypeForROPID(), and geo::ChannelMapAlg::SignalTypeForROPIDImpl().

91  { 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:36
bool geo::ChannelMapStandardAlg::HasROP ( readout::ROPID const &  ropid) const
overridevirtual

Returns whether we have the specified ROP

Returns
whether the readout plane is valid and exists

Implements geo::ChannelMapAlg.

Definition at line 394 of file ChannelMapStandardAlg.cxx.

References NROPs(), readout::ROPID::ROP, and WirePlaneToROP().

Referenced by Nchannels(), and PlaneWireToChannel().

394  {
395  return ropid.ROP < NROPs(ropid);
396  } // ChannelMapStandardAlg::HasROP()
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROPs in the specified TPC set.
bool geo::ChannelMapStandardAlg::HasTPCset ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

Returns whether we have the specified TPC set

Returns
whether the TPC set is valid and exists

Implements geo::ChannelMapAlg.

Definition at line 333 of file ChannelMapStandardAlg.cxx.

References NTPCsets(), readout::TPCsetID::TPCset, and TPCtoTPCset().

Referenced by NROPs(), and PlaneWireToChannel().

334  {
335  return tpcsetid.TPCset < NTPCsets(tpcsetid);
336  } // ChannelMapStandardAlg::HasTPCset()
virtual unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
void geo::ChannelMapStandardAlg::Initialize ( GeometryData_t const &  geodata)
overridevirtual

Geometry initialisation.

Implements geo::ChannelMapAlg.

Definition at line 27 of file ChannelMapStandardAlg.cxx.

References geo::WireGeo::CosThetaZ(), geo::GeometryData_t::cryostats, geo::ChannelMapAlg::fFirstChannelInNextPlane, geo::ChannelMapAlg::fFirstChannelInThisPlane, fFirstWireProj, fNchannels, fNcryostat, fNPlanes, fNTPC, fOrthVectorsY, fOrthVectorsZ, fPlaneBaselines, fPlaneIDs, fTopChannel, fWireCounts, fWiresPerPlane, geo::WireGeo::GetCenter(), LOG_DEBUG, geo::TPCGeo::Nplanes(), geo::CryostatGeo::NTPC(), geo::PlaneGeo::Nwires(), geo::TPCGeo::Plane(), geo::WireGeo::SinThetaZ(), geo::CryostatGeo::TPC(), Uninitialize(), geo::PlaneGeo::Wire(), and geo::TPCGeo::WirePitch().

28  {
29  // start over:
30  Uninitialize();
31 
32  std::vector<geo::CryostatGeo> const& cgeo = geodata.cryostats;
33 
34  fNcryostat = cgeo.size();
35 
36  mf::LogInfo("ChannelMapStandardAlg") << "Initializing Standard ChannelMap...";
37 
38  fNTPC.resize(fNcryostat);
39  fWireCounts.resize(fNcryostat);
40  fNPlanes.resize(fNcryostat);
41  fFirstWireProj.resize(fNcryostat);
42  fOrthVectorsY.resize(fNcryostat);
43  fOrthVectorsZ.resize(fNcryostat);
45  fWiresPerPlane.resize(fNcryostat);
48  fPlaneIDs.clear();
49  fTopChannel = 0;
50 
51  int RunningTotal = 0;
52 
53  for(unsigned int cs = 0; cs != fNcryostat; ++cs){
54  geo::CryostatGeo const& cryo = cgeo[cs];
55  fNTPC[cs] = cryo.NTPC();
56 
57  // Size up all the vectors
58  fWireCounts[cs] .resize(fNTPC[cs]);
59  fFirstWireProj[cs] .resize(fNTPC[cs]);
60  fOrthVectorsY[cs] .resize(fNTPC[cs]);
61  fOrthVectorsZ[cs] .resize(fNTPC[cs]);
62  fPlaneBaselines[cs] .resize(fNTPC[cs]);
63  fWiresPerPlane[cs] .resize(fNTPC[cs]);
64  fNPlanes[cs] .resize(fNTPC[cs]);
65  fFirstChannelInThisPlane[cs].resize(fNTPC[cs]);
66  fFirstChannelInNextPlane[cs].resize(fNTPC[cs]);
67 
68  for(unsigned int TPCCount = 0; TPCCount != fNTPC[cs]; ++TPCCount){
69  geo::TPCGeo const& TPC = cryo.TPC(TPCCount);
70  unsigned int PlanesThisTPC = TPC.Nplanes();
71  fWireCounts[cs][TPCCount] .resize(PlanesThisTPC);
72  fFirstWireProj[cs][TPCCount].resize(PlanesThisTPC);
73  fOrthVectorsY[cs][TPCCount] .resize(PlanesThisTPC);
74  fOrthVectorsZ[cs][TPCCount] .resize(PlanesThisTPC);
75  fNPlanes[cs][TPCCount]=PlanesThisTPC;
76  for(unsigned int PlaneCount = 0; PlaneCount != PlanesThisTPC; ++PlaneCount){
77  geo::PlaneGeo const& plane = TPC.Plane(PlaneCount);
78 
79  fPlaneIDs.emplace(PlaneID(cs, TPCCount, PlaneCount));
80  double ThisWirePitch = TPC.WirePitch(PlaneCount);
81  fWireCounts[cs][TPCCount][PlaneCount] = plane.Nwires();
82 
83  double WireCentre1[3] = {0.,0.,0.};
84  double WireCentre2[3] = {0.,0.,0.};
85 
86  const geo::WireGeo& firstWire = plane.Wire(0);
87  const double sth = firstWire.SinThetaZ(), cth = firstWire.CosThetaZ();
88 
89  firstWire.GetCenter(WireCentre1,0);
90  plane.Wire(1).GetCenter(WireCentre2,0);
91 
92  // figure out if we need to flip the orthogonal vector
93  // (should point from wire n -> n+1)
94  double OrthY = cth, OrthZ = -sth;
95  if(((WireCentre2[1] - WireCentre1[1])*OrthY
96  + (WireCentre2[2] - WireCentre1[2])*OrthZ) < 0){
97  OrthZ *= -1;
98  OrthY *= -1;
99  }
100 
101  // Overall we are trying to build an expression that looks like
102  // int NearestWireNumber = round((worldPos.OrthVector - FirstWire.OrthVector)/WirePitch);
103  // That runs as fast as humanly possible.
104  // We predivide everything by the wire pitch so we don't do this in the loop.
105  //
106  // Putting this together into the useful constants we will use later per plane and tpc:
107  fOrthVectorsY[cs][TPCCount][PlaneCount] = OrthY / ThisWirePitch;
108  fOrthVectorsZ[cs][TPCCount][PlaneCount] = OrthZ / ThisWirePitch;
109 
110  fFirstWireProj[cs][TPCCount][PlaneCount] = WireCentre1[1]*OrthY + WireCentre1[2]*OrthZ;
111  fFirstWireProj[cs][TPCCount][PlaneCount] /= ThisWirePitch;
112 
113  // now to count up wires in each plane and get first channel in each plane
114  int WiresThisPlane = plane.Nwires();
115  fWiresPerPlane[cs] .at(TPCCount).push_back(WiresThisPlane);
116  fPlaneBaselines[cs].at(TPCCount).push_back(RunningTotal);
117 
118  RunningTotal += WiresThisPlane;
119 
120  fFirstChannelInThisPlane[cs].at(TPCCount).push_back(fTopChannel);
121  fTopChannel += WiresThisPlane;
122  fFirstChannelInNextPlane[cs].at(TPCCount).push_back(fTopChannel);
123 
124  }// end loop over planes
125  }// end loop over TPCs
126  }// end loop over cryostats
127 
128  // calculate the total number of channels in the detector
130 
131  LOG_DEBUG("ChannelMapStandard") << "# of channels is " << fNchannels;
132 
133 
134  return;
135  }
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:61
TPCInfoMap_t< unsigned int > fNPlanes
PlaneInfoMap_t< float > fWireCounts
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:506
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
double SinThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
Definition: WireGeo.h:204
Geometry information for a single TPC.
Definition: TPCGeo.h:37
Geometry information for a single cryostat.
Definition: CryostatGeo.h:36
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
PlaneInfoMap_t< float > fOrthVectorsZ
unsigned int fNcryostat
number of cryostats in the detector
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
PlaneInfoMap_t< unsigned int > fPlaneBaselines
unsigned int NTPC() const
Number of TPCs in this cryostat.
Definition: CryostatGeo.h:155
PlaneInfoMap_t< unsigned int > fWiresPerPlane
double WirePitch(unsigned plane=0) const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.cxx:427
PlaneInfoMap_t< float > fFirstWireProj
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
unsigned int fNchannels
number of channels in the detector
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
virtual void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:250
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
#define LOG_DEBUG(id)
raw::ChannelID_t fTopChannel
book keeping highest channel #
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
Definition: WireGeo.cxx:68
double CosThetaZ() const
Returns trigonometric operations on ThetaZ()
Definition: WireGeo.h:203
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
template<typename T >
bool geo::ChannelMapAlg::isValidElement ( TPCInfoMap_t< T > const &  map,
geo::CryostatID const &  id 
) const
inlineprotectedinherited

Returns whether the ID specifies a valid entry.

Definition at line 646 of file ChannelMapAlg.h.

Referenced by geo::ChannelMapAlg::AccessElementSize(), and geo::ChannelMapAlg::isValidElement().

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

Returns the specified element of the TPC map.

Definition at line 649 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::AccessElement(), and geo::ChannelMapAlg::isValidElement().

650  {
651  return isValidElement(map, id.asCryostatID())
652  && (id.TPC < map[id.Cryostat].size());
653  }
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
inlineprotectedinherited

Returns whether the ID specifies a valid entry.

Definition at line 673 of file ChannelMapAlg.h.

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

Returns whether the ID specifies a valid entry.

Definition at line 676 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::isValidElement().

677  {
678  return isValidElement(map, id.asCryostatID())
679  && (id.TPC < map[id.Cryostat].size());
680  }
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
inlineprotectedinherited

Returns whether the ID specifies a valid entry.

Definition at line 683 of file ChannelMapAlg.h.

References geo::ChannelMapAlg::GetElementPtr(), and geo::ChannelMapAlg::isValidElement().

684  {
685  return isValidElement(map, id.asTPCID())
686  && (id.Plane < AccessSize(map, id.asTPCID()));
687  }
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
virtualinherited

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.

References geo::ChannelMapAlg::HardwareChannelFromOpChannel(), geo::ChannelMapAlg::NOpChannels(), geo::ChannelMapAlg::NOpHardwareChannels(), and geo::ChannelMapAlg::OpDetFromOpChannel().

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

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
virtualinherited

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.

References geo::ChannelMapAlg::NOpChannels().

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

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.
unsigned int geo::ChannelMapStandardAlg::MaxROPs ( ) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 384 of file ChannelMapStandardAlg.cxx.

References fNPlanes, and max.

Referenced by PlaneWireToChannel().

384  {
385  unsigned int max = 0;
386  for (auto const& cryo_tpc: fNPlanes)
387  for (unsigned int nPlanes: cryo_tpc)
388  if (nPlanes > max) max = nPlanes;
389  return max;
390  } // ChannelMapStandardAlg::MaxROPs()
TPCInfoMap_t< unsigned int > fNPlanes
Int_t max
Definition: plot.C:27
unsigned int geo::ChannelMapStandardAlg::MaxTPCs ( ) const
private

Returns the largest number of TPCs in a single cryostat.

Definition at line 366 of file ChannelMapStandardAlg.cxx.

References fNTPC, max, and NROPs().

Referenced by MaxTPCsets(), and WireCount().

367  {
368  unsigned int max = 0;
369  for (unsigned int nTPCs: fNTPC) if (nTPCs > max) max = nTPCs;
370  return max;
371  } // ChannelMapStandardAlg::MaxTPCs()
Int_t max
Definition: plot.C:27
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int geo::ChannelMapStandardAlg::MaxTPCsets ( ) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 326 of file ChannelMapStandardAlg.cxx.

References MaxTPCs().

Referenced by PlaneWireToChannel().

327  {
328  return MaxTPCs();
329  } // ChannelMapStandardAlg::MaxTPCsets()
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
raw::ChannelID_t geo::ChannelMapStandardAlg::Nchannels ( ) const
overridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 183 of file ChannelMapStandardAlg.cxx.

References fNchannels.

184  {
185  return fNchannels;
186  }
unsigned int fNchannels
number of channels in the detector
unsigned int geo::ChannelMapStandardAlg::Nchannels ( readout::ROPID const &  ropid) const
overridevirtual

Returns the number of channels in the specified ROP.

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

Implements geo::ChannelMapAlg.

Definition at line 190 of file ChannelMapStandardAlg.cxx.

References FirstWirePlaneInROP(), HasROP(), WireCoordinate(), and WireCount().

191  {
192  if (!HasROP(ropid)) return 0;
193  // The number of channels matches the number of wires. Life is easy.
194  return WireCount(FirstWirePlaneInROP(ropid));
195  } // ChannelMapStandardAlg::Nchannels(ROPID)
unsigned int WireCount(geo::PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
virtual bool HasROP(readout::ROPID const &ropid) const override
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
size_t geo::ChannelMapAlg::NearestAuxDet ( const double *  point,
std::vector< geo::AuxDetGeo * > const &  auxDets 
) const
virtualinherited

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
Returns
index of auxiliary detector within auxDets

Definition at line 80 of file ChannelMapAlg.cxx.

Referenced by geo::ChannelMapAlg::NearestSensitiveAuxDet(), and geo::ChannelMapAlg::NearestWire().

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

Returns sensitive auxiliary detector closest to specified point.

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

Definition at line 114 of file ChannelMapAlg.cxx.

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

Referenced by geo::ChannelMapAlg::NearestWire().

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

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.

References geo::ChannelMapAlg::NearestWireID(), and geo::WireID::Wire.

Referenced by geo::ChannelMapAlg::NearestWire(), and geo::ChannelMapAlg::NearestWireID().

17  {
18  return NearestWireID(worldPos, planeID).Wire;
19  }
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:313
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
inlineinherited

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

References geo::ChannelMapAlg::ChannelToAuxDet(), geo::ChannelMapAlg::ChannelToROP(), geo::ChannelMapAlg::ChannelToSensitiveAuxDet(), geo::ChannelMapAlg::FirstChannelInROP(), geo::ChannelMapAlg::FirstTPCinTPCset(), geo::ChannelMapAlg::FirstWirePlaneInROP(), geo::ChannelMapAlg::HasROP(), geo::ChannelMapAlg::HasTPCset(), geo::ChannelMapAlg::MaxROPs(), geo::ChannelMapAlg::MaxTPCsets(), geo::ChannelMapAlg::NearestAuxDet(), geo::ChannelMapAlg::NearestSensitiveAuxDet(), geo::ChannelMapAlg::NearestWire(), geo::ChannelMapAlg::NROPs(), geo::ChannelMapAlg::NTPCsets(), geo::ChannelMapAlg::ROPtoTPCs(), geo::ChannelMapAlg::ROPtoWirePlanes(), geo::ChannelMapAlg::Sorter(), geo::ChannelMapAlg::TPCsetToTPCs(), geo::ChannelMapAlg::TPCtoTPCset(), and geo::ChannelMapAlg::WirePlaneToROP().

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

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 from geo::ChannelMapAlg.

Definition at line 213 of file ChannelMapStandardAlg.cxx.

References PlaneWireToChannel(), WireCoordinate(), and WireCount().

Referenced by NearestWireID(), and WireCoordinate().

214  {
215 
216  // This part is the actual calculation of the nearest wire number, where we assume
217  // uniform wire pitch and angle within a wireplane
218 
219  // add 0.5 to have the correct rounding
220  int NearestWireNumber = int
221  (0.5 + WireCoordinate(worldPos.Y(), worldPos.Z(), planeID));
222 
223  // If we are outside of the wireplane range, throw an exception
224  // (this response maintains consistency with the previous
225  // implementation based on geometry lookup)
226  if(NearestWireNumber < 0 ||
227  (unsigned int) NearestWireNumber >= WireCount(planeID))
228  {
229  int wireNumber = NearestWireNumber; // save for the output
230 
231  if(NearestWireNumber < 0 ) NearestWireNumber = 0;
232  else NearestWireNumber = WireCount(planeID) - 1;
233 
234  throw InvalidWireIDError("Geometry", wireNumber, NearestWireNumber)
235  << "Can't Find Nearest Wire for position ("
236  << worldPos[0] << "," << worldPos[1] << "," << worldPos[2] << ")"
237  << " in plane " << std::string(planeID) << " approx wire number # "
238  << wireNumber << " (capped from " << NearestWireNumber << ")\n";
239  }
240 
241  return geo::WireID(planeID, (geo::WireID::WireID_t) NearestWireNumber);
242  }
unsigned int WireCount(geo::PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:306
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
virtual WireID geo::ChannelMapStandardAlg::NearestWireID ( const TVector3 &  worldPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) const
inlineoverridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 49 of file ChannelMapStandardAlg.h.

References NearestWireID(), and PlaneWireToChannel().

53  { return NearestWireID(worldPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
virtual WireID NearestWireID(const TVector3 &worldPos, geo::PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
unsigned int geo::ChannelMapAlg::NOpChannels ( unsigned int  NOpDets) const
virtualinherited

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.

Referenced by geo::ChannelMapAlg::IsValidOpChannel(), geo::ChannelMapAlg::MaxOpChannel(), and geo::ChannelMapAlg::PlaneWireToChannel().

23  {
24  // By default just return the number of optical detectos
25  return NOpDets;
26  }
unsigned int geo::ChannelMapAlg::NOpHardwareChannels ( unsigned int  opDet) const
virtualinherited

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.

Referenced by geo::ChannelMapAlg::IsValidOpChannel(), and geo::ChannelMapAlg::PlaneWireToChannel().

37  {
38  // By defualt, 1 channel per optical detector
39  return 1;
40  }
unsigned int geo::ChannelMapStandardAlg::NROPs ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

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

Parameters
tpcsetidTPC set ID
Returns
number of readout planes in the TPC sets, or 0 if ID is invalid

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

In this mapping, planes have independent readout and there is one wire plane in each readout plane and one readout plane for each wire plane.

Implements geo::ChannelMapAlg.

Definition at line 376 of file ChannelMapStandardAlg.cxx.

References geo::ChannelMapAlg::AccessElement(), FirstTPCinTPCset(), fNPlanes, and HasTPCset().

Referenced by HasROP(), MaxTPCs(), and PlaneWireToChannel().

377  {
378  if (!HasTPCset(tpcsetid)) return 0;
379  return AccessElement(fNPlanes, FirstTPCinTPCset(tpcsetid));
380  } // ChannelMapStandardAlg::NROPs()
TPCInfoMap_t< unsigned int > fNPlanes
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
virtual bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
virtual geo::TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
unsigned int geo::ChannelMapStandardAlg::NTPCsets ( readout::CryostatID const &  cryoid) const
overridevirtual

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

In this mapping, TPCs have independent readout and there is one TPC in each TPC set and one TPC set for each TPC.

Implements geo::ChannelMapAlg.

Definition at line 317 of file ChannelMapStandardAlg.cxx.

References geo::CryostatID::Cryostat, fNTPC, and geo::CryostatID::isValid.

Referenced by HasTPCset(), PlaneIDs(), and PlaneWireToChannel().

318  {
319  // return the same number as the number of TPCs
320  return (cryoid.isValid && cryoid.Cryostat < fNTPC.size())?
321  fNTPC[cryoid.Cryostat]: 0;
322  } // ChannelMapStandardAlg::NTPCsets()
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int geo::ChannelMapAlg::OpChannel ( unsigned int  detNum,
unsigned int  hwchannel = 0 
) const
virtualinherited

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.

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

46  {
47  return detNum;
48  }
unsigned int geo::ChannelMapAlg::OpDetFromOpChannel ( unsigned int  opChannel) const
virtualinherited

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.

Referenced by geo::ChannelMapAlg::IsValidOpChannel(), and geo::ChannelMapAlg::PlaneWireToChannel().

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

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

Implements geo::ChannelMapAlg.

Definition at line 309 of file ChannelMapStandardAlg.cxx.

References fPlaneIDs, and NTPCsets().

Referenced by PlaneWireToChannel().

310  {
311  return fPlaneIDs;
312  }
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
raw::ChannelID_t geo::ChannelMapStandardAlg::PlaneWireToChannel ( geo::WireID const &  wireID) const
overridevirtual

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 from geo::ChannelMapAlg.

Definition at line 258 of file ChannelMapStandardAlg.cxx.

References fPlaneBaselines, geo::ChannelMapAlg::GetElementPtr(), raw::InvalidChannelID, and geo::WireID::Wire.

Referenced by NearestWireID(), and PlaneWireToChannel().

259  {
260  unsigned int const* pBaseLine = GetElementPtr(fPlaneBaselines, wireID);
261  // This is the actual lookup part - first make sure coordinates are legal
262  if (pBaseLine) {
263  // if the channel has legal coordinates, its ID is given by the wire
264  // number above the number of wires in lower planes, tpcs and cryostats
265  return *pBaseLine + wireID.Wire;
266  }
267  else{
268  // if the coordinates were bad, throw an exception
269  throw cet::exception("ChannelMapStandardAlg")
270  << "NO CHANNEL FOUND for " << std::string(wireID);
271  }
272 
273  // made it here, that shouldn't happen, return raw::InvalidChannelID
274  mf::LogWarning("ChannelMapStandardAlg") << "should not be at the point in the function, returning "
275  << "invalid channel";
276  return raw::InvalidChannelID;
277 
278  }
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
PlaneInfoMap_t< unsigned int > fPlaneBaselines
T const * GetElementPtr(PlaneInfoMap_t< T > const &map, geo::PlaneID const &id) const
Returns a pointer to the specified element, or nullptr if invalid.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual raw::ChannelID_t geo::ChannelMapStandardAlg::PlaneWireToChannel ( unsigned int  plane,
unsigned int  wire,
unsigned int  tpc,
unsigned int  cstat 
) const
inlineoverridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 59 of file ChannelMapStandardAlg.h.

References ChannelToROP(), FirstChannelInROP(), FirstTPCinTPCset(), FirstWirePlaneInROP(), HasROP(), HasTPCset(), MaxROPs(), MaxTPCsets(), NROPs(), NTPCsets(), PlaneIDs(), PlaneWireToChannel(), ROPtoTPCs(), ROPtoWirePlanes(), TPCsetToTPCs(), TPCtoTPCset(), and WirePlaneToROP().

63  { return PlaneWireToChannel(geo::WireID(cstat, tpc, plane, wire)); }
virtual raw::ChannelID_t PlaneWireToChannel(geo::WireID const &wireID) const override
Returns the channel ID a wire is connected to.
std::vector< geo::TPCID > geo::ChannelMapStandardAlg::ROPtoTPCs ( readout::ROPID const &  ropid) const
overridevirtual

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

In this mapping, readout planes and wire planes are mapped one-to-one. The returned list contains always one entry, unless the specified readout plane ID is invalid, in which case the list is empty. 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.

Implements geo::ChannelMapAlg.

Definition at line 419 of file ChannelMapStandardAlg.cxx.

References readout::ROPID::asTPCsetID(), ChannelToROP(), ConvertTPCsetToTPC(), and geo::CryostatID::isValid.

Referenced by PlaneWireToChannel(), and ROPtoWirePlanes().

420  {
421  std::vector<geo::TPCID> IDs;
422  // we take the TPC set of the ROP and convert it straight into a TPC ID
423  if (ropid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(ropid.asTPCsetID()));
424  return IDs;
425  } // ChannelMapStandardAlg::ROPtoTPCs()
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
std::vector< geo::PlaneID > geo::ChannelMapStandardAlg::ROPtoWirePlanes ( readout::ROPID const &  ropid) const
overridevirtual

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

Parameters
ropidID of the readout plane to convert into wire planes
Returns
the list of wire plane IDs, empty if readout plane ID is invalid

In this mapping, readout planes and wire planes are mapped one-to-one. The returned list contains always one entry, unless the specified readout plane ID is invalid, in which case the list is empty. 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.

Implements geo::ChannelMapAlg.

Definition at line 409 of file ChannelMapStandardAlg.cxx.

References FirstWirePlaneInROP(), geo::CryostatID::isValid, and ROPtoTPCs().

Referenced by PlaneWireToChannel(), and WirePlaneToROP().

410  {
411  std::vector<geo::PlaneID> IDs;
412  if (ropid.isValid) IDs.emplace_back(FirstWirePlaneInROP(ropid));
413  return IDs;
414  } // ChannelMapStandardAlg::ROPtoWirePlanes()
virtual geo::PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
geo::SigType_t geo::ChannelMapAlg::SignalTypeForChannel ( raw::ChannelID_t const  channel) const
inherited

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

References geo::ChannelMapAlg::SignalTypeForChannelImpl().

Referenced by geo::ChannelMapAlg::HasChannel(), and geo::ChannelMapAlg::SignalTypeForROPIDImpl().

196  {
197  return SignalTypeForChannelImpl(channel);
198  }
virtual geo::SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const =0
Return the signal type of the specified channel.
SigType_t geo::ChannelMapStandardAlg::SignalTypeForChannelImpl ( raw::ChannelID_t const  channel) const
overrideprivatevirtual

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.

Implements geo::ChannelMapAlg.

Definition at line 282 of file ChannelMapStandardAlg.cxx.

References geo::ChannelMapAlg::fFirstChannelInNextPlane, geo::ChannelMapAlg::fFirstChannelInThisPlane, fNchannels, fNPlanes, fNTPC, geo::kCollection, geo::kInduction, and geo::kMysteryType.

283  {
284 
285  // still assume one cryostat for now -- faster
286  unsigned int nChanPerTPC = fNchannels/fNTPC[0];
287  // casting wil trunc towards 0 -- faster than floor
288  unsigned int tpc = channel / nChanPerTPC;
289  //need number of planes to know Collection
290  unsigned int PlanesThisTPC = fNPlanes[0][tpc];
291 
292 
293 
295  if( (channel >= fFirstChannelInThisPlane[0][tpc][0]) &&
296  (channel < fFirstChannelInNextPlane[0][tpc][PlanesThisTPC-2]) ){ sigt = geo::kInduction; }
297  else if( (channel >= fFirstChannelInThisPlane[0][tpc][PlanesThisTPC-1]) &&
298  (channel < fFirstChannelInNextPlane[0][tpc][PlanesThisTPC-1]) ){ sigt = geo::kCollection; }
299  else
300  mf::LogWarning("BadChannelSignalType") << "Channel " << channel
301  << " not given signal type." << std::endl;
302 
303 
304  return sigt;
305  }
TPCInfoMap_t< unsigned int > fNPlanes
Who knows?
Definition: geo_types.h:94
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
Signal from induction planes.
Definition: geo_types.h:92
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
unsigned int fNchannels
number of channels in the detector
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
Signal from collection planes.
Definition: geo_types.h:93
geo::SigType_t geo::ChannelMapAlg::SignalTypeForROPID ( readout::ROPID const &  ropid) const
inherited

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

References geo::ChannelMapAlg::SignalTypeForROPIDImpl().

Referenced by geo::ChannelMapAlg::HasChannel().

201  {
202  return SignalTypeForROPIDImpl(ropid);
203  }
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
protectedvirtualinherited

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

References geo::ChannelMapAlg::FirstChannelInROP(), and geo::ChannelMapAlg::SignalTypeForChannel().

Referenced by geo::ChannelMapAlg::HasChannel(), and geo::ChannelMapAlg::SignalTypeForROPID().

206  {
208  }
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::ChannelMapStandardAlg::Sorter ( ) const
inlineoverridevirtual

Return the sorter.

Implements geo::ChannelMapAlg.

Definition at line 227 of file ChannelMapStandardAlg.h.

References fSorter.

228  { return fSorter; }
geo::GeoObjectSorterStandard fSorter
class to sort geo objects
std::vector< geo::TPCID > geo::ChannelMapStandardAlg::TPCsetToTPCs ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

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

In this mapping, TPC sets and TPCs are mapped one-to-one. The returned list contains always one entry, unless the specified TPC set ID is invalid, in which case the list is empty. 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.

Implements geo::ChannelMapAlg.

Definition at line 349 of file ChannelMapStandardAlg.cxx.

References ConvertTPCsetToTPC(), FirstTPCinTPCset(), and geo::CryostatID::isValid.

Referenced by PlaneWireToChannel(), and TPCtoTPCset().

350  {
351  std::vector<geo::TPCID> IDs;
352  if (tpcsetid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(tpcsetid));
353  return IDs;
354  } // ChannelMapStandardAlg::TPCsetToTPCs()
static geo::TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
readout::TPCsetID geo::ChannelMapStandardAlg::TPCtoTPCset ( geo::TPCID const &  tpcid) const
overridevirtual

Returns the ID of the TPC set the specified TPC belongs to.

Parameters
tpcidID of the TPC
Returns
the ID of the corresponding TPC set, or invalid ID when tpcid is

In this mapping, TPC sets and TPCs are mapped one-to-one. The returned value mirrors the TPC ID in the readout space. If the TPC ID is not valid, an invalid TPC set ID is returned. Note that this check is performed on the validity of the TPC ID, that does not necessarily imply that the TPC specified by the ID actually exists.

Implements geo::ChannelMapAlg.

Definition at line 341 of file ChannelMapStandardAlg.cxx.

References ConvertTPCtoTPCset(), and TPCsetToTPCs().

Referenced by HasTPCset(), and PlaneWireToChannel().

342  {
343  return ConvertTPCtoTPCset(tpcid);
344  } // ChannelMapStandardAlg::TPCtoTPCset()
static readout::TPCsetID ConvertTPCtoTPCset(geo::TPCID const &tpcid)
Converts a TPC ID into a TPC set ID using the same numerical indices.
void geo::ChannelMapStandardAlg::Uninitialize ( )
overridevirtual

Deconfiguration: prepare for a following call of Initialize()

Implements geo::ChannelMapAlg.

Definition at line 138 of file ChannelMapStandardAlg.cxx.

Referenced by Initialize().

139  {
140  }
double geo::ChannelMapStandardAlg::WireCoordinate ( double  YPos,
double  ZPos,
geo::PlaneID const &  planeID 
) const
overridevirtual

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 from geo::ChannelMapAlg.

Definition at line 200 of file ChannelMapStandardAlg.cxx.

References geo::ChannelMapAlg::AccessElement(), fFirstWireProj, fOrthVectorsY, fOrthVectorsZ, and NearestWireID().

Referenced by Nchannels(), NearestWireID(), and WireCoordinate().

201  {
202  // Returns the wire number corresponding to a (Y,Z) position in PlaneNo
203  // with float precision.
204  // B. Baller August 2014
205  return YPos*AccessElement(fOrthVectorsY, planeID)
206  + ZPos*AccessElement(fOrthVectorsZ, planeID)
207  - AccessElement(fFirstWireProj, planeID);
208  }
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
PlaneInfoMap_t< float > fOrthVectorsZ
PlaneInfoMap_t< float > fFirstWireProj
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
virtual double geo::ChannelMapStandardAlg::WireCoordinate ( double  YPos,
double  ZPos,
unsigned int  PlaneNo,
unsigned int  TPCNo,
unsigned int  cstat 
) const
inlineoverridevirtual

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

Implements geo::ChannelMapAlg.

Definition at line 39 of file ChannelMapStandardAlg.h.

References NearestWireID(), and WireCoordinate().

43  { return WireCoordinate(YPos, ZPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
virtual double WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
unsigned int geo::ChannelMapStandardAlg::WireCount ( geo::PlaneID const &  id) const
inlineprivate

Retrieved the wire cound for the specified plane ID.

Definition at line 260 of file ChannelMapStandardAlg.h.

References geo::ChannelMapAlg::AccessElement(), ConvertROPtoWirePlane(), ConvertTPCsetToTPC(), ConvertTPCtoTPCset(), ConvertWirePlaneToROP(), and MaxTPCs().

Referenced by Nchannels(), and NearestWireID().

261  { return AccessElement(fWireCounts, id); }
PlaneInfoMap_t< float > fWireCounts
T const & AccessElement(TPCInfoMap_t< T > const &map, geo::TPCID const &id) const
Returns the specified element of the TPC map.
readout::ROPID geo::ChannelMapStandardAlg::WirePlaneToROP ( geo::PlaneID const &  planeid) const
overridevirtual

Returns the ID of the ROP planeid belongs to, or invalid if none.

Parameters
planeidID of the plane
Returns
the ID of the corresponding ROP, or invalid ID when planeid is

In this mapping, readout planes and wire planes are mapped one-to-one. The returned value mirrors the plane ID in the readout space. If the plane ID is not valid, an invalid readout plane ID is returned. Note that this check is performed on the validity of the plane ID, that does not necessarily imply that the plane specified by the ID actually exists.

Implements geo::ChannelMapAlg.

Definition at line 401 of file ChannelMapStandardAlg.cxx.

References ConvertWirePlaneToROP(), and ROPtoWirePlanes().

Referenced by ChannelToROP(), HasROP(), and PlaneWireToChannel().

402  {
403  return ConvertWirePlaneToROP(planeid);
404  } // ChannelMapStandardAlg::WirePlaneToROP()
static readout::ROPID ConvertWirePlaneToROP(geo::PlaneID const &planeid)
Converts a ROP ID into a wire plane ID using the same numerical indices.

Member Data Documentation

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

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

Definition at line 618 of file ChannelMapAlg.h.

Referenced by geo::ChannelMapAlg::ChannelToSensitiveAuxDet().

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

map the names of the dets to the AuxDetGeo objects

Definition at line 617 of file ChannelMapAlg.h.

Referenced by geo::ChannelMapAlg::ChannelToAuxDet().

PlaneInfoMap_t<raw::ChannelID_t> geo::ChannelMapAlg::fFirstChannelInNextPlane
protectedinherited
PlaneInfoMap_t<raw::ChannelID_t> geo::ChannelMapAlg::fFirstChannelInThisPlane
protectedinherited
PlaneInfoMap_t<float> geo::ChannelMapStandardAlg::fFirstWireProj
private

Distance (0,0,0) to first wire along orth vector per plane per TPC

Definition at line 238 of file ChannelMapStandardAlg.h.

Referenced by Initialize(), and WireCoordinate().

unsigned int geo::ChannelMapStandardAlg::fNchannels
private

number of channels in the detector

Definition at line 233 of file ChannelMapStandardAlg.h.

Referenced by Initialize(), Nchannels(), and SignalTypeForChannelImpl().

unsigned int geo::ChannelMapStandardAlg::fNcryostat
private

number of cryostats in the detector

Definition at line 232 of file ChannelMapStandardAlg.h.

Referenced by ChannelToWire(), and Initialize().

TPCInfoMap_t<unsigned int> geo::ChannelMapStandardAlg::fNPlanes
private

Number of planes in each TPC - for range checking after calculation

Definition at line 246 of file ChannelMapStandardAlg.h.

Referenced by Initialize(), MaxROPs(), NROPs(), and SignalTypeForChannelImpl().

std::vector<unsigned int> geo::ChannelMapStandardAlg::fNTPC
private

number of TPCs in each cryostat

Definition at line 235 of file ChannelMapStandardAlg.h.

Referenced by ChannelToWire(), Initialize(), MaxTPCs(), NTPCsets(), and SignalTypeForChannelImpl().

PlaneInfoMap_t<float> geo::ChannelMapStandardAlg::fOrthVectorsY
private

Unit vectors orthogonal to wires in.

Definition at line 240 of file ChannelMapStandardAlg.h.

Referenced by Initialize(), and WireCoordinate().

PlaneInfoMap_t<float> geo::ChannelMapStandardAlg::fOrthVectorsZ
private

each plane - stored as 2 components to avoid having to invoke any bulky TObjects / CLHEP vectors etc

Definition at line 241 of file ChannelMapStandardAlg.h.

Referenced by Initialize(), and WireCoordinate().

PlaneInfoMap_t<unsigned int> geo::ChannelMapStandardAlg::fPlaneBaselines
private

The number of wires in all the tpcs and planes up to this one in the heirachy

Definition at line 248 of file ChannelMapStandardAlg.h.

Referenced by FirstChannelInROP(), Initialize(), and PlaneWireToChannel().

std::set<PlaneID> geo::ChannelMapStandardAlg::fPlaneIDs
private

vector of the PlaneIDs present in the detector

Definition at line 237 of file ChannelMapStandardAlg.h.

Referenced by Initialize(), and PlaneIDs().

geo::GeoObjectSorterStandard geo::ChannelMapStandardAlg::fSorter
private

class to sort geo objects

Definition at line 254 of file ChannelMapStandardAlg.h.

Referenced by Sorter().

raw::ChannelID_t geo::ChannelMapStandardAlg::fTopChannel
private

book keeping highest channel #

Definition at line 234 of file ChannelMapStandardAlg.h.

Referenced by ChannelToWire(), and Initialize().

std::set<View_t> geo::ChannelMapStandardAlg::fViews
private

vector of the views present in the detector

Definition at line 236 of file ChannelMapStandardAlg.h.

PlaneInfoMap_t<float> geo::ChannelMapStandardAlg::fWireCounts
private

Number of wires in each plane - for range checking after calculation

Definition at line 244 of file ChannelMapStandardAlg.h.

Referenced by Initialize().

PlaneInfoMap_t<unsigned int> geo::ChannelMapStandardAlg::fWiresPerPlane
private

The number of wires in this plane in the heirachy

Definition at line 251 of file ChannelMapStandardAlg.h.

Referenced by Initialize().


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