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 
30 class HGCalGeometry final : public CaloSubdetectorGeometry {
31 public:
32  typedef std::vector<FlatHexagon> CellVec;
33  typedef std::vector<FlatTrd> CellVec2;
37 
38  typedef std::set<DetId> DetIdSet;
39  typedef std::vector<GlobalPoint> CornersVec;
40 
41  typedef HGCalGeometryRecord AlignedRecord; // NOTE: not aligned yet
43 
44  static constexpr unsigned int k_NumberOfParametersPerTrd = 12; // FlatTrd
45  static constexpr unsigned int k_NumberOfParametersPerHex = 3; // FlatHexagon
46  static constexpr unsigned int k_NumberOfParametersPerShape = 3; // FlatHexagon
47  static constexpr unsigned int k_NumberOfShapes = 100;
48  static constexpr unsigned int k_NumberOfShapesTrd = 1000;
49 
50  static std::string dbString() { return "PHGCalRcd"; }
51 
53 
54  ~HGCalGeometry() override;
55 
56  void localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref);
57 
58  void newCell(const GlobalPoint& f1,
59  const GlobalPoint& f2,
60  const GlobalPoint& f3,
61  const CCGFloat* parm,
62  const DetId& detId) override;
63 
65  std::shared_ptr<const CaloCellGeometry> getGeometry(const DetId& id) const override;
66 
67  bool present(const DetId& id) const override;
68 
72  CaloSubdetectorGeometry::IVec& dinsVector) const override;
73 
74  GlobalPoint getPosition(const DetId& id) const;
75  GlobalPoint getWaferPosition(const DetId& id) const;
76 
78  double getArea(const DetId& detid) const;
79 
81  CornersVec getCorners(const DetId& id) const;
82  CornersVec get8Corners(const DetId& id) const;
83  CornersVec getNewCorners(const DetId& id) const;
84 
85  // Get neighbor in z along a direction
86  DetId neighborZ(const DetId& idin, const GlobalVector& p) const;
87  DetId neighborZ(const DetId& idin, const MagneticField* bField, int charge, const GlobalVector& momentum) const;
88 
89  // avoid sorting set in base class
90  const std::vector<DetId>& getValidDetIds(DetId::Detector det = DetId::Detector(0), int subdet = 0) const override {
91  return m_validIds;
92  }
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  unsigned int indexFor(const DetId& id) const override;
118  unsigned int sizeForDenseIndex() const;
119 
120  // Modify the RawPtr class
121  const CaloCellGeometry* getGeometryRawPtr(uint32_t index) const override;
122 
123  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index) const override;
124 
125  void addValidID(const DetId& id);
126  unsigned int getClosestCellIndex(const GlobalPoint& r) const;
127 
128 private:
129  template <class T>
130  unsigned int getClosestCellIndex(const GlobalPoint& r, const std::vector<T>& vec) const;
131  std::shared_ptr<const CaloCellGeometry> cellGeomPtr(uint32_t index, const GlobalPoint& p) const;
132  DetId getGeometryDetId(DetId detId) const;
133 
134  static constexpr double k_half = 0.5;
135  static constexpr double k_fac1 = 0.5;
136  static constexpr double k_fac2 = 1.0 / 3.0;
137 
141  std::vector<DetId> m_validGeomIds;
145  const double twoBysqrt3_;
146 };
147 
148 #endif
Vector3DBase
Definition: Vector3DBase.h:8
CaloCellGeometry::Pt3DVec
std::vector< Pt3D > Pt3DVec
Definition: CaloCellGeometry.h:55
HGCalGeometry::CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: HGCalGeometry.h:34
HGCalGeometry::sortDetIds
void sortDetIds()
Definition: HGCalGeometry.cc:655
HGCalGeometry::localCorners
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: HGCalGeometry.cc:50
HGCalGeometry::m_det
DetId::Detector m_det
Definition: HGCalGeometry.h:143
mps_fire.i
i
Definition: mps_fire.py:355
HGCalGeometry::k_NumberOfParametersPerShape
static constexpr unsigned int k_NumberOfParametersPerShape
Definition: HGCalGeometry.h:46
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
HGCalGeometry::addValidID
void addValidID(const DetId &id)
Definition: HGCalGeometry.cc:605
HGCalGeometry::m_cellVec
CellVec m_cellVec
Definition: HGCalGeometry.h:139
HGCScintillatorDetId.h
HGCalGeometry::~HGCalGeometry
~HGCalGeometry() override
Definition: HGCalGeometry.cc:44
HGCalGeometry::CellVec2
std::vector< FlatTrd > CellVec2
Definition: HGCalGeometry.h:33
HGCalGeometry::cellGeomPtr
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
Definition: HGCalGeometry.cc:560
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:184
HGCalGeometryMode.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCalGeometry::k_half
static constexpr double k_half
Definition: HGCalGeometry.h:134
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:248
CaloSubdetectorGeometry::TrVec
std::vector< CCGFloat > TrVec
Definition: CaloSubdetectorGeometry.h:33
HGCalGeometry::dbString
static std::string dbString()
Definition: HGCalGeometry.h:50
HGCalGeometry::m_cellVec2
CellVec2 m_cellVec2
Definition: HGCalGeometry.h:140
HGCalGeometry::k_NumberOfShapes
static constexpr unsigned int k_NumberOfShapes
Definition: HGCalGeometry.h:47
HGCalGeometry::getWaferPosition
GlobalPoint getWaferPosition(const DetId &id) const
Definition: HGCalGeometry.cc:229
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:514
HGCalGeometry::getSummary
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
Definition: HGCalGeometry.cc:660
HFNoseDetId.h
HGCalGeometry::Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: HGCalGeometry.h:35
HGCalGeometry::m_subdet
ForwardSubdetector m_subdet
Definition: HGCalGeometry.h:144
HGCalGeometry::k_NumberOfParametersPerTrd
static constexpr unsigned int k_NumberOfParametersPerTrd
Definition: HGCalGeometry.h:44
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:398
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloCellGeometry.cc:5
DetId
Definition: DetId.h:17
HGCalGeometry::cellElement
std::string cellElement() const
Definition: HGCalGeometry.cc:519
HGCalGeometry::PGeometryRecord
PHGCalRcd PGeometryRecord
Definition: HGCalGeometry.h:42
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:45
FlatHexagon.h
HGCalGeometry::getGeometryDetId
DetId getGeometryDetId(DetId detId) const
Definition: HGCalGeometry.cc:762
Point3DBase< float, GlobalTag >
HGCalGeometry
Definition: HGCalGeometry.h:30
CaloCellGeometry::Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
Definition: CaloCellGeometry.h:54
HGCalGeometry::topology
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:112
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:90
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalGeometry::k_NumberOfShapesTrd
static constexpr unsigned int k_NumberOfShapesTrd
Definition: HGCalGeometry.h:48
HGCalGeometry::mode_
HGCalGeometryMode::GeometryMode mode_
Definition: HGCalGeometry.h:142
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
CaloSubdetectorGeometry.h
HGCalGeometry::CellVec
std::vector< FlatHexagon > CellVec
Definition: HGCalGeometry.h:32
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:141
HGCalGeometry::HGCalGeometry
HGCalGeometry(const HGCalTopology &topology)
Definition: HGCalGeometry.cc:26
HGCalGeometryMode::GeometryMode
GeometryMode
Definition: HGCalGeometryMode.h:25
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
HGCalGeometry::getGeometryRawPtr
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
Definition: HGCalGeometry.cc:545
HGCalGeometry::k_fac1
static constexpr double k_fac1
Definition: HGCalGeometry.h:135
HGCalGeometry::producerTag
static std::string producerTag()
Definition: HGCalGeometry.h:109
IdealGeometryRecord.h
DetId::Detector
Detector
Definition: DetId.h:24
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:192
MagneticField.h
HGCalGeometry::getClosestCell
DetId getClosestCell(const GlobalPoint &r) const override
Definition: HGCalGeometry.cc:464
AtomicPtrCache.h
HGCalGeometry::twoBysqrt3_
const double twoBysqrt3_
Definition: HGCalGeometry.h:145
HGCalTopology
Definition: HGCalTopology.h:12
HGCalGeometry::DetIdSet
std::set< DetId > DetIdSet
Definition: HGCalGeometry.h:38
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HGCalGeometry::k_fac2
static constexpr double k_fac2
Definition: HGCalGeometry.h:136
HGCalGeometry::getCorners
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell's volume.
Definition: HGCalGeometry.cc:262
HGCalDetId.h
HGCalGeometry::initializeParms
void initializeParms() override
Definition: HGCalGeometry.cc:48
HGCalGeometry::sizeForDenseIndex
unsigned int sizeForDenseIndex() const
Definition: HGCalGeometry.cc:543
HGCalGeometry::Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: HGCalGeometry.h:36
HGCalGeometry::fillNamedParams
virtual void fillNamedParams(DDFilteredView fv)
Definition: HGCalGeometry.cc:46
Calorimetry_cff.bField
bField
Definition: Calorimetry_cff.py:292
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:93
HGCalGeometry::indexFor
unsigned int indexFor(const DetId &id) const override
Definition: HGCalGeometry.cc:530
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:58
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:609
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
HGCalGeometry::AlignedRecord
HGCalGeometryRecord AlignedRecord
Definition: HGCalGeometry.h:41
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:175
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:39
HGCalGeometry::getNewCorners
CornersVec getNewCorners(const DetId &id) const
Definition: HGCalGeometry.cc:357
HGCalGeometry::m_topology
const HGCalTopology & m_topology
Definition: HGCalGeometry.h:138
HGCalGeometry::get8Corners
CornersVec get8Corners(const DetId &id) const
Definition: HGCalGeometry.cc:314