|
| 1 | +#include "CRTAuxDetInitializerSBND.h" |
| 2 | + |
| 3 | +namespace sbnd::crt { |
| 4 | + |
| 5 | + CRTAuxDetInitializerSBND::CRTAuxDetInitializerSBND(fhicl::ParameterSet const&) {} |
| 6 | + |
| 7 | + geo::AuxDetReadoutInitializers |
| 8 | + CRTAuxDetInitializerSBND::initialize(std::vector<geo::AuxDetGeo> const& adgeo) const { |
| 9 | + geo::AuxDetReadoutInitializers result; |
| 10 | + // Map the AuxDetGeo names to their position in the sorted vector |
| 11 | + // |
| 12 | + // Each tagger is composed of scintillator modules, composed of 16 strips. |
| 13 | + // In the geometry, CRTStripArrays are AuxDets and CRTStrips are the |
| 14 | + // AuxDetSensitives. Each strip has two SiPM channels, one per optical |
| 15 | + // fiber (not in the geometry). |
| 16 | + // |
| 17 | + |
| 18 | + for (size_t a=0; a<adgeo.size(); a++){ |
| 19 | + std::string volName(adgeo[a].TotalVolume()->GetName()); |
| 20 | + |
| 21 | + long unsigned int number_scintillating_strips = 0; |
| 22 | + |
| 23 | + if (strncmp(((adgeo[a].TotalVolume())->GetShape())->GetName(), "CRTstripMINOSArray", 18) == 0) { |
| 24 | + number_scintillating_strips = 20; //To account for the MINOS modules. |
| 25 | + } |
| 26 | + else {number_scintillating_strips = 16;} |
| 27 | + |
| 28 | + size_t nsv = adgeo[a].NSensitiveVolume(); |
| 29 | + if (nsv != number_scintillating_strips) { |
| 30 | + throw cet::exception("CRTChannelMap") |
| 31 | + << "Wrong number of sensitive volumes for CRT volume " |
| 32 | + << volName << " (got " << nsv << ", expected 16)" << std::endl; |
| 33 | + } |
| 34 | + |
| 35 | + result.ADGeoToName[a] = volName; |
| 36 | + result.NameToADGeo[volName] = a; |
| 37 | + |
| 38 | + if (volName.find("CRTStripArray") != std::string::npos) { |
| 39 | + for (size_t svID=0; svID<number_scintillating_strips; svID++) { |
| 40 | + for (size_t ich=0; ich<2; ich++) { |
| 41 | + size_t chID = 2 * svID + ich; |
| 42 | + result.ADGeoToChannelAndSV[a].push_back(std::make_pair(chID, svID)); |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + return result; |
| 48 | + } |
| 49 | + |
| 50 | +} // namespace sbnd::crt |
0 commit comments