Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:41

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 "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0008 
0009 class EcalBarrelHardcodedTopology final : public CaloSubdetectorTopology {
0010 public:
0011   /// create a new Topology
0012   EcalBarrelHardcodedTopology(){};
0013 
0014   ~EcalBarrelHardcodedTopology() override{};
0015 
0016   /// move the Topology north (increment iphi)
0017   DetId goNorth(const DetId& id) const override { return incrementIphi(EBDetId(id)); }
0018   std::vector<DetId> north(const DetId& id) const override {
0019     EBDetId nextId = goNorth(id);
0020     std::vector<DetId> vNeighborsDetId;
0021     if (!(nextId == EBDetId(0)))
0022       vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0023     return vNeighborsDetId;
0024   }
0025 
0026   /// move the Topology south (decrement iphi)
0027   DetId goSouth(const DetId& id) const override { return decrementIphi(EBDetId(id)); }
0028   std::vector<DetId> south(const DetId& id) const override {
0029     EBDetId nextId = goSouth(id);
0030     std::vector<DetId> vNeighborsDetId;
0031     if (!(nextId == EBDetId(0)))
0032       vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0033     return vNeighborsDetId;
0034   }
0035 
0036   /// move the Topology east (negative ieta)
0037   DetId goEast(const DetId& id) const override { return decrementIeta(EBDetId(id)); }
0038   std::vector<DetId> east(const DetId& id) const override {
0039     EBDetId nextId = goEast(id);
0040     std::vector<DetId> vNeighborsDetId;
0041     if (!(nextId == EBDetId(0)))
0042       vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0043     return vNeighborsDetId;
0044   }
0045 
0046   /// move the Topology west (positive ieta)
0047   DetId goWest(const DetId& id) const override { return incrementIeta(EBDetId(id)); }
0048   std::vector<DetId> west(const DetId& id) const override {
0049     EBDetId nextId = goWest(id);
0050     std::vector<DetId> vNeighborsDetId;
0051     if (!(nextId == EBDetId(0)))
0052       vNeighborsDetId.emplace_back(DetId(nextId.rawId()));
0053     return vNeighborsDetId;
0054   }
0055 
0056   std::vector<DetId> up(const DetId& /*id*/) const override {
0057     std::cout << "EcalBarrelHardcodedTopology::up() not yet implemented" << std::endl;
0058     std::vector<DetId> vNeighborsDetId;
0059     return vNeighborsDetId;
0060   }
0061 
0062   std::vector<DetId> down(const DetId& /*id*/) const override {
0063     std::cout << "EcalBarrelHardcodedTopology::down() not yet implemented" << std::endl;
0064     std::vector<DetId> vNeighborsDetId;
0065     return vNeighborsDetId;
0066   }
0067 
0068 private:
0069   /// move the nagivator to larger ieta (more positive z) (stops at end of barrel and returns null)
0070   EBDetId incrementIeta(const EBDetId&) const;
0071 
0072   /// move the nagivator to smaller ieta (more negative z) (stops at end of barrel and returns null)
0073   EBDetId decrementIeta(const EBDetId&) const;
0074 
0075   /// move the nagivator to larger iphi (wraps around the barrel)
0076   EBDetId incrementIphi(const EBDetId&) const;
0077 
0078   /// move the nagivator to smaller iphi (wraps around the barrel)
0079   EBDetId decrementIphi(const EBDetId&) const;
0080 };
0081 
0082 #endif