11 #include "art/Framework/Services/Registry/ServiceHandle.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
29 fhicl::ParameterSet
const&
p)
36 std::vector<geo::AuxDetGeo>& adgeo = geodata.
auxDets;
37 std::vector<geo::AuxDetGeo*> adgeo_copy;
38 for (
size_t i=0; i<adgeo.size(); i++) adgeo_copy.push_back(&adgeo[i]);
99 for (
size_t a=0;
a<adgeo.size();
a++){
101 std::string volName(adgeo[
a].TotalVolume()->GetName());
106 std::vector<std::pair<int, geo::AuxDetSensitiveGeo> > adslist;
109 size_t nsv = adgeo[
a].NSensitiveVolume();
112 for(
int isv = 0; isv < (int)nsv; isv++ ){
113 adslist.push_back(std::make_pair(isv,adgeo[
a].SensitiveVolume(isv)));
127 if (nsv != 20 && nsv !=16 && nsv != 64) {
128 throw cet::exception(
"CRTChannelMap")
129 <<
"Wrong number of sensitive volumes for CRT volume "
130 << volName <<
" (got " << nsv <<
", expected 20, 16 or 64)" << std::endl;
140 std::string str = volName;
144 for ( ; i < str.length(); i++ ){
if ( std::isdigit(str[i]) )
break; }
147 str = str.substr(i, str.length() - i );
150 int id = std::atoi(str.c_str());
156 if (volName.find(
"volAuxDet_") != std::string::npos) {
162 for (
size_t svID=0; svID<16; svID++) {
165 for (
size_t ich=0; ich<2; ich++) {
175 for (
size_t svID=0; svID<64; svID++) {
185 for (
size_t svID=0; svID<20; svID+=2) {
193 if (adslist[svID].
second.Length() == 800){
214 std::cout <<
" " <<
a <<
" \t" << volName <<
"\t "<<
id <<
" \t" << chID << std::endl;
217 throw cet::exception(
"CRTChannelMap")
218 <<
"Unrecognized volume found: " << volName << std::endl;
237 double const worldLoc[3],
238 std::vector<geo::AuxDetGeo>
const& auxDets,
243 uint32_t channel = UINT_MAX;
252 double svOrigin[3] = {0, 0, 0};
253 double localOrigin[3] = {0, 0, 0};
255 auxDets[ad].SensitiveVolume(sv).LocalToWorld(localOrigin, svOrigin);
267 throw cet::exception(
"CRTChannelMapAlg")
268 <<
"No entry in channel and sensitive volume map for AuxDet index "
282 for (
auto& pairItr : csvItr->second)
283 if (pairItr.second == sv) channel = pairItr.first;
298 uint32_t
const& channel,
299 std::string
const& auxDetName,
300 std::vector<geo::AuxDetGeo>
const& auxDets)
const {
306 size_t ad = UINT_MAX;
311 throw cet::exception(
"CRTChannelMapAlg")
312 <<
"No AuxDetGeo with name " << auxDetName;
319 throw cet::exception(
"CRTChannelMapAlg")
320 <<
"No entry in channel and sensitive volume"
321 <<
" map for AuxDet index " << ad <<
" bail";
327 double svOrigin[3] = {0, 0, 0};
328 double localOrigin[3] = {0, 0, 0};
329 for (
auto csv : csvItr->second) {
330 if (csv.first == channel) {
332 auxDets[ad].SensitiveVolume(csv.second).LocalToWorld(localOrigin,
343 return TVector3(x, y, z);
std::map< std::string, size_t > fNameToADGeo
map the names to the AuxDetGeo index
process_name opflash particleana ie ie ie z
void SortCRTSensitive(std::vector< std::pair< int, geo::AuxDetSensitiveGeo > > &adsgeo) const
process_name opflash particleana ie x
Encapsulate the geometry of the sensitive portion of an auxiliary detector.
void Initialize(AuxDetGeometryData_t &geodata) override
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
Access the description of auxiliary detector geometry.
uint32_t PositionToAuxDetChannel(double const worldLoc[3], std::vector< geo::AuxDetGeo > const &auxDets, size_t &ad, size_t &sv) const override
process_name opflash particleana ie ie y
void SortCRTs(std::vector< geo::AuxDetGeo > &adgeo) const
geo::CRTGeoObjectSorter fSorter
Class to sort geo objects.
Encapsulate the geometry of an auxiliary detector.
AuxDetList_t auxDets
The auxiliary detectors.
const TVector3 AuxDetChannelToPosition(uint32_t const &channel, std::string const &auxDetName, std::vector< geo::AuxDetGeo > const &auxDets) const override
std::map< size_t, std::string > fADGeoToName
map the AuxDetGeo index to the name
CRTChannelMapAlg(fhicl::ParameterSet const &p)
virtual size_t NearestSensitiveAuxDet(const double *point, std::vector< geo::AuxDetGeo > const &auxDets, size_t &ad, double tolerance=0) const
BEGIN_PROLOG could also be cout
void Uninitialize() override