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 
25 #include <vector>
26 
28 
29 public:
30 
31  typedef std::vector<FlatHexagon> CellVec;
32  typedef std::vector<FlatTrd> CellVec2;
36 
37  typedef std::set<DetId> DetIdSet;
38  typedef std::vector<GlobalPoint> CornersVec ;
39 
40  typedef HGCalGeometryRecord AlignedRecord ; // NOTE: not aligned yet
42 
43  static constexpr unsigned int k_NumberOfParametersPerTrd = 12; // FlatTrd
44  static constexpr unsigned int k_NumberOfParametersPerHex = 3 ; // FlatHexagon
45  static constexpr unsigned int k_NumberOfParametersPerShape = 3; // FlatHexagon
46  static constexpr unsigned int k_NumberOfShapes = 100;
47  static constexpr unsigned int k_NumberOfShapesTrd = 1000;
48 
49  static std::string dbString() { return "PHGCalRcd" ; }
50 
52 
53  ~HGCalGeometry() override;
54 
55  void localCorners( Pt3DVec& lc ,
56  const CCGFloat* pv ,
57  unsigned int i ,
58  Pt3D& ref ) ;
59 
60  void newCell( const GlobalPoint& f1 ,
61  const GlobalPoint& f2 ,
62  const GlobalPoint& f3 ,
63  const CCGFloat* parm ,
64  const DetId& detId ) override;
65 
67  std::shared_ptr<const CaloCellGeometry> getGeometry( const DetId& id ) const override;
68 
69  bool present (const DetId& id) const override;
70 
74  CaloSubdetectorGeometry::IVec& dinsVector ) const override;
75 
76  GlobalPoint getPosition( const DetId& id ) const;
77 
79  CornersVec getCorners( const DetId& id ) const;
80 
81  // avoid sorting set in base class
82  const std::vector<DetId>& getValidDetIds( DetId::Detector det = DetId::Detector(0), int subdet = 0) const override { return m_validIds; }
83  const std::vector<DetId>& getValidGeomDetIds( void ) const { return m_validGeomIds; }
84 
85  // Get closest cell, etc...
86  DetId getClosestCell( const GlobalPoint& r ) const override;
87 
94  DetIdSet getCells( const GlobalPoint& r, double dR ) const override;
95 
96  virtual void fillNamedParams (DDFilteredView fv);
97  void initializeParms() override;
98 
99  static std::string producerTag() { return "HGCal" ; }
100  std::string cellElement() const;
101 
102  const HGCalTopology& topology () const {return m_topology;}
103  void sortDetIds();
104 
105 protected:
106 
107  unsigned int indexFor(const DetId& id) const override;
109  unsigned int sizeForDenseIndex() const;
110 
111  // Modify the RawPtr class
112  const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
113 
114  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
115 
116  void addValidID(const DetId& id);
117  unsigned int getClosestCellIndex ( const GlobalPoint& r ) const;
118 
119 private:
120 
121  template<class T>
122  unsigned int getClosestCellIndex(const GlobalPoint&r, const std::vector<T>& vec) const;
123  std::shared_ptr<const CaloCellGeometry> cellGeomPtr( uint32_t index, const GlobalPoint& p) const;
124 
126  CellVec m_cellVec;
127  CellVec2 m_cellVec2;
128  std::vector<DetId> m_validGeomIds;
132  const double twoBysqrt3_;
133 };
134 
135 #endif
std::vector< DetId > m_validGeomIds
HGCalGeometryMode::GeometryMode mode_
std::vector< CCGFloat > DimVec
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:31
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()
Definition: HGCalGeometry.h:99
~HGCalGeometry() override
std::vector< unsigned int > IVec
const std::vector< DetId > & getValidGeomDetIds(void) const
Definition: HGCalGeometry.h:83
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:38
std::vector< CCGFloat > TrVec
GlobalPoint getPosition(const DetId &id) const
HGCalGeometryRecord AlignedRecord
Definition: HGCalGeometry.h:40
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:35
const double twoBysqrt3_
HGCalGeometry(const HGCalTopology &topology)
static unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
void initializeParms() override
static unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
std::vector< DetId > m_validIds
const HGCalTopology & topology() const
static std::string dbString()
Definition: HGCalGeometry.h:49
static unsigned int k_NumberOfShapesTrd
Definition: HGCalGeometry.h:47
def pv(vc)
Definition: MetAnalyzer.py:6
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:37
CellVec2 m_cellVec2
static unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:43
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:82
ForwardSubdetector m_subdet
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:32
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:45
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:34
PHGCalRcd PGeometryRecord
Definition: HGCalGeometry.h:41
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
CaloCellGeometry::CCGFloat CCGFloat
Definition: HGCalGeometry.h:33