Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:53

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