Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:17

0001 #ifndef GEOMETRY_CALOTOPOLOGY_CALOTOPOLOGY_H
0002 #define GEOMETRY_CALOTOPOLOGY_CALOTOPOLOGY_H 1
0003 
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "Geometry/CaloTopology/interface/CaloDirection.h"
0006 #include <map>
0007 #include <memory>
0008 #include <vector>
0009 
0010 class CaloSubdetectorTopology;
0011 
0012 /** \class CaloTopology
0013       
0014 $Revision: 1.4 $
0015 
0016 \author J. Mans and P. Meridiani
0017 */
0018 
0019 class CaloTopology {
0020 public:
0021   typedef std::map<int, std::unique_ptr<const CaloSubdetectorTopology>> TopMap;
0022 
0023   CaloTopology();
0024 
0025   ~CaloTopology();
0026   /// Register a subdetector Topology
0027   void setSubdetTopology(DetId::Detector det, int subdet, std::unique_ptr<const CaloSubdetectorTopology> geom);
0028   /// access the subdetector Topology for the given subdetector directly
0029   const CaloSubdetectorTopology* getSubdetectorTopology(const DetId& id) const;
0030   /// access the subdetector Topology for the given subdetector directly
0031   const CaloSubdetectorTopology* getSubdetectorTopology(DetId::Detector det, int subdet) const;
0032   /// Is this a valid cell id?
0033   bool valid(const DetId& id) const;
0034 
0035   /// Get the neighbors of the given cell in east direction
0036   std::vector<DetId> east(const DetId& id) const;
0037   /// Get the neighbors of the given cell in west direction
0038   std::vector<DetId> west(const DetId& id) const;
0039   /// Get the neighbors of the given cell in north direction
0040   std::vector<DetId> north(const DetId& id) const;
0041   /// Get the neighbors of the given cell in south direction
0042   std::vector<DetId> south(const DetId& id) const;
0043   /// Get the neighbors of the given cell in up direction (outward)
0044   std::vector<DetId> up(const DetId& id) const;
0045   /// Get the neighbors of the given cell in down direction (inward)
0046   std::vector<DetId> down(const DetId& id) const;
0047   /// Get the neighbors of the given cell given direction
0048   std::vector<DetId> getNeighbours(const DetId& id, const CaloDirection& dir) const;
0049   /// Get the neighbors of the given cell in a window of given size
0050   std::vector<DetId> getWindow(const DetId& id, const int& northSouthSize, const int& eastWestSize) const;
0051   /// Get all the neighbors of the given cell
0052   std::vector<DetId> getAllNeighbours(const DetId& id) const;
0053 
0054 private:
0055   TopMap theTopologies_;
0056   int makeIndex(DetId::Detector det, int subdet) const;
0057 };
0058 
0059 #endif