56 if (opChannel >= this->
NOpChannels(NOpDets))
return false;
60 if (opdet >= NOpDets)
return false;
71 std::vector<geo::AuxDetGeo>
const& auxDets,
72 double tolerance)
const 74 for (
size_t a = 0; a < auxDets.size(); ++a) {
75 auto const localPoint = auxDets[a].toLocalCoords(point);
77 double const HalfCenterWidth = 0.5 * (auxDets[a].HalfWidth1() + auxDets[a].HalfWidth2());
79 if (localPoint.Z() >= -(auxDets[a].Length() / 2 + tolerance) &&
80 localPoint.Z() <= (auxDets[a].Length() / 2 + tolerance) &&
81 localPoint.Y() >= -auxDets[a].HalfHeight() - tolerance &&
82 localPoint.Y() <= auxDets[a].HalfHeight() + tolerance &&
84 localPoint.X() >= -HalfCenterWidth +
85 localPoint.Z() * (HalfCenterWidth - auxDets[a].HalfWidth2()) /
86 (0.5 * auxDets[a].
Length()) -
88 localPoint.X() <= HalfCenterWidth -
89 localPoint.Z() * (HalfCenterWidth - auxDets[a].HalfWidth2()) /
90 (0.5 * auxDets[a].
Length()) +
97 throw cet::exception(
"ChannelMap") <<
"Can't find AuxDet for position (" << point.X() <<
"," 98 << point.Y() <<
"," << point.Z() <<
")\n";
103 std::vector<geo::AuxDetGeo>
const& auxDets,
104 double tolerance)
const 115 if (localPoint.Z() >= -(adsg.
Length() / 2 + tolerance) &&
116 localPoint.Z() <= (adsg.
Length() / 2 + tolerance) &&
117 localPoint.Y() >= -adsg.
HalfHeight() - tolerance &&
118 localPoint.Y() <= adsg.
HalfHeight() + tolerance &&
122 localPoint.Z() * (HalfCenterWidth - adsg.
HalfWidth2()) / (0.5 * adsg.
Length()) -
126 localPoint.Z() * (HalfCenterWidth - adsg.
HalfWidth2()) / (0.5 * adsg.
Length()) +
132 throw cet::exception(
"Geometry") <<
"Can't find AuxDetSensitive for position (" << point.X()
133 <<
"," << point.Y() <<
"," << point.Z() <<
")\n";
138 std::string
const& detName,
139 uint32_t
const& )
const 144 if (itr.first.compare(detName) == 0)
return itr.second;
146 throw cet::exception(
"Geometry") <<
"No AuxDetGeo matching name: " << detName;
153 std::vector<geo::AuxDetGeo>
const& auxDets,
154 std::string
const& detName,
155 uint32_t
const& channel)
const 165 if (channel < itr->
second.size())
return std::make_pair(adGeoIdx, itr->second[channel]);
168 <<
"Given AuxDetSensitive channel, " << channel
169 <<
", cannot be found in vector associated to AuxDetGeo index: " << adGeoIdx
170 <<
". Vector has size " << itr->second.size();
173 throw cet::exception(
"Geometry") <<
"Given AuxDetGeo with index " << adGeoIdx
174 <<
" does not correspond to any vector of sensitive volumes";
float Length(const PFPStruct &pfp)
double HalfWidth2() const
virtual SigType_t SignalTypeForChannelImpl(raw::ChannelID_t const channel) const =0
Return the signal type of the specified channel.
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
SigType_t SignalTypeForROPID(readout::ROPID const &ropid) const
Return the signal type on the specified readout plane.
SigType_t SignalTypeForChannel(raw::ChannelID_t const channel) const
Return the signal type of the specified channel.
virtual unsigned int NOpChannels(unsigned int NOpDets) const
Returns the number of optical channels contained in some detectors.
virtual unsigned int OpDetFromOpChannel(unsigned int opChannel) const
Returns the optical detector the specified optical channel belongs.
double HalfWidth1() const
double HalfHeight() const
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
std::map< std::string, size_t > fADNameToGeo
map the names of the dets to the AuxDetGeo objects
size_t NSensitiveVolume() const
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet(std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
Returns the index of the sensitive detector containing the channel.
Class identifying a set of planes sharing readout channels.
virtual size_t ChannelToAuxDet(std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
Returns the index of the detector containing the specified channel.
Encapsulate the geometry of an auxiliary detector.
std::map< size_t, std::vector< size_t > > fADChannelToSensitiveGeo
virtual raw::ChannelID_t FirstChannelInROP(readout::ROPID const &ropid) const =0
Returns the ID of the first channel in the specified readout plane.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
virtual SigType_t SignalTypeForROPIDImpl(readout::ROPID const &ropid) const
Return the signal type on the specified readout plane.
virtual unsigned int HardwareChannelFromOpChannel(unsigned int opChannel) const
Returns the hardware channel number of specified optical channel.
virtual unsigned int MaxOpChannel(unsigned int NOpDets) const
Returns the number of optical channels contained in some detectors.
virtual size_t NearestAuxDet(Point_t const &point, std::vector< AuxDetGeo > const &auxDets, double tolerance=0) const
Returns the auxiliary detector closest to the specified point.
virtual unsigned int OpChannel(unsigned int detNum, unsigned int hwchannel=0) const
Returns the channel ID of the specified hardware channel.
virtual unsigned int NOpHardwareChannels(unsigned int opDet) const
Returns the number of channels in the specified optical detectors.
virtual bool IsValidOpChannel(unsigned int opChannel, unsigned int NOpDets) const
Returns whether the ID identifies a valid optical detector channel.
Interface to algorithm class for a specific detector channel mapping.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
second_as<> second
Type of time stored in seconds, in double precision.
Namespace collecting geometry-related classes utilities.
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local auxiliary detector frame.
cet::coded_exception< error, detail::translate > exception
virtual size_t NearestSensitiveAuxDet(Point_t const &point, std::vector< AuxDetGeo > const &auxDets, double tolerance=0) const
Returns sensitive auxiliary detector closest to specified point.