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