8 #include "cetlib_except/exception.h" 18 std::vector<AuxDetGeo>
const& auxDets,
19 double tolerance)
const 21 for (
size_t a = 0; a < auxDets.size(); ++a) {
22 auto const localPoint = auxDets[a].toLocalCoords(point);
23 double const HalfCenterWidth = 0.5 * (auxDets[a].HalfWidth1() + auxDets[a].HalfWidth2());
25 if (localPoint.Z() >= (-auxDets[a].Length() / 2 - tolerance) &&
26 localPoint.Z() <= (auxDets[a].Length() / 2 + tolerance) &&
27 localPoint.Y() >= (-auxDets[a].HalfHeight() - tolerance) &&
28 localPoint.Y() <= (auxDets[a].HalfHeight() + tolerance) &&
30 localPoint.X() >= (-HalfCenterWidth +
31 localPoint.Z() * (HalfCenterWidth - auxDets[a].HalfWidth2()) /
32 (0.5 * auxDets[a].
Length()) -
34 localPoint.X() <= (HalfCenterWidth -
35 localPoint.Z() * (HalfCenterWidth - auxDets[a].HalfWidth2()) /
36 (0.5 * auxDets[a].
Length()) +
43 throw cet::exception(
"AuxDetChannelMapAlg") <<
"Can't find AuxDet for position (" << point.X()
44 <<
"," << point.Y() <<
"," << point.Z() <<
")\n";
49 std::vector<AuxDetGeo>
const& auxDets,
51 double tolerance)
const 63 if (localPoint.Z() >= -(adsg.
Length() / 2 + tolerance) &&
64 localPoint.Z() <= adsg.
Length() / 2 + tolerance &&
65 localPoint.Y() >= -(adsg.
HalfHeight() + tolerance) &&
66 localPoint.Y() <= adsg.
HalfHeight() + tolerance &&
70 localPoint.Z() * (HalfCenterWidth - adsg.
HalfWidth2()) / (0.5 * adsg.
Length()) -
74 localPoint.Z() * (HalfCenterWidth - adsg.
HalfWidth2()) / (0.5 * adsg.
Length()) +
80 throw cet::exception(
"Geometry") <<
"Can't find AuxDetSensitive for position (" << point.X()
81 <<
"," << point.Y() <<
"," << point.Z() <<
")\n";
86 std::string
const& detName,
94 if (itr.second.compare(detName) == 0)
return itr.first;
96 throw cet::exception(
"Geometry") <<
"No AuxDetGeo matching name: " << detName;
103 std::vector<AuxDetGeo>
const& auxDets,
104 std::string
const& detName,
105 uint32_t channel)
const 115 if (channel < itr->
second.size())
116 return std::make_pair(adGeoIdx, itr->second[channel].second);
119 <<
"Given AuxDetSensitive channel, " << channel
120 <<
", cannot be found in vector associated to AuxDetGeo index: " << adGeoIdx
121 <<
". Vector has size " << itr->second.size();
124 throw cet::exception(
"Geometry") <<
"Given AuxDetGeo with index " << adGeoIdx
125 <<
" does not correspond to any vector of sensitive volumes";
float Length(const PFPStruct &pfp)
double HalfWidth2() const
Encapsulate the geometry of the sensitive portion of an auxiliary detector.
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
double HalfWidth1() const
double HalfHeight() const
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet(std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t channel) const
virtual size_t NearestAuxDet(Point_t const &point, std::vector< AuxDetGeo > const &auxDets, double tolerance=0) const
virtual size_t ChannelToAuxDet(std::vector< AuxDetGeo > const &auxDets, std::string const &detName, uint32_t channel) const
size_t NSensitiveVolume() const
Encapsulate the geometry of an auxiliary detector.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
virtual size_t NearestSensitiveAuxDet(Point_t const &point, std::vector< AuxDetGeo > const &auxDets, size_t &ad, double tolerance=0) const
std::map< size_t, std::string > fADGeoToName
map the AuxDetGeo index to the name
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