Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-04 04:35:02

0001 #ifndef HGCalCommonData_HGCalWaferMask_h
0002 #define HGCalCommonData_HGCalWaferMask_h
0003 
0004 /** \class HGCalWaferMask
0005  *
0006  * this class determines the masking of wafers to mimic partial wafers
0007  *
0008  *  $Date: 2019/01/15 00:06:50 $
0009  * \author Sunanda Banerjee, Fermilab <sunanda.banerjee@cern.ch>
0010  *
0011  */
0012 
0013 #include <cmath>
0014 #include <vector>
0015 #include <array>
0016 
0017 class HGCalWaferMask {
0018 public:
0019   HGCalWaferMask() = default;
0020 
0021   // Decides if the cell is present or not from # oc corners (for V14)
0022   static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners);
0023   // Decides if the cell is present or not from # oc corners (for V15, V16)
0024   static bool goodCell(int u, int v, int N, int type, int rotn);
0025   // Decides if the cell is present or not (for v17)
0026   static bool goodCell(int u, int v, int waferType);
0027   // Converts rotation index (as otained from flat file) depending on
0028   // zside and type (for V15, V16)
0029   static int getRotation(int zside, int type, int rotn);
0030   // Get partial wafer type and orientation (for V15, V16)
0031   static std::pair<int, int> getTypeMode(const double& xpos,
0032                                          const double& ypos,
0033                                          const double& delX,
0034                                          const double& delY,
0035                                          const double& rin,
0036                                          const double& rout,
0037                                          const int& waferType,
0038                                          const int& mode,
0039                                          const bool& v17,
0040                                          const bool& debug = false);
0041   // Checks partial wafer type and orientation (for V15, V16)
0042   static bool goodTypeMode(const double& xpos,
0043                            const double& ypos,
0044                            const double& delX,
0045                            const double& delY,
0046                            const double& rin,
0047                            const double& rout,
0048                            const int& part,
0049                            const int& rotn,
0050                            const bool& v17,
0051                            const bool& debug = false);
0052   // Gets the corners of the partial wafers from its type, orientation, zside
0053   // (Good for V15, V16 geometries)
0054   static std::vector<std::pair<double, double> > waferXY(const int& part,
0055                                                          const int& orient,
0056                                                          const int& zside,
0057                                                          const double& waferSize,
0058                                                          const double& offset,
0059                                                          const double& xpos,
0060                                                          const double& ypos,
0061                                                          const bool& v17);
0062   // Gets the corners of the partial wafers from its type, placement index
0063   // (Good for V17 geometry)
0064   static std::vector<std::pair<double, double> > waferXY(const int& part,
0065                                                          const int& placement,
0066                                                          const double& wafersize,
0067                                                          const double& offset,
0068                                                          const double& xpos,
0069                                                          const double& ypos,
0070                                                          const bool& v17);
0071 
0072   static std::array<double, 4> maskCut(
0073       const int& part, const int& place, const double& waferSize, const double& offset, const bool& v17OrLess);
0074 
0075 private:
0076   static constexpr double sqrt3_ = 1.732050807568877;  // std::sqrt(3.0) in double precision
0077   static constexpr double sin_60_ = 0.5 * sqrt3_;
0078   static constexpr double cos_60_ = 0.5;
0079   static constexpr double tan_60_ = sqrt3_;
0080   static constexpr std::array<double, 12> tan_1 = {
0081       {-sqrt3_, sqrt3_, 0.0, -sqrt3_, sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0, sqrt3_, -sqrt3_, 0.0}};
0082   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}};
0083   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}};
0084   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}};
0085 };
0086 
0087 #endif