Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-29 02:25:49

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