11 #include "art/Framework/Services/Registry/ServiceHandle.h"
12 #include "messagefacility/MessageLogger/MessageLogger.h"
25 fhicl::ParameterSet
const&
p)
26 : fSorter(geo::CRTGeoObjectSorter(p)) {}
32 std::vector<geo::AuxDetGeo>& adgeo = geodata.auxDets;
53 for (
size_t a=0;
a<adgeo.size();
a++){
54 std::string volName(adgeo[
a].TotalVolume()->GetName());
56 long unsigned int number_scintillating_strips = 0;
58 if (strncmp(((adgeo[
a].TotalVolume())->GetShape())->GetName(),
"CRTstripMINOSArray", 18) == 0) {
59 number_scintillating_strips = 20;
61 else {number_scintillating_strips = 16;}
63 size_t nsv = adgeo[
a].NSensitiveVolume();
64 if (nsv != number_scintillating_strips) {
65 throw cet::exception(
"CRTChannelMap")
66 <<
"Wrong number of sensitive volumes for CRT volume "
67 << volName <<
" (got " << nsv <<
", expected 16)" << std::endl;
73 if (volName.find(
"CRTStripArray") != std::string::npos) {
74 for (
size_t svID=0; svID<number_scintillating_strips; svID++) {
75 for (
size_t ich=0; ich<2; ich++) {
76 size_t chID = 2 * svID + ich;
89 double const worldLoc[3],
90 std::vector<geo::AuxDetGeo>
const& auxDets,
95 uint32_t channel = UINT_MAX;
102 double svOrigin[3] = {0, 0, 0};
103 double localOrigin[3] = {0, 0, 0};
105 auxDets[ad].SensitiveVolume(sv).LocalToWorld(localOrigin, svOrigin);
114 throw cet::exception(
"CRTChannelMapAlg")
115 <<
"No entry in channel and sensitive volume map for AuxDet index "
120 channel = 2 * sv + 0;
123 if (channel == UINT_MAX) {
124 mf::LogDebug(
"CRTChannelMapAlg") <<
"Can't find AuxDet for position ("
125 << worldLoc[0] <<
","
126 << worldLoc[1] <<
","
136 uint32_t
const& channel,
137 std::string
const& auxDetName,
138 std::vector<geo::AuxDetGeo>
const& auxDets)
const {
143 std::cout <<
"CRTChannelMapAlg::AuxDetChannelToPosition" << std::endl;
146 size_t ad = UINT_MAX;
151 throw cet::exception(
"CRTChannelMapAlg")
152 <<
"No AuxDetGeo with name " << auxDetName;
159 throw cet::exception(
"CRTChannelMapAlg")
160 <<
"No entry in channel and sensitive volume"
161 <<
" map for AuxDet index " << ad <<
" bail";
167 double svOrigin[3] = {0, 0, 0};
168 double localOrigin[3] = {0, 0, 0};
169 for (
auto csv : csvItr->second) {
170 if (csv.first == channel) {
172 auxDets[ad].SensitiveVolume(csv.second).LocalToWorld(localOrigin,
183 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
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
Encapsulate the geometry of an auxiliary detector.
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