File indexing completed on 2024-09-07 04:36:28
0001 #ifndef GEOMETRY_CALOTOPOLOGY_ECALBARRELHARDCODEDTOPOLOGY_H
0002 #define GEOMETRY_CALOTOPOLOGY_ECALBARRELHARDCODEDTOPOLOGY_H 1
0003
0004 #include <vector>
0005 #include <iostream>
0006 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0009
0010 class EcalBarrelHardcodedTopology final : public CaloSubdetectorTopology {
0011 public:
0012
0013 EcalBarrelHardcodedTopology() {}
0014
0015 ~EcalBarrelHardcodedTopology() override {}
0016
0017
0018 DetId goNorth(const DetId& id) const override { return incrementIphi(EBDetId(id)); }
0019 std::vector<DetId> north(const DetId& id) const override {
0020 EBDetId nextId = goNorth(id);
0021 std::vector<DetId> vNeighborsDetId;
0022 if (!(nextId == EBDetId(0)))
0023 vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0024 return vNeighborsDetId;
0025 }
0026
0027
0028 DetId goSouth(const DetId& id) const override { return decrementIphi(EBDetId(id)); }
0029 std::vector<DetId> south(const DetId& id) const override {
0030 EBDetId nextId = goSouth(id);
0031 std::vector<DetId> vNeighborsDetId;
0032 if (!(nextId == EBDetId(0)))
0033 vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0034 return vNeighborsDetId;
0035 }
0036
0037
0038 DetId goEast(const DetId& id) const override { return decrementIeta(EBDetId(id)); }
0039 std::vector<DetId> east(const DetId& id) const override {
0040 EBDetId nextId = goEast(id);
0041 std::vector<DetId> vNeighborsDetId;
0042 if (!(nextId == EBDetId(0)))
0043 vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0044 return vNeighborsDetId;
0045 }
0046
0047
0048 DetId goWest(const DetId& id) const override { return incrementIeta(EBDetId(id)); }
0049 std::vector<DetId> west(const DetId& id) const override {
0050 EBDetId nextId = goWest(id);
0051 std::vector<DetId> vNeighborsDetId;
0052 if (!(nextId == EBDetId(0)))
0053 vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0054 return vNeighborsDetId;
0055 }
0056
0057 std::vector<DetId> up(const DetId& ) const override {
0058 edm::LogVerbatim("CaloTopology") << "EcalBarrelHardcodedTopology::up() not yet implemented";
0059 std::vector<DetId> vNeighborsDetId;
0060 return vNeighborsDetId;
0061 }
0062
0063 std::vector<DetId> down(const DetId& ) const override {
0064 edm::LogVerbatim("CaloTopology") << "EcalBarrelHardcodedTopology::down() not yet implemented";
0065 std::vector<DetId> vNeighborsDetId;
0066 return vNeighborsDetId;
0067 }
0068
0069 private:
0070
0071 EBDetId incrementIeta(const EBDetId&) const;
0072
0073
0074 EBDetId decrementIeta(const EBDetId&) const;
0075
0076
0077 EBDetId incrementIphi(const EBDetId&) const;
0078
0079
0080 EBDetId decrementIphi(const EBDetId&) const;
0081 };
0082
0083 #endif