Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef Geometry_HGCalCommonData_HGCalTypes_h
0002 #define Geometry_HGCalCommonData_HGCalTypes_h
0003 
0004 #include <array>
0005 #include <cmath>
0006 #include <cstdint>
0007 #include <vector>
0008 
0009 class HGCalTypes {
0010 public:
0011   HGCalTypes() {}
0012 
0013   static constexpr int32_t WaferCorner0 = 0;
0014   static constexpr int32_t WaferCorner1 = 1;
0015   static constexpr int32_t WaferCorner2 = 2;
0016   static constexpr int32_t WaferCorner3 = 3;
0017   static constexpr int32_t WaferCorner4 = 4;
0018   static constexpr int32_t WaferCorner5 = 5;
0019 
0020   static constexpr int32_t UnknownPosition = -1;
0021   static constexpr int32_t WaferCenter = 0;
0022   static constexpr int32_t CornerCenterYp = 1;
0023   static constexpr int32_t CornerCenterYm = 2;
0024   static constexpr int32_t CornerCenterXp = 3;
0025   static constexpr int32_t CornerCenterXm = 4;
0026   static constexpr int32_t WaferCenterB = 5;
0027   static constexpr int32_t WaferCenterR = 6;
0028 
0029   static constexpr int32_t WaferTypeUndefined = -1;
0030   static constexpr int32_t WaferFineThin = 0;
0031   static constexpr int32_t WaferCoarseThin = 1;
0032   static constexpr int32_t WaferCoarseThick = 2;
0033   static constexpr int32_t WaferFineThick = 3;
0034 
0035   static constexpr int32_t WaferFull = 0;
0036   static constexpr int32_t WaferFive = 1;
0037   static constexpr int32_t WaferChopTwo = 2;
0038   static constexpr int32_t WaferChopTwoM = 3;
0039   static constexpr int32_t WaferHalf = 4;
0040   static constexpr int32_t WaferSemi = 5;
0041   static constexpr int32_t WaferSemi2 = 6;
0042   static constexpr int32_t WaferThree = 7;
0043   static constexpr int32_t WaferHalf2 = 8;
0044   static constexpr int32_t WaferFive2 = 9;
0045   static constexpr int32_t WaferLDTop = 11;
0046   static constexpr int32_t WaferLDBottom = 12;
0047   static constexpr int32_t WaferLDLeft = 13;
0048   static constexpr int32_t WaferLDRight = 14;
0049   static constexpr int32_t WaferLDFive = 15;
0050   static constexpr int32_t WaferLDThree = 16;
0051   static constexpr int32_t WaferHDTop = 21;
0052   static constexpr int32_t WaferHDBottom = 22;
0053   static constexpr int32_t WaferHDLeft = 23;
0054   static constexpr int32_t WaferHDRight = 24;
0055   static constexpr int32_t WaferHDFive = 25;
0056   static constexpr int32_t WaferOut = 99;
0057   static constexpr int32_t WaferPartLDOffset = 11;
0058   static constexpr int32_t WaferPartHDOffset = 21;
0059   static constexpr int32_t WaferPartLDCount = 6;
0060   static constexpr int32_t WaferPartHDCount = 5;
0061   static constexpr int32_t WaferTypeOffset[3] = {0, 5, 11};
0062 
0063   static constexpr int32_t WaferOrient0 = 0;
0064   static constexpr int32_t WaferOrient1 = 1;
0065   static constexpr int32_t WaferOrient2 = 2;
0066   static constexpr int32_t WaferOrient3 = 3;
0067   static constexpr int32_t WaferOrient4 = 4;
0068   static constexpr int32_t WaferOrient5 = 5;
0069 
0070   static constexpr int32_t WaferCenteredFront = 0;
0071   static constexpr int32_t WaferCenteredBack = 1;
0072   static constexpr int32_t CornerCenteredY = 2;
0073   static constexpr int32_t CornerCenteredLambda = 3;
0074   static constexpr int32_t WaferCenteredRotated = 4;
0075 
0076   static constexpr int32_t WaferCornerMin = 3;
0077   static constexpr int32_t WaferCornerMax = 6;
0078   static constexpr int32_t WaferSizeMax = 9;
0079 
0080   // Condition for cells in partial wafer: arr[0]*u + arr[1]*v <= arr[2]
0081   static constexpr std::array<int, 3> edgeWaferLDTop = {{1, 0, 7}};
0082   static constexpr std::array<int, 3> edgeWaferLDBottom = {{-1, 0, -8}};
0083   static constexpr std::array<int, 3> edgeWaferLDLeft = {{-1, 2, 8}};
0084   static constexpr std::array<int, 3> edgeWaferLDRight = {{1, -2, -7}};
0085   static constexpr std::array<int, 3> edgeWaferLDFive = {{-1, 2, 15}};
0086   static constexpr std::array<int, 3> edgeWaferLDThree = {{1, -2, -14}};
0087   static constexpr std::array<int, 3> edgeWaferHDTop = {{1, 0, 9}};
0088   static constexpr std::array<int, 3> edgeWaferHDBottom = {{-1, 0, -10}};
0089   static constexpr std::array<int, 3> edgeWaferHDLeft = {{-1, 2, 5}};
0090   static constexpr std::array<int, 3> edgeWaferHDRight = {{1, -2, -18}};
0091   static constexpr std::array<int, 3> edgeWaferHDFive = {{-1, 2, 18}};
0092 
0093   static constexpr int k_OffsetRotation = 10;
0094 
0095   static constexpr double c00 = 0.0;
0096   static constexpr double c22O = 0.225;
0097   static constexpr double c221 = 0.2083;
0098   static constexpr double c22 = 0.1944;
0099   static constexpr double c25 = 0.25;
0100   static constexpr double c27O = 0.275;
0101   static constexpr double c271 = 0.2917;
0102   static constexpr double c27 = 0.3056;
0103   static constexpr double c50 = 0.5;
0104   static constexpr double c61O = 0.6125;
0105   static constexpr double c611 = 0.6042;
0106   static constexpr double c61 = 0.59722;
0107   static constexpr double c75 = 0.75;
0108   static constexpr double c77O = 0.775;
0109   static constexpr double c771 = 0.7917;
0110   static constexpr double c77 = 0.8055;
0111   static constexpr double c88O = 0.8875;
0112   static constexpr double c881 = 0.8958;
0113   static constexpr double c88 = 0.90277;
0114   static constexpr double c10 = 1.0;
0115 
0116   enum TileType { TileFine = 0, TileCoarseCast = 1, TileCoarseMould = 2 };
0117 
0118   enum TileSiPMType { SiPMUnknown = 0, SiPMSmall = 2, SiPMLarge = 4 };
0119 
0120   // Packing and unpacking of type, u, v of wafers
0121   static int32_t packTypeUV(int type, int u, int v);
0122   static int32_t getUnpackedType(int id);
0123   static int32_t getUnpackedU(int id);
0124   static int32_t getUnpackedV(int id);
0125   // Packing and unpacking of type, u, v of wafer cells
0126   static int32_t packCellTypeUV(int type, int u, int v);
0127   static int32_t getUnpackedCellType(int id);
0128   static int32_t getUnpackedCellU(int id);
0129   static int32_t getUnpackedCellV(int id);
0130   // Packing and unpacking of type, cell# of wafer cells (6 inch wafers)
0131   static int32_t packCellType6(int type, int cell);
0132   static int32_t getUnpackedCellType6(int id);
0133   static int32_t getUnpackedCell6(int id);
0134   // Translate from flat file format to CMSSW format of Layer type
0135   static int32_t layerType(int type);
0136   // Get the front-back index from the layer orientation index
0137   static constexpr int32_t layerFrontBack(int32_t layerOrient) { return ((layerOrient == WaferCenterB) ? 1 : -1); }
0138   static constexpr int32_t waferFrontBack(int32_t index) { return ((index == 0) ? -1 : 1); }
0139   // LD vs HD and Fullvs Partial wafer
0140   static constexpr bool waferHD(int32_t type) { return ((type == WaferFineThin) || (type == WaferFineThick)); }
0141   static constexpr bool waferFull(int32_t type) { return (type == WaferFull); }
0142 
0143 private:
0144   static constexpr int32_t facu_ = 1;
0145   static constexpr int32_t facv_ = 100;
0146   static constexpr int32_t factype_ = 1000000;
0147   static constexpr int32_t signu_ = 10000;
0148   static constexpr int32_t signv_ = 100000;
0149   static constexpr int32_t maxuv_ = 100;
0150   static constexpr int32_t maxsign_ = 10;
0151   static constexpr int32_t maxtype_ = 10;
0152   static constexpr int32_t faccell_ = 100;
0153   static constexpr int32_t faccelltype_ = 10000;
0154   static constexpr int32_t faccell6_ = 1000;
0155 };
0156 
0157 #endif