|
| 1 | +#include "larcorealg/Geometry/AuxDetGeo.h" |
| 2 | +#include "larcorealg/Geometry/AuxDetSensitiveGeo.h" |
| 3 | +#include "larcorealg/Geometry/AuxDetGeometryCore.h" |
| 4 | + |
| 5 | +#include "art/Utilities/ToolMacros.h" |
| 6 | + |
| 7 | +namespace { |
| 8 | + class CRTAuxDetInitializer : public geo::AuxDetInitializer { |
| 9 | + public: |
| 10 | + explicit CRTAuxDetInitializer(fhicl::ParameterSet const&) {} |
| 11 | + |
| 12 | + private: |
| 13 | + geo::AuxDetReadoutInitializers |
| 14 | + initialize(std::vector<geo::AuxDetGeo> const& adgeo) const override |
| 15 | + { |
| 16 | + geo::AuxDetReadoutInitializers result; |
| 17 | + // Map the AuxDetGeo names to their position in the sorted vector |
| 18 | + // |
| 19 | + // Each tagger is composed of scintillator modules, composed of 16 strips. |
| 20 | + // In the geometry, CRTStripArrays are AuxDets and CRTStrips are the |
| 21 | + // AuxDetSensitives. Each strip has two SiPM channels, one per optical |
| 22 | + // fiber (not in the geometry). |
| 23 | + // |
| 24 | + // 2x TaggerTop: (5x2 +5x2)x16 = 320 strips, 640 channels |
| 25 | + // 2x TaggerSide: (4x2 +5x2)x16 = 288 strips, 576 channels |
| 26 | + // 1x TaggerFace: (4x2 +4x2)x16 = 256 strips, 512 channels |
| 27 | + // 1x TaggerFace: (4x2-1+4x2)x16 = 240 strips, 480 channels |
| 28 | + // 1x TaggerBot: 34x16 = 544 strips, 1088 channels |
| 29 | + |
| 30 | + for (size_t a=0; a<adgeo.size(); a++){ |
| 31 | + std::string volName(adgeo[a].TotalVolume()->GetName()); |
| 32 | + |
| 33 | + long unsigned int number_scintillating_strips = 0; |
| 34 | + |
| 35 | + if (strncmp(((adgeo[a].TotalVolume())->GetShape())->GetName(), "CRTstripMINOSArray", 18) == 0) { |
| 36 | + number_scintillating_strips = 20; //To account for the MINOS modules. |
| 37 | + } |
| 38 | + else {number_scintillating_strips = 16;} |
| 39 | + |
| 40 | + size_t nsv = adgeo[a].NSensitiveVolume(); |
| 41 | + if (nsv != number_scintillating_strips) { |
| 42 | + throw cet::exception("CRTChannelMap") |
| 43 | + << "Wrong number of sensitive volumes for CRT volume " |
| 44 | + << volName << " (got " << nsv << ", expected 16)" << std::endl; |
| 45 | + } |
| 46 | + |
| 47 | + result.ADGeoToName[a] = volName; |
| 48 | + result.NameToADGeo[volName] = a; |
| 49 | + |
| 50 | + if (volName.find("CRTStripArray") != std::string::npos) { |
| 51 | + for (size_t svID=0; svID<number_scintillating_strips; svID++) { |
| 52 | + for (size_t ich=0; ich<2; ich++) { |
| 53 | + size_t chID = 2 * svID + ich; |
| 54 | + result.ADGeoToChannelAndSV[a].push_back(std::make_pair(chID, svID)); |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + return result; |
| 60 | + } |
| 61 | + }; |
| 62 | +} |
| 63 | + |
| 64 | +DEFINE_ART_CLASS_TOOL(CRTAuxDetInitializer) |
0 commit comments