Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:49:03

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   /// create a new Topology
0013   EcalBarrelHardcodedTopology(){};
0014 
0015   ~EcalBarrelHardcodedTopology() override{};
0016 
0017   /// move the Topology north (increment iphi)
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   /// move the Topology south (decrement iphi)
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   /// move the Topology east (negative ieta)
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   /// move the Topology west (positive ieta)
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& /*id*/) 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& /*id*/) const override {
0064     edm::LogVerbatim("CaloTopology") << "EcalBarrelHardcodedTopology::down() not yet implemented";
0065     std::vector<DetId> vNeighborsDetId;
0066     return vNeighborsDetId;
0067   }
0068 
0069 private:
0070   /// move the nagivator to larger ieta (more positive z) (stops at end of barrel and returns null)
0071   EBDetId incrementIeta(const EBDetId&) const;
0072 
0073   /// move the nagivator to smaller ieta (more negative z) (stops at end of barrel and returns null)
0074   EBDetId decrementIeta(const EBDetId&) const;
0075 
0076   /// move the nagivator to larger iphi (wraps around the barrel)
0077   EBDetId incrementIphi(const EBDetId&) const;
0078 
0079   /// move the nagivator to smaller iphi (wraps around the barrel)
0080   EBDetId decrementIphi(const EBDetId&) const;
0081 };
0082 
0083 #endif