16 #include "cetlib_except/exception.h" 32 std::vector<CryostatGeo>
const& cgeo = geodata.
cryostats;
36 mf::LogInfo(
"ChannelMapStandardAlg") <<
"Initializing Standard ChannelMap...";
53 for (
unsigned int cs = 0; cs !=
fNcryostat; ++cs) {
68 for (
unsigned int TPCCount = 0; TPCCount !=
fNTPC[cs]; ++TPCCount) {
70 unsigned int PlanesThisTPC = TPC.
Nplanes();
75 fNPlanes[cs][TPCCount] = PlanesThisTPC;
76 for (
unsigned int PlaneCount = 0; PlaneCount != PlanesThisTPC; ++PlaneCount) {
80 double ThisWirePitch = TPC.
WirePitch(PlaneCount);
91 double OrthY = cth, OrthZ = -sth;
92 if (((WireCenter2.Y() - WireCenter1.Y()) * OrthY +
93 (WireCenter2.Z() - WireCenter1.Z()) * OrthZ) < 0) {
104 fOrthVectorsY[cs][TPCCount][PlaneCount] = OrthY / ThisWirePitch;
105 fOrthVectorsZ[cs][TPCCount][PlaneCount] = OrthZ / ThisWirePitch;
108 WireCenter1.Y() * OrthY + WireCenter1.Z() * OrthZ;
112 int WiresThisPlane = plane.
Nwires();
116 RunningTotal += WiresThisPlane;
138 std::vector<WireID> AllSegments;
139 unsigned int cstat = 0;
140 unsigned int tpc = 0;
141 unsigned int plane = 0;
142 unsigned int wire = 0;
146 throw cet::exception(
"Geometry") <<
"ILLEGAL CHANNEL ID for channel " << channel <<
"\n";
149 bool foundWid(
false);
150 for (
unsigned int csloop = 0; csloop !=
fNcryostat; ++csloop) {
151 for (
unsigned int tpcloop = 0; tpcloop !=
fNTPC[csloop]; ++tpcloop) {
152 for (
unsigned int planeloop = 0;
170 WireID CodeWire(cstat, tpc, plane, wire);
172 AllSegments.push_back(CodeWire);
186 if (!
HasROP(ropid))
return 0;
208 int NearestWireNumber = int(0.5 +
WireCoordinate(worldPos.Y(), worldPos.Z(), planeID));
213 if (NearestWireNumber < 0 || (
unsigned int)NearestWireNumber >=
WireCount(planeID)) {
214 int wireNumber = NearestWireNumber;
216 if (NearestWireNumber < 0)
217 NearestWireNumber = 0;
219 NearestWireNumber =
WireCount(planeID) - 1;
222 <<
"Can't Find Nearest Wire for position (" << worldPos.X() <<
"," << worldPos.Y() <<
"," 223 << worldPos.Z() <<
")" 224 <<
" in plane " << std::string(planeID) <<
" approx wire number # " << wireNumber
225 <<
" (capped from " << NearestWireNumber <<
")\n";
251 return *pBaseLine + wireID.
Wire;
256 <<
"NO CHANNEL FOUND for " << std::string(wireID);
261 <<
"should not be at the point in the function, returning " 262 <<
"invalid channel";
273 unsigned int tpc = channel / nChanPerTPC;
275 unsigned int PlanesThisTPC =
fNPlanes[0][tpc];
288 <<
"Channel " << channel <<
" not given signal type." << std::endl;
327 std::vector<TPCID> IDs;
341 unsigned int max = 0;
342 for (
unsigned int nTPCs :
fNTPC)
343 if (nTPCs > max) max = nTPCs;
357 unsigned int max = 0;
358 for (
auto const& cryo_tpc :
fNPlanes)
359 for (
unsigned int nPlanes : cryo_tpc)
360 if (nPlanes > max) max = nPlanes;
379 std::vector<PlaneID> IDs;
387 std::vector<TPCID> IDs;
402 if (wires.empty())
return {};
432 if (!tpcsetid.
isValid)
return {};
439 if (!planeid.
isValid)
return {};
void Initialize(GeometryData_t const &geodata) override
Geometry initialisation.
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
std::vector< TPCID > TPCsetToTPCs(readout::TPCsetID const &tpcsetid) const override
Returns a list of ID of TPCs belonging to the specified TPC set.
Point_t const & GetCenter() const
Returns the world coordinate of the center of the wire [cm].
WireID NearestWireID(Point_t const &worldPos, PlaneID const &planeID) const override
Returns the ID of the wire nearest to the specified position.
TPCInfoMap_t< unsigned int > fNPlanes
PlaneInfoMap_t< float > fWireCounts
raw::ChannelID_t PlaneWireToChannel(WireID const &wireID) const override
Returns the channel ID a wire is connected to.
Encapsulate the construction of a single cyostat.
TPCID FirstTPCinTPCset(readout::TPCsetID const &tpcsetid) const override
Returns the ID of the first TPC belonging to the specified TPC set.
static TPCID ConvertTPCsetToTPC(readout::TPCsetID const &tpcsetid)
Converts a TPC set ID into a TPC ID using the same numerical indices.
double WireCoordinate(double YPos, double ZPos, PlaneID const &planeID) const override
Returns the index of the wire nearest to the specified position.
WireGeo const & Wire(unsigned int iwire) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int Nplanes() const
Number of planes in this tpc.
unsigned int ROPID_t
Type for the ID number.
T const & AccessElement(TPCInfoMap_t< T > const &map, TPCID const &id) const
Returns the specified element of the TPC map.
SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const override
Return the signal type of the specified channel.
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.
Class identifying a set of TPC sharing readout channels.
std::vector< PlaneID > ROPtoWirePlanes(readout::ROPID const &ropid) const override
Returns a list of ID of wire planes belonging to the specified ROP.
CryostatID_t Cryostat
Index of cryostat.
unsigned int MaxTPCsets() const override
Returns the largest number of TPC sets any cryostat in the detector has.
WireID_t Wire
Index of the wire within its plane.
CryostatList_t cryostats
The detector cryostats.
PlaneID FirstWirePlaneInROP(readout::ROPID const &ropid) const override
Returns the ID of the first plane belonging to the specified ROP.
Geometry information for a single cryostat.
PlaneInfoMap_t< raw::ChannelID_t > fFirstChannelInThisPlane
PlaneInfoMap_t< float > fOrthVectorsZ
readout::ROPID WirePlaneToROP(PlaneID const &planeid) const override
Returns the ID of the ROP planeid belongs to, or invalid if none.
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
Access the description of detector geometry.
readout::ROPID ChannelToROP(raw::ChannelID_t channel) const override
Returns the ID of the ROP the channel belongs to (invalid if none)
Collection of exceptions for Geometry system.
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
unsigned int MaxTPCs() const
Returns the largest number of TPCs in a single cryostat.
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.
bool HasROP(readout::ROPID const &ropid) const override
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
unsigned int fNcryostat
number of cryostats in the detector
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
PlaneInfoMap_t< unsigned int > fPlaneBaselines
constexpr bool isValidChannelID(raw::ChannelID_t channel)
unsigned int NTPC() const
Number of TPCs in this cryostat.
PlaneInfoMap_t< unsigned int > fWiresPerPlane
double WirePitch(unsigned plane=0) const
Returns the center of the TPC volume in world coordinates [cm].
unsigned int MaxROPs() const override
Returns the largest number of ROPs a TPC set in the detector has.
PlaneInfoMap_t< float > fFirstWireProj
bool HasTPCset(readout::TPCsetID const &tpcsetid) const override
std::set< PlaneID > const & PlaneIDs() const override
Returns a list of the plane IDs in the whole detector.
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
std::set< PlaneID > fPlaneIDs
vector of the PlaneIDs present in the detector
unsigned int Nchannels() const override
Returns the total number of channels present (not necessarily contiguous)
Class identifying a set of planes sharing readout channels.
unsigned int fNchannels
number of channels in the detector
static PlaneID ConvertROPtoWirePlane(readout::ROPID const &ropid)
Converts a wire plane ID into a ROP ID using the same numerical indices.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Encapsulate the geometry of a wire.
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.
unsigned int WireCount(PlaneID const &id) const
Retrieved the wire cound for the specified plane ID.
ChannelMapStandardAlg(fhicl::ParameterSet const &p)
unsigned int TPCID_t
Type for the ID number.
std::vector< TPCID > ROPtoTPCs(readout::ROPID const &ropid) const override
Returns a list of ID of TPCs the specified ROP spans.
Interface to algorithm class for a specific detector channel mapping.
Encapsulate the construction of a single detector plane.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
static readout::TPCsetID ConvertTPCtoTPCset(TPCID const &tpcid)
Converts a TPC ID into a TPC set ID using the same numerical indices.
unsigned int NTPCsets(readout::CryostatID const &cryoid) const override
Returns the total number of TPC sets in the specified cryostat.
void Uninitialize() override
Deconfiguration: prepare for a following call of Initialize()
unsigned int Nwires() const
Number of wires in this plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::vector< WireID > ChannelToWire(raw::ChannelID_t channel) const override
PlaneInfoMap_t< float > fOrthVectorsY
Unit vectors orthogonal to wires in.
Exception thrown on invalid wire number.
raw::ChannelID_t fTopChannel
book keeping highest channel #
unsigned int WireID_t
Type for the ID number.
raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const override
Returns the ID of the first channel in the specified readout plane.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Data in the geometry description.
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.
static readout::ROPID ConvertWirePlaneToROP(PlaneID const &planeid)
Converts a ROP ID into a wire plane ID using the same numerical indices.
unsigned int NROPs(readout::TPCsetID const &tpcsetid) const override
Returns the total number of ROPs in the specified TPC set.
Namespace collecting geometry-related classes utilities.
T const * GetElementPtr(PlaneInfoMap_t< T > const &map, PlaneID const &id) const
Returns a pointer to the specified element, or nullptr if invalid.
readout::TPCsetID TPCtoTPCset(TPCID const &tpcid) const override
Returns the ID of the TPC set the specified TPC belongs to.
cet::coded_exception< error, detail::translate > exception
std::vector< unsigned int > fNTPC
number of TPCs in each cryostat
constexpr TPCsetID const & asTPCsetID() const
Conversion to TPCsetID (for convenience of notation).
Encapsulate the construction of a single detector plane.
The data type to uniquely identify a cryostat.
Signal from collection planes.