CMS 3D CMS Logo

HGCalTBGeometry.h
Go to the documentation of this file.
1 #ifndef GeometryHGCalGeometryHGCalTBGeometry_h
2 #define GeometryHGCalGeometryHGCalTBGeometry_h
3 
4 /*
5  * Geometry for High Granularity Calorimeter TestBeam
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 public:
29  typedef std::vector<FlatHexagon> CellVec;
30  typedef std::vector<FlatTrd> CellVec2;
34 
35  typedef std::set<DetId> DetIdSet;
36  typedef std::vector<GlobalPoint> CornersVec;
37 
38  typedef HGCalGeometryRecord AlignedRecord; // NOTE: not aligned yet
40 
41  static constexpr unsigned int k_NumberOfParametersPerTrd = 12; // FlatTrd
42  static constexpr unsigned int k_NumberOfParametersPerHex = 3; // FlatHexagon
43  static constexpr unsigned int k_NumberOfParametersPerShape = 3; // FlatHexagon
44  static constexpr unsigned int k_NumberOfShapes = 100;
45  static constexpr unsigned int k_NumberOfShapesTrd = 1000;
46 
47  static std::string dbString() { return "PHGCalTBRcd"; }
48 
50 
51  ~HGCalTBGeometry() override;
52 
53  void localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref);
54 
55  void newCell(const GlobalPoint& f1,
56  const GlobalPoint& f2,
57  const GlobalPoint& f3,
58  const CCGFloat* parm,
59  const DetId& detId) override;
60 
62  std::shared_ptr<const CaloCellGeometry> getGeometry(const DetId& id) const override;
63 
64  bool present(const DetId& id) const override;
65 
69  CaloSubdetectorGeometry::IVec& dinsVector) const override;
70 
71  GlobalPoint getPosition(const DetId& id, bool debug = false) const;
72  GlobalPoint getWaferPosition(const DetId& id) const;
73 
75  double getArea(const DetId& detid) const;
76 
78  CornersVec getCorners(const DetId& id) const;
79  CornersVec get8Corners(const DetId& id) const;
80  CornersVec getNewCorners(const DetId& id, bool debug = false) const;
81 
82  // Get neighbor in z along a direction
83  DetId neighborZ(const DetId& idin, const GlobalVector& p) const;
84  DetId neighborZ(const DetId& idin, const MagneticField* bField, int charge, const GlobalVector& momentum) const;
85 
86  // avoid sorting set in base class
87  const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const override {
88  return m_validIds;
89  }
90  const std::vector<DetId>& getValidGeomDetIds(void) const { return m_validGeomIds; }
91 
92  // Get closest cell, etc...
93  DetId getClosestCell(const GlobalPoint& r) const override;
94 
101  DetIdSet getCells(const GlobalPoint& r, double dR) const override;
102 
103  virtual void fillNamedParams(DDFilteredView fv);
104  void initializeParms() override;
105 
106  static std::string producerTag() { return "HGCalTB"; }
107  std::string cellElement() const;
108 
109  const HGCalTBTopology& topology() const { return m_topology; }
110  void sortDetIds();
111 
112 protected:
113  unsigned int indexFor(const DetId& id) const override;
115  unsigned int sizeForDenseIndex() const;
116 
117  // Modify the RawPtr class
118  const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
119 
120  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
121 
122  void addValidID(const DetId& id);
123  unsigned int getClosestCellIndex(const GlobalPoint& r) const;
124 
125 private:
126  template <class T>
127  unsigned int getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const;
128  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index, const GlobalPoint& p) const;
129  DetId getGeometryDetId(DetId detId) const;
130 
131  static constexpr double k_half = 0.5;
132  static constexpr double k_fac1 = 0.5;
133  static constexpr double k_fac2 = 1.0 / 3.0;
134 
137  std::vector<DetId> m_validGeomIds;
140  const double twoBysqrt3_;
141 };
142 
143 #endif
CornersVec getNewCorners(const DetId &id, bool debug=false) const
static std::string dbString()
CaloCellGeometry::Pt3DVec Pt3DVec
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.
std::vector< CCGFloat > DimVec
static constexpr unsigned int k_NumberOfParametersPerHex
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
double getArea(const DetId &detid) const
Returns area of a cell.
static constexpr double k_fac1
unsigned int getClosestCellIndex(const GlobalPoint &r) const
static constexpr double k_half
std::vector< unsigned int > IVec
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
std::vector< CCGFloat > TrVec
std::vector< GlobalPoint > CornersVec
std::vector< Pt3D > Pt3DVec
static constexpr unsigned int k_NumberOfShapesTrd
ForwardSubdetector
static constexpr unsigned int k_NumberOfParametersPerTrd
ForwardSubdetector m_subdet
static constexpr double k_fac2
PHGCalRcd PGeometryRecord
void addValidID(const DetId &id)
HGCalGeometryRecord AlignedRecord
const double twoBysqrt3_
DetId getClosestCell(const GlobalPoint &r) const override
std::set< DetId > DetIdSet
std::string cellElement() const
std::vector< DetId > m_validIds
CaloCellGeometry::CCGFloat CCGFloat
DetId getGeometryDetId(DetId detId) const
CaloCellGeometry::Pt3D Pt3D
HGCalTBGeometry(const HGCalTBTopology &topology)
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
CaloCellGeometry::Pt3D Pt3D
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
std::vector< FlatHexagon > CellVec
virtual void fillNamedParams(DDFilteredView fv)
CornersVec get8Corners(const DetId &id) const
const HGCalTBTopology & topology() const
Detector
Definition: DetId.h:24
const std::vector< DetId > & getValidGeomDetIds(void) const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
~HGCalTBGeometry() override
const HGCalTBTopology & m_topology
GlobalPoint getPosition(const DetId &id, bool debug=false) const
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell&#39;s volume.
std::vector< DetId > m_validGeomIds
static constexpr unsigned int k_NumberOfParametersPerShape
unsigned int indexFor(const DetId &id) const override
GlobalPoint getWaferPosition(const DetId &id) const
void initializeParms() override
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)
std::vector< FlatTrd > CellVec2
DetId neighborZ(const DetId &idin, const GlobalVector &p) const
DetId::Detector m_det
static constexpr unsigned int k_NumberOfShapes
static std::string producerTag()
CaloCellGeometry::CCGFloat CCGFloat
bool present(const DetId &id) const override
is this detid present in the geometry?
unsigned int sizeForDenseIndex() const
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
virtual unsigned int sizeForDenseIndex(const DetId &id) const