Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-30 00:11:39

0001 #ifndef Geometry_HGCalCommonData_HGCalParameters_h
0002 #define Geometry_HGCalCommonData_HGCalParameters_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 HGCalParameters {
0016 public:
0017   struct waferInfo {
0018     int32_t type, part, orient, cassette;
0019     waferInfo(int32_t t = 0, int32_t p = 0, int32_t o = 0, int32_t c = 0) : type(t), part(p), orient(o), cassette(c) {}
0020   };
0021   struct tileInfo {
0022     int32_t type, sipm, cassette, hex[6];
0023     tileInfo(int32_t t = 0,
0024              int32_t s = 0,
0025              int32_t h1 = 0,
0026              int32_t h2 = 0,
0027              int32_t h3 = 0,
0028              int32_t h4 = 0,
0029              int32_t h5 = 0,
0030              int32_t h6 = 0)
0031         : type(t), sipm(s) {
0032       hex[0] = h1;
0033       hex[1] = h2;
0034       hex[2] = h3;
0035       hex[3] = h4;
0036       hex[4] = h5;
0037       hex[5] = h6;
0038     };
0039   };
0040   typedef std::vector<std::unordered_map<int32_t, int32_t> > layer_map;
0041   typedef std::unordered_map<int32_t, int32_t> wafer_map;
0042   typedef std::unordered_map<int32_t, std::pair<int32_t, int32_t> > waferT_map;
0043   typedef std::unordered_map<int32_t, waferInfo> waferInfo_map;
0044   typedef std::unordered_map<int32_t, tileInfo> tileInfo_map;
0045 
0046   static constexpr double k_ScaleFromDDD = 0.1;
0047   static constexpr double k_ScaleFromDDD2 = 0.01;
0048   static constexpr double k_ScaleToDDD = 10.0;
0049   static constexpr double k_ScaleToDDD2 = 100.0;
0050   static constexpr double k_ScaleFromDDDToG4 = 1.0;
0051   static constexpr double k_ScaleToDDDFromG4 = 1.0;
0052   static constexpr double k_ScaleFromDD4hep = (1.0 / dd4hep::cm);
0053   static constexpr double k_ScaleToDD4hep = dd4hep::cm;
0054   static constexpr double k_ScaleFromDD4hepToG4 = (1.0 / dd4hep::mm);
0055   static constexpr double k_ScaleToDD4hepFromG4 = dd4hep::mm;
0056   static constexpr uint32_t k_CornerSize = 6;
0057   static constexpr double tol = 1.0e-12;
0058 
0059   struct hgtrap {
0060     int lay;
0061     float bl, tl, h, dz, alpha, cellSize;
0062   };
0063 
0064   struct hgtrform {
0065     int zp, lay, sec, subsec;
0066     CLHEP::Hep3Vector h3v;
0067     CLHEP::HepRotation hr;
0068   };
0069 
0070   HGCalParameters(const std::string& nam);
0071   ~HGCalParameters(void) = default;
0072   void fillModule(const hgtrap& mytr, bool reco);
0073   hgtrap getModule(unsigned int k, bool reco) const;
0074   void fillTrForm(const hgtrform& mytr);
0075   hgtrform getTrForm(unsigned int k) const;
0076   void addTrForm(const CLHEP::Hep3Vector& h3v);
0077   void scaleTrForm(double);
0078   int scintCells(const int layer) const { return nPhiBinBH_[scintType(layer)]; }
0079   double scintCellSize(const int layer) const { return cellSize_[scintType(layer)]; }
0080   int scintType(const int layer) const { return ((layer < layerFrontBH_[1]) ? 0 : 1); }
0081   std::array<int, 4> getID(unsigned int k) const;
0082 
0083   std::string name_;
0084   int detectorType_ = 0;
0085   int useSimWt_ = 0;
0086   int nCells_ = 0;
0087   int nSectors_ = 0;
0088   int firstLayer_ = 0;
0089   int firstMixedLayer_ = 0;
0090   HGCalGeometryMode::GeometryMode mode_ = HGCalGeometryMode::Square;
0091 
0092   std::vector<double> cellSize_;
0093   std::vector<double> slopeMin_;
0094   std::vector<double> zFrontMin_;
0095   std::vector<double> rMinFront_;
0096   std::vector<double> slopeTop_;
0097   std::vector<double> zFrontTop_;
0098   std::vector<double> rMaxFront_;
0099   std::vector<double> zRanges_;
0100   std::vector<int> moduleLayS_;
0101   std::vector<double> moduleBlS_;
0102   std::vector<double> moduleTlS_;
0103   std::vector<double> moduleHS_;
0104   std::vector<double> moduleDzS_;
0105   std::vector<double> moduleAlphaS_;
0106   std::vector<double> moduleCellS_;
0107   std::vector<int> moduleLayR_;
0108   std::vector<double> moduleBlR_;
0109   std::vector<double> moduleTlR_;
0110   std::vector<double> moduleHR_;
0111   std::vector<double> moduleDzR_;
0112   std::vector<double> moduleAlphaR_;
0113   std::vector<double> moduleCellR_;
0114   std::vector<uint32_t> trformIndex_;
0115   std::vector<double> trformTranX_;
0116   std::vector<double> trformTranY_;
0117   std::vector<double> trformTranZ_;
0118   std::vector<double> trformRotXX_;
0119   std::vector<double> trformRotYX_;
0120   std::vector<double> trformRotZX_;
0121   std::vector<double> trformRotXY_;
0122   std::vector<double> trformRotYY_;
0123   std::vector<double> trformRotZY_;
0124   std::vector<double> trformRotXZ_;
0125   std::vector<double> trformRotYZ_;
0126   std::vector<double> trformRotZZ_;
0127   std::vector<double> xLayerHex_;
0128   std::vector<double> yLayerHex_;
0129   std::vector<double> zLayerHex_;
0130   std::vector<double> rMinLayHex_;
0131   std::vector<double> rMaxLayHex_;
0132   std::vector<double> waferPosX_;
0133   std::vector<double> waferPosY_;
0134   wafer_map cellFineIndex_;
0135   std::vector<double> cellFineX_;
0136   std::vector<double> cellFineY_;
0137   std::vector<bool> cellFineHalf_;
0138   wafer_map cellCoarseIndex_;
0139   std::vector<double> cellCoarseX_;
0140   std::vector<double> cellCoarseY_;
0141   std::vector<bool> cellCoarseHalf_;
0142   std::vector<double> boundR_;
0143   std::vector<int> layer_;
0144   std::vector<int> layerIndex_;
0145   std::vector<int> layerGroup_;
0146   std::vector<int> cellFactor_;
0147   std::vector<int> depth_;
0148   std::vector<int> depthIndex_;
0149   std::vector<int> depthLayerF_;
0150   std::vector<int> waferCopy_;
0151   std::vector<int> waferTypeL_;
0152   std::vector<int> waferTypeT_;
0153   std::vector<int> layerGroupM_;
0154   std::vector<int> layerGroupO_;
0155   std::vector<double> rLimit_;
0156   std::vector<int> cellFine_;
0157   std::vector<int> cellCoarse_;
0158   double waferR_ = 0.;
0159   std::vector<int> levelT_;
0160   int levelZSide_ = 0;
0161   layer_map copiesInLayers_;
0162   int nCellsFine_ = 0;
0163   int nCellsCoarse_ = 0;
0164   double waferSize_ = 0.;
0165   double waferThick_ = 0.;
0166   double sensorSeparation_ = 0.;
0167   double sensorSizeOffset_ = 0.;
0168   double guardRingOffset_ = 0.;
0169   double mouseBite_ = 0.;
0170   int useOffset_ = 0;
0171   int waferUVMax_ = 0;
0172   std::vector<int> waferUVMaxLayer_;
0173   bool defineFull_ = false;
0174   std::vector<double> waferThickness_;
0175   std::vector<double> cellThickness_;
0176   std::vector<double> radius100to200_;
0177   std::vector<double> radius200to300_;
0178   int choiceType_ = 0;
0179   int nCornerCut_ = 0;
0180   double fracAreaMin_ = 0.;
0181   double zMinForRad_ = 0.;
0182   std::vector<double> radiusMixBoundary_;
0183   std::vector<int> nPhiBinBH_;
0184   std::vector<int> layerFrontBH_;
0185   std::vector<double> rMinLayerBH_;
0186   std::vector<double> radiusLayer_[2];
0187   std::vector<int> iradMinBH_;
0188   std::vector<int> iradMaxBH_;
0189   double minTileSize_ = 0.;
0190   std::vector<int> firstModule_;
0191   std::vector<int> lastModule_;
0192   int layerOffset_ = 0;
0193   double layerRotation_ = 0.;
0194   std::vector<int> layerType_;
0195   std::vector<int> layerCenter_;
0196   wafer_map wafersInLayers_;
0197   wafer_map typesInLayers_;
0198   waferT_map waferTypes_;
0199   int waferMaskMode_ = 0;
0200   int waferZSide_ = 0;
0201   waferInfo_map waferInfoMap_;
0202   std::vector<std::pair<double, double> > layerRotV_;
0203   tileInfo_map tileInfoMap_;
0204   std::vector<std::pair<double, double> > tileRingR_;
0205   std::vector<std::pair<int, int> > tileRingRange_;
0206   std::vector<std::pair<double, double> > tileRingFineR_;
0207   std::vector<std::pair<int, int> > tileRingFineRange_;
0208   std::vector<int> nPhiLayer_;
0209   int cassettes_ = 0;
0210   int nphiCassette_ = 0;
0211   int nphiFineCassette_ = 0;
0212   int phiOffset_ = 0;
0213   std::vector<double> cassetteShift_;
0214   std::vector<double> cassetteShiftTile_;
0215   double calibCellRHD_ = 0.;
0216   std::vector<int> calibCellFullHD_;
0217   std::vector<int> calibCellPartHD_;
0218   double calibCellRLD_ = 0.;
0219   std::vector<int> calibCellFullLD_;
0220   std::vector<int> calibCellPartLD_;
0221 
0222   COND_SERIALIZABLE;
0223 
0224 private:
0225   static constexpr int kMaskZside = 0x1;
0226   static constexpr int kMaskLayer = 0x7F;
0227   static constexpr int kMaskSector = 0x3FF;
0228   static constexpr int kMaskSubSec = 0x1;
0229   static constexpr int kShiftZside = 19;
0230   static constexpr int kShiftLayer = 12;
0231   static constexpr int kShiftSector = 1;
0232   static constexpr int kShiftSubSec = 0;
0233 };
0234 
0235 #endif