Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-03 00:59:13

0001 #include "Geometry/HGCalGeometry/interface/HGCalMouseBite.h"
0002 #include "DataFormats/Math/interface/CMSUnits.h"
0003 
0004 //#define EDM_ML_DEBUG
0005 using namespace cms_units::operators;
0006 
0007 HGCalMouseBite::HGCalMouseBite(const HGCalDDDConstants& hgc, const bool rot) {
0008   if (hgc.waferHexagon8()) {
0009     const std::vector<double> angle = {90._deg, 30._deg};
0010     std::vector<std::pair<double, double> > projXY;
0011     projXY.reserve(angle.size());
0012     for (auto ang : angle)
0013       projXY.emplace_back(std::make_pair(cos(ang), sin(ang)));
0014     const double mousebite(hgc.mouseBite(true));
0015     const double wafersize(hgc.waferSize(true));
0016     double cut = wafersize * tan(angle[1]) - mousebite;
0017 #ifdef EDM_ML_DEBUG
0018     edm::LogVerbatim("HGCalGeom") << "Creating HGCMosueBite with cut at " << cut << " along " << angle.size()
0019                                   << " axes in wafers of size " << wafersize;
0020     for (unsigned int k = 0; k < angle.size(); ++k)
0021       edm::LogVerbatim("HGCalGeom") << "Axis[" << k << "] " << convertRadToDeg(angle[k]) << " with projections "
0022                                     << projXY[k].first << ":" << projXY[k].second;
0023 #endif
0024     static const double sqrt3 = std::sqrt(3.0);
0025     int nf(HGCSiliconDetId::HGCalFineN);
0026     int nf2 = nf / 2;
0027     double delXF = wafersize / (3.0 * nf);
0028     double delYF = 0.5 * delXF * sqrt3;
0029     for (int u = 0; u < 2 * nf; ++u) {
0030       for (int v = 0; v < 2 * nf; ++v) {
0031         if (((v - u) < nf) && ((u - v) <= nf)) {
0032           double yp = std::abs((u - 0.5 * v - nf2) * 2 * delYF);
0033           double xp = std::abs((1.5 * (v - nf) + 1.0) * delXF);
0034           for (auto proj : projXY) {
0035             double dist = (rot ? (yp * proj.first + xp * proj.second) : (xp * proj.first + yp * proj.second));
0036             if (dist > cut) {
0037               rejectFine_.emplace_back(100 * u + v);
0038               break;
0039             }
0040           }
0041         }
0042       }
0043     }
0044 #ifdef EDM_ML_DEBUG
0045     edm::LogVerbatim("HGCalGeom") << "HGCalMouseBite:: " << rejectFine_.size()
0046                                   << " masked u, v's among the fine grain wafers:";
0047     for (unsigned int k = 0; k < rejectFine_.size(); ++k)
0048       edm::LogVerbatim("HGCalGeom") << "[" << k << "] = (" << rejectFine_[k] / 100 << ", " << rejectFine_[k] % 100
0049                                     << ")";
0050 #endif
0051     int nc(HGCSiliconDetId::HGCalCoarseN);
0052     int nc2 = nc / 2;
0053     double delXC = hgc.getParameter()->waferSize_ / (3.0 * nc);
0054     double delYC = 0.5 * delXC * sqrt3;
0055     for (int u = 0; u < 2 * nc; ++u) {
0056       for (int v = 0; v < 2 * nc; ++v) {
0057         if (((v - u) < nc) && ((u - v) <= nc)) {
0058           double yp = (u - 0.5 * v - nc2) * 2 * delYC;
0059           double xp = (1.5 * (v - nc) + 1.0) * delXC;
0060           for (auto proj : projXY) {
0061             double dist = (rot ? (yp * proj.first + xp * proj.second) : (xp * proj.first + yp * proj.second));
0062             if (dist > cut)
0063               rejectCoarse_.emplace_back(100 * u + v);
0064             break;
0065           }
0066         }
0067       }
0068     }
0069 #ifdef EDM_ML_DEBUG
0070     edm::LogVerbatim("HGCalGeom") << "HGCalMouseBite:: " << rejectCoarse_.size()
0071                                   << " masked u, v's among the coarse grain wafers:";
0072     for (unsigned int k = 0; k < rejectCoarse_.size(); ++k)
0073       edm::LogVerbatim("HGCalGeom") << "[" << k << "] = (" << rejectCoarse_[k] / 100 << ", " << rejectCoarse_[k] % 100
0074                                     << ")";
0075 #endif
0076   }
0077 }