File indexing completed on 2024-08-05 04:32:11
0001 #ifndef HGCalCommonData_HGCalGeomParameters_h
0002 #define HGCalCommonData_HGCalGeomParameters_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <string>
0016 #include <utility>
0017 #include <vector>
0018
0019 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0020 #include "DetectorDescription/Core/interface/DDsvalues.h"
0021 #include "DetectorDescription/Core/interface/DDCompactView.h"
0022 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0023 #include "DetectorDescription/DDCMS/interface/DDCompactView.h"
0024 #include "DetectorDescription/DDCMS/interface/DDFilteredView.h"
0025 #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h"
0026 #include "Geometry/HGCalCommonData/interface/HGCalParameters.h"
0027 #include "Geometry/HGCalCommonData/interface/HGCalGeomTools.h"
0028
0029 class HGCalGeomParameters {
0030 public:
0031 HGCalGeomParameters();
0032 ~HGCalGeomParameters() = default;
0033
0034 void loadGeometryHexagon(const DDFilteredView& _fv,
0035 HGCalParameters& php,
0036 const std::string& sdTag1,
0037 const DDCompactView* cpv,
0038 const std::string& sdTag2,
0039 const std::string& sdTag3,
0040 HGCalGeometryMode::WaferMode mode);
0041 void loadGeometryHexagon(const cms::DDCompactView* cpv,
0042 HGCalParameters& php,
0043 const std::string& sdTag1,
0044 const std::string& sdTag2,
0045 const std::string& sdTag3,
0046 HGCalGeometryMode::WaferMode mode);
0047 void loadGeometryHexagon8(const DDFilteredView& _fv, HGCalParameters& php, int firstLayer);
0048 void loadGeometryHexagon8(const cms::DDCompactView* cpv,
0049 HGCalParameters& php,
0050 const std::string& sdTag1,
0051 int firstLayer);
0052 void loadGeometryHexagonModule(const DDCompactView* cpv,
0053 HGCalParameters& php,
0054 const std::string& sdTag1,
0055 const std::string& sdTag2,
0056 int firstLayer);
0057 void loadGeometryHexagonModule(const cms::DDCompactView* cpv,
0058 HGCalParameters& php,
0059 const std::string& sdTag1,
0060 const std::string& sdTag2,
0061 int firstLayer);
0062 void loadSpecParsHexagon(const DDFilteredView& fv,
0063 HGCalParameters& php,
0064 const DDCompactView* cpv,
0065 const std::string& sdTag1,
0066 const std::string& sdTag2);
0067 void loadSpecParsHexagon(const cms::DDFilteredView& fv,
0068 HGCalParameters& php,
0069 const std::string& sdTag1,
0070 const std::string& sdTag2,
0071 const std::string& sdTag3,
0072 const std::string& sdTag4);
0073 void loadSpecParsHexagon8(const DDFilteredView& fv, HGCalParameters& php);
0074 void loadSpecParsHexagon8(const cms::DDFilteredView& fv,
0075 const cms::DDVectorsMap& vmap,
0076 HGCalParameters& php,
0077 const std::string& sdTag1);
0078 void loadSpecParsTrapezoid(const DDFilteredView& fv, HGCalParameters& php);
0079 void loadSpecParsTrapezoid(const cms::DDFilteredView& fv,
0080 const cms::DDVectorsMap& vmap,
0081 HGCalParameters& php,
0082 const std::string& sdTag1);
0083 void loadWaferHexagon(HGCalParameters& php);
0084 void loadWaferHexagon8(HGCalParameters& php);
0085 void loadCellParsHexagon(const DDCompactView* cpv, HGCalParameters& php);
0086 void loadCellParsHexagon(const cms::DDVectorsMap& vmap, HGCalParameters& php);
0087 void loadCellParsHexagon(const HGCalParameters& php);
0088 void loadCellTrapezoid(HGCalParameters& php);
0089
0090 struct layerParameters {
0091 double rmin, rmax, zpos;
0092 layerParameters(double rin = 0, double rout = 0, double zp = 0) : rmin(rin), rmax(rout), zpos(zp) {}
0093 };
0094 struct cellParameters {
0095 bool half;
0096 int wafer;
0097 GlobalPoint xyz;
0098 cellParameters(bool h = false, int w = 0, GlobalPoint p = GlobalPoint(0, 0, 0))
0099 : half(h), wafer(w), xyz(std::move(p)) {}
0100 };
0101
0102 constexpr static int siliconFileEE = 2;
0103 constexpr static int siliconFileHE = 3;
0104 constexpr static int scintillatorFile = 4;
0105 constexpr static int siliconCassetteEE = 5;
0106 constexpr static int siliconCassetteHE = 6;
0107 constexpr static int scintillatorCassette = 7;
0108 constexpr static int scintillatorFineCell = 8;
0109
0110 private:
0111 void loadGeometryHexagon(const std::map<int, HGCalGeomParameters::layerParameters>& layers,
0112 std::vector<HGCalParameters::hgtrform>& trforms,
0113 std::vector<bool>& trformUse,
0114 const std::unordered_map<int32_t, int32_t>& copies,
0115 const HGCalParameters::layer_map& copiesInLayers,
0116 const std::vector<int32_t>& wafer2copy,
0117 const std::vector<HGCalGeomParameters::cellParameters>& wafers,
0118 const std::map<int, int>& wafertype,
0119 const std::map<int, HGCalGeomParameters::cellParameters>& cellsf,
0120 const std::map<int, HGCalGeomParameters::cellParameters>& cellsc,
0121 HGCalParameters& php);
0122 void loadGeometryHexagon8(const std::map<int, HGCalGeomParameters::layerParameters>& layers,
0123 std::map<std::pair<int, int>, HGCalParameters::hgtrform>& trforms,
0124 const int& firstLayer,
0125 HGCalParameters& php);
0126 void loadSpecParsHexagon(const HGCalParameters& php);
0127 void loadSpecParsHexagon8(HGCalParameters& php);
0128 void loadSpecParsHexagon8(HGCalParameters& php,
0129 const std::vector<int>& layerType,
0130 const std::vector<int>& waferIndex,
0131 const std::vector<int>& waferProperties);
0132 void loadSpecParsTrapezoid(HGCalParameters& php);
0133 void loadSpecParsTrapezoid(HGCalParameters& php,
0134 const std::vector<int>& tileIndex,
0135 const std::vector<int>& tileProperty,
0136 const std::vector<int>& tileHEX1,
0137 const std::vector<int>& tileHEX2,
0138 const std::vector<int>& tileHEX3,
0139 const std::vector<int>& tileHEX4,
0140 const std::vector<int>& tileHEX5,
0141 const std::vector<int>& tileHEX6,
0142 const std::vector<double>& tileRMin,
0143 const std::vector<double>& tileRMax,
0144 const std::vector<double>& tileRMinFine,
0145 const std::vector<double>& tileRMaxFine,
0146 const std::vector<int>& tileRingMin,
0147 const std::vector<int>& tileRingMax,
0148 const std::vector<int>& tileRingMinFine,
0149 const std::vector<int>& tileRingMaxFine);
0150 std::vector<double> getDDDArray(const std::string& str, const DDsvalues_type& sv, const int nmin);
0151 std::pair<double, double> cellPosition(const std::vector<cellParameters>& wafers,
0152 std::vector<cellParameters>::const_iterator& itrf,
0153 int wafer,
0154 double xx,
0155 double yy);
0156 void rescale(std::vector<double>&, const double s);
0157 void resetZero(std::vector<double>&);
0158
0159 constexpr static double tan30deg_ = 0.5773502693;
0160 HGCalGeomTools geomTools_;
0161 const double sqrt3_;
0162 double waferSize_;
0163 };
0164
0165 #endif