1 #ifndef LARCOREALG_GEOMETRY_WIREREADOUTGEOM_H 2 #define LARCOREALG_GEOMETRY_WIREREADOUTGEOM_H 53 :
Iterable<details::ReadoutIterationPolicy, details::ToReadoutGeometryElement> {
58 std::unique_ptr<WireReadoutGeometryBuilder> builder,
59 std::unique_ptr<WireReadoutSorter> sorter);
62 using Segment = std::pair<Point_t, Point_t>;
117 unsigned int Nviews()
const;
125 std::set<View_t>
Views(
TPCID const& tpcid)
const;
354 WireID const& wid2)
const;
412 PlaneID const& output_plane)
const;
433 double slope2)
const;
455 TPCID const& tpcid)
const 480 PlaneID const& output_plane)
const;
501 double slope2)
const;
518 double angle_target);
543 double pitch_target);
549 double PlanePitch(
TPCID const& tpcid,
unsigned int p1 = 0,
unsigned int p2 = 1)
const;
556 virtual unsigned int Nchannels()
const = 0;
658 virtual std::set<PlaneID>
const&
PlaneIDs()
const = 0;
692 virtual unsigned int NOpChannels(
unsigned int NOpDets)
const;
715 virtual unsigned int MaxOpChannel(
unsigned int NOpDets)
const;
746 virtual bool IsValidOpChannel(
unsigned int opChannel,
unsigned int NOpDets)
const;
756 virtual unsigned int OpChannel(
unsigned int detNum,
unsigned int hwchannel = 0)
const;
879 virtual unsigned int MaxROPs()
const = 0;
977 template <
typename T>
981 template <
typename T>
993 template <
typename T>
996 return map[
id.Cryostat][
id.TPC];
1000 template <
typename T>
1003 return map[
id.Cryostat].size();
1007 template <
typename T>
1011 return id.Cryostat < map.size();
1013 template <
typename T>
1016 return isValidElement(map,
id.asCryostatID()) && (
id.TPC < map[
id.Cryostat].size());
1021 template <
typename T>
1024 return map[
id.Cryostat][
id.TPC][
id.Plane];
1028 template <
typename T>
1031 return map[
id.Cryostat][
id.TPC].size();
1035 template <
typename T>
1039 return id.Cryostat < map.size();
1041 template <
typename T>
1044 return isValidElement(map,
id.asCryostatID()) && (
id.TPC < map[
id.Cryostat].size());
1046 template <
typename T>
1049 return isValidElement(map,
id.asTPCID()) && (
id.Plane < AccessSize(map,
id.asTPCID()));
1054 template <
typename T>
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];
1083 void SortPlanes(
TPCID const& tpcid, std::vector<PlaneGeo>& planes)
const;
1096 #endif // LARCOREALG_GEOMETRY_WIREREADOUTGEOM_H
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
bool HasElement(WireID const &wireid) const
Returns whether we have the specified wire.
virtual readout::ROPID ChannelToROP(raw::ChannelID_t channel) const =0
Returns the ID of the ROP the channel belongs to.
virtual double WireCoordinate(double YPos, double ZPos, PlaneID const &planeID) const =0
Returns the index of the wire nearest to the specified position.
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.
PlaneID ThirdPlane(PlaneID const &pid1, PlaneID const &pid2) const
Returns the plane that is not in the specified arguments.
static auto const & start(Segment const &s)
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
WireGeo const & GetElement(WireID const &wireid) const
Returns the specified wire.
virtual unsigned int MaxROPs() const =0
Returns the largest number of ROPs a TPC set in the detector has.
unsigned int NElements(TPCID const &tpcid) const
Returns the total number of planes in the specified TPC.
double Plane0Pitch(TPCID const &tpcid, unsigned int p1) const
bool isValidElement(TPCInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
Classes identifying readout-related concepts.
PlaneGeo const & GetElement(PlaneID const &planeid) const
Returns the specified wire.
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the specified plane.
virtual unsigned int NTPCsets(readout::CryostatID const &cryoid) const =0
Returns the total number of TPC sets in the specified cryostat.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
bool IsValidOpChannel(int opChannel) const
Is this a valid OpChannel number?
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.
bool HasWire(WireID const &wireid) const
Returns whether we have the specified wire.
virtual unsigned int Nchannels() const =0
Returns the total number of channels present (not necessarily contiguous)
void SortPlanes(TPCID const &tpcid, std::vector< PlaneGeo > &planes) const
Sorts (in place) the specified PlaneGeo objects by drift distance.
unsigned int PlaneID_t
Type for the ID number.
The data type to uniquely identify a Plane.
Geometry information for a single TPC.
Class identifying a set of TPC sharing readout channels.
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.
double WireAngleToVertical(View_t view, TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
double PlanePitch(TPCID const &tpcid, unsigned int p1=0, unsigned int p2=1) const
WireGeo const * WirePtr(WireID const &wireid) const
Returns the specified wire.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
std::optional< WireIDIntersection > ChannelsIntersect(raw::ChannelID_t c1, raw::ChannelID_t c2) const
Returns an intersection point of two channels.
Point_t GetStart() const
Returns the world coordinate of one end of the wire [cm].
Point_t GetEnd() const
Returns the world coordinate of one end of the wire [cm].
std::map< TPCID, std::vector< PlaneGeo > > fPlanes
bool HasPlane(PlaneID const &planeid) const
Returns whether we have the specified plane.
virtual bool HasROP(readout::ROPID const &ropid) const =0
virtual bool HasChannel(raw::ChannelID_t channel) const
Returns whether the specified channel is valid This default implementation assumes all channels up to...
std::map< TPCID, std::vector< double > > fPlane0Pitch
Pitch between planes.
virtual TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const =0
Returns the ID of the first TPC belonging to the specified TPC set.
unsigned int NSiblingElements(WireID const &wireid) const
Returns the total number of wires in the specified plane.
WireReadoutGeom(GeometryCore const *geom, std::unique_ptr< WireReadoutGeometryBuilder > builder, std::unique_ptr< WireReadoutSorter > sorter)
WireGeo const & Wire(WireID const &wireid) const
Returns the specified wire.
virtual WireID NearestWireID(Point_t const &worldPos, PlaneID const &planeID) const =0
Returns the ID of the wire nearest to the specified position.
PlaneGeo const * GetElementPtr(PlaneID const &planeid) const
Returns the specified plane.
virtual PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const =0
Returns the ID of the first plane belonging to the specified ROP.
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
std::vector< raw::ChannelID_t > ChannelsInTPCs() const
Returns an std::vector<ChannelID_t> in all TPCs in a TPCSet.
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.
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int opChannel) const
Returns the optical detector the specified optical channel belongs.
readout::TPCsetID FindTPCsetAtPosition(Point_t const &worldLoc) const
Returns the total number of TPC sets in the specified cryostat.
unsigned int MaxPlanes() const
Returns the largest number of planes among all TPCs in this detector.
iterator_type< T > begin() const
std::set< View_t > const & Views() const
Returns a list of possible views in the detector.
std::function< bool(T const &, T const &)> Compare
void UpdateAfterSorting(TPCGeo const &tpc, std::vector< PlaneGeo > &planes)
bool isValidElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
virtual readout::ROPID WirePlaneToROP(PlaneID const &planeid) const =0
Returns the ID of the ROP planeid belongs to.
Definitions of geometry vector data types.
static auto const & finish(Segment const &s)
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Interface for a class providing readout channel mapping to geometry.
std::pair< Point_t, Point_t > Segment
unsigned int MaxWires() const
Returns the total number of wires in the specified plane.
std::vector< std::vector< std::vector< raw::ChannelID_t > > > const & FirstChannelInNextPlane() const
Retrieve the private fFirstChannelInNextPlane vector for testing.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
unsigned int Nviews() const
Returns the number of views (different wire orientations)
virtual SigType_t SignalTypeForROPIDImpl(readout::ROPID const &ropid) const
Return the signal type on the specified readout plane.
std::vector< std::vector< std::vector< raw::ChannelID_t > > > const & FirstChannelInThisPlane() const
Retrieve the private fFirstChannelInThisPlane vector for testing.
constexpr bool isValidChannelID(raw::ChannelID_t channel)
virtual raw::ChannelID_t PlaneWireToChannel(WireID const &wireID) const =0
Returns the channel ID a wire is connected to.
void SortSubVolumes(std::vector< PlaneGeo > &planes, Compare< WireGeo > compareWires) const
virtual bool HasTPCset(readout::TPCsetID const &tpcsetid) const =0
bool isValidElement(PlaneInfoMap_t< T > const &map, PlaneID const &id) const
Returns whether the ID specifies a valid entry.
std::vector< std::vector< T >> TPCInfoMap_t
Data type for per-TPC information.
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.
The data type to uniquely identify a TPC.
Description of the physical geometry of one entire detector.
bool isValidElement(PlaneInfoMap_t< T > const &map, TPCID const &id) const
Returns whether the ID specifies a valid entry.
Definition of data types for geometry description.
Class identifying a set of planes sharing readout channels.
raw::ChannelID_t NearestChannel(Point_t const &worldLoc, PlaneID const &planeid) const
Returns the ID of the channel nearest to the specified position.
void ResetDriftDirection(TPCID const &tpcid)
Recomputes the drift direction; needs planes to have been initialised.
id_sentinel_for< T > end() const
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, Point_t &intersection) const
Computes the intersection between two wires.
unsigned int Nplanes(TPCID const &tpcid=details::tpc_zero) const
Returns the total number of planes in the specified TPC.
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.
Encapsulate the geometry of a wire .
virtual ~WireReadoutGeom()
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
virtual unsigned int NROPs(readout::TPCsetID const &tpcsetid) const =0
Returns the total number of ROP in the specified TPC set.
TPCInfoMap_t< std::vector< T >> PlaneInfoMap_t
Data type for per-plane information.
virtual unsigned int HardwareChannelFromOpChannel(unsigned int opChannel) const
Returns the hardware channel number of specified optical channel.
Segment WireEndPoints(WireID const &wireid) const
Returns a segment whose ends are the wire end points.
PlaneGeo const & FirstPlane(TPCID const &tpcid) const
Returns the first plane of the specified TPC.
T const * GetElementPtr(PlaneInfoMap_t< T > const &map, PlaneID const &id) const
Returns a pointer to the specified element, or nullptr if invalid.
virtual std::set< PlaneID > const & PlaneIDs() const =0
Returns a list of the plane IDs in the whole detector.
virtual std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const =0
Encapsulate the construction of a single detector plane .
View_t View(raw::ChannelID_t const channel) const
Returns the view (wire orientation) on the specified TPC channel.
unsigned int MaxOpChannel() const
Largest optical channel number.
unsigned int NSiblingElements(PlaneID const &planeid) const
Returns the total number of planes in the specified TPC.
virtual std::vector< TPCID > TPCsetToTPCs(readout::TPCsetID const &tpcsetid) const =0
Returns a list of ID of TPCs belonging to the specified TPC set.
range_type< T > Iterate() const
virtual unsigned int MaxTPCsets() const =0
Returns the largest number of TPC sets any cryostat in the detector has.
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
bool isValidElement(PlaneInfoMap_t< T > const &map, CryostatID const &id) const
Returns whether the ID specifies a valid entry.
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const =0
Returns the ID of the first channel in the specified readout plane.
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
bool WireIDIntersectionCheck(WireID const &wid1, WireID const &wid2) const
Wire ID check for WireIDsIntersect methods.
GeometryCore const * fGeom
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
WireGeo const * GetElementPtr(WireID const &wireid) const
Returns the specified wire.
PlaneGeo const & Plane(TPCID const &tpcid, View_t view) const
Returns the specified wire.
T const & AccessElement(PlaneInfoMap_t< T > const &map, PlaneID const &id) const
Returns the specified element of the plane map.
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
virtual std::vector< TPCID > ROPtoTPCs(readout::ROPID const &ropid) const =0
Returns a list of ID of TPCs the specified ROP spans.
virtual unsigned int OpChannel(unsigned int detNum, unsigned int hwchannel=0) const
Returns the channel ID of the specified hardware channel.
virtual SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const =0
Return the signal type of the specified channel.
void WireEndPoints(WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
bool HasElement(PlaneID const &planeid) const
Returns whether we have the specified plane.
std::set< View_t > allViews
All views in the detector.
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.
virtual std::vector< PlaneID > ROPtoWirePlanes(readout::ROPID const &ropid) const =0
Returns a list of ID of planes belonging to the specified ROP.
The data type to uniquely identify a cryostat.
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.
virtual readout::TPCsetID TPCtoTPCset(TPCID const &tpcid) const =0
Returns the ID of the TPC set tpcid belongs to.