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  double getArea(const DetId& detid) const;
83 
85  CornersVec getCorners( const DetId& id ) const;
86  CornersVec get8Corners( const DetId& id ) const;
87  CornersVec getNewCorners( const DetId& id ) const;
88 
89  // Get neighbor in z along a direction
90  DetId neighborZ(const DetId& idin, const GlobalVector& p) const;
91  DetId neighborZ(const DetId& idin, const MagneticField* bField, int charge,
92  const GlobalVector& momentum) const;
93 
94  // avoid sorting set in base class
95  const std::vector<DetId>& getValidDetIds( DetId::Detector det = DetId::Detector(0), int subdet = 0) const override { return m_validIds; }
96  const std::vector<DetId>& getValidGeomDetIds( void ) const { return m_validGeomIds; }
97 
98  // Get closest cell, etc...
99  DetId getClosestCell( const GlobalPoint& r ) const override;
100 
107  DetIdSet getCells( const GlobalPoint& r, double dR ) const override;
108 
109  virtual void fillNamedParams (DDFilteredView fv);
110  void initializeParms() override;
111 
112  static std::string producerTag() { return "HGCal" ; }
113  std::string cellElement() const;
114 
115  const HGCalTopology& topology () const {return m_topology;}
116  void sortDetIds();
117 
118 protected:
119 
120  unsigned int indexFor(const DetId& id) const override;
122  unsigned int sizeForDenseIndex() const;
123 
124  // Modify the RawPtr class
125  const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
126 
127  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
128 
129  void addValidID(const DetId& id);
130  unsigned int getClosestCellIndex ( const GlobalPoint& r ) const;
131 
132 private:
133 
134  template<class T>
135  unsigned int getClosestCellIndex(const GlobalPoint&r, const std::vector<T>& vec) const;
136  std::shared_ptr<const CaloCellGeometry> cellGeomPtr( uint32_t index, const GlobalPoint& p) const;
137  DetId getGeometryDetId(DetId detId) const;
138 
139  static constexpr double k_half = 0.5;
140  static constexpr double k_fac1 = 0.5;
141  static constexpr double k_fac2 = 1.0/3.0;
142 
144  CellVec m_cellVec;
145  CellVec2 m_cellVec2;
146  std::vector<DetId> m_validGeomIds;
150  const double twoBysqrt3_;
151 };
152 
153 #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
static double k_fac1
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:96
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
double getArea(const DetId &detid) const
Returns area of a cell.
std::vector< Pt3D > Pt3DVec
ForwardSubdetector
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
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)
static double k_fac2
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:95
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?
#define constexpr
CellVec m_cellVec
DetId getGeometryDetId(DetId detId) const
CaloCellGeometry::CCGFloat CCGFloat
Definition: HGCalGeometry.h:36