Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-07 02:29:37

0001 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRY_H
0002 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRY_H 1
0003 
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0006 #include <memory>
0007 #include <vector>
0008 
0009 class CaloSubdetectorGeometry;
0010 class CaloCellGeometry;
0011 
0012 /** \class CaloGeometry
0013       
0014 Interface class to the geometry information for all calorimetry 
0015 subdetectors.
0016 
0017 $Revision: 1.7 $
0018 \author J. Mans and P. Meridiani
0019 */
0020 
0021 class CaloGeometry {
0022 public:
0023   CaloGeometry();
0024 
0025   /// Register a subdetector geometry
0026   void setSubdetGeometry(DetId::Detector det, int subdet, const CaloSubdetectorGeometry* geom);
0027 
0028   /// Get the position of a given detector id
0029   GlobalPoint getPosition(const DetId& id) const;
0030 
0031   /// Get the cell geometry of a given detector id
0032   std::shared_ptr<const CaloCellGeometry> getGeometry(const DetId& id) const;
0033 
0034   /// Get the list of all valid detector ids
0035   std::vector<DetId> getValidDetIds() const;
0036 
0037   /// Get the list of valid detector ids for the given subdetector
0038   const std::vector<DetId>& getValidDetIds(DetId::Detector det, int subdet) const;
0039 
0040   /// is this detid present in the geometry?
0041   bool present(const DetId& id) const;
0042 
0043   /// access the subdetector geometry for the given subdetector directly
0044   const CaloSubdetectorGeometry* getSubdetectorGeometry(const DetId& id) const;
0045 
0046   /// access the subdetector geometry for the given subdetector directly
0047   const CaloSubdetectorGeometry* getSubdetectorGeometry(DetId::Detector det, int subdet) const;
0048 
0049   // Get closest cell, etc...
0050   //not implemented      const DetId getClosestCell( const GlobalPoint& r ) const ;
0051 
0052 private:
0053   static const std::vector<DetId> k_emptyVec;
0054 
0055   std::vector<const CaloSubdetectorGeometry*> m_geos;
0056 
0057   unsigned int makeIndex(DetId::Detector det, int subdet, bool& ok) const;
0058 
0059   static constexpr int kMaxDet = 10, kMinDet = 3, kNDets = kMaxDet - kMinDet + 1, kMaxSub = 6, kNSubDets = kMaxSub + 1,
0060                        kLength = kNDets * kNSubDets;
0061 };
0062 
0063 #endif