File indexing completed on 2024-12-12 23:19:13
0001 #ifndef MTDTOPOLOGY_H
0002 #define MTDTOPOLOGY_H
0003
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h"
0006 #include "DataFormats/ForwardDetId/interface/BTLDetId.h"
0007 #include "DataFormats/ForwardDetId/interface/ETLDetId.h"
0008 #include <Geometry/CommonDetUnit/interface/GeomDet.h>
0009
0010 #include <vector>
0011 #include <string>
0012
0013 class MTDTopology {
0014 public:
0015 struct BTLLayout {
0016
0017 static constexpr uint32_t nBTLphi_ = BTLDetId::HALF_ROD * BTLDetId::kModulesPerTrkV2;
0018 static constexpr uint32_t nBTLeta_ =
0019 2 * BTLDetId::kRUPerTypeV2 * BTLDetId::kCrystalTypes * BTLDetId::kModulesPerRUV2 / BTLDetId::kModulesPerTrkV2;
0020 static constexpr uint32_t nBTLmodules_ = nBTLphi_ * nBTLeta_;
0021
0022 std::array<uint32_t, nBTLmodules_> btlDetId_;
0023 std::array<uint32_t, nBTLmodules_> btlPhi_;
0024 std::array<uint32_t, nBTLmodules_> btlEta_;
0025 };
0026
0027 using BTLValues = BTLLayout;
0028
0029 struct ETLfaceLayout {
0030 uint32_t idDiscSide_;
0031 uint32_t idDetType1_;
0032
0033 std::array<std::vector<int>, 2> start_copy_;
0034 std::array<std::vector<int>, 2> offset_;
0035 };
0036
0037 using ETLValues = std::vector<ETLfaceLayout>;
0038
0039 MTDTopology(const int& topologyMode, const BTLValues& btl, const ETLValues& etl);
0040
0041 int getMTDTopologyMode() const { return mtdTopologyMode_; }
0042
0043 uint32_t btlRods() const { return btlVals_.nBTLphi_; }
0044 uint32_t btlModulesPerRod() const { return btlVals_.nBTLeta_; }
0045 uint32_t btlModules() const { return btlVals_.nBTLmodules_; }
0046
0047
0048
0049 std::pair<uint32_t, uint32_t> btlIndex(const uint32_t detId) const;
0050 uint32_t btlidFromIndex(const uint32_t iphi, const uint32_t ieta) const;
0051
0052
0053
0054 uint32_t phishiftBTL(const uint32_t detid, const int phiShift) const;
0055 uint32_t etashiftBTL(const uint32_t detid, const int etaShift) const;
0056
0057
0058
0059 static bool orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2);
0060
0061
0062
0063
0064 size_t hshiftETL(const uint32_t detid, const int horizontalShift) const;
0065 size_t vshiftETL(const uint32_t detid, const int verticalShift, size_t& closest) const;
0066
0067 private:
0068 const int mtdTopologyMode_;
0069
0070 const BTLValues btlVals_;
0071
0072 const ETLValues etlVals_;
0073
0074 static constexpr size_t failIndex_ =
0075 std::numeric_limits<unsigned int>::max();
0076 };
0077
0078 #endif