CMS 3D CMS Logo

HGCalGeometry.h
Go to the documentation of this file.
1 #ifndef GeometryHGCalGeometryHGCalGeometry_h
2 #define GeometryHGCalGeometryHGCalGeometry_h
3 
4 /*
5  * Geometry for High Granularity Calorimeter
6  * This geometry is essentially driven by topology,
7  * which is thus encapsulated in this class.
8  * This makes this geometry not suitable to be loaded
9  * by regular CaloGeometryLoader<T>
10  */
11 
26 #include <vector>
27 
29 
30 public:
31 
32  typedef std::vector<FlatHexagon> CellVec;
33  typedef std::vector<FlatTrd> CellVec2;
37 
38  typedef std::set<DetId> DetIdSet;
39  typedef std::vector<GlobalPoint> CornersVec ;
40 
41  typedef HGCalGeometryRecord AlignedRecord ; // NOTE: not aligned yet
43 
44  static constexpr unsigned int k_NumberOfParametersPerTrd = 12; // FlatTrd
45  static constexpr unsigned int k_NumberOfParametersPerHex = 3 ; // FlatHexagon
46  static constexpr unsigned int k_NumberOfParametersPerShape = 3; // FlatHexagon
47  static constexpr unsigned int k_NumberOfShapes = 100;
48  static constexpr unsigned int k_NumberOfShapesTrd = 1000;
49 
50  static std::string dbString() { return "PHGCalRcd" ; }
51 
53 
54  ~HGCalGeometry() override;
55 
56  void localCorners( Pt3DVec& lc ,
57  const CCGFloat* pv ,
58  unsigned int i ,
59  Pt3D& ref ) ;
60 
61  void newCell( const GlobalPoint& f1 ,
62  const GlobalPoint& f2 ,
63  const GlobalPoint& f3 ,
64  const CCGFloat* parm ,
65  const DetId& detId ) override;
66 
68  std::shared_ptr<const CaloCellGeometry> getGeometry( const DetId& id ) const override;
69 
70  bool present (const DetId& id) const override;
71 
75  CaloSubdetectorGeometry::IVec& dinsVector ) const override;
76 
77  GlobalPoint getPosition( const DetId& id ) const;
78 
80  CornersVec getCorners( const DetId& id ) const;
81  CornersVec get8Corners( const DetId& id ) const;
82 
83  // avoid sorting set in base class
84  const std::vector<DetId>& getValidDetIds( DetId::Detector det = DetId::Detector(0), int subdet = 0) const override { return m_validIds; }
85  const std::vector<DetId>& getValidGeomDetIds( void ) const { return m_validGeomIds; }
86 
87  // Get closest cell, etc...
88  DetId getClosestCell( const GlobalPoint& r ) const override;
89 
96  DetIdSet getCells( const GlobalPoint& r, double dR ) const override;
97 
98  virtual void fillNamedParams (DDFilteredView fv);
99  void initializeParms() override;
100 
101  static std::string producerTag() { return "HGCal" ; }
102  std::string cellElement() const;
103 
104  const HGCalTopology& topology () const {return m_topology;}
105  void sortDetIds();
106 
107 protected:
108 
109  unsigned int indexFor(const DetId& id) const override;
111  unsigned int sizeForDenseIndex() const;
112 
113  // Modify the RawPtr class
114  const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
115 
116  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
117 
118  void addValidID(const DetId& id);
119  unsigned int getClosestCellIndex ( const GlobalPoint& r ) const;
120 
121 private:
122 
123  template<class T>
124  unsigned int getClosestCellIndex(const GlobalPoint&r, const std::vector<T>& vec) const;
125  std::shared_ptr<const CaloCellGeometry> cellGeomPtr( uint32_t index, const GlobalPoint& p) const;
126  DetId getGeometryDetId(DetId detId) const;
127 
129  CellVec m_cellVec;
130  CellVec2 m_cellVec2;
131  std::vector<DetId> m_validGeomIds;
135  const double twoBysqrt3_;
136 };
137 
138 #endif
std::vector< DetId > m_validGeomIds
HGCalGeometryMode::GeometryMode mode_
std::vector< CCGFloat > DimVec
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:32
std::string cellElement() const
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
unsigned int sizeForDenseIndex() const
unsigned int getClosestCellIndex(const GlobalPoint &r) const
const HGCalTopology & m_topology
static std::string producerTag()
~HGCalGeometry() override
std::vector< unsigned int > IVec
const std::vector< DetId > & getValidGeomDetIds(void) const
Definition: HGCalGeometry.h:85
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:39
std::vector< CCGFloat > TrVec
GlobalPoint getPosition(const DetId &id) const
HGCalGeometryRecord AlignedRecord
Definition: HGCalGeometry.h:41
std::vector< Pt3D > Pt3DVec
ForwardSubdetector
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
#define constexpr
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: HGCalGeometry.h:36
const double twoBysqrt3_
HGCalGeometry(const HGCalTopology &topology)
static unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:47
void initializeParms() override
static unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:45
std::vector< DetId > m_validIds
const HGCalTopology & topology() const
static std::string dbString()
Definition: HGCalGeometry.h:50
static unsigned int k_NumberOfShapesTrd
Definition: HGCalGeometry.h:48
def pv(vc)
Definition: MetAnalyzer.py:7
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:38
CornersVec get8Corners(const DetId &id) const
CellVec2 m_cellVec2
static unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:44
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:18
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
Definition: HGCalGeometry.h:84
ForwardSubdetector m_subdet
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:33
DetId getClosestCell(const GlobalPoint &r) const override
Detector
Definition: DetId.h:26
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
HepGeom::Point3D< CCGFloat > Pt3D
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const override
Get the cell geometry of a given detector id. Should return false if not found.
static unsigned int k_NumberOfParametersPerShape
Definition: HGCalGeometry.h:46
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:35
PHGCalRcd PGeometryRecord
Definition: HGCalGeometry.h:42
virtual void fillNamedParams(DDFilteredView fv)
DetId::Detector m_det
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
void addValidID(const DetId &id)
virtual unsigned int sizeForDenseIndex(const DetId &id) const
unsigned int indexFor(const DetId &id) const override
bool present(const DetId &id) const override
is this detid present in the geometry?
CellVec m_cellVec
DetId getGeometryDetId(DetId detId) const
CaloCellGeometry::CCGFloat CCGFloat
Definition: HGCalGeometry.h:34