16 std::vector<geo::AuxDetGeo*>
const& auxDets)
const 18 double HalfCenterWidth = 0.;
19 double localPoint[3] = {0.};
21 for(
size_t a = 0; a < auxDets.size(); ++a) {
23 auxDets[a]->WorldToLocal(point, localPoint);
25 HalfCenterWidth = 0.5 * (auxDets[a]->HalfWidth1() + auxDets[a]->HalfWidth2());
27 if(localPoint[2] >= - auxDets[a]->Length()/2 &&
28 localPoint[2] <= auxDets[a]->Length()/2 &&
29 localPoint[1] >= - auxDets[a]->HalfHeight() &&
30 localPoint[1] <= auxDets[a]->HalfHeight() &&
32 localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - auxDets[a]->HalfWidth2())/(0.5 * auxDets[a]->Length()) &&
33 localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - auxDets[a]->HalfWidth2())/(0.5 * auxDets[a]->Length())
39 throw cet::exception(
"AuxDetChannelMapAlg") <<
"Can't find AuxDet for position (" 50 std::vector<geo::AuxDetGeo*>
const& auxDets,
53 double HalfCenterWidth = 0.;
54 double localPoint[3] = {0.};
67 if(localPoint[2] >= - adsg.
Length()/2 &&
68 localPoint[2] <= adsg.
Length()/2 &&
72 localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - adsg.
HalfWidth2())/(0.5 * adsg.
Length()) &&
73 localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - adsg.
HalfWidth2())/(0.5 * adsg.
Length())
78 throw cet::exception(
"Geometry") <<
"Can't find AuxDetSensitive for position (" 88 std::string
const& detName,
89 uint32_t
const& )
const 96 if( itr.second.compare(detName) == 0 )
return itr.first;
99 throw cet::exception(
"Geometry") <<
"No AuxDetGeo matching name: " << detName;
108 std::string
const& detName,
109 uint32_t
const& channel)
const 119 if( channel < itr->second.size() )
120 return std::make_pair(adGeoIdx, itr->second[channel].second);
122 throw cet::exception(
"Geometry") <<
"Given AuxDetSensitive channel, " << channel
123 <<
", cannot be found in vector associated to AuxDetGeo index: " 124 << adGeoIdx <<
". Vector has size " << itr->second.size();
127 throw cet::exception(
"Geometry") <<
"Given AuxDetGeo with index " << adGeoIdx
128 <<
" does not correspond to any vector of sensitive volumes";
130 return std::make_pair(adGeoIdx, UINT_MAX);
double HalfWidth2() const
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
double HalfWidth1() const
double HalfHeight() const
virtual size_t NearestAuxDet(const double *point, std::vector< geo::AuxDetGeo * > const &auxDets) const
virtual size_t ChannelToAuxDet(std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
size_t NSensitiveVolume() const
Encapsulate the geometry of an auxiliary detector.
void WorldToLocal(const double *world, double *auxdet) const
Transform point from world frame to local auxiliary detector frame.
std::map< size_t, std::string > fADGeoToName
map the AuxDetGeo index to the name
Namespace collecting geometry-related classes utilities.
virtual size_t NearestSensitiveAuxDet(const double *point, std::vector< geo::AuxDetGeo * > const &auxDets, size_t &ad) const
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet(std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
cet::coded_exception< error, detail::translate > exception