LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo::WireReadoutStandardGeom Class Reference

#include "WireReadoutStandardGeom.h"

Inheritance diagram for geo::WireReadoutStandardGeom:
geo::WireReadoutGeom geo::Iterable< details::ReadoutIterationPolicy, details::ToReadoutGeometryElement >

Public Types

using Segment = std::pair< Point_t, Point_t >
 

Public Member Functions

 WireReadoutStandardGeom (fhicl::ParameterSet const &pset, GeometryCore const *geom, std::unique_ptr< WireReadoutSorter > sorter)
 
std::vector< WireIDChannelToWire (raw::ChannelID_t channel) const override
 
unsigned int Nchannels () const override
 Returns the total number of channels present (not necessarily contiguous) More...
 
unsigned int Nchannels (readout::ROPID const &ropid) const override
 Returns the number of channels in the specified ROP. More...
 
std::set< PlaneID > const & PlaneIDs () const override
 Returns a list of the plane IDs in the whole detector. More...
 
unsigned int MaxPlanes () const
 Returns the largest number of planes among all TPCs in this detector. More...
 
unsigned int Nviews () const
 Returns the number of views (different wire orientations) More...
 
std::set< View_t > const & Views () const
 Returns a list of possible views in the detector. More...
 
std::set< View_tViews (TPCID const &tpcid) const
 
void WireEndPoints (WireID const &wireid, double *xyzStart, double *xyzEnd) const
 Fills two arrays with the coordinates of the wire end points. More...
 
double ThirdPlane_dTdW (PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2, PlaneID const &output_plane) const
 Returns dT/dW on the third plane, given it in the other two. More...
 
double ThirdPlane_dTdW (PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2) const
 Returns dT/dW on the third plane, given it in the other two. More...
 
double Plane0Pitch (TPCID const &tpcid, unsigned int p1) const
 
double PlanePitch (TPCID const &tpcid, unsigned int p1=0, unsigned int p2=1) const
 
double WireCoordinate (double YPos, double ZPos, PlaneID const &planeID) const override
 Returns the index of the wire nearest to the specified position. More...
 
WireID NearestWireID (Point_t const &worldPos, PlaneID const &planeID) const override
 Returns the ID of the wire nearest to the specified position. More...
 
raw::ChannelID_t PlaneWireToChannel (WireID const &wireID) const override
 Returns the channel ID a wire is connected to. More...
 
TPC set mapping
unsigned int NTPCsets (readout::CryostatID const &cryoid) const override
 Returns the total number of TPC sets in the specified cryostat. More...
 
unsigned int MaxTPCsets () const override
 Returns the largest number of TPC sets any cryostat in the detector has. More...
 
bool HasTPCset (readout::TPCsetID const &tpcsetid) const override
 
readout::TPCsetID TPCtoTPCset (TPCID const &tpcid) const override
 Returns the ID of the TPC set the specified TPC belongs to. More...
 
std::vector< TPCIDTPCsetToTPCs (readout::TPCsetID const &tpcsetid) const override
 Returns a list of ID of TPCs belonging to the specified TPC set. More...
 
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
unsigned int NROPs (readout::TPCsetID const &tpcsetid) const override
 Returns the total number of ROPs in the specified TPC set. More...
 
unsigned int MaxROPs () const override
 Returns the largest number of ROPs a TPC set in the detector has. More...
 
bool HasROP (readout::ROPID const &ropid) const override
 
readout::ROPID WirePlaneToROP (PlaneID const &planeid) const override
 Returns the ID of the ROP planeid belongs to, or invalid if none. More...
 
std::vector< PlaneIDROPtoWirePlanes (readout::ROPID const &ropid) const override
 Returns a list of ID of wire planes belonging to the specified ROP. More...
 
std::vector< TPCIDROPtoTPCs (readout::ROPID const &ropid) const override
 Returns a list of ID of TPCs the specified ROP spans. More...
 
readout::ROPID ChannelToROP (raw::ChannelID_t channel) const override
 Returns the ID of the ROP the channel belongs to (invalid if none) More...
 
raw::ChannelID_t FirstChannelInROP (readout::ROPID const &ropid) const override
 Returns the ID of the first channel in the specified readout plane. More...
 
PlaneID FirstWirePlaneInROP (readout::ROPID const &ropid) const override
 Returns the ID of the first plane belonging to the specified ROP. More...
 
bool HasPlane (PlaneID const &planeid) const
 Returns whether we have the specified plane. More...
 
bool HasElement (PlaneID const &planeid) const
 Returns whether we have the specified plane. More...
 
bool HasElement (WireID const &wireid) const
 Returns whether we have the specified wire. More...
 
bool HasWire (WireID const &wireid) const
 Returns whether we have the specified wire. More...
 
unsigned int Nplanes (TPCID const &tpcid=details::tpc_zero) const
 Returns the total number of planes in the specified TPC. More...
 
unsigned int NElements (TPCID const &tpcid) const
 Returns the total number of planes in the specified TPC. More...
 
unsigned int NSiblingElements (PlaneID const &planeid) const
 Returns the total number of planes in the specified TPC. More...
 
Wire details
unsigned int NElements (PlaneID const &planeid) const
 Returns the total number of wires in the specified plane. More...
 
unsigned int NSiblingElements (WireID const &wireid) const
 Returns the total number of wires in the specified plane. More...
 
unsigned int MaxWires () const
 Returns the total number of wires in the specified plane. More...
 
unsigned int Nwires (PlaneID const &planeid) const
 Returns the total number of wires in the specified plane. More...
 
PlaneGeo const & FirstPlane (TPCID const &tpcid) const
 Returns the first plane of the specified TPC. More...
 
PlaneGeo const & Plane (TPCID const &tpcid, View_t view) const
 Returns the specified wire. More...
 
PlaneGeo const & Plane (PlaneID const &planeid) const
 Returns the specified wire. More...
 
PlaneGeo const & GetElement (PlaneID const &planeid) const
 Returns the specified wire. More...
 
WireGeo const & GetElement (WireID const &wireid) const
 Returns the specified wire. More...
 
WireGeo const & Wire (WireID const &wireid) const
 Returns the specified wire. More...
 
PlaneGeo const * PlanePtr (PlaneID const &planeid) const
 Returns the specified plane. More...
 
PlaneGeo const * GetElementPtr (PlaneID const &planeid) const
 Returns the specified plane. More...
 
WireGeo const * GetElementPtr (WireID const &wireid) const
 Returns the specified wire. More...
 
WireGeo const * WirePtr (WireID const &wireid) const
 Returns the specified wire. More...
 
Segment WireEndPoints (WireID const &wireid) const
 Returns a segment whose ends are the wire end points. More...
 
Wire access and information
double WireAngleToVertical (View_t view, TPCID const &tpcid) const
 Returns the angle of the wires in the specified view from vertical. More...
 
bool WireIDsIntersect (WireID const &wid1, WireID const &wid2, Point_t &intersection) const
 Computes the intersection between two wires. More...
 
std::optional< WireIDIntersectionWireIDsIntersect (WireID const &wid1, WireID const &wid2) const
 Computes the intersection between two wires. More...
 
Wire geometry queries

Please note the differences between functions: ChannelsIntersect(), WireIDsIntersect() and IntersectionPoint() all calculate wires intersection using the same equation. ChannelsIntersect() and WireIdsIntersect() will return true if the two wires cross, return false if they don't. IntersectionPoint() does not check if the two wires cross.

PlaneID ThirdPlane (PlaneID const &pid1, PlaneID const &pid2) const
 Returns the plane that is not in the specified arguments. More...
 
double ThirdPlaneSlope (PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2, PlaneID const &output_plane) const
 Returns the slope on the third plane, given it in the other two. More...
 
double ThirdPlaneSlope (PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2) const
 Returns the slope on the third plane, given it in the other two. More...
 
double ThirdPlaneSlope (PlaneID::PlaneID_t plane1, double slope1, PlaneID::PlaneID_t plane2, double slope2, TPCID const &tpcid) const
 Returns the slope on the third plane, given it in the other two. More...
 
TPC channel mapping
std::vector< raw::ChannelID_tChannelsInTPCs () const
 Returns an std::vector<ChannelID_t> in all TPCs in a TPCSet. 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...
 
View_t View (raw::ChannelID_t const channel) const
 Returns the view (wire orientation) on the specified TPC channel. More...
 
View_t View (readout::ROPID const &ropid) const
 Returns the view of the channels in the specified readout plane. More...
 
SigType_t SignalType (PlaneID const &pid) const
 Returns the type of signal on the channels of specified TPC plane. More...
 
SigType_t SignalType (raw::ChannelID_t const channel) const
 Return the signal type of the specified channel. More...
 
SigType_t SignalType (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 
raw::ChannelID_t NearestChannel (Point_t const &worldLoc, PlaneID const &planeid) const
 Returns the ID of the channel nearest to the specified position. More...
 
std::optional< WireIDIntersectionChannelsIntersect (raw::ChannelID_t c1, raw::ChannelID_t c2) const
 Returns an intersection point of two channels. More...
 
Optical detector channel mapping
virtual unsigned int NOpChannels (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
unsigned int NOpChannels () const
 Number of electronics channels for all the optical detectors. More...
 
unsigned int MaxOpChannel () const
 Largest optical channel number. More...
 
virtual unsigned int MaxOpChannel (unsigned int NOpDets) const
 Returns the number of optical channels contained in some detectors. More...
 
bool IsValidOpChannel (int opChannel) const
 Is this a valid OpChannel number? 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 NOpHardwareChannels (unsigned int opDet) const
 Returns the number of channels in the specified optical detectors. 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...
 
OpDetGeo const & OpDetGeoFromOpChannel (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...
 
TPC set mapping
readout::TPCsetID FindTPCsetAtPosition (Point_t const &worldLoc) const
 Returns the total number of TPC sets in the specified cryostat. More...
 
Testing (not in the interface)
std::vector< std::vector< std::vector< raw::ChannelID_t > > > const & FirstChannelInNextPlane () const
 Retrieve the private fFirstChannelInNextPlane vector for testing. More...
 
std::vector< std::vector< std::vector< raw::ChannelID_t > > > const & FirstChannelInThisPlane () const
 Retrieve the private fFirstChannelInThisPlane vector for testing. More...
 

Static Public Member Functions

static auto const & start (Segment const &s)
 
static auto const & finish (Segment const &s)
 
static double ComputeThirdPlaneSlope (double angle1, double slope1, double angle2, double slope2, double angle_target)
 Returns the slope on the third plane, given it in the other two. More...
 
static double ComputeThirdPlane_dTdW (double angle1, double pitch1, double dTdW1, double angle2, double pitch2, double dTdW2, double angle_target, double pitch_target)
 Returns the slope on the third plane, given it in the other two. 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 * GetElementPtr (PlaneInfoMap_t< T > const &map, PlaneID const &id) const
 Returns a pointer to the specified element, or nullptr if invalid. More...
 
virtual SigType_t SignalTypeForROPIDImpl (readout::ROPID const &ropid) const
 Return the signal type on the specified readout plane. More...
 
template<typename T >
T const & AccessElement (PlaneInfoMap_t< T > const &map, PlaneID const &id) const
 Returns the specified element of the plane map. More...
 
template<typename T >
size_t AccessElementSize (PlaneInfoMap_t< T > const &map, TPCID const &id) const
 Returns the number of elements in the specified TPC of the plane map. More...
 
Internal structure data access

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

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

Protected Attributes

PlaneInfoMap_t< raw::ChannelID_tfFirstChannelInThisPlane
 
PlaneInfoMap_t< raw::ChannelID_tfFirstChannelInNextPlane
 

Private Member Functions

SigType_t SignalTypeForChannelImpl (raw::ChannelID_t const channel) const override
 Return the signal type of the specified channel. More...
 
unsigned int WireCount (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...
 

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
 

Detailed Description

Definition at line 21 of file WireReadoutStandardGeom.h.

Member Typedef Documentation

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

Data type for per-plane information.

Definition at line 982 of file WireReadoutGeom.h.

using geo::WireReadoutGeom::Segment = std::pair<Point_t, Point_t>
inherited

Definition at line 62 of file WireReadoutGeom.h.

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

Data type for per-TPC information.

Definition at line 978 of file WireReadoutGeom.h.

Constructor & Destructor Documentation

geo::WireReadoutStandardGeom::WireReadoutStandardGeom ( fhicl::ParameterSet const &  pset,
GeometryCore const *  geom,
std::unique_ptr< WireReadoutSorter sorter 
)

Definition at line 57 of file WireReadoutStandardGeom.cxx.

References geo::WireGeo::CosThetaZ(), geo::WireReadoutGeom::fFirstChannelInNextPlane, geo::WireReadoutGeom::fFirstChannelInThisPlane, fFirstWireProj, fNchannels, fNcryostat, fNPlanes, fNTPC, fOrthVectorsY, fOrthVectorsZ, fPlaneBaselines, fPlaneIDs, fTopChannel, fWireCounts, fWiresPerPlane, fhicl::ParameterSet::get(), geo::WireGeo::GetCenter(), MF_LOG_DEBUG, geo::WireReadoutGeom::Nplanes(), and geo::WireGeo::SinThetaZ().

60  : WireReadoutGeom{geom,
61  std::make_unique<WireReadoutGeomBuilderStandard>(
62  pset.get<fhicl::ParameterSet>("Builder", {})),
63  std::move(sorter)}
64  {
65  fNcryostat = geom->Ncryostats();
66 
67  mf::LogInfo("WireReadoutStandardGeom") << "Initializing standard wire-readout geometry...";
68 
69  fNTPC.resize(fNcryostat);
70  fWireCounts.resize(fNcryostat);
71  fNPlanes.resize(fNcryostat);
72  fFirstWireProj.resize(fNcryostat);
73  fOrthVectorsY.resize(fNcryostat);
74  fOrthVectorsZ.resize(fNcryostat);
76  fWiresPerPlane.resize(fNcryostat);
79  fPlaneIDs.clear();
80  fTopChannel = 0;
81 
82  int RunningTotal = 0;
83 
84  for (auto const& cryo : geom->Iterate<CryostatGeo>()) {
85  auto const cs = cryo.ID().Cryostat;
86  fNTPC[cs] = cryo.NTPC();
87 
88  // Size up all the vectors
89  fWireCounts[cs].resize(fNTPC[cs]);
90  fFirstWireProj[cs].resize(fNTPC[cs]);
91  fOrthVectorsY[cs].resize(fNTPC[cs]);
92  fOrthVectorsZ[cs].resize(fNTPC[cs]);
93  fPlaneBaselines[cs].resize(fNTPC[cs]);
94  fWiresPerPlane[cs].resize(fNTPC[cs]);
95  fNPlanes[cs].resize(fNTPC[cs]);
96  fFirstChannelInThisPlane[cs].resize(fNTPC[cs]);
97  fFirstChannelInNextPlane[cs].resize(fNTPC[cs]);
98 
99  for (auto const& TPC : geom->Iterate<TPCGeo>(cryo.ID())) {
100  auto const TPCCount = TPC.ID().TPC;
101  unsigned int PlanesThisTPC = Nplanes(TPC.ID());
102  fWireCounts[cs][TPCCount].resize(PlanesThisTPC);
103  fFirstWireProj[cs][TPCCount].resize(PlanesThisTPC);
104  fOrthVectorsY[cs][TPCCount].resize(PlanesThisTPC);
105  fOrthVectorsZ[cs][TPCCount].resize(PlanesThisTPC);
106  fNPlanes[cs][TPCCount] = PlanesThisTPC;
107  for (auto const& plane : Iterate<PlaneGeo>(TPC.ID())) {
108  fPlaneIDs.insert(plane.ID());
109  auto const PlaneCount = plane.ID().Plane;
110 
111  double ThisWirePitch = plane.WirePitch();
112  fWireCounts[cs][TPCCount][PlaneCount] = plane.Nwires();
113 
114  WireGeo const& firstWire = plane.Wire(0);
115  double const sth = firstWire.SinThetaZ(), cth = firstWire.CosThetaZ();
116 
117  auto WireCenter1 = firstWire.GetCenter();
118  auto WireCenter2 = plane.Wire(1).GetCenter();
119 
120  // figure out if we need to flip the orthogonal vector
121  // (should point from wire n -> n+1)
122  double OrthY = cth, OrthZ = -sth;
123  if (((WireCenter2.Y() - WireCenter1.Y()) * OrthY +
124  (WireCenter2.Z() - WireCenter1.Z()) * OrthZ) < 0) {
125  OrthZ *= -1;
126  OrthY *= -1;
127  }
128 
129  // Overall we are trying to build an expression that looks like
130  // int NearestWireNumber = round((worldPos.OrthVector - FirstWire.OrthVector)/WirePitch);
131  // That runs as fast as humanly possible.
132  // We predivide everything by the wire pitch so we don't do this in the loop.
133  //
134  // Putting this together into the useful constants we will use later per plane and tpc:
135  fOrthVectorsY[cs][TPCCount][PlaneCount] = OrthY / ThisWirePitch;
136  fOrthVectorsZ[cs][TPCCount][PlaneCount] = OrthZ / ThisWirePitch;
137 
138  fFirstWireProj[cs][TPCCount][PlaneCount] =
139  WireCenter1.Y() * OrthY + WireCenter1.Z() * OrthZ;
140  fFirstWireProj[cs][TPCCount][PlaneCount] /= ThisWirePitch;
141 
142  // now to count up wires in each plane and get first channel in each plane
143  int WiresThisPlane = plane.Nwires();
144  fWiresPerPlane[cs].at(TPCCount).push_back(WiresThisPlane);
145  fPlaneBaselines[cs].at(TPCCount).push_back(RunningTotal);
146 
147  RunningTotal += WiresThisPlane;
148 
149  fFirstChannelInThisPlane[cs].at(TPCCount).push_back(fTopChannel);
150  fTopChannel += WiresThisPlane;
151  fFirstChannelInNextPlane[cs].at(TPCCount).push_back(fTopChannel);
152 
153  } // end loop over planes
154  } // end loop over TPCs
155  } // end loop over cryostats
156 
157  // calculate the total number of channels in the detector
159 
160  MF_LOG_DEBUG("ChannelMapStandard") << "# of channels is " << fNchannels;
161  }
PlaneInfoMap_t< float > fOrthVectorsZ
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int fNcryostat
number of cryostats in the detector
PlaneInfoMap_t< unsigned int > fWiresPerPlane
WireReadoutGeom(GeometryCore const *geom, std::unique_ptr< WireReadoutGeometryBuilder > builder, std::unique_ptr< WireReadoutSorter > sorter)
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
PlaneInfoMap_t< float > fWireCounts
unsigned int fNchannels
number of channels in the detector
PlaneInfoMap_t< unsigned int > fPlaneBaselines
TPCInfoMap_t< unsigned int > fNPlanes
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
PlaneInfoMap_t< float > fFirstWireProj
raw::ChannelID_t fTopChannel
book keeping highest channel #
#define MF_LOG_DEBUG(id)
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat

Member Function Documentation

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

Returns the specified element of the TPC map.

Definition at line 994 of file WireReadoutGeom.h.

Referenced by FirstChannelInROP(), NROPs(), WireCoordinate(), and WireCount().

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

Returns the specified element of the plane map.

Definition at line 1022 of file WireReadoutGeom.h.

1023  {
1024  return map[id.Cryostat][id.TPC][id.Plane];
1025  }
template<typename T >
size_t geo::WireReadoutGeom::AccessElementSize ( TPCInfoMap_t< T > const &  map,
CryostatID const &  id 
) const
inlineprotectedinherited

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

Definition at line 1001 of file WireReadoutGeom.h.

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

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

Definition at line 1029 of file WireReadoutGeom.h.

1030  {
1031  return map[id.Cryostat][id.TPC].size();
1032  }
std::optional< WireIDIntersection > geo::WireReadoutGeom::ChannelsIntersect ( raw::ChannelID_t  c1,
raw::ChannelID_t  c2 
) const
inherited

Returns an intersection point of two channels.

Parameters
c1one channel ID
c2the other channel ID
Returns
WireIDIntersection object if intersection point was found; otherwise std::nullopt
Todo:

what happens for channels from different TPCs?

what happens for channels with multiple intersection points?

Deprecated:
This is clearly not APA-aware

Definition at line 543 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ChannelToWire(), and geo::WireReadoutGeom::WireIDsIntersect().

Referenced by util::GeometryUtilities::GetProjectedPoint(), util::GeometryUtilities::GetYZ(), and geo::WireReadoutGeom::HasChannel().

546  {
547  // [GP] these errors should be exceptions, and this function is deprecated because it
548  // violates interoperability
549  std::vector<WireID> chan1wires = ChannelToWire(c1);
550  if (chan1wires.empty()) {
551  mf::LogError("ChannelsIntersect")
552  << "1st channel " << c1 << " maps to no wire (is it a real one?)";
553  return std::nullopt;
554  }
555  std::vector<WireID> chan2wires = ChannelToWire(c2);
556  if (chan2wires.empty()) {
557  mf::LogError("ChannelsIntersect")
558  << "2nd channel " << c2 << " maps to no wire (is it a real one?)";
559  return std::nullopt;
560  }
561 
562  if (chan1wires.size() > 1) {
563  mf::LogWarning("ChannelsIntersect")
564  << "1st channel " << c1 << " maps to " << chan2wires.size() << " wires; using the first!";
565  return std::nullopt;
566  }
567  if (chan2wires.size() > 1) {
568  mf::LogError("ChannelsIntersect")
569  << "2nd channel " << c2 << " maps to " << chan2wires.size() << " wires; using the first!";
570  return std::nullopt;
571  }
572 
573  return WireIDsIntersect(chan1wires[0], chan2wires[0]);
574  }
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
TCanvas * c1
Definition: plotHisto.C:7
TCanvas * c2
Definition: plot_hist.C:75
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, Point_t &intersection) const
Computes the intersection between two wires.
virtual std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const =0
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< raw::ChannelID_t > geo::WireReadoutGeom::ChannelsInTPCs ( ) const
inherited

Returns an std::vector<ChannelID_t> in all TPCs in a TPCSet.

Definition at line 462 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::Nchannels(), geo::WireReadoutGeom::PlaneWireToChannel(), and geo::WireReadoutGeom::TPCsetToTPCs().

Referenced by geo::WireReadoutGeom::ThirdPlaneSlope().

463  {
464  std::vector<raw::ChannelID_t> channels;
465  channels.reserve(Nchannels());
466 
467  for (auto const& ts : Iterate<readout::TPCsetID>()) {
468  for (auto const t : TPCsetToTPCs(ts)) {
469  for (auto const& wire : Iterate<WireID>(t)) {
470  channels.push_back(PlaneWireToChannel(wire));
471  }
472  }
473  }
474  std::sort(channels.begin(), channels.end());
475  auto last = std::unique(channels.begin(), channels.end());
476  channels.erase(last, channels.end());
477  return channels;
478  }
virtual unsigned int Nchannels() const =0
Returns the total number of channels present (not necessarily contiguous)
virtual raw::ChannelID_t PlaneWireToChannel(WireID const &wireID) const =0
Returns the channel ID a wire is connected to.
virtual std::vector< TPCID > TPCsetToTPCs(readout::TPCsetID const &tpcsetid) const =0
Returns a list of ID of TPCs belonging to the specified TPC set.
readout::ROPID geo::WireReadoutStandardGeom::ChannelToROP ( raw::ChannelID_t  channel) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 423 of file WireReadoutStandardGeom.cxx.

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

424  {
425  if (!raw::isValidChannelID(channel)) return {}; // invalid ROP returned
426 
427  // which wires does the channel cover?
428  std::vector<WireID> wires = ChannelToWire(channel);
429 
430  // - none:
431  if (wires.empty()) return {}; // invalid ROP returned
432 
433  // - one: maps its plane ID into a ROP ID
434  return WirePlaneToROP(wires[0]);
435  }
constexpr bool isValidChannelID(raw::ChannelID_t channel)
Definition: RawTypes.h:35
readout::ROPID WirePlaneToROP(PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to, or invalid if none.
std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
std::vector< WireID > geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 164 of file WireReadoutStandardGeom.cxx.

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

Referenced by ChannelToROP().

165  {
166  std::vector<WireID> AllSegments;
167  unsigned int cstat = 0;
168  unsigned int tpc = 0;
169  unsigned int plane = 0;
170  unsigned int wire = 0;
171 
172  // first check if this channel ID is legal
173  if (channel > fTopChannel)
174  throw cet::exception("Geometry") << "ILLEGAL CHANNEL ID for channel " << channel << "\n";
175 
176  // then go find which plane, tpc and cryostat it is in from the information we stored earlier
177  bool foundWid(false);
178  for (unsigned int csloop = 0; csloop != fNcryostat; ++csloop) {
179  for (unsigned int tpcloop = 0; tpcloop != fNTPC[csloop]; ++tpcloop) {
180  for (unsigned int planeloop = 0;
181  planeloop != fFirstChannelInNextPlane[csloop][tpcloop].size();
182  ++planeloop) {
183  if (channel < fFirstChannelInNextPlane[csloop][tpcloop][planeloop]) {
184  cstat = csloop;
185  tpc = tpcloop;
186  plane = planeloop;
187  wire = channel - fFirstChannelInThisPlane[cstat][tpcloop][planeloop];
188  foundWid = true;
189  break;
190  }
191  if (foundWid) break;
192  } // end plane loop
193  if (foundWid) break;
194  } // end tpc loop
195  if (foundWid) break;
196  } // end cryostat loop
197 
198  WireID CodeWire(cstat, tpc, plane, wire);
199 
200  AllSegments.push_back(CodeWire);
201 
202  return AllSegments;
203  }
unsigned int fNcryostat
number of cryostats in the detector
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
raw::ChannelID_t fTopChannel
book keeping highest channel #
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
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
double geo::WireReadoutGeom::ComputeThirdPlane_dTdW ( double  angle1,
double  pitch1,
double  dTdW1,
double  angle2,
double  pitch2,
double  dTdW2,
double  angle_target,
double  pitch_target 
)
staticinherited

Returns the slope on the third plane, given it in the other two.

Parameters
angle1angle or the wires on the first plane
pitch1wire pitch on the first plane
dTdW1slope in dt/dw units as observed on the first plane
angle2angle or the wires on the second plane
pitch2wire pitch on the second plane
dTdW2slope in dt/dw units as observed on the second plane
angle_targetangle or the wires on the target plane
pitch_targetwire pitch on the target plane
Returns
dt/dw slope as measured on the third plane, or 999 if infinity

The input slope must be specified in dt/dw non-homogeneous coordinates.

This function will return a small slope if both input slopes are small.

Definition at line 730 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ComputeThirdPlaneSlope().

Referenced by geo::WireReadoutGeom::ThirdPlane_dTdW(), and geo::WireReadoutGeom::ThirdPlaneSlope().

738  {
739  // we need to convert dt/dw into homogeneous coordinates, and then back;
740  // slope = [dT * (TDCperiod / driftVelocity)] / [dW * wirePitch]
741  // The coefficient of dT is assumed to be the same for all the planes, and it finally
742  // cancels out. Pitches cancel out only if they are all the same.
743  return pitch_target *
744  ComputeThirdPlaneSlope(angle1, dTdW1 / pitch1, angle2, dTdW2 / pitch2, angle_target);
745  }
static double ComputeThirdPlaneSlope(double angle1, double slope1, double angle2, double slope2, double angle_target)
Returns the slope on the third plane, given it in the other two.
double geo::WireReadoutGeom::ComputeThirdPlaneSlope ( double  angle1,
double  slope1,
double  angle2,
double  slope2,
double  angle_target 
)
staticinherited

Returns the slope on the third plane, given it in the other two.

Parameters
angle1angle or the wires on the first plane
slope1slope as observed on the first plane
angle2angle or the wires on the second plane
slope2slope as observed on the second plane
angle_targetangle or the wires on the target plane
Returns
the slope as measure on the third plane, or 999 if infinity

This function will return a small slope if both input slopes are small.

Definition at line 702 of file WireReadoutGeom.cxx.

References util::abs().

Referenced by geo::WireReadoutGeom::ComputeThirdPlane_dTdW(), and geo::WireReadoutGeom::ThirdPlaneSlope().

707  {
708  // note that, if needed, the trigonometric functions can be pre-calculated.
709 
710  // Can't resolve very small slopes
711  if ((std::abs(slope1) < 0.001) && (std::abs(slope2)) < 0.001) return 0.001;
712 
713  // We need the "wire coordinate direction" for each plane. This is perpendicular to
714  // the wire orientation.
715  double slope3 = 0.001;
716  if (std::abs(slope1) > 0.001 && std::abs(slope2) > 0.001) {
717  slope3 =
718  (+(1. / slope1) * std::sin(angle3 - angle2) - (1. / slope2) * std::sin(angle3 - angle1)) /
719  std::sin(angle1 - angle2);
720  }
721  if (slope3 != 0.)
722  slope3 = 1. / slope3;
723  else
724  slope3 = 999.;
725 
726  return slope3;
727  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
readout::TPCsetID geo::WireReadoutGeom::FindTPCsetAtPosition ( Point_t const &  worldLoc) const
inherited

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

Definition at line 576 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fGeom, geo::GeometryCore::FindTPCAtPosition(), and geo::WireReadoutGeom::TPCtoTPCset().

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

577  {
578  return TPCtoTPCset(fGeom->FindTPCAtPosition(worldLoc));
579  }
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
GeometryCore const * fGeom
virtual readout::TPCsetID TPCtoTPCset(TPCID const &tpcid) const =0
Returns the ID of the TPC set tpcid belongs to.
std::vector<std::vector<std::vector<raw::ChannelID_t> > > const& geo::WireReadoutGeom::FirstChannelInNextPlane ( ) const
inlineinherited

Retrieve the private fFirstChannelInNextPlane vector for testing.

Definition at line 936 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::fFirstChannelInThisPlane.

937  {
939  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
raw::ChannelID_t geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 438 of file WireReadoutStandardGeom.cxx.

References geo::WireReadoutGeom::AccessElement(), fPlaneBaselines, raw::InvalidChannelID, and geo::CryostatID::isValid.

439  {
440  if (!ropid.isValid) return raw::InvalidChannelID;
441  return (raw::ChannelID_t)AccessElement(fPlaneBaselines, ConvertROPtoWirePlane(ropid));
442  }
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
PlaneInfoMap_t< unsigned int > fPlaneBaselines
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:28
std::vector<std::vector<std::vector<raw::ChannelID_t> > > const& geo::WireReadoutGeom::FirstChannelInThisPlane ( ) const
inlineinherited

Retrieve the private fFirstChannelInThisPlane vector for testing.

Definition at line 942 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::fFirstChannelInNextPlane, geo::WireReadoutGeom::SignalTypeForChannelImpl(), and geo::WireReadoutGeom::SignalTypeForROPIDImpl().

943  {
945  }
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
PlaneGeo const & geo::WireReadoutGeom::FirstPlane ( TPCID const &  tpcid) const
inherited

Returns the first plane of the specified TPC.

Parameters
tpcID of the TPC
Returns
a constant reference to the specified plane
Exceptions
cet::exception(WireReadoutGeom category) if plane not present

Definition at line 202 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::PlanePtr().

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), trkf::TrackLineFitAlg::TrkLineFit(), DUNE::NeutrinoTrackingEff::truthLength(), and geo::WireReadoutGeom::Views().

203  {
204  if (auto const* plane_ptr = PlanePtr({tpcid, 0})) { return *plane_ptr; }
205  throw cet::exception("WireReadoutGeom")
206  << "TPC with ID " << tpcid << " does not have a first plane.";
207  }
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
TPCID geo::WireReadoutStandardGeom::FirstTPCinTPCset ( readout::TPCsetID const &  tpcsetid) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 362 of file WireReadoutStandardGeom.cxx.

Referenced by NROPs().

363  {
364  return ConvertTPCsetToTPC(tpcsetid);
365  }
PlaneID geo::WireReadoutStandardGeom::FirstWirePlaneInROP ( readout::ROPID const &  ropid) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 445 of file WireReadoutStandardGeom.cxx.

Referenced by Nchannels(), and ROPtoWirePlanes().

446  {
447  return ConvertROPtoWirePlane(ropid);
448  }
PlaneGeo const& geo::WireReadoutGeom::GetElement ( PlaneID const &  planeid) const
inlineinherited

Returns the specified wire.

Parameters
tpcidID of the TPC
viewnumber of the requested view
planeidID of the plane
Returns
a constant reference to the specified plane
Exceptions
cet::exception(GeometryCore category) if cryostat not present
cet::exception(TPCOutOfRange category) if no such TPC
cet::exception(PlaneOutOfRange category) if no such plane

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 152 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::Plane(), and geo::WireReadoutGeom::PlanePtr().

152 { return Plane(planeid); }
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
WireGeo const& geo::WireReadoutGeom::GetElement ( WireID const &  wireid) const
inlineinherited

Returns the specified wire.

Parameters
wireidID of the wire
Returns
a constant reference to the specified wire
Exceptions
cet::exceptionif not found

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 226 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::Wire(), and geo::WireReadoutGeom::WireEndPoints().

226 { return Wire(wireid); }
WireGeo const & Wire(WireID const &wireid) const
Returns the specified wire.
PlaneGeo const* geo::WireReadoutGeom::GetElementPtr ( PlaneID const &  planeid) const
inlineinherited

Returns the specified plane.

Parameters
planeidplane ID
Returns
a constant pointer to the specified plane, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 164 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::MaxWires(), geo::WireReadoutGeom::NElements(), geo::WireReadoutGeom::Nwires(), and geo::WireReadoutGeom::PlanePtr().

Referenced by PlaneWireToChannel().

164 { return PlanePtr(planeid); }
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.
WireGeo const* geo::WireReadoutGeom::GetElementPtr ( WireID const &  wireid) const
inlineinherited

Returns the specified wire.

Parameters
wireidwire ID
Returns
a constant pointer to the specified wire, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 213 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::Wire(), and geo::WireReadoutGeom::WirePtr().

213 { return WirePtr(wireid); }
WireGeo const * WirePtr(WireID const &wireid) const
Returns the specified wire.
template<typename T >
T const* geo::WireReadoutGeom::GetElementPtr ( PlaneInfoMap_t< T > const &  map,
PlaneID const &  id 
) const
inlineprotectedinherited

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

Definition at line 1055 of file WireReadoutGeom.h.

1056  {
1057  if (id.Cryostat >= map.size()) return nullptr;
1058  auto const& cryo_map = map[id.Cryostat];
1059  if (id.TPC >= cryo_map.size()) return nullptr;
1060  auto const& TPC_map = cryo_map[id.TPC];
1061  if (id.Plane >= TPC_map.size()) return nullptr;
1062  auto const& plane_map = TPC_map[id.Plane];
1063  return &plane_map;
1064  } // GetElementPtr()
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
unsigned int geo::WireReadoutGeom::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 426 of file WireReadoutGeom.cxx.

Referenced by geo::WireReadoutGeom::HasChannel(), and geo::WireReadoutGeom::IsValidOpChannel().

427  {
428  return 0;
429  }
virtual bool geo::WireReadoutGeom::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 567 of file WireReadoutGeom.h.

References c1, c2, geo::WireReadoutGeom::ChannelsIntersect(), geo::WireReadoutGeom::ChannelToROP(), geo::WireReadoutGeom::ChannelToWire(), geo::WireReadoutGeom::FindTPCsetAtPosition(), geo::WireReadoutGeom::FirstChannelInROP(), geo::WireReadoutGeom::FirstTPCinTPCset(), geo::WireReadoutGeom::FirstWirePlaneInROP(), geo::WireReadoutGeom::HardwareChannelFromOpChannel(), geo::WireReadoutGeom::HasROP(), geo::WireReadoutGeom::HasTPCset(), raw::isValidChannelID(), geo::WireReadoutGeom::IsValidOpChannel(), geo::WireReadoutGeom::MaxOpChannel(), geo::WireReadoutGeom::MaxROPs(), geo::WireReadoutGeom::MaxTPCsets(), geo::WireReadoutGeom::Nchannels(), geo::WireReadoutGeom::NearestChannel(), geo::WireReadoutGeom::NearestWireID(), geo::WireReadoutGeom::NOpChannels(), geo::WireReadoutGeom::NOpHardwareChannels(), geo::WireReadoutGeom::NROPs(), geo::WireReadoutGeom::NTPCsets(), geo::WireReadoutGeom::OpChannel(), geo::WireReadoutGeom::OpDetFromOpChannel(), geo::WireReadoutGeom::OpDetGeoFromOpChannel(), geo::WireReadoutGeom::PlaneIDs(), geo::WireReadoutGeom::PlaneWireToChannel(), geo::WireReadoutGeom::ROPtoTPCs(), geo::WireReadoutGeom::ROPtoWirePlanes(), geo::WireReadoutGeom::SignalType(), geo::WireReadoutGeom::TPCsetToTPCs(), geo::WireReadoutGeom::TPCtoTPCset(), geo::WireReadoutGeom::View(), geo::WireReadoutGeom::WireCoordinate(), and geo::WireReadoutGeom::WirePlaneToROP().

568  {
569  return raw::isValidChannelID(channel) ? channel < Nchannels() : false;
570  }
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:35
bool geo::WireReadoutGeom::HasElement ( PlaneID const &  planeid) const
inlineinherited

Returns whether we have the specified plane.

The HasElement() method is overloaded and its meaning depends on the type of ID.

Definition at line 79 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::HasPlane(), geo::WireReadoutGeom::MaxPlanes(), geo::WireReadoutGeom::Nplanes(), and geo::details::tpc_zero.

79 { return HasPlane(planeid); }
bool HasPlane(PlaneID const &planeid) const
Returns whether we have the specified plane.
bool geo::WireReadoutGeom::HasElement ( WireID const &  wireid) const
inlineinherited

Returns whether we have the specified wire.

The HasElement() method is overloaded and its meaning depends on the type of ID.

Definition at line 201 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::HasWire(), and geo::WireReadoutGeom::WirePtr().

201 { return HasWire(wireid); }
bool HasWire(WireID const &wireid) const
Returns whether we have the specified wire.
bool geo::WireReadoutGeom::HasPlane ( PlaneID const &  planeid) const
inherited

Returns whether we have the specified plane.

The HasElement() method is overloaded and its meaning depends on the type of ID.

Definition at line 188 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::PlanePtr().

Referenced by pma::ProjectionMatchingAlg::buildShowerSeg(), geo::WireReadoutGeom::finish(), pma::ProjectionMatchingAlg::guideEndpoints(), geo::WireReadoutGeom::HasElement(), pma::PMAlgTracker::matchCluster(), pma::Node3D::Node3D(), trkf::PMAlgTrajFitter::produce(), and pma::ProjectionMatchingAlg::TestTrk_().

189  {
190  return PlanePtr(planeid) != nullptr;
191  }
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.
bool geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 394 of file WireReadoutStandardGeom.cxx.

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

Referenced by Nchannels().

395  {
396  return ropid.ROP < NROPs(ropid);
397  }
unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROPs in the specified TPC set.
bool geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 342 of file WireReadoutStandardGeom.cxx.

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

Referenced by NROPs().

343  {
344  return tpcsetid.TPCset < NTPCsets(tpcsetid);
345  }
unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
bool geo::WireReadoutGeom::HasWire ( WireID const &  wireid) const
inherited

Returns whether we have the specified wire.

The HasElement() method is overloaded and its meaning depends on the type of ID.

Definition at line 256 of file WireReadoutGeom.cxx.

References geo::PlaneGeo::HasWire(), and geo::WireReadoutGeom::PlanePtr().

Referenced by tca::FillmAllTraj(), geo::WireReadoutGeom::HasElement(), geo::WireReadoutGeom::NSiblingElements(), pma::ProjectionMatchingAlg::validate(), pma::ProjectionMatchingAlg::validate_on_adc(), pma::ProjectionMatchingAlg::validate_on_adc_test(), and geo::WireReadoutGeom::WireIDIntersectionCheck().

257  {
258  PlaneGeo const* pPlane = PlanePtr(wireid);
259  return pPlane ? pPlane->HasWire(wireid) : false;
260  }
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.
template<typename T >
bool geo::WireReadoutGeom::isValidElement ( TPCInfoMap_t< T > const &  map,
CryostatID const &  id 
) const
inlineprotectedinherited

Returns whether the ID specifies a valid entry.

Definition at line 1009 of file WireReadoutGeom.h.

Referenced by geo::WireReadoutGeom::isValidElement().

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

Returns the specified element of the TPC map.

Definition at line 1014 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::isValidElement().

1015  {
1016  return isValidElement(map, id.asCryostatID()) && (id.TPC < map[id.Cryostat].size());
1017  }
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
template<typename T >
bool geo::WireReadoutGeom::isValidElement ( PlaneInfoMap_t< T > const &  map,
CryostatID const &  id 
) const
inlineprotectedinherited

Returns whether the ID specifies a valid entry.

Definition at line 1037 of file WireReadoutGeom.h.

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

Returns whether the ID specifies a valid entry.

Definition at line 1042 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::isValidElement().

1043  {
1044  return isValidElement(map, id.asCryostatID()) && (id.TPC < map[id.Cryostat].size());
1045  }
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
template<typename T >
bool geo::WireReadoutGeom::isValidElement ( PlaneInfoMap_t< T > const &  map,
PlaneID const &  id 
) const
inlineprotectedinherited

Returns whether the ID specifies a valid entry.

Definition at line 1047 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::isValidElement().

1048  {
1049  return isValidElement(map, id.asTPCID()) && (id.Plane < AccessSize(map, id.asTPCID()));
1050  }
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
bool geo::WireReadoutGeom::IsValidOpChannel ( int  opChannel) const
inherited

Is this a valid OpChannel number?

Definition at line 493 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fGeom, and geo::GeometryCore::NOpDets().

Referenced by cosmic::BeamFlashTrackMatchTaggerAlg::CheckCompatibility(), geo::WireReadoutGeom::HasChannel(), cosmic::BeamFlashTrackMatchTaggerAlg::PrintHypothesisFlashComparison(), and opdet::RunHitFinder().

494  {
495  return IsValidOpChannel(opChannel, fGeom->NOpDets());
496  }
bool IsValidOpChannel(int opChannel) const
Is this a valid OpChannel number?
unsigned int NOpDets() const
Number of OpDets in the whole detector.
GeometryCore const * fGeom
bool geo::WireReadoutGeom::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 432 of file WireReadoutGeom.cxx.

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

433  {
434  // Check channel number
435  if (opChannel >= NOpChannels(NOpDets)) return false;
436 
437  // Check opdet number
438  unsigned int opdet = OpDetFromOpChannel(opChannel);
439  if (opdet >= NOpDets) return false;
440 
441  // Check hardware channel number
442  unsigned int hChan = HardwareChannelFromOpChannel(opChannel);
443  return hChan < NOpHardwareChannels(opdet);
444  }
virtual unsigned int OpDetFromOpChannel(unsigned int opChannel) const
Returns the optical detector the specified optical channel belongs.
virtual unsigned int NOpHardwareChannels(unsigned int opDet) const
Returns the number of channels in the specified optical detectors.
virtual unsigned int HardwareChannelFromOpChannel(unsigned int opChannel) const
Returns the hardware channel number of specified optical channel.
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
unsigned int geo::WireReadoutGeom::MaxOpChannel ( ) const
inherited

Largest optical channel number.

Definition at line 487 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fGeom, and geo::GeometryCore::NOpDets().

Referenced by cosmic::BeamFlashTrackMatchTaggerAlg::CheckCompatibility(), opdet::ConstructFlash(), geo::WireReadoutGeom::HasChannel(), and cosmic::BeamFlashTrackMatchTaggerAlg::PrintHypothesisFlashComparison().

488  {
489  return MaxOpChannel(fGeom->NOpDets());
490  }
unsigned int NOpDets() const
Number of OpDets in the whole detector.
unsigned int MaxOpChannel() const
Largest optical channel number.
GeometryCore const * fGeom
unsigned int geo::WireReadoutGeom::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 394 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::NOpChannels().

395  {
396  // By default just return the number of optical detectos
397  return NOpChannels(NOpDets);
398  }
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
unsigned int geo::WireReadoutGeom::MaxPlanes ( ) const
inherited

Returns the largest number of planes among all TPCs in this detector.

Definition at line 166 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fPlanes.

Referenced by pma::PMAlgTracker::build(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), shower::EMShowerAlg::CheckIsolatedHits_(), img::DataProviderAlg::DataProviderAlg(), trkf::TrackKalmanFitter::doFitWork(), geo::details::ReadoutIterationPolicy::EndPlaneID(), geo::WireReadoutGeom::HasElement(), shower::EMShowerAlg::MakeShower(), shower::EMShowerAlg::MakeSpacePoints(), geo::WireReadoutGeom::Nviews(), shower::EMShowerAlg::OrderShowerHits(), pma::PMAlgTracker::PMAlgTracker(), shower::EMShowerAlg::RelativeWireWidth_(), trkf::TrackKalmanFitter::sortOutput(), and shower::EMShowerAlg::WorstPlane_().

167  {
168  unsigned int maxPlanes = 0;
169  for (auto const& [tpc_id, planes] : fPlanes) {
170  unsigned int maxPlanesInTPC = planes.size();
171  if (maxPlanesInTPC > maxPlanes) maxPlanes = maxPlanesInTPC;
172  }
173  return maxPlanes;
174  }
std::map< TPCID, std::vector< PlaneGeo > > fPlanes
unsigned int geo::WireReadoutStandardGeom::MaxROPs ( ) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 384 of file WireReadoutStandardGeom.cxx.

References fNPlanes.

385  {
386  unsigned int max = 0;
387  for (auto const& cryo_tpc : fNPlanes)
388  for (unsigned int nPlanes : cryo_tpc)
389  if (nPlanes > max) max = nPlanes;
390  return max;
391  }
TPCInfoMap_t< unsigned int > fNPlanes
unsigned int geo::WireReadoutStandardGeom::MaxTPCs ( ) const
private

Returns the largest number of TPCs in a single cryostat.

Definition at line 368 of file WireReadoutStandardGeom.cxx.

References fNTPC.

Referenced by MaxTPCsets(), and WireCount().

369  {
370  unsigned int max = 0;
371  for (unsigned int nTPCs : fNTPC)
372  if (nTPCs > max) max = nTPCs;
373  return max;
374  }
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int geo::WireReadoutStandardGeom::MaxTPCsets ( ) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 336 of file WireReadoutStandardGeom.cxx.

References MaxTPCs().

337  {
338  return MaxTPCs();
339  }
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
unsigned int geo::WireReadoutGeom::MaxWires ( ) const
inherited

Returns the total number of wires in the specified plane.

Parameters
planeidplane ID
Returns
number of wires in specified plane, or 0 if no plane found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 177 of file WireReadoutGeom.cxx.

Referenced by cluster::BlurredClusteringAlg::ConvertRecobHitsToVector(), geo::details::ReadoutIterationPolicy::EndWireID(), and geo::WireReadoutGeom::GetElementPtr().

178  {
179  unsigned int maxWires = 0;
180  for (PlaneGeo const& plane : Iterate<PlaneGeo>()) {
181  unsigned int maxWiresInPlane = plane.Nwires();
182  if (maxWiresInPlane > maxWires) maxWires = maxWiresInPlane;
183  }
184  return maxWires;
185  }
raw::ChannelID_t geo::WireReadoutStandardGeom::Nchannels ( ) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 206 of file WireReadoutStandardGeom.cxx.

References fNchannels.

207  {
208  return fNchannels;
209  }
unsigned int fNchannels
number of channels in the detector
unsigned int geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 212 of file WireReadoutStandardGeom.cxx.

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

213  {
214  if (!HasROP(ropid)) return 0;
215  // The number of channels matches the number of wires. Life is easy.
216  return WireCount(FirstWirePlaneInROP(ropid));
217  }
unsigned int WireCount(PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
bool HasROP(readout::ROPID const &ropid) const override
raw::ChannelID_t geo::WireReadoutGeom::NearestChannel ( Point_t const &  worldLoc,
PlaneID const &  planeid 
) const
inherited

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

Parameters
worldLoc3D coordinates of the point (world reference frame)
planeidID of the wire plane the channel must belong to
Returns
the ID of the channel, or raw::InvalidChannelID if invalid wire
Bug:
on invalid wire, a geo::InvalidWireError exception is thrown

Definition at line 524 of file WireReadoutGeom.cxx.

References raw::InvalidChannelID, geo::PlaneGeo::NearestWireID(), geo::WireReadoutGeom::Plane(), and geo::WireReadoutGeom::PlaneWireToChannel().

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), geo::WireReadoutGeom::HasChannel(), and apa::DisambigAlg::TrivialDisambig().

526  {
527  // This method is supposed to return a channel number rather than a wire number.
528  // Perform the conversion here (although, maybe faster if we deal in wire numbers
529  // rather than channel numbers?)
530 
531  // NOTE on failure both NearestChannel() and upstream:
532  // * according to documentation, should return invalid channel
533  // * in the actual code throw an exception because of a BUG
534  //
535  // The following implementation automatically becomes in fact compliant to the
536  // documentation if upstreams becomes compliant to. When that happens, just delete
537  // this comment.
538  WireID const wireID = Plane(planeid).NearestWireID(worldPos);
539  return wireID ? PlaneWireToChannel(wireID) : raw::InvalidChannelID;
540  }
WireID NearestWireID(Point_t const &pos) const
Returns the ID of wire closest to the specified position.
Definition: PlaneGeo.cxx:485
Raw data description.
Definition: RawTypes.h:6
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
virtual raw::ChannelID_t PlaneWireToChannel(WireID const &wireID) const =0
Returns the channel ID a wire is connected to.
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
WireID geo::WireReadoutStandardGeom::NearestWireID ( Point_t const &  worldPos,
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.

Implements geo::WireReadoutGeom.

Definition at line 229 of file WireReadoutStandardGeom.cxx.

References WireCoordinate(), and WireCount().

231  {
232 
233  // This part is the actual calculation of the nearest wire number, where we assume
234  // uniform wire pitch and angle within a wireplane
235 
236  // add 0.5 to have the correct rounding
237  int NearestWireNumber = int(0.5 + WireCoordinate(worldPos.Y(), worldPos.Z(), planeID));
238 
239  // If we are outside of the wireplane range, throw an exception
240  // (this response maintains consistency with the previous
241  // implementation based on geometry lookup)
242  if (NearestWireNumber < 0 || (unsigned int)NearestWireNumber >= WireCount(planeID)) {
243  int wireNumber = NearestWireNumber; // save for the output
244 
245  if (NearestWireNumber < 0)
246  NearestWireNumber = 0;
247  else
248  NearestWireNumber = WireCount(planeID) - 1;
249 
250  throw InvalidWireError("Geometry", planeID, wireNumber, NearestWireNumber)
251  << "Can't Find Nearest Wire for position (" << worldPos.X() << "," << worldPos.Y() << ","
252  << worldPos.Z() << ")"
253  << " in plane " << std::string(planeID) << " approx wire number # " << wireNumber
254  << " (capped from " << NearestWireNumber << ")\n";
255  }
256 
257  return WireID(planeID, (WireID::WireID_t)NearestWireNumber);
258  }
unsigned int WireCount(PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
double WireCoordinate(double YPos, double ZPos, PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:422
unsigned int geo::WireReadoutGeom::NElements ( TPCID const &  tpcid) const
inlineinherited

Returns the total number of planes in the specified TPC.

Parameters
tpcidTPC ID
Returns
number of planes in specified TPC, or 0 if no TPC found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 103 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::Nplanes().

Referenced by geo::WireReadoutGeom::GetElementPtr().

103 { return Nplanes(tpcid); }
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
unsigned int geo::WireReadoutGeom::NElements ( PlaneID const &  planeid) const
inherited

Returns the total number of wires in the specified plane.

Parameters
planeidplane ID
Returns
number of wires in specified plane, or 0 if no plane found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t
unsigned int geo::WireReadoutGeom::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 387 of file WireReadoutGeom.cxx.

Referenced by opdet::OptDetDigitizer::produce().

388  {
389  // By default just return the number of optical detectos
390  return NOpDets;
391  }
unsigned int geo::WireReadoutGeom::NOpChannels ( ) const
inherited

Number of electronics channels for all the optical detectors.

Definition at line 481 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fGeom, and geo::GeometryCore::NOpDets().

Referenced by geo::WireReadoutGeom::HasChannel(), geo::WireReadoutGeom::IsValidOpChannel(), and geo::WireReadoutGeom::MaxOpChannel().

482  {
483  return NOpChannels(fGeom->NOpDets());
484  }
unsigned int NOpDets() const
Number of OpDets in the whole detector.
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
GeometryCore const * fGeom
unsigned int geo::WireReadoutGeom::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 401 of file WireReadoutGeom.cxx.

Referenced by geo::WireReadoutGeom::HasChannel(), and geo::WireReadoutGeom::IsValidOpChannel().

402  {
403  // By default, 1 channel per optical detector
404  return 1;
405  }
unsigned int geo::WireReadoutGeom::Nplanes ( TPCID const &  tpcid = details::tpc_zero) const
inherited

Returns the total number of planes in the specified TPC.

Parameters
tpcidTPC ID
Returns
number of planes in specified TPC, or 0 if no TPC found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 194 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fPlanes.

Referenced by tca::AnalyzeHits(), cluster::SmallClusterFinder::beginJob(), lar_cluster3d::StandardHit3DBuilder::BuildChannelStatusVec(), lar_cluster3d::SnippetHit3DBuilder::BuildChannelStatusVec(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerLinearEnergy::CalculateElement(), ShowerRecoTools::ShowerNumElectronsEnergy::CalculateElement(), opdet::ConstructFlash(), tca::TrajClusterAlg::CreateSlice(), detinfo::DetectorPropertiesStandard::DataFor(), hit::DisambigCheater::DisambigCheater(), larg4::LArVoxelReadout::DriftIonizationElectrons(), calo::TrackCalorimetryAlg::ExtractCalorimetry(), trkf::CCTrackMaker::FillEndMatch(), trkf::CCTrackMaker::FillWireHitRange(), tca::FillWireHitRange(), tca::FindShowers3D(), trkf::CCTrackMaker::FitVertices(), opdet::GetHitGeometryInfo(), corner::CornerFinderAlg::GrabWires(), geo::WireReadoutGeom::HasElement(), corner::CornerFinderAlg::InitializeGeometry(), trkf::CCTrackMaker::MakeClusterChains(), trkf::CCTrackMaker::MakeFamily(), geo::WireReadoutGeom::NElements(), geo::WireReadoutGeom::NSiblingElements(), trkf::CCTrackMaker::PlnMatch(), trkf::CCTrackMaker::PrintClusters(), trk::TrackContainmentAlg::ProcessTracks(), trkf::CCTrackMaker::produce(), ShowerRecoTools::ShowerLinearEnergy::ShowerLinearEnergy(), cluster::SmallClusterFinderAlg::SmallClusterFinderAlg(), trkf::CCTrackMaker::SortMatches(), cheat::BackTracker::SpacePointHitsToWeightedXYZ(), trkf::CCTrackMaker::StoreTrack(), geo::WireReadoutGeom::ThirdPlane(), trkf::VertexFitAlg::VertexFit(), trkf::CCTrackMaker::VtxMatch(), nnet::WaveformDenoiseTest::WaveformDenoiseTest(), and WireReadoutStandardGeom().

195  {
196  auto it = fPlanes.find(tpcid);
197  if (it == fPlanes.cend()) { return 0; }
198  return it->second.size();
199  }
std::map< TPCID, std::vector< PlaneGeo > > fPlanes
unsigned int geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 377 of file WireReadoutStandardGeom.cxx.

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

Referenced by HasROP().

378  {
379  if (!HasTPCset(tpcsetid)) return 0;
380  return AccessElement(fNPlanes, FirstTPCinTPCset(tpcsetid));
381  }
TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
TPCInfoMap_t< unsigned int > fNPlanes
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
unsigned int geo::WireReadoutGeom::NSiblingElements ( PlaneID const &  planeid) const
inlineinherited

Returns the total number of planes in the specified TPC.

Parameters
tpcidTPC ID
Returns
number of planes in specified TPC, or 0 if no TPC found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 104 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::Nplanes(), and geo::WireReadoutGeom::Nviews().

Referenced by geo::details::ReadoutIterationPolicy::NSiblings().

104 { return Nplanes(planeid); }
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
unsigned int geo::WireReadoutGeom::NSiblingElements ( WireID const &  wireid) const
inlineinherited

Returns the total number of wires in the specified plane.

Parameters
planeidplane ID
Returns
number of wires in specified plane, or 0 if no plane found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 186 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::HasWire(), and geo::WireReadoutGeom::Nwires().

186 { return Nwires(wireid); }
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
unsigned int geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 329 of file WireReadoutStandardGeom.cxx.

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

Referenced by HasTPCset().

330  {
331  // return the same number as the number of TPCs
332  return (cryoid.isValid && cryoid.Cryostat < fNTPC.size()) ? fNTPC[cryoid.Cryostat] : 0;
333  }
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
unsigned int geo::WireReadoutGeom::Nviews ( ) const
inherited

Returns the number of views (different wire orientations)

Returns the number of different views, or wire orientations, in the detector.

The function assumes that all TPCs in all cryostats of a detector have the same number of planes, which should be a safe assumption.

Todo:
Change return type to size_t

Definition at line 160 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::MaxPlanes().

Referenced by geo::WireReadoutGeom::NSiblingElements().

161  {
162  return MaxPlanes();
163  }
unsigned int MaxPlanes() const
Returns the largest number of planes among all TPCs in this detector.
unsigned int geo::WireReadoutGeom::Nwires ( PlaneID const &  planeid) const
inherited
unsigned int geo::WireReadoutGeom::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 408 of file WireReadoutGeom.cxx.

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

409  {
410  return detNum;
411  }
unsigned int geo::WireReadoutGeom::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 414 of file WireReadoutGeom.cxx.

Referenced by cosmic::BeamFlashTrackMatchTaggerAlg::CheckCompatibility(), geo::WireReadoutGeom::HasChannel(), geo::WireReadoutGeom::IsValidOpChannel(), geo::WireReadoutGeom::OpDetGeoFromOpChannel(), and cosmic::BeamFlashTrackMatchTaggerAlg::PrintHypothesisFlashComparison().

415  {
416  return opChannel;
417  }
OpDetGeo const & geo::WireReadoutGeom::OpDetGeoFromOpChannel ( unsigned int  opChannel) const
inherited

Returns the optical detector the specified optical channel belongs.

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

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

Definition at line 420 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fGeom, geo::WireReadoutGeom::OpDetFromOpChannel(), and geo::GeometryCore::OpDetGeoFromOpDet().

Referenced by opdet::GetHitGeometryInfo(), and geo::WireReadoutGeom::HasChannel().

421  {
422  return fGeom->OpDetGeoFromOpDet(OpDetFromOpChannel(opChannel));
423  }
virtual unsigned int OpDetFromOpChannel(unsigned int opChannel) const
Returns the optical detector the specified optical channel belongs.
GeometryCore const * fGeom
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
PlaneGeo const & geo::WireReadoutGeom::Plane ( TPCID const &  tpcid,
View_t  view 
) const
inherited

Returns the specified wire.

Parameters
tpcidID of the TPC
viewnumber of the requested view
planeidID of the plane
Returns
a constant reference to the specified plane
Exceptions
cet::exception(GeometryCore category) if cryostat not present
cet::exception(TPCOutOfRange category) if no such TPC
cet::exception(PlaneOutOfRange category) if no such plane

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 210 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fPlanes, and geo::PlaneGeo::View().

Referenced by calo::TrackCalorimetryAlg::AnalyzeHit(), apa::APAGeometryAlg::APAGeometryAlg(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), util::GeometryUtilities::CalculatePitch(), util::GeometryUtilities::CalculatePitchPolar(), tca::ChgFracBetween(), tca::ChgFracNearEnd(), detinfo::DetectorPropertiesStandard::DataFor(), tca::dEdx(), calo::TrackCalorimetryAlg::ExtractCalorimetry(), trkf::CCTrackMaker::FillEndMatch(), tca::FillWireHitRange(), tca::Find3DVertices(), apa::DisambigAlg::FindChanTimeEndPts(), lar_cluster3d::HoughSeedFinderAlg::findHoughClusters(), cluster::SmallClusterFinderAlg::FindSmallClusters(), tca::FitTP3Ds(), util::GeometryUtilities::GeometryUtilities(), util::GeometryUtilities::Get2DangleFrom3D(), util::GeometryUtilities::Get2DPointProjection(), util::GeometryUtilities::Get2DPointProjectionCM(), corner::CornerFinderAlg::get_feature_points(), corner::CornerFinderAlg::get_feature_points_fast(), corner::CornerFinderAlg::get_feature_points_LineIntegralScore(), pma::ProjectionMatchingAlg::GetCloseHits_(), geo::WireReadoutGeom::GetElement(), opdet::GetHitGeometryInfo(), util::GeometryUtilities::GetProjectedPoint(), nnet::TrainingDataAlg::getProjection(), util::GeometryUtilities::GetTimeTicks(), util::GeometryUtilities::GetXYZ(), cluster::MergeClusterAlg::GlobalWire(), cluster::BlurredClusteringAlg::GlobalWire(), shower::EMShowerAlg::GlobalWire_(), shower::LArPandoraShowerAlg::HitCoordinates(), shower::EMShowerAlg::HitPosition_(), hit::DisambigCheater::InitHitToWids(), lar_cluster3d::PCASeedFinderAlg::LineFit2DHits(), lar_cluster3d::HoughSeedFinderAlg::LineFit2DHits(), apa::APAGeometryAlg::LineSegChanIntersect(), tca::MakeBareTP(), shower::EMShowerAlg::MakeShower(), tca::MakeTP3D(), geo::WireReadoutGeom::NearestChannel(), lar_cluster3d::StandardHit3DBuilder::NearestWireID(), lar_cluster3d::SnippetHit3DBuilder::NearestWireID(), apa::APAGeometryAlg::NearestWireIDOnChan(), shower::LArPandoraShowerAlg::OrderShowerHits(), shower::EMShowerAlg::OrderShowerHits_(), util::GeometryUtilities::PitchInView(), trkf::CCTrackMaker::PlnMatch(), tca::PosInPlane(), trk::TrackContainmentAlg::ProcessTracks(), cluster::DBCluster3D::produce(), cluster::TrajCluster::produce(), trkf::CCTrackMaker::produce(), cluster::SmallClusterFinder::produce(), shower::EMShowerAlg::Project3DPointOntoPlane_(), phot::SemiAnalyticalModel::SemiAnalyticalModel(), tca::SetSection(), lar_cluster3d::SnippetHit3DBuilder::SnippetHit3DBuilder(), lar_cluster3d::StandardHit3DBuilder::StandardHit3DBuilder(), lar_pandora::DUNEFarDetVDThreeView::TargetViewU(), lar_pandora::ProtoDUNEDualPhase::TargetViewU(), lar_pandora::ICARUS::TargetViewU(), lar_pandora::VintageLArTPCThreeView::TargetViewU(), lar_pandora::DUNEFarDetVDThreeView::TargetViewV(), lar_pandora::ProtoDUNEDualPhase::TargetViewV(), lar_pandora::ICARUS::TargetViewV(), lar_pandora::VintageLArTPCThreeView::TargetViewV(), lar_pandora::DUNEFarDetVDThreeView::TargetViewW(), lar_pandora::ICARUS::TargetViewW(), lar_pandora::VintageLArTPCThreeView::TargetViewW(), geo::WireReadoutGeom::ThirdPlane_dTdW(), geo::WireReadoutGeom::ThirdPlaneSlope(), trkf::TrackLineFitAlg::TrkLineFit(), pma::ProjectionMatchingAlg::validate(), pma::ProjectionMatchingAlg::validate_on_adc(), pma::ProjectionMatchingAlg::validate_on_adc_test(), trkf::VertexFitAlg::VertexFit(), geo::WireReadoutGeom::View(), geo::WireReadoutGeom::Views(), geo::WireReadoutGeom::Wire(), lar_pandora::VintageLArTPCThreeView::WirePitchU(), lar_pandora::VintageLArTPCThreeView::WirePitchV(), and lar_pandora::VintageLArTPCThreeView::WirePitchW().

211  {
212  auto it = fPlanes.find(tpcid);
213  if (it == fPlanes.cend()) {
214  throw cet::exception("WireReadoutGeom") << "No TPC with ID " << tpcid << " supported.";
215  }
216  for (PlaneGeo const& plane : it->second) {
217  if (plane.View() == view) { return plane; }
218  }
219  throw cet::exception("WireReadoutGeom")
220  << "TPCGeo " << tpcid << " has no plane for view #" << (size_t)view << "\n";
221  }
std::map< TPCID, std::vector< PlaneGeo > > fPlanes
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
PlaneGeo const & geo::WireReadoutGeom::Plane ( PlaneID const &  planeid) const
inherited

Returns the specified wire.

Parameters
tpcidID of the TPC
viewnumber of the requested view
planeidID of the plane
Returns
a constant reference to the specified plane
Exceptions
cet::exception(GeometryCore category) if cryostat not present
cet::exception(TPCOutOfRange category) if no such TPC
cet::exception(PlaneOutOfRange category) if no such plane

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 224 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::PlanePtr().

225  {
226  if (auto const* plane_ptr = PlanePtr(planeid)) { return *plane_ptr; }
227  throw cet::exception("WireReadoutGeom") << "Plane with ID " << planeid << " is not supported.";
228  }
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double geo::WireReadoutGeom::Plane0Pitch ( TPCID const &  tpcid,
unsigned int  p1 
) const
inherited

Definition at line 124 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fPlane0Pitch.

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), and geo::WireReadoutGeom::ThirdPlaneSlope().

125  {
126  return fPlane0Pitch.at(tpcid)[p];
127  }
std::map< TPCID, std::vector< double > > fPlane0Pitch
Pitch between planes.
std::set< PlaneID > const & geo::WireReadoutStandardGeom::PlaneIDs ( ) const
overridevirtual

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

Implements geo::WireReadoutGeom.

Definition at line 323 of file WireReadoutStandardGeom.cxx.

References fPlaneIDs.

324  {
325  return fPlaneIDs;
326  }
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
double geo::WireReadoutGeom::PlanePitch ( TPCID const &  tpcid,
unsigned int  p1 = 0,
unsigned int  p2 = 1 
) const
inherited

Definition at line 130 of file WireReadoutGeom.cxx.

References util::abs(), and geo::WireReadoutGeom::fPlane0Pitch.

Referenced by detinfo::DetectorPropertiesStandard::DataFor(), larg4::LArVoxelReadout::DriftIonizationElectrons(), and geo::WireReadoutGeom::ThirdPlaneSlope().

131  {
132  auto const& plane0_pitch = fPlane0Pitch.at(tpcid);
133  return std::abs(plane0_pitch[p2] - plane0_pitch[p1]);
134  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::map< TPCID, std::vector< double > > fPlane0Pitch
Pitch between planes.
PlaneGeo const * geo::WireReadoutGeom::PlanePtr ( PlaneID const &  planeid) const
inherited

Returns the specified plane.

Parameters
planeidplane ID
Returns
a constant pointer to the specified plane, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 231 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fPlanes, n, geo::PlaneID::parentID(), and geo::PlaneID::Plane.

Referenced by geo::WireReadoutGeom::FirstPlane(), geo::WireReadoutGeom::GetElement(), geo::details::getElementPtr(), geo::WireReadoutGeom::GetElementPtr(), geo::WireReadoutGeom::HasPlane(), geo::WireReadoutGeom::HasWire(), geo::WireReadoutGeom::Nwires(), geo::WireReadoutGeom::Plane(), and geo::WireReadoutGeom::WirePtr().

232  {
233  auto const [tpc_id, plane] = std::make_pair(planeid.parentID(), planeid.Plane);
234  auto it = fPlanes.find(tpc_id);
235  if (it == fPlanes.cend()) { return nullptr; }
236  if (std::size_t const n = it->second.size(); n <= plane) { return nullptr; }
237  return &it->second[plane];
238  }
std::map< TPCID, std::vector< PlaneGeo > > fPlanes
Char_t n[5]
raw::ChannelID_t geo::WireReadoutStandardGeom::PlaneWireToChannel ( 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.

Implements geo::WireReadoutGeom.

Definition at line 273 of file WireReadoutStandardGeom.cxx.

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

274  {
275  unsigned int const* pBaseLine = GetElementPtr(fPlaneBaselines, wireID);
276  // This is the actual lookup part - first make sure coordinates are legal
277  if (pBaseLine) {
278  // if the channel has legal coordinates, its ID is given by the wire
279  // number above the number of wires in lower planes, tpcs and cryostats
280  return *pBaseLine + wireID.Wire;
281  }
282  else {
283  // if the coordinates were bad, throw an exception
284  throw cet::exception("WireReadoutStandardGeom")
285  << "NO CHANNEL FOUND for " << std::string(wireID);
286  }
287 
288  // made it here, that shouldn't happen, return raw::InvalidChannelID
289  mf::LogWarning("WireReadoutStandardGeom")
290  << "should not be at the point in the function, returning "
291  << "invalid channel";
292  return raw::InvalidChannelID;
293  }
PlaneGeo const * GetElementPtr(PlaneID const &planeid) const
Returns the specified plane.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
PlaneInfoMap_t< unsigned int > fPlaneBaselines
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< TPCID > geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 414 of file WireReadoutStandardGeom.cxx.

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

415  {
416  std::vector<TPCID> IDs;
417  // we take the TPC set of the ROP and convert it straight into a TPC ID
418  if (ropid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(ropid.asTPCsetID()));
419  return IDs;
420  }
std::vector< PlaneID > geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 406 of file WireReadoutStandardGeom.cxx.

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

407  {
408  std::vector<PlaneID> IDs;
409  if (ropid.isValid) IDs.emplace_back(FirstWirePlaneInROP(ropid));
410  return IDs;
411  }
PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
SigType_t geo::WireReadoutGeom::SignalType ( PlaneID const &  pid) const
inherited

Returns the type of signal on the channels of specified TPC plane.

Parameters
planeTPC plane ID
Returns
the type of signal on the specified plane, or geo::kMysteryType

Assumes that all the channels on the plane have the same signal type.

Todo:
verify that kMysteryType is returned on invalid plane

Definition at line 499 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::WirePlaneToROP().

Referenced by geo::WireReadoutDumper::dumpTPCplane(), reco3d::TripletFinder::FillHitMap(), cluster::MergeClusterAlg::GlobalWire(), cluster::BlurredClusteringAlg::GlobalWire(), shower::EMShowerAlg::GlobalWire_(), geo::WireReadoutGeom::HasChannel(), shwf::ShowerReco::LongTransEnergy(), caldata::CalWire::produce(), hit::RFFHitFinderAlg::Run(), hit::CCHitFinderAlg::RunCCHitFinder(), and geo::WireReadoutGeom::SignalTypeForROPIDImpl().

500  {
501  // map wire plane -> readout plane -> first channel, then use SignalType(channel)
502 
503  auto const ropid = WirePlaneToROP(pid);
504  if (!ropid.isValid) {
505  throw cet::exception("WireReadoutGeom") << "SignalType(): Mapping of wire plane "
506  << std::string(pid) << " to readout plane failed!\n";
507  }
508  return SignalType(ropid);
509  }
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
virtual readout::ROPID WirePlaneToROP(PlaneID const &planeid) const =0
Returns the ID of the ROP planeid belongs to.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
SigType_t geo::WireReadoutGeom::SignalType ( 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 446 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::SignalTypeForChannelImpl().

447  {
448  return SignalTypeForChannelImpl(channel);
449  }
virtual SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const =0
Return the signal type of the specified channel.
SigType_t geo::WireReadoutGeom::SignalType ( 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 451 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::SignalTypeForROPIDImpl().

452  {
453  return SignalTypeForROPIDImpl(ropid);
454  }
virtual SigType_t SignalTypeForROPIDImpl(readout::ROPID const &ropid) const
Return the signal type on the specified readout plane.
SigType_t geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 296 of file WireReadoutStandardGeom.cxx.

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

297  {
298 
299  // still assume one cryostat for now -- faster
300  unsigned int nChanPerTPC = fNchannels / fNTPC[0];
301  // casting wil trunc towards 0 -- faster than floor
302  unsigned int tpc = channel / nChanPerTPC;
303  //need number of planes to know Collection
304  unsigned int PlanesThisTPC = fNPlanes[0][tpc];
305 
306  SigType_t sigt = kMysteryType;
307  if ((channel >= fFirstChannelInThisPlane[0][tpc][0]) &&
308  (channel < fFirstChannelInNextPlane[0][tpc][PlanesThisTPC - 2])) {
309  sigt = kInduction;
310  }
311  else if ((channel >= fFirstChannelInThisPlane[0][tpc][PlanesThisTPC - 1]) &&
312  (channel < fFirstChannelInNextPlane[0][tpc][PlanesThisTPC - 1])) {
313  sigt = kCollection;
314  }
315  else
316  mf::LogWarning("BadChannelSignalType")
317  << "Channel " << channel << " not given signal type." << std::endl;
318 
319  return sigt;
320  }
Who knows?
Definition: geo_types.h:149
Signal from induction planes.
Definition: geo_types.h:147
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
unsigned int fNchannels
number of channels in the detector
TPCInfoMap_t< unsigned int > fNPlanes
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
Signal from collection planes.
Definition: geo_types.h:148
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
SigType_t geo::WireReadoutGeom::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 456 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::FirstChannelInROP(), and geo::WireReadoutGeom::SignalType().

Referenced by geo::WireReadoutGeom::FirstChannelInThisPlane(), and geo::WireReadoutGeom::SignalType().

457  {
458  return SignalType(FirstChannelInROP(ropid));
459  }
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const =0
Returns the ID of the first channel in the specified readout plane.
static auto const& geo::WireReadoutGeom::start ( Segment const &  s)
inlinestaticinherited

Definition at line 63 of file WireReadoutGeom.h.

Referenced by geo::WireReadoutGeom::WireEndPoints(), and geo::WireReadoutGeom::WireIDsIntersect().

63 { return s.first; }
PlaneID geo::WireReadoutGeom::ThirdPlane ( PlaneID const &  pid1,
PlaneID const &  pid2 
) const
inherited

Returns the plane that is not in the specified arguments.

Parameters
pid1a plane
pid2another plane
Returns
the ID to the third plane
Exceptions
cet::exception(category: "GeometryCore") if other than 3 planes
cet::exception(category: "GeometryCore") if pid1 and pid2 match

This function requires a geometry with exactly three planes. If the two input planes are not on the same TPC, the result is undefined.

Definition at line 610 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::Nplanes(), and geo::PlaneID::Plane.

Referenced by geo::WireReadoutGeom::ThirdPlane_dTdW(), geo::WireReadoutGeom::ThirdPlaneSlope(), and geo::WireReadoutGeom::WireEndPoints().

611  {
612  // how many planes in the TPC pid1 belongs to:
613  unsigned const int nPlanes = Nplanes(pid1);
614  if (nPlanes != 3) {
615  throw cet::exception("GeometryCore")
616  << "ThirdPlane() supports only TPCs with 3 planes, and I see " << nPlanes << " instead\n";
617  }
618 
619  PlaneID::PlaneID_t target_plane = nPlanes;
620  for (PlaneID::PlaneID_t iPlane = 0; iPlane < nPlanes; ++iPlane) {
621  if ((iPlane == pid1.Plane) || (iPlane == pid2.Plane)) continue;
622  if (target_plane != nPlanes) {
623  throw cet::exception("GeometryCore")
624  << "ThirdPlane() found too many planes that are not " << std::string(pid1) << " nor "
625  << std::string(pid2) << "! (first " << target_plane << ", then " << iPlane << ")\n";
626  } // if we had a target already
627  target_plane = iPlane;
628  } // for
629  if (target_plane == nPlanes) {
630  throw cet::exception("GeometryCore")
631  << "ThirdPlane() can't find a plane that is not " << std::string(pid1) << " nor "
632  << std::string(pid2) << "!\n";
633  }
634 
635  return PlaneID(pid1, target_plane);
636  }
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:365
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double geo::WireReadoutGeom::ThirdPlane_dTdW ( PlaneID const &  pid1,
double  slope1,
PlaneID const &  pid2,
double  slope2,
PlaneID const &  output_plane 
) const
inherited

Returns dT/dW on the third plane, given it in the other two.

Parameters
pid1ID of the plane of the first dT/dW
dTdW1dT/dW as seen on the first plane
pid2ID of the plane of the second dT/dW
dTdW2dT/dW as seen on the second plane
output_planeID of the plane on which to calculate the slope
Returns
dT/dW on the third plane, or -999. if dT/dW would be infinity
Exceptions
cet::exception(category: "GeometryCore") if different TPC
cet::exception(category: "GeometryCore") if same plane
cet::exception(category: "GeometryCore") if other than 3 planes

Given a dT/dW as projected in two planes, returns the dT/dW as projected in the third plane. The dT/dW are defined in time ticks/wide number units.

Definition at line 663 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ComputeThirdPlane_dTdW(), geo::PlaneGeo::PhiZ(), geo::WireReadoutGeom::Plane(), and geo::PlaneGeo::WirePitch().

Referenced by geo::WireReadoutGeom::ThirdPlane_dTdW(), and geo::WireReadoutGeom::ThirdPlaneSlope().

668  {
669  CheckIndependentPlanesOnSameTPC(pid1, pid2, "ThirdPlane_dTdW()");
670 
671  double angle[3], pitch[3];
672  PlaneGeo const* const planes[3] = {&Plane(pid1), &Plane(pid2), &Plane(output_plane)};
673 
674  // We need wire pitch and "wire coordinate direction" for each plane. The latter is
675  // perpendicular to the wire orientation. PlaneGeo::PhiZ() defines the right
676  // orientation too.
677  for (size_t i = 0; i < 3; ++i) {
678  angle[i] = planes[i]->PhiZ();
679  pitch[i] = planes[i]->WirePitch();
680  }
681 
682  return ComputeThirdPlane_dTdW(
683  angle[0], pitch[0], slope1, angle[1], pitch[1], slope2, angle[2], pitch[2]);
684  }
static double ComputeThirdPlane_dTdW(double angle1, double pitch1, double dTdW1, double angle2, double pitch2, double dTdW2, double angle_target, double pitch_target)
Returns the slope on the third plane, given it in the other two.
double PhiZ() const
Angle from positive z axis of the wire coordinate axis, in radians.
Definition: PlaneGeo.h:164
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
double geo::WireReadoutGeom::ThirdPlane_dTdW ( PlaneID const &  pid1,
double  slope1,
PlaneID const &  pid2,
double  slope2 
) const
inherited

Returns dT/dW on the third plane, given it in the other two.

Parameters
pid1ID of the plane of the first dT/dW
dTdW1dT/dW as seen on the first plane
pid2ID of the plane of the second dT/dW
dTdW2dT/dW as seen on the second plane
Returns
dT/dW on the third plane, or -999. if dT/dW would be infinity
Exceptions
cet::exception(category: "GeometryCore") if different TPC
cet::exception(category: "GeometryCore") if same plane
cet::exception(category: "GeometryCore") if other than 3 planes

Given a dT/dW as projected in two planes, returns the dT/dW as projected in the third plane. This function is a shortcut assuming exactly three wire planes in the TPC, in which case the output plane is chosen as the one that is neither of the input planes.

Definition at line 687 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ThirdPlane(), and geo::WireReadoutGeom::ThirdPlane_dTdW().

691  {
692  return ThirdPlane_dTdW(pid1, slope1, pid2, slope2, ThirdPlane(pid1, pid2));
693  }
PlaneID ThirdPlane(PlaneID const &pid1, PlaneID const &pid2) const
Returns the plane that is not in the specified arguments.
double ThirdPlane_dTdW(PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2, PlaneID const &output_plane) const
Returns dT/dW on the third plane, given it in the other two.
double geo::WireReadoutGeom::ThirdPlaneSlope ( PlaneID const &  pid1,
double  slope1,
PlaneID const &  pid2,
double  slope2,
PlaneID const &  output_plane 
) const
inherited

Returns the slope on the third plane, given it in the other two.

Parameters
pid1ID of the plane of the first slope
slope1slope as seen on the first plane
pid2ID of the plane of the second slope
slope2slope as seen on the second plane
output_planeID of the plane on which to calculate the slope
Returns
the slope on the third plane, or -999. if slope would be infinity
Exceptions
cet::exception(category: "GeometryCore") if different TPC
cet::exception(category: "GeometryCore") if input planes match

Given a slope as projected in two planes, returns the slope as projected in the specified output plane. The slopes are defined in uniform units; they should be computed as distance ratios (or tangent of a geometrical angle; the formula is still valid using dt/dw directly in case of equal wire pitch in all planes and uniform drift velocity.

Definition at line 639 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ComputeThirdPlaneSlope(), and geo::WireReadoutGeom::Plane().

Referenced by trkf::CCTrackMaker::FillEndMatch(), trkf::CCTrackMaker::PlnMatch(), geo::WireReadoutGeom::ThirdPlaneSlope(), and geo::WireReadoutGeom::WireEndPoints().

644  {
645  CheckIndependentPlanesOnSameTPC(pid1, pid2, "ThirdPlaneSlope()");
646 
647  // We need the "wire coordinate direction" for each plane. This is perpendicular to
648  // the wire orientation. PlaneGeo::PhiZ() defines the right orientation too.
649  return ComputeThirdPlaneSlope(
650  Plane(pid1).PhiZ(), slope1, Plane(pid2).PhiZ(), slope2, Plane(output_plane).PhiZ());
651  }
static double ComputeThirdPlaneSlope(double angle1, double slope1, double angle2, double slope2, double angle_target)
Returns the slope on the third plane, given it in the other two.
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
double geo::WireReadoutGeom::ThirdPlaneSlope ( PlaneID const &  pid1,
double  slope1,
PlaneID const &  pid2,
double  slope2 
) const
inherited

Returns the slope on the third plane, given it in the other two.

Parameters
pid1ID of the plane of the first slope
slope1slope as seen on the first plane
pid2ID of the plane of the second slope
slope2slope as seen on the second plane
Returns
the slope on the third plane, or -999. if slope would be infinity
Exceptions
cet::exception(category: "GeometryCore") if different TPC
cet::exception(category: "GeometryCore") if same plane
cet::exception(category: "GeometryCore") if other than 3 planes

Given a slope as projected in two planes, returns the slope as projected in the third plane. This function is a shortcut assuming exactly three wire planes in the TPC, in which case the output plane is chosen as the one that is neither of the input planes.

Definition at line 654 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ThirdPlane(), and geo::WireReadoutGeom::ThirdPlaneSlope().

658  {
659  return ThirdPlaneSlope(pid1, slope1, pid2, slope2, ThirdPlane(pid1, pid2));
660  }
PlaneID ThirdPlane(PlaneID const &pid1, PlaneID const &pid2) const
Returns the plane that is not in the specified arguments.
double ThirdPlaneSlope(PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2, PlaneID const &output_plane) const
Returns the slope on the third plane, given it in the other two.
double geo::WireReadoutGeom::ThirdPlaneSlope ( PlaneID::PlaneID_t  plane1,
double  slope1,
PlaneID::PlaneID_t  plane2,
double  slope2,
TPCID const &  tpcid 
) const
inlineinherited

Returns the slope on the third plane, given it in the other two.

Parameters
plane1index of the plane of the first slope
slope1slope as seen on the first plane
plane2index of the plane of the second slope
slope2slope as seen on the second plane
tpcidTPC where the two planes belong
Returns
the slope on the third plane, or -999. if slope would be infinity
Exceptions
cet::exception(category: "GeometryCore") if different TPC
cet::exception(category: "GeometryCore") if same plane
cet::exception(category: "GeometryCore") if other than 3 planes

Given a slope as projected in two planes, returns the slope as projected in the third plane.

Definition at line 451 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::ChannelsInTPCs(), geo::WireReadoutGeom::ComputeThirdPlane_dTdW(), geo::WireReadoutGeom::ComputeThirdPlaneSlope(), geo::WireReadoutGeom::Nchannels(), geo::WireReadoutGeom::Plane0Pitch(), geo::WireReadoutGeom::PlanePitch(), geo::WireReadoutGeom::ThirdPlane_dTdW(), and geo::WireReadoutGeom::ThirdPlaneSlope().

456  {
457  return ThirdPlaneSlope(PlaneID(tpcid, plane1), slope1, PlaneID(tpcid, plane2), slope2);
458  }
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
double ThirdPlaneSlope(PlaneID const &pid1, double slope1, PlaneID const &pid2, double slope2, PlaneID const &output_plane) const
Returns the slope on the third plane, given it in the other two.
std::vector< TPCID > geo::WireReadoutStandardGeom::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::WireReadoutGeom.

Definition at line 354 of file WireReadoutStandardGeom.cxx.

References geo::CryostatID::isValid.

355  {
356  std::vector<TPCID> IDs;
357  if (tpcsetid.isValid) IDs.emplace_back(ConvertTPCsetToTPC(tpcsetid));
358  return IDs;
359  }
readout::TPCsetID geo::WireReadoutStandardGeom::TPCtoTPCset ( 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::WireReadoutGeom.

Definition at line 348 of file WireReadoutStandardGeom.cxx.

349  {
350  return ConvertTPCtoTPCset(tpcid);
351  }
View_t geo::WireReadoutGeom::View ( raw::ChannelID_t const  channel) const
inherited

Returns the view (wire orientation) on the specified TPC channel.

Parameters
channelTPC channel ID
Returns
the type of signal on the specified channel, or geo::kUnknown

The view of the readout plane channel belongs to is returned, as in View(readout::ROPID const&) const.

Definition at line 518 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::ChannelToROP(), raw::InvalidChannelID, and geo::kUnknown.

Referenced by nnet::WaveformDenoiseTest::analyze(), nnet::NoiseWaveformDump::analyze(), nnet::RawWaveformDump::analyze(), nnet::RawWaveformClnSigDump::analyze(), apa::APAGeometryAlg::APAChannelsIntersect(), apa::APAGeometryAlg::APAGeometryAlg(), apa::APAGeometryAlg::APAView(), tca::FillWireHitRange(), apa::APAGeometryAlg::FirstChannelInView(), quad::GetPts2D(), geo::WireReadoutGeom::HasChannel(), apa::DisambigAlg::MakeCloseHits(), apa::APAGeometryAlg::NearestWireIDOnChan(), and cheat::BackTracker::TrackIdToSimIDEs_Ps().

519  {
520  return (channel == raw::InvalidChannelID) ? kUnknown : View(ChannelToROP(channel));
521  }
virtual readout::ROPID ChannelToROP(raw::ChannelID_t channel) const =0
Returns the ID of the ROP the channel belongs to.
Unknown view.
Definition: geo_types.h:138
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
Definition: RawTypes.h:31
View_t View(raw::ChannelID_t const channel) const
Returns the view (wire orientation) on the specified TPC channel.
View_t geo::WireReadoutGeom::View ( readout::ROPID const &  ropid) const
inherited

Returns the view of the channels in the specified readout plane.

Parameters
ropidreadout plane ID
Returns
the type of signal on the specified ROP

Returns the view (wire orientation) on the channels of specified readout plane. If ropid is an invalid ID, geo::kUnknown is returned. If ropid is a valid ID (i.e. an ID whose isValid flag is set) that points to a non-existent readout plane, the result is undefined. Use HasROP() to check if the readout plane actually exists.

Definition at line 512 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::FirstWirePlaneInROP(), geo::kUnknown, geo::WireReadoutGeom::Plane(), and geo::PlaneGeo::View().

513  {
514  auto const pid = FirstWirePlaneInROP(ropid);
515  return pid ? Plane(pid).View() : kUnknown;
516  }
Unknown view.
Definition: geo_types.h:138
virtual PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const =0
Returns the ID of the first plane belonging to the specified ROP.
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:155
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
std::set<View_t> const& geo::WireReadoutGeom::Views ( ) const
inlineinherited

Returns a list of possible views in the detector.

Returns
the set of views

Definition at line 123 of file WireReadoutGeom.h.

References geo::WireReadoutGeom::allViews, geo::WireReadoutGeom::FirstPlane(), and geo::WireReadoutGeom::Plane().

Referenced by pma::PMAlgTracker::PMAlgTracker(), and geo::WireReadoutGeom::WireReadoutGeom().

123 { return allViews; }
std::set< View_t > allViews
All views in the detector.
std::set< View_t > geo::WireReadoutGeom::Views ( TPCID const &  tpcid) const
inherited

Definition at line 241 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::fPlanes.

242  {
243  auto it = fPlanes.find(tpcid);
244  if (it == fPlanes.cend()) { return {}; }
245  return ::Views(it->second);
246  }
std::map< TPCID, std::vector< PlaneGeo > > fPlanes
WireGeo const & geo::WireReadoutGeom::Wire ( WireID const &  wireid) const
inherited

Returns the specified wire.

Parameters
wireidID of the wire
Returns
a constant reference to the specified wire
Exceptions
cet::exceptionif not found

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 270 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::Plane(), and geo::PlaneGeo::Wire().

Referenced by lar_cluster3d::SnippetHit3DBuilder::DistanceFromPointToHitWire(), geo::WireReadoutGeom::GetElement(), geo::WireReadoutGeom::GetElementPtr(), cluster::MergeClusterAlg::GlobalWire(), cluster::BlurredClusteringAlg::GlobalWire(), shower::EMShowerAlg::GlobalWire_(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_2D(), lar_cluster3d::PrincipalComponentsAlg::PCAAnalysis_calc2DDocas(), trkf::TrackKalmanFitter::setupInputStates(), apa::APAGeometryAlg::ThreeChanPos(), geo::WireReadoutGeom::WireEndPoints(), lar_cluster3d::SnippetHit3DBuilder::WireIDsIntersect(), and geo::WireReadoutGeom::WireIDsIntersect().

271  {
272  return Plane(wireid).Wire(wireid);
273  }
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:403
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
double geo::WireReadoutGeom::WireAngleToVertical ( View_t  view,
TPCID const &  tpcid 
) const
inherited

Returns the angle of the wires in the specified view from vertical.

Parameters
viewthe view
tpcidID of the TPC
Returns
the angle [radians]
Exceptions
cet::exception("GeometryCore" category) if no such view

The angle is defined as in WireGeo::ThetaZ().

This method assumes all wires in the view have the same angle (it queries for the first).

Deprecated:
This does not feel APA-ready

Definition at line 376 of file WireReadoutGeom.cxx.

References geo::PlaneGeo::ViewName().

Referenced by ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), util::GeometryUtilities::CalculatePitch(), util::GeometryUtilities::CalculatePitchPolar(), util::GeometryUtilities::Get2DangleFrom3D(), shower::EMShowerAlg::MakeShower(), util::GeometryUtilities::PitchInView(), lar_pandora::detector_functions::WireAngle(), and geo::WireReadoutGeom::WireEndPoints().

377  {
378  for (PlaneGeo const& plane : Iterate<PlaneGeo>(tpcid)) {
379  if (plane.View() == view) return plane.ThetaZ();
380  } // for
381  throw cet::exception("WireReadoutGeom")
382  << "WireAngleToVertical(): no view \"" << PlaneGeo::ViewName(view) << "\" (#" << ((int)view)
383  << ") in " << std::string(tpcid);
384  }
static std::string ViewName(View_t view)
Returns the name of the specified view.
Definition: PlaneGeo.cxx:584
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double geo::WireReadoutStandardGeom::WireCoordinate ( double  YPos,
double  ZPos,
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.

Implements geo::WireReadoutGeom.

Definition at line 220 of file WireReadoutStandardGeom.cxx.

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

Referenced by NearestWireID().

223  {
224  return YPos * AccessElement(fOrthVectorsY, planeID) +
225  ZPos * AccessElement(fOrthVectorsZ, planeID) - AccessElement(fFirstWireProj, planeID);
226  }
PlaneInfoMap_t< float > fOrthVectorsZ
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
PlaneInfoMap_t< float > fFirstWireProj
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
unsigned int geo::WireReadoutStandardGeom::WireCount ( PlaneID const &  id) const
inlineprivate

Retrieved the wire cound for the specified plane ID.

Definition at line 213 of file WireReadoutStandardGeom.h.

References geo::WireReadoutGeom::AccessElement(), and MaxTPCs().

Referenced by Nchannels(), and NearestWireID().

213 { return AccessElement(fWireCounts, id); }
PlaneInfoMap_t< float > fWireCounts
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
void geo::WireReadoutGeom::WireEndPoints ( WireID const &  wireid,
double *  xyzStart,
double *  xyzEnd 
) const
inherited

Fills two arrays with the coordinates of the wire end points.

Parameters
wireidID of the wire
xyzStart(output) an array with the start coordinate
xyzEnd(output) an array with the end coordinate
Exceptions
cet::exceptionwire not present

The starting point is the wire end with lower z coordinate.

Deprecated:
use the wire ID interface instead (but note that it does not sort the ends)

Definition at line 276 of file WireReadoutGeom.cxx.

References util::abs(), geo::Iterable< details::ReadoutIterationPolicy, details::ToReadoutGeometryElement >::end(), and geo::WireReadoutGeom::start().

Referenced by lar_cluster3d::StandardHit3DBuilder::DistanceFromPointToHitWire(), geo::WireReadoutGeom::GetElement(), quad::GetPts2D(), apa::DisambigAlg::TrivialDisambig(), and geo::WireReadoutGeom::WireIDsIntersect().

277  {
278  auto const [start, end] = WireEndPoints(wireid);
279 
280  xyzStart[0] = start.X();
281  xyzStart[1] = start.Y();
282  xyzStart[2] = start.Z();
283  xyzEnd[0] = end.X();
284  xyzEnd[1] = end.Y();
285  xyzEnd[2] = end.Z();
286 
287  if (xyzEnd[2] < xyzStart[2]) {
288  // Ensure that "End" has higher z-value than "Start"
289  std::swap(xyzStart[0], xyzEnd[0]);
290  std::swap(xyzStart[1], xyzEnd[1]);
291  std::swap(xyzStart[2], xyzEnd[2]);
292  }
293  if (xyzEnd[1] < xyzStart[1] && std::abs(xyzEnd[2] - xyzStart[2]) < 0.01) {
294  // If wire is vertical ensure that "End" has higher y-value than "Start"
295  std::swap(xyzStart[0], xyzEnd[0]);
296  std::swap(xyzStart[1], xyzEnd[1]);
297  std::swap(xyzStart[2], xyzEnd[2]);
298  }
299  }
static auto const & start(Segment const &s)
constexpr auto abs(T v)
Returns the absolute value of the argument.
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
void WireEndPoints(WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
Segment geo::WireReadoutGeom::WireEndPoints ( WireID const &  wireid) const
inlineinherited

Returns a segment whose ends are the wire end points.

Parameters
wireidID of the wire
Returns
a segment whose ends are the wire end points
Exceptions
cet::exceptionwire not present

The start and end are assigned as returned from the geo::WireGeo object. The rules for this assignment are documented in that class.

Deprecated:
use the wire ID interface instead (but note that it does not sort the ends)

Definition at line 260 of file WireReadoutGeom.h.

References geo::WireGeo::GetEnd(), geo::WireGeo::GetStart(), geo::WireReadoutGeom::ThirdPlane(), geo::WireReadoutGeom::ThirdPlaneSlope(), geo::WireReadoutGeom::Wire(), geo::WireReadoutGeom::WireAngleToVertical(), and geo::WireReadoutGeom::WireIDsIntersect().

261  {
262  WireGeo const& wire = Wire(wireid);
263  return {wire.GetStart(), wire.GetEnd()};
264  }
WireGeo const & Wire(WireID const &wireid) const
Returns the specified wire.
bool geo::WireReadoutGeom::WireIDsIntersect ( WireID const &  wid1,
WireID const &  wid2,
Point_t intersection 
) const
inherited

Computes the intersection between two wires.

Parameters
wid1ID of the first wire
wid2ID of the other wire
[out]intersectionthe intersection point (global coordinates)
Returns
whether an intersection was found inside the TPC the wires belong
See also
geo::WiresIntersection(), geo::LineClosestPoint()

The wires identified by wid1 and wid2 are intersected, and the 3D intersection point is written into the intersection parameter. The "intersection" point is actually the point belonging to the first wire (wid2) which is the closest (in Euclidean 3D metric) to the second wire.

The intersection is computed only if the wires belong to different planes of the same TPC. If that is not the case (i.e. they belong to different TPC or cryostat, or if they belong to the same plane), false is returned and intersection is set with all components to infinity (std::numeric_limits<>::infinity()).

When the intersection is computed, it is always stored in the intersection output parameter. Return value is true if this intersection lies within the physical boundaries first wire, while it is instead false if it lies on the extrapolation of the wire direction, but not within the wire physical extension.

To test that the result is not infinity (nor NaN), use geo::vect::isfinite(intersection) etc.

Note
If geo::WireGeo objects are already available, using instead the free function geo::WiresIntersection() or the method geo::WireGeo::IntersectionWith() is faster (and recommended). For purely geometric intersection, geo::LineClosestPoint() is also available.

Definition at line 344 of file WireReadoutGeom.cxx.

References util::abs(), geo::WireGeo::HalfL(), geo::IntersectionPointAndOffsets< Point >::offset1, geo::IntersectionPointAndOffsets< Point >::offset2, geo::IntersectionPointAndOffsets< Point >::point, geo::WireReadoutGeom::Wire(), geo::WireReadoutGeom::WireIDIntersectionCheck(), and geo::WiresIntersectionAndOffsets().

Referenced by pma::ProjectionMatchingAlg::addEndpointRef_(), apa::APAGeometryAlg::APAChannelsIntersect(), geo::WireReadoutGeom::ChannelsIntersect(), apa::DisambigAlg::CompareViews(), shower::EMShowerAlg::Construct3DPoint_(), trkf::CCTrackMaker::FillEndMatch(), tca::FillWireIntersections(), tca::Find3DVertices(), reco3d::IntersectionCache::ISect(), lar_cluster3d::StandardHit3DBuilder::makeDeadChannelPair(), lar_cluster3d::SnippetHit3DBuilder::makeDeadChannelPair(), lar_cluster3d::StandardHit3DBuilder::makeHitPair(), tca::Match2Planes(), trkf::CCTrackMaker::PlnMatch(), trkf::TrackTrajectoryAlg::ShortTrackTrajectory(), apa::APAGeometryAlg::ThreeChanPos(), and geo::WireReadoutGeom::WireEndPoints().

347  {
348  // This is not a real 3D intersection: the wires do not cross, since they are required
349  // to belong to two different planes.
350  //
351  // We take the point on the first wire which is closest to the other one.
352  static_assert(std::numeric_limits<decltype(intersection.X())>::has_infinity,
353  "the vector coordinate type can't represent infinity!");
354  constexpr auto infinity = std::numeric_limits<decltype(intersection.X())>::infinity();
355 
356  if (!WireIDIntersectionCheck(wid1, wid2)) {
357  intersection = {infinity, infinity, infinity};
358  return false;
359  }
360 
361  WireGeo const& wire1 = Wire(wid1);
362  WireGeo const& wire2 = Wire(wid2);
363 
364  // Distance of the intersection point from the center of the two wires:
365  IntersectionPointAndOffsets<Point_t> intersectionAndOffset =
366  WiresIntersectionAndOffsets(wire1, wire2);
367  intersection = intersectionAndOffset.point;
368 
369  return std::abs(intersectionAndOffset.offset1) <= wire1.HalfL() &&
370  std::abs(intersectionAndOffset.offset2) <= wire2.HalfL();
371  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
WireGeo const & Wire(WireID const &wireid) const
Returns the specified wire.
IntersectionPointAndOffsets< Point_t > WiresIntersectionAndOffsets(WireGeo const &wireA, WireGeo const &wireB)
Returns the point of wireA that is closest to wireB.
Definition: WireGeo.h:516
bool WireIDIntersectionCheck(WireID const &wid1, WireID const &wid2) const
Wire ID check for WireIDsIntersect methods.
std::optional< WireIDIntersection > geo::WireReadoutGeom::WireIDsIntersect ( WireID const &  wid1,
WireID const &  wid2 
) const
inherited

Computes the intersection between two wires.

Parameters
wid1ID of the first wire
wid2ID of the other wire
Returns
whether an intersection was found within the TPC

The "intersection" refers to the projection of the wires into the same $ x = 0 $ plane. Wires are assumed to have at most one intersection. If wires are parallel, widIntersect will have the two components set to infinity (std::numeric_limits<>::infinity()) and the TPC number set to invalid (geo::TPCID::InvalidID). Also, false is returned. If the intersection is outside the TPC, false is also returned, but the widIntersect will contain the coordinates of that intersection. The TPC number is still set to invalid, although the intersection might belong to a valid TPC somewhere else.

Deprecated:
This method uses arbitrary assumptions and should not be used. Use the interface returning a full vector instead.

Definition at line 302 of file WireReadoutGeom.cxx.

References geo::vect::cross(), geo::WireReadoutGeom::finish(), geo::IntersectLines(), lar::util::PointWithinSegments(), geo::WireReadoutGeom::start(), geo::TPCID::TPC, geo::WireIDIntersection::TPC, geo::WireReadoutGeom::WireEndPoints(), geo::WireReadoutGeom::WireIDIntersectionCheck(), geo::Y, geo::WireIDIntersection::y, geo::Z, and geo::WireIDIntersection::z.

304  {
305  if (!WireIDIntersectionCheck(wid1, wid2)) { return std::nullopt; }
306 
307  // get the endpoints to see if wires intersect
308  Segment const w1 = WireEndPoints(wid1);
309  Segment const w2 = WireEndPoints(wid2);
310 
311  // TODO extract the coordinates in the right way;
312  // is it any worth, since then the result is in (y, z), whatever it means?
313  WireIDIntersection result;
314  bool const cross = IntersectLines(start(w1).Y(),
315  start(w1).Z(),
316  finish(w1).Y(),
317  finish(w1).Z(),
318  start(w2).Y(),
319  start(w2).Z(),
320  finish(w2).Y(),
321  finish(w2).Z(),
322  result.y,
323  result.z);
324  if (!cross) { return std::nullopt; }
325 
326  bool const within = lar::util::PointWithinSegments(start(w1).Y(),
327  start(w1).Z(),
328  finish(w1).Y(),
329  finish(w1).Z(),
330  start(w2).Y(),
331  start(w2).Z(),
332  finish(w2).Y(),
333  finish(w2).Z(),
334  result.y,
335  result.z);
336 
337  if (!within) { return std::nullopt; }
338 
339  result.TPC = wid1.TPC;
340  return result;
341  }
static auto const & start(Segment const &s)
bool PointWithinSegments(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double x, double y)
Returns whether x and y are within both specified ranges (A and B).
bool IntersectLines(double A_start_x, double A_start_y, double A_end_x, double A_end_y, double B_start_x, double B_start_y, double B_end_x, double B_end_y, double &x, double &y)
Computes the intersection between two lines on a plane.
static auto const & finish(Segment const &s)
std::pair< Point_t, Point_t > Segment
bool WireIDIntersectionCheck(WireID const &wid1, WireID const &wid2) const
Wire ID check for WireIDsIntersect methods.
Vector cross(Vector const &a, Vector const &b)
Return cross product of two vectors.
void WireEndPoints(WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
readout::ROPID geo::WireReadoutStandardGeom::WirePlaneToROP ( 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::WireReadoutGeom.

Definition at line 400 of file WireReadoutStandardGeom.cxx.

Referenced by ChannelToROP().

401  {
402  return ConvertWirePlaneToROP(planeid);
403  }
WireGeo const * geo::WireReadoutGeom::WirePtr ( WireID const &  wireid) const
inherited

Returns the specified wire.

Parameters
wireidwire ID
Returns
a constant pointer to the specified wire, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 263 of file WireReadoutGeom.cxx.

References geo::WireReadoutGeom::PlanePtr(), and geo::PlaneGeo::WirePtr().

Referenced by geo::details::getElementPtr(), geo::WireReadoutGeom::GetElementPtr(), geo::WireReadoutGeom::HasElement(), and lar_cluster3d::MinSpanTreeAlg::MinSpanTreeAlg().

264  {
265  PlaneGeo const* pPlane = PlanePtr(wireid);
266  return pPlane ? pPlane->WirePtr(wireid) : nullptr;
267  }
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.

Member Data Documentation

PlaneInfoMap_t<raw::ChannelID_t> geo::WireReadoutGeom::fFirstChannelInNextPlane
protectedinherited
PlaneInfoMap_t<raw::ChannelID_t> geo::WireReadoutGeom::fFirstChannelInThisPlane
protectedinherited
PlaneInfoMap_t<float> geo::WireReadoutStandardGeom::fFirstWireProj
private

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

Definition at line 194 of file WireReadoutStandardGeom.h.

Referenced by WireCoordinate(), and WireReadoutStandardGeom().

unsigned int geo::WireReadoutStandardGeom::fNchannels
private

number of channels in the detector

Definition at line 189 of file WireReadoutStandardGeom.h.

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

unsigned int geo::WireReadoutStandardGeom::fNcryostat
private

number of cryostats in the detector

Definition at line 188 of file WireReadoutStandardGeom.h.

Referenced by ChannelToWire(), and WireReadoutStandardGeom().

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

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

Definition at line 202 of file WireReadoutStandardGeom.h.

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

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

number of TPCs in each cryostat

Definition at line 191 of file WireReadoutStandardGeom.h.

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

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

Unit vectors orthogonal to wires in.

Definition at line 196 of file WireReadoutStandardGeom.h.

Referenced by WireCoordinate(), and WireReadoutStandardGeom().

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

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

Definition at line 197 of file WireReadoutStandardGeom.h.

Referenced by WireCoordinate(), and WireReadoutStandardGeom().

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

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

Definition at line 204 of file WireReadoutStandardGeom.h.

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

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

vector of the PlaneIDs present in the detector

Definition at line 193 of file WireReadoutStandardGeom.h.

Referenced by PlaneIDs(), and WireReadoutStandardGeom().

raw::ChannelID_t geo::WireReadoutStandardGeom::fTopChannel
private

book keeping highest channel #

Definition at line 190 of file WireReadoutStandardGeom.h.

Referenced by ChannelToWire(), and WireReadoutStandardGeom().

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

vector of the views present in the detector

Definition at line 192 of file WireReadoutStandardGeom.h.

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

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

Definition at line 200 of file WireReadoutStandardGeom.h.

Referenced by WireReadoutStandardGeom().

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

The number of wires in this plane in the heirachy

Definition at line 207 of file WireReadoutStandardGeom.h.

Referenced by WireReadoutStandardGeom().


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