HGCalWaferMask

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
#ifndef HGCalCommonData_HGCalWaferMask_h
#define HGCalCommonData_HGCalWaferMask_h

/** \class HGCalWaferMask
 *
 * this class determines the masking of wafers to mimic partial wafers
 *
 *  $Date: 2019/01/15 00:06:50 $
 * \author Sunanda Banerjee, Fermilab <sunanda.banerjee@cern.ch>
 *
 */

#include <cmath>
#include <vector>
#include <array>

class HGCalWaferMask {
public:
  HGCalWaferMask() = default;

  // Decides if the cell is present or not from # oc corners (for V14)
  static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners);
  // Decides if the cell is present or not from # oc corners (for V15, V16)
  static bool goodCell(int u, int v, int N, int type, int rotn);
  // Decides if the cell is present or not (for v17)
  static bool goodCell(int u, int v, int waferType);
  // Converts rotation index (as otained from flat file) depending on
  // zside and type (for V15, V16)
  static int getRotation(int zside, int type, int rotn);
  // Get partial wafer type and orientation (for V15, V16)
  static std::pair<int, int> getTypeMode(const double& xpos,
                                         const double& ypos,
                                         const double& delX,
                                         const double& delY,
                                         const double& rin,
                                         const double& rout,
                                         const int& waferType,
                                         const int& mode,
                                         const bool& v17,
                                         const bool& debug = false);
  // Checks partial wafer type and orientation (for V15, V16)
  static bool goodTypeMode(const double& xpos,
                           const double& ypos,
                           const double& delX,
                           const double& delY,
                           const double& rin,
                           const double& rout,
                           const int& part,
                           const int& rotn,
                           const bool& v17,
                           const bool& debug = false);
  // Gets the corners of the partial wafers from its type, orientation, zside
  // (Good for V15, V16 geometries)
  static std::vector<std::pair<double, double> > waferXY(const int& part,
                                                         const int& orient,
                                                         const int& zside,
                                                         const double& waferSize,
                                                         const double& offset,
                                                         const double& xpos,
                                                         const double& ypos,
                                                         const bool& v17);
  // Gets the corners of the partial wafers from its type, placement index
  // (Good for V17 geometry)
  static std::vector<std::pair<double, double> > waferXY(const int& part,
                                                         const int& placement,
                                                         const double& wafersize,
                                                         const double& offset,
                                                         const double& xpos,
                                                         const double& ypos,
                                                         const bool& v17);

  static std::array<double, 4> maskCut(
      const int& part, const int& place, const double& waferSize, const double& offset, const bool& v17OrLess);

private:
  static constexpr double sqrt3_ = 1.732050807568877;  // std::sqrt(3.0) in double precision
  static constexpr double sin_60_ = 0.5 * sqrt3_;
  static constexpr double cos_60_ = 0.5;
  static constexpr double tan_60_ = sqrt3_;
  static constexpr std::array<double, 12> tan_1 = {
      {-sqrt3_, sqrt3_, 0.0, -sqrt3_, sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0}};
  static constexpr std::array<double, 12> cos_1 = {{0.5, -0.5, -1.0, -0.5, 0.5, 1.0, 0.5, -0.5, -1.0, -0.5, 0.5, 1.0}};
  static constexpr std::array<double, 12> sign_1 = {{1.0, -1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, -1.0, -1.0}};
  static constexpr std::array<double, 12> sign_2 = {{1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, 1.0, 1.0}};
};

#endif