Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-24 02:59:09

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 
0016 class HGCalWaferMask {
0017 public:
0018   HGCalWaferMask() = default;
0019 
0020   // Decides if the cell is present or not from # oc corners (for V14)
0021   static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners);
0022   // Decides if the cell is present or not from # oc corners (for V15, V16)
0023   static bool goodCell(int u, int v, int N, int type, int rotn);
0024   // Decides if the cell is present or not (for v17)
0025   static bool goodCell(int u, int v, int waferType);
0026   // Converts rotation index (as otained from flat file) depending on
0027   // zside and type (for V15, V16)
0028   static int getRotation(int zside, int type, int rotn);
0029   // Get partial wafer type and orientation (for V15, V16)
0030   static std::pair<int, int> getTypeMode(const double& xpos,
0031                                          const double& ypos,
0032                                          const double& delX,
0033                                          const double& delY,
0034                                          const double& rin,
0035                                          const double& rout,
0036                                          const int& waferType,
0037                                          const int& mode,
0038                                          bool debug = false);
0039   // Checks partial wafer type and orientation (for V15, V16)
0040   static bool goodTypeMode(double xpos,
0041                            double ypos,
0042                            double delX,
0043                            double delY,
0044                            double rin,
0045                            double rout,
0046                            int part,
0047                            int rotn,
0048                            bool debug = false);
0049   // Gets the corners of the partial wafers from its type, orientation, zside
0050   // (Good for V15, V16 geometries)
0051   static std::vector<std::pair<double, double> > waferXY(
0052       int part, int orient, int zside, double waferSize, double offset, double xpos, double ypos);
0053   // Gets the corners of the partial wafers from its type, placement index
0054   // (Good for V17 geometry)
0055   static std::vector<std::pair<double, double> > waferXY(
0056       int part, int placement, double wafersize, double offset, double xpos, double ypos);
0057 
0058 private:
0059   static constexpr double sqrt3_ = 1.732050807568877;  // std::sqrt(3.0) in double precision
0060   static constexpr double sin_60_ = 0.5 * sqrt3_;
0061   static constexpr double cos_60_ = 0.5;
0062   static constexpr double tan_60_ = sqrt3_;
0063 };
0064 
0065 #endif