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 
27 #include <vector>
28 
29 class HGCalGeometry final : public CaloSubdetectorGeometry {
30 public:
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, const CCGFloat* pv, unsigned int i, Pt3D& ref);
56 
57  void newCell(const GlobalPoint& f1,
58  const GlobalPoint& f2,
59  const GlobalPoint& f3,
60  const CCGFloat* parm,
61  const DetId& detId) override;
62 
64  std::shared_ptr<const CaloCellGeometry> getGeometry(const DetId& id) const override;
65 
66  bool present(const DetId& id) const override;
67 
71  CaloSubdetectorGeometry::IVec& dinsVector) const override;
72 
73  GlobalPoint getPosition(const DetId& id) const;
74  GlobalPoint getWaferPosition(const DetId& id) const;
75 
77  double getArea(const DetId& detid) const;
78 
80  CornersVec getCorners(const DetId& id) const;
81  CornersVec get8Corners(const DetId& id) const;
82  CornersVec getNewCorners(const DetId& id) const;
83 
84  // Get neighbor in z along a direction
85  DetId neighborZ(const DetId& idin, const GlobalVector& p) const;
86  DetId neighborZ(const DetId& idin, const MagneticField* bField, int charge, const GlobalVector& momentum) const;
87 
88  // avoid sorting set in base class
89  const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const override {
90  return m_validIds;
91  }
92  const std::vector<DetId>& getValidGeomDetIds(void) const { return m_validGeomIds; }
93 
94  // Get closest cell, etc...
95  DetId getClosestCell(const GlobalPoint& r) const override;
96 
103  DetIdSet getCells(const GlobalPoint& r, double dR) const override;
104 
105  virtual void fillNamedParams(DDFilteredView fv);
106  void initializeParms() override;
107 
108  static std::string producerTag() { return "HGCal"; }
109  std::string cellElement() const;
110 
111  const HGCalTopology& topology() const { return m_topology; }
112  void sortDetIds();
113 
114 protected:
115  unsigned int indexFor(const DetId& id) const override;
117  unsigned int sizeForDenseIndex() const;
118 
119  // Modify the RawPtr class
120  const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
121 
122  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
123 
124  void addValidID(const DetId& id);
125  unsigned int getClosestCellIndex(const GlobalPoint& r) const;
126 
127 private:
128  template <class T>
129  unsigned int getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const;
130  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index, const GlobalPoint& p) const;
131  DetId getGeometryDetId(DetId detId) const;
132 
133  static constexpr double k_half = 0.5;
134  static constexpr double k_fac1 = 0.5;
135  static constexpr double k_fac2 = 1.0 / 3.0;
136 
140  std::vector<DetId> m_validGeomIds;
143  const double twoBysqrt3_;
144 };
145 
146 #endif
Vector3DBase
Definition: Vector3DBase.h:8
CaloCellGeometry::Pt3DVec
std::vector< Pt3D > Pt3DVec
Definition: CaloCellGeometry.h:55
HGCalGeometry::CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: HGCalGeometry.h:33
HGCalGeometry::sortDetIds
void sortDetIds()
Definition: HGCalGeometry.cc:663
HGCalGeometry::localCorners
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: HGCalGeometry.cc:49
HGCalGeometry::m_det
DetId::Detector m_det
Definition: HGCalGeometry.h:141
mps_fire.i
i
Definition: mps_fire.py:428
HGCalGeometry::k_NumberOfParametersPerShape
static constexpr unsigned int k_NumberOfParametersPerShape
Definition: HGCalGeometry.h:45
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
HGCalGeometry::addValidID
void addValidID(const DetId &id)
Definition: HGCalGeometry.cc:613
HGCalGeometry::m_cellVec
CellVec m_cellVec
Definition: HGCalGeometry.h:138
HGCScintillatorDetId.h
HGCalGeometry::~HGCalGeometry
~HGCalGeometry() override
Definition: HGCalGeometry.cc:43
HGCalGeometry::CellVec2
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:32
HGCalGeometry::cellGeomPtr
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Definition: HGCalGeometry.cc:568
CaloSubdetectorGeometry::DimVec
std::vector< CCGFloat > DimVec
Definition: CaloSubdetectorGeometry.h:35
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCalGeometry::present
bool present(const DetId &id) const override
is this detid present in the geometry?
Definition: HGCalGeometry.cc:190
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCalGeometry::k_half
static constexpr double k_half
Definition: HGCalGeometry.h:133
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloCellGeometry.cc:4
HGCSiliconDetId.h
HGCalGeometry::getArea
double getArea(const DetId &detid) const
Returns area of a cell.
Definition: HGCalGeometry.cc:254
CaloSubdetectorGeometry::TrVec
std::vector< CCGFloat > TrVec
Definition: CaloSubdetectorGeometry.h:33
HGCalGeometry::dbString
static std::string dbString()
Definition: HGCalGeometry.h:49
HGCalGeometry::m_cellVec2
CellVec2 m_cellVec2
Definition: HGCalGeometry.h:139
HGCalGeometry::k_NumberOfShapes
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:46
HGCalGeometry::getWaferPosition
GlobalPoint getWaferPosition(const DetId &id) const
Definition: HGCalGeometry.cc:235
HGCalGeometry::getCells
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
Definition: HGCalGeometry.cc:522
HGCalGeometry::getSummary
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
Definition: HGCalGeometry.cc:668
HFNoseDetId.h
HGCalGeometry::Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:34
HGCalGeometry::m_subdet
ForwardSubdetector m_subdet
Definition: HGCalGeometry.h:142
HGCalGeometry::k_NumberOfParametersPerTrd
static constexpr unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:43
CaloSubdetectorGeometry::IVec
std::vector< unsigned int > IVec
Definition: CaloSubdetectorGeometry.h:34
HGCalGeometry::neighborZ
DetId neighborZ(const DetId &idin, const GlobalVector &p) const
Definition: HGCalGeometry.cc:404
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloCellGeometry.cc:5
DetId
Definition: DetId.h:17
HGCalGeometry::cellElement
std::string cellElement() const
Definition: HGCalGeometry.cc:527
HGCalGeometry::PGeometryRecord
PHGCalRcd PGeometryRecord
Definition: HGCalGeometry.h:41
DDFilteredView.h
HGCalTopology.h
HGCalGeometryRecord.h
CaloSubdetectorGeometry::m_validIds
std::vector< DetId > m_validIds
Definition: CaloSubdetectorGeometry.h:115
HGCalGeometry::k_NumberOfParametersPerHex
static constexpr unsigned int k_NumberOfParametersPerHex
Definition: HGCalGeometry.h:44
FlatHexagon.h
HGCalGeometry::getGeometryDetId
DetId getGeometryDetId(DetId detId) const
Definition: HGCalGeometry.cc:770
Point3DBase< float, GlobalTag >
HGCalGeometry
Definition: HGCalGeometry.h:29
CaloCellGeometry::Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
Definition: CaloCellGeometry.h:54
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:111
HGCalGeometry::getValidDetIds
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:89
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalGeometry::k_NumberOfShapesTrd
static constexpr unsigned int k_NumberOfShapesTrd
Definition: HGCalGeometry.h:47
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
CaloSubdetectorGeometry.h
HGCalGeometry::CellVec
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:31
CaloCellGeometry
Definition: CaloCellGeometry.h:50
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
HGCalGeometry::m_validGeomIds
std::vector< DetId > m_validGeomIds
Definition: HGCalGeometry.h:140
HGCalGeometry::HGCalGeometry
HGCalGeometry(const HGCalTopology &topology)
Definition: HGCalGeometry.cc:26
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
HGCalGeometry::getGeometryRawPtr
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
Definition: HGCalGeometry.cc:553
HGCalGeometry::k_fac1
static constexpr double k_fac1
Definition: HGCalGeometry.h:134
HGCalGeometry::producerTag
static std::string producerTag()
Definition: HGCalGeometry.h:108
IdealGeometryRecord.h
DetId::Detector
Detector
Definition: DetId.h:24
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:198
MagneticField.h
HGCalGeometry::getClosestCell
DetId getClosestCell(const GlobalPoint &r) const override
Definition: HGCalGeometry.cc:470
AtomicPtrCache.h
HGCalGeometry::twoBysqrt3_
const double twoBysqrt3_
Definition: HGCalGeometry.h:143
HGCalTopology
Definition: HGCalTopology.h:12
HGCalGeometry::DetIdSet
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:37
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCalGeometry::k_fac2
static constexpr double k_fac2
Definition: HGCalGeometry.h:135
HGCalGeometry::getCorners
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell's volume.
Definition: HGCalGeometry.cc:268
HGCalDetId.h
HGCalGeometry::initializeParms
void initializeParms() override
Definition: HGCalGeometry.cc:47
HGCalGeometry::sizeForDenseIndex
unsigned int sizeForDenseIndex() const
Definition: HGCalGeometry.cc:551
HGCalGeometry::Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: HGCalGeometry.h:35
HGCalGeometry::fillNamedParams
virtual void fillNamedParams(DDFilteredView fv)
Definition: HGCalGeometry.cc:45
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:284
PHGCalRcd
Definition: PHGCalRcd.h:5
GlobalVector.h
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
FlatTrd.h
HGCalGeometry::getValidGeomDetIds
const std::vector< DetId > & getValidGeomDetIds(void) const
Definition: HGCalGeometry.h:92
HGCalGeometry::indexFor
unsigned int indexFor(const DetId &id) const override
Definition: HGCalGeometry.cc:538
HGCalGeometryRecord
Definition: HGCalGeometryRecord.h:11
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HGCalGeometry::newCell
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
Definition: HGCalGeometry.cc:57
Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: CaloCellGeometry.cc:6
DDFilteredView
Definition: DDFilteredView.h:20
HGCalGeometry::getClosestCellIndex
unsigned int getClosestCellIndex(const GlobalPoint &r) const
Definition: HGCalGeometry.cc:617
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
HGCalGeometry::AlignedRecord
HGCalGeometryRecord AlignedRecord
Definition: HGCalGeometry.h:40
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
MagneticField
Definition: MagneticField.h:19
HGCalGeometry::getGeometry
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.
Definition: HGCalGeometry.cc:181
GlobalPoint.h
CaloSubdetectorGeometry::sizeForDenseIndex
virtual unsigned int sizeForDenseIndex(const DetId &id) const
Definition: CaloSubdetectorGeometry.cc:256
HGCalGeometry::CornersVec
std::vector< GlobalPoint > CornersVec
Definition: HGCalGeometry.h:38
HGCalGeometry::getNewCorners
CornersVec getNewCorners(const DetId &id) const
Definition: HGCalGeometry.cc:363
HGCalGeometry::m_topology
const HGCalTopology & m_topology
Definition: HGCalGeometry.h:137
HGCalGeometry::get8Corners
CornersVec get8Corners(const DetId &id) const
Definition: HGCalGeometry.cc:320