File indexing completed on 2024-04-06 12:15:13
0001 #ifndef Geometry_HGCalCommonData_HGCalTBParameters_h
0002 #define Geometry_HGCalCommonData_HGCalTBParameters_h
0003
0004 #include <CLHEP/Geometry/Transform3D.h>
0005 #include <array>
0006 #include <cstdint>
0007 #include <string>
0008 #include <unordered_map>
0009 #include <vector>
0010 #include "CondFormats/Serialization/interface/Serializable.h"
0011 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0012 #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
0013 #include "DD4hep/DD4hepUnits.h"
0014
0015 class HGCalTBParameters {
0016 public:
0017 typedef std::vector<std::unordered_map<int32_t, int32_t> > layer_map;
0018 typedef std::unordered_map<int32_t, int32_t> wafer_map;
0019 typedef std::unordered_map<int32_t, std::pair<int32_t, int32_t> > waferT_map;
0020
0021 static constexpr double k_ScaleFromDDD = 0.1;
0022 static constexpr double k_ScaleToDDD = 10.0;
0023 static constexpr double k_ScaleFromDDDToG4 = 1.0;
0024 static constexpr double k_ScaleToDDDFromG4 = 1.0;
0025 static constexpr double k_ScaleFromDD4hep = (1.0 / dd4hep::cm);
0026 static constexpr double k_ScaleToDD4hep = dd4hep::cm;
0027 static constexpr double k_ScaleFromDD4hepToG4 = (1.0 / dd4hep::mm);
0028 static constexpr double k_ScaleToDD4hepFromG4 = dd4hep::mm;
0029 static constexpr uint32_t k_CornerSize = 6;
0030 static constexpr double tol = 1.0e-12;
0031 enum waferType { HGCalFine = 0, HGCalCoarseThin = 1, HGCalCoarseThick = 2 };
0032
0033 struct hgtrap {
0034 int lay;
0035 float bl, tl, h, dz, alpha, cellSize;
0036 };
0037
0038 struct hgtrform {
0039 int zp, lay, sec, subsec;
0040 CLHEP::Hep3Vector h3v;
0041 CLHEP::HepRotation hr;
0042 };
0043
0044 HGCalTBParameters(const std::string& nam);
0045 ~HGCalTBParameters(void) = default;
0046 void fillModule(const hgtrap& mytr, bool reco);
0047 hgtrap getModule(unsigned int k, bool reco) const;
0048 void fillTrForm(const hgtrform& mytr);
0049 hgtrform getTrForm(unsigned int k) const;
0050 void addTrForm(const CLHEP::Hep3Vector& h3v);
0051 void scaleTrForm(double);
0052 std::array<int, 4> getID(unsigned int k) const;
0053
0054 std::string name_;
0055 int detectorType_;
0056 int useSimWt_;
0057 int nCells_;
0058 int nSectors_;
0059 int firstLayer_;
0060 HGCalGeometryMode::GeometryMode mode_;
0061 bool defineFull_;
0062
0063 std::vector<double> cellSize_;
0064 std::vector<double> slopeMin_;
0065 std::vector<double> zFrontMin_;
0066 std::vector<double> rMinFront_;
0067 std::vector<double> slopeTop_;
0068 std::vector<double> zFrontTop_;
0069 std::vector<double> rMaxFront_;
0070 std::vector<double> zRanges_;
0071 std::vector<int> moduleLayS_;
0072 std::vector<double> moduleBlS_;
0073 std::vector<double> moduleTlS_;
0074 std::vector<double> moduleHS_;
0075 std::vector<double> moduleDzS_;
0076 std::vector<double> moduleAlphaS_;
0077 std::vector<double> moduleCellS_;
0078 std::vector<int> moduleLayR_;
0079 std::vector<double> moduleBlR_;
0080 std::vector<double> moduleTlR_;
0081 std::vector<double> moduleHR_;
0082 std::vector<double> moduleDzR_;
0083 std::vector<double> moduleAlphaR_;
0084 std::vector<double> moduleCellR_;
0085 std::vector<uint32_t> trformIndex_;
0086 std::vector<double> trformTranX_;
0087 std::vector<double> trformTranY_;
0088 std::vector<double> trformTranZ_;
0089 std::vector<double> trformRotXX_;
0090 std::vector<double> trformRotYX_;
0091 std::vector<double> trformRotZX_;
0092 std::vector<double> trformRotXY_;
0093 std::vector<double> trformRotYY_;
0094 std::vector<double> trformRotZY_;
0095 std::vector<double> trformRotXZ_;
0096 std::vector<double> trformRotYZ_;
0097 std::vector<double> trformRotZZ_;
0098 std::vector<double> xLayerHex_;
0099 std::vector<double> yLayerHex_;
0100 std::vector<double> zLayerHex_;
0101 std::vector<double> rMinLayHex_;
0102 std::vector<double> rMaxLayHex_;
0103 std::vector<double> waferPosX_;
0104 std::vector<double> waferPosY_;
0105 wafer_map cellFineIndex_;
0106 std::vector<double> cellFineX_;
0107 std::vector<double> cellFineY_;
0108 std::vector<bool> cellFineHalf_;
0109 wafer_map cellCoarseIndex_;
0110 std::vector<double> cellCoarseX_;
0111 std::vector<double> cellCoarseY_;
0112 std::vector<bool> cellCoarseHalf_;
0113 std::vector<double> boundR_;
0114 std::vector<int> layer_;
0115 std::vector<int> layerIndex_;
0116 std::vector<int> layerGroup_;
0117 std::vector<int> cellFactor_;
0118 std::vector<int> depth_;
0119 std::vector<int> depthIndex_;
0120 std::vector<int> depthLayerF_;
0121 std::vector<int> waferCopy_;
0122 std::vector<int> waferTypeL_;
0123 std::vector<int> waferTypeT_;
0124 std::vector<int> layerGroupM_;
0125 std::vector<int> layerGroupO_;
0126 std::vector<double> rLimit_;
0127 std::vector<int> cellFine_;
0128 std::vector<int> cellCoarse_;
0129 double waferR_;
0130 std::vector<int> levelT_;
0131 int levelZSide_;
0132 layer_map copiesInLayers_;
0133 double waferSize_;
0134 double waferThick_;
0135 double sensorSeparation_;
0136 double mouseBite_;
0137 int waferUVMax_;
0138 std::vector<int> waferUVMaxLayer_;
0139 waferT_map waferTypes_;
0140
0141 COND_SERIALIZABLE;
0142
0143 private:
0144 static constexpr int kMaskZside = 0x1;
0145 static constexpr int kMaskLayer = 0x7F;
0146 static constexpr int kMaskSector = 0x3FF;
0147 static constexpr int kMaskSubSec = 0x1;
0148 static constexpr int kShiftZside = 19;
0149 static constexpr int kShiftLayer = 12;
0150 static constexpr int kShiftSector = 1;
0151 static constexpr int kShiftSubSec = 0;
0152 };
0153
0154 #endif