15 #include "cetlib_except/exception.h" 30 if (!tpcsetid.
isValid)
return {};
37 if (!planeid.
isValid)
return {};
59 std::unique_ptr<WireReadoutSorter> sorter)
61 std::make_unique<WireReadoutGeomBuilderStandard>(
67 mf::LogInfo(
"WireReadoutStandardGeom") <<
"Initializing standard wire-readout geometry...";
84 for (
auto const& cryo : geom->Iterate<
CryostatGeo>()) {
85 auto const cs = cryo.ID().Cryostat;
86 fNTPC[cs] = cryo.NTPC();
99 for (
auto const& TPC : geom->Iterate<
TPCGeo>(cryo.ID())) {
100 auto const TPCCount = TPC.ID().TPC;
101 unsigned int PlanesThisTPC =
Nplanes(TPC.ID());
106 fNPlanes[cs][TPCCount] = PlanesThisTPC;
107 for (
auto const& plane : Iterate<PlaneGeo>(TPC.ID())) {
109 auto const PlaneCount = plane.ID().Plane;
111 double ThisWirePitch = plane.WirePitch();
112 fWireCounts[cs][TPCCount][PlaneCount] = plane.Nwires();
114 WireGeo const& firstWire = plane.Wire(0);
117 auto WireCenter1 = firstWire.
GetCenter();
118 auto WireCenter2 = plane.Wire(1).GetCenter();
122 double OrthY = cth, OrthZ = -sth;
123 if (((WireCenter2.Y() - WireCenter1.Y()) * OrthY +
124 (WireCenter2.Z() - WireCenter1.Z()) * OrthZ) < 0) {
135 fOrthVectorsY[cs][TPCCount][PlaneCount] = OrthY / ThisWirePitch;
136 fOrthVectorsZ[cs][TPCCount][PlaneCount] = OrthZ / ThisWirePitch;
139 WireCenter1.Y() * OrthY + WireCenter1.Z() * OrthZ;
143 int WiresThisPlane = plane.Nwires();
147 RunningTotal += WiresThisPlane;
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;
174 throw cet::exception(
"Geometry") <<
"ILLEGAL CHANNEL ID for channel " << channel <<
"\n";
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;
198 WireID CodeWire(cstat, tpc, plane, wire);
200 AllSegments.push_back(CodeWire);
214 if (!
HasROP(ropid))
return 0;
237 int NearestWireNumber = int(0.5 +
WireCoordinate(worldPos.Y(), worldPos.Z(), planeID));
242 if (NearestWireNumber < 0 || (
unsigned int)NearestWireNumber >=
WireCount(planeID)) {
243 int wireNumber = NearestWireNumber;
245 if (NearestWireNumber < 0)
246 NearestWireNumber = 0;
248 NearestWireNumber =
WireCount(planeID) - 1;
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";
280 return *pBaseLine + wireID.
Wire;
285 <<
"NO CHANNEL FOUND for " << std::string(wireID);
290 <<
"should not be at the point in the function, returning " 291 <<
"invalid channel";
302 unsigned int tpc = channel / nChanPerTPC;
304 unsigned int PlanesThisTPC =
fNPlanes[0][tpc];
317 <<
"Channel " << channel <<
" not given signal type." << std::endl;
350 return ConvertTPCtoTPCset(tpcid);
356 std::vector<TPCID> IDs;
357 if (tpcsetid.
isValid) IDs.emplace_back(ConvertTPCsetToTPC(tpcsetid));
364 return ConvertTPCsetToTPC(tpcsetid);
370 unsigned int max = 0;
371 for (
unsigned int nTPCs :
fNTPC)
372 if (nTPCs > max) max = nTPCs;
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;
402 return ConvertWirePlaneToROP(planeid);
408 std::vector<PlaneID> IDs;
416 std::vector<TPCID> IDs;
431 if (wires.empty())
return {};
447 return ConvertROPtoWirePlane(ropid);
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
PlaneInfoMap_t< float > fOrthVectorsZ
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
WireReadoutStandardGeom(fhicl::ParameterSet const &pset, GeometryCore const *geom, std::unique_ptr< WireReadoutSorter > sorter)
Encapsulate the construction of a single cyostat .
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int ROPID_t
Type for the ID number.
unsigned int MaxROPs() const override
Returns the largest number of ROPs a TPC set in the detector has.
unsigned short TPCsetID_t
Type for the ID number.
unsigned int PlaneID_t
Type for the ID number.
double SinThetaZ() const
Returns trigonometric operations on ThetaZ()
The data type to uniquely identify a Plane.
bool isValid
Whether this ID points to a valid element.
Geometry information for a single TPC.
SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const override
Return the signal type of the specified channel.
Class identifying a set of TPC sharing readout channels.
TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
WireID NearestWireID(Point_t const &worldPos, PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
unsigned int WireCount(PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
CryostatID_t Cryostat
Index of cryostat.
unsigned int MaxTPCsets() const override
Returns the largest number of TPC sets any cryostat in the detector has.
unsigned int fNcryostat
number of cryostats in the detector
WireID_t Wire
Index of the wire within its plane.
PlaneInfoMap_t< unsigned int > fWiresPerPlane
Geometry information for a single cryostat.
bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
std::vector< TPCID > ROPtoTPCs(readout::ROPID const &ropid) const override
Returns a list of ID of TPCs the specified ROP spans.
PlaneGeo const * GetElementPtr(PlaneID const &planeid) const
Returns the specified plane.
readout::ROPID ChannelToROP(raw::ChannelID_t channel) const override
Returns the ID of the ROP the channel belongs to (invalid if none)
std::vector< TPCID > TPCsetToTPCs(readout::TPCsetID const &tpcsetid) const override
Returns a list of ID of TPCs belonging to the specified TPC set.
Access the description of the physical detector geometry.
double WireCoordinate(double YPos, double ZPos, PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
PlaneInfoMap_t< float > fWireCounts
std::set< PlaneID > const & PlaneIDs() const override
Returns a list of the plane IDs in the whole detector.
Collection of exceptions for Geometry system.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
ROPID_t ROP
Index of the readout plane within its TPC set.
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
Signal from induction planes.
constexpr TPCsetID const & asTPCsetID() const
Conversion to ROPID (for convenience of notation).
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Interface for a class providing readout channel mapping to geometry.
unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROPs in the specified TPC set.
T get(std::string const &key) const
unsigned int fNchannels
number of channels in the detector
constexpr bool isValidChannelID(raw::ChannelID_t channel)
raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const override
Returns the ID of the first channel in the specified readout plane.
PlaneInfoMap_t< unsigned int > fPlaneBaselines
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
Description of the physical geometry of one entire detector.
TPCInfoMap_t< unsigned int > fNPlanes
Class identifying a set of planes sharing readout channels.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
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.
unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
Encapsulate the geometry of a wire .
PlaneInfoMap_t< float > fFirstWireProj
raw::ChannelID_t fTopChannel
book keeping highest channel #
unsigned int Nchannels() const override
Returns the total number of channels present (not necessarily contiguous)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
unsigned int CryostatID_t
Type for the ID number.
readout::ROPID WirePlaneToROP(PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to, or invalid if none.
unsigned int TPCID_t
Type for the ID number.
Encapsulate the construction of a single detector plane .
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
Exception thrown on invalid wire number.
Interface to algorithm class for a specific detector channel mapping.
unsigned int WireID_t
Type for the ID number.
PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
double CosThetaZ() const
Returns trigonometric operations on ThetaZ()
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInNextPlane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
TPCID_t TPC
Index of the TPC within its cryostat.
raw::ChannelID_t PlaneWireToChannel(WireID const &wireID) const override
Returns the channel ID a wire is connected to.
bool HasROP(readout::ROPID const &ropid) const override
std::vector< PlaneID > ROPtoWirePlanes(readout::ROPID const &ropid) const override
Returns a list of ID of wire planes belonging to the specified ROP.
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
cet::coded_exception< error, detail::translate > exception
std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
Encapsulate the construction of a single detector plane .
readout::TPCsetID TPCtoTPCset(TPCID const &tpcid) const override
Returns the ID of the TPC set the specified TPC belongs to.
The data type to uniquely identify a cryostat.
Signal from collection planes.
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat