8 #include "cetlib_except/exception.h" 21 std::vector<geo::AuxDetGeo>
const& auxDets,
double tolerance)
const 23 double HalfCenterWidth = 0.;
24 double localPoint[3] = {0.};
26 for(
size_t a = 0;
a < auxDets.size(); ++
a) {
28 auxDets[
a].WorldToLocal(point, localPoint);
30 HalfCenterWidth = 0.5 * (auxDets[
a].HalfWidth1() + auxDets[
a].HalfWidth2());
32 if(localPoint[2] >= (- auxDets[
a].
Length()/2 - tolerance) &&
33 localPoint[2] <= ( auxDets[
a].Length()/2 +
tolerance) &&
34 localPoint[1] >= (- auxDets[
a].HalfHeight() -
tolerance) &&
35 localPoint[1] <= (auxDets[
a].HalfHeight() +
tolerance) &&
37 localPoint[0] >= (- HalfCenterWidth + localPoint[2]*(HalfCenterWidth - auxDets[
a].HalfWidth2())/(0.5 * auxDets[
a].Length()) - tolerance) &&
38 localPoint[0] <= ( HalfCenterWidth - localPoint[2]*(HalfCenterWidth - auxDets[
a].HalfWidth2())/(0.5 * auxDets[
a].
Length()) + tolerance)
44 throw cet::exception(
"AuxDetChannelMapAlg") <<
"Can't find AuxDet for position (" 55 std::vector<geo::AuxDetGeo>
const& auxDets,
59 double HalfCenterWidth = 0.;
60 double localPoint[3] = {0.};
75 localPoint[2] <= adsg.
Length()/2 + tolerance &&
77 localPoint[1] <= adsg.
HalfHeight() + tolerance &&
79 localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - adsg.
HalfWidth2())/(0.5 * adsg.
Length()) - tolerance &&
80 localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - adsg.
HalfWidth2())/(0.5 * adsg.
Length()) + tolerance
85 throw cet::exception(
"Geometry") <<
"Can't find AuxDetSensitive for position (" 96 uint32_t
const& )
const 103 if( itr.second.compare(detName) == 0 )
return itr.first;
106 throw cet::exception(
"Geometry") <<
"No AuxDetGeo matching name: " << detName;
126 if( channel < itr->
second.size() )
127 return std::make_pair(adGeoIdx, itr->second[channel].second);
129 throw cet::exception(
"Geometry") <<
"Given AuxDetSensitive channel, " << channel
130 <<
", cannot be found in vector associated to AuxDetGeo index: " 131 << adGeoIdx <<
". Vector has size " << itr->second.size();
134 throw cet::exception(
"Geometry") <<
"Given AuxDetGeo with index " << adGeoIdx
135 <<
" does not correspond to any vector of sensitive volumes";
137 return std::make_pair(adGeoIdx, UINT_MAX);
virtual size_t ChannelToAuxDet(std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) const
float Length(const PFPStruct &pfp)
double HalfWidth2() const
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
double HalfWidth1() const
virtual size_t NearestAuxDet(const double *point, std::vector< geo::AuxDetGeo > const &auxDets, double tolerance=0) const
double HalfHeight() const
Encapsulate the geometry of the sensitive portion of an auxiliary detector.
Encapsulate the geometry of an auxiliary detector.
size_t NSensitiveVolume() const
void WorldToLocal(const double *world, double *auxdet) const
Transform point from world frame to local auxiliary detector frame.
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet(std::vector< geo::AuxDetGeo > const &auxDets, std::string const &detName, uint32_t const &channel) 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.
LArSoft geometry interface.
virtual size_t NearestSensitiveAuxDet(const double *point, std::vector< geo::AuxDetGeo > const &auxDets, size_t &ad, double tolerance=0) const
cet::coded_exception< error, detail::translate > exception