HGCalCell

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
#ifndef Geometry_HGCalCommonData_HGCalCell_h
#define Geometry_HGCalCommonData_HGCalCell_h

#include <cmath>
#include <cstdint>

class HGCalCell {
public:
  HGCalCell(double waferSize, int32_t nFine, int32_t nCoarse);

  static constexpr int32_t cellPlacementIndex0 = 0;
  static constexpr int32_t cellPlacementIndex1 = 1;
  static constexpr int32_t cellPlacementIndex2 = 2;
  static constexpr int32_t cellPlacementIndex3 = 3;
  static constexpr int32_t cellPlacementIndex4 = 4;
  static constexpr int32_t cellPlacementIndex5 = 5;
  static constexpr int32_t cellPlacementIndex6 = 6;
  static constexpr int32_t cellPlacementIndex7 = 7;
  static constexpr int32_t cellPlacementIndex8 = 8;
  static constexpr int32_t cellPlacementIndex9 = 9;
  static constexpr int32_t cellPlacementIndex10 = 10;
  static constexpr int32_t cellPlacementIndex11 = 11;

  static constexpr int32_t cellPlacementExtra = 6;
  static constexpr int32_t cellPlacementOld = 7;
  static constexpr int32_t cellPlacementTotal = 12;

  static constexpr int32_t fullCell = 0;
  static constexpr int32_t cornerCell = 1;
  static constexpr int32_t truncatedCell = 2;
  static constexpr int32_t extendedCell = 3;
  static constexpr int32_t truncatedMBCell = 4;
  static constexpr int32_t extendedMBCell = 5;
  static constexpr int32_t fullWaferCellsCount = 6;

  static constexpr int32_t halfCell = 11;
  static constexpr int32_t extHalfTrunCell = 12;
  static constexpr int32_t extHalfExtCell = 13;
  static constexpr int32_t extTrunCellCenCut = 14;
  static constexpr int32_t extExtCellCenCut = 15;
  static constexpr int32_t extTrunCellEdgeCut = 16;
  static constexpr int32_t extExtCellEdgeCut = 17;
  static constexpr int32_t fullCellEdgeCut = 18;
  static constexpr int32_t fullCellCenCut = 19;
  static constexpr int32_t intExtCell = 20;
  static constexpr int32_t intTrunCell = 21;
  static constexpr int32_t intHalfExtCell = 22;
  static constexpr int32_t intHalfTrunCell = 23;
  static constexpr int32_t intExtCellCenCut = 24;
  static constexpr int32_t intTrunCellCenCut = 25;
  static constexpr int32_t intExtCellEdgeCut = 26;
  static constexpr int32_t intTrunCellEdgeCut = 27;
  static constexpr int32_t partiaclWaferCellsOffset = 11;

  static constexpr int32_t LDPartial0714Cell = 28;
  static constexpr int32_t LDPartial0209Cell = 29;
  static constexpr int32_t LDPartial0007Cell = 30;
  static constexpr int32_t LDPartial0815Cell = 31;
  static constexpr int32_t LDPartial1415Cell = 32;
  static constexpr int32_t LDPartial1515Cell = 33;

  static constexpr int32_t HDPartial0920Cell = 34;
  static constexpr int32_t HDPartial1021Cell = 35;

  static constexpr int32_t undefinedCell = -1;
  static constexpr int32_t centralCell = 0;
  static constexpr int32_t bottomLeftEdge = 1;
  static constexpr int32_t leftEdge = 2;
  static constexpr int32_t topLeftEdge = 3;
  static constexpr int32_t topRightEdge = 4;
  static constexpr int32_t rightEdge = 5;
  static constexpr int32_t bottomRightEdge = 6;
  static constexpr int32_t bottomCorner = 11;
  static constexpr int32_t bottomLeftCorner = 12;
  static constexpr int32_t topLeftCorner = 13;
  static constexpr int32_t topCorner = 14;
  static constexpr int32_t topRightCorner = 15;
  static constexpr int32_t bottomRightCorner = 16;

  static constexpr int32_t leftCell = 21;
  static constexpr int32_t rightCell = 22;
  static constexpr int32_t topCell = 23;
  static constexpr int32_t bottomCell = 24;
  static constexpr int32_t partiaclCellsPosOffset = 21;

  std::pair<double, double> cellUV2XY1(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
  std::pair<double, double> cellUV2XY2(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
  // Get cell type and orientation index
  std::pair<int32_t, int32_t> cellUV2Cell(int32_t u, int32_t v, int32_t placementIndex, int32_t type);
  // Get the placement index from zside, front-back tag, orientation flag
  static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient);
  // Get the orientation flag and front-back tag from placement index
  static std::pair<int32_t, int32_t> cellOrient(int32_t placementIndex);
  // Get cell type and position in the list
  static std::pair<int32_t, int32_t> cellType(int32_t u, int32_t v, int32_t ncell, int32_t placementIndex);
  static std::pair<int32_t, int32_t> cellType(
      int32_t u, int32_t v, int32_t ncell, int32_t placementIndex, int32_t partialType);

private:
  const double sqrt3By2_ = (0.5 * std::sqrt(3.0));
  int32_t ncell_[2];
  double cellX_[2], cellY_[2];
};

#endif