CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalMouseBite Class Reference

#include <HGCalMouseBite.h>

Public Member Functions

template<class T >
bool exclude (const T &id)
 
 HGCalMouseBite (const HGCalDDDConstants &hgc, bool waferRotate=false)
 

Private Attributes

std::vector< int > rejectCoarse_
 
std::vector< int > rejectFine_
 

Detailed Description

Definition at line 13 of file HGCalMouseBite.h.

Constructor & Destructor Documentation

◆ HGCalMouseBite()

HGCalMouseBite::HGCalMouseBite ( const HGCalDDDConstants hgc,
bool  waferRotate = false 
)

Definition at line 7 of file HGCalMouseBite.cc.

References funct::abs(), angle(), angle_units::operators::convertRadToDeg(), funct::cos(), DMR_cfg::cut, HGCSiliconDetId::HGCalHighDensityN, HGCSiliconDetId::HGCalLowDensityN, isotrackApplyRegressor::k, amptDefault_cfi::proj, makeMuonMisalignmentScenario::rot, funct::sin(), mathSSE::sqrt(), funct::tan(), and findQualityFiles::v.

7  {
8  if (hgc.waferHexagon8()) {
9  const std::vector<double> angle = {90._deg, 30._deg};
10  std::vector<std::pair<double, double> > projXY;
11  projXY.reserve(angle.size());
12  for (auto ang : angle)
13  projXY.emplace_back(std::make_pair(cos(ang), sin(ang)));
14  const double mousebite(hgc.mouseBite(true));
15  const double wafersize(hgc.waferSize(true));
16  double cut = wafersize * tan(angle[1]) - mousebite;
17 #ifdef EDM_ML_DEBUG
18  edm::LogVerbatim("HGCalGeom") << "Creating HGCMosueBite with cut at " << cut << " along " << angle.size()
19  << " axes in wafers of size " << wafersize;
20  for (unsigned int k = 0; k < angle.size(); ++k)
21  edm::LogVerbatim("HGCalGeom") << "Axis[" << k << "] " << convertRadToDeg(angle[k]) << " with projections "
22  << projXY[k].first << ":" << projXY[k].second;
23 #endif
24  static const double sqrt3 = std::sqrt(3.0);
26  int nf2 = nf / 2;
27  double delXF = wafersize / (3.0 * nf);
28  double delYF = 0.5 * delXF * sqrt3;
29  for (int u = 0; u < 2 * nf; ++u) {
30  for (int v = 0; v < 2 * nf; ++v) {
31  if (((v - u) < nf) && ((u - v) <= nf)) {
32  double yp = std::abs((u - 0.5 * v - nf2) * 2 * delYF);
33  double xp = std::abs((1.5 * (v - nf) + 1.0) * delXF);
34  for (auto proj : projXY) {
35  double dist = (rot ? (yp * proj.first + xp * proj.second) : (xp * proj.first + yp * proj.second));
36  if (dist > cut) {
37  rejectFine_.emplace_back(100 * u + v);
38  break;
39  }
40  }
41  }
42  }
43  }
44 #ifdef EDM_ML_DEBUG
45  edm::LogVerbatim("HGCalGeom") << "HGCalMouseBite:: " << rejectFine_.size()
46  << " masked u, v's among the fine grain wafers:";
47  for (unsigned int k = 0; k < rejectFine_.size(); ++k)
48  edm::LogVerbatim("HGCalGeom") << "[" << k << "] = (" << rejectFine_[k] / 100 << ", " << rejectFine_[k] % 100
49  << ")";
50 #endif
52  int nc2 = nc / 2;
53  double delXC = hgc.getParameter()->waferSize_ / (3.0 * nc);
54  double delYC = 0.5 * delXC * sqrt3;
55  for (int u = 0; u < 2 * nc; ++u) {
56  for (int v = 0; v < 2 * nc; ++v) {
57  if (((v - u) < nc) && ((u - v) <= nc)) {
58  double yp = (u - 0.5 * v - nc2) * 2 * delYC;
59  double xp = (1.5 * (v - nc) + 1.0) * delXC;
60  for (auto proj : projXY) {
61  double dist = (rot ? (yp * proj.first + xp * proj.second) : (xp * proj.first + yp * proj.second));
62  if (dist > cut)
63  rejectCoarse_.emplace_back(100 * u + v);
64  break;
65  }
66  }
67  }
68  }
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HGCalGeom") << "HGCalMouseBite:: " << rejectCoarse_.size()
71  << " masked u, v's among the coarse grain wafers:";
72  for (unsigned int k = 0; k < rejectCoarse_.size(); ++k)
73  edm::LogVerbatim("HGCalGeom") << "[" << k << "] = (" << rejectCoarse_[k] / 100 << ", " << rejectCoarse_[k] % 100
74  << ")";
75 #endif
76  }
77 }
Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static constexpr int32_t HGCalLowDensityN
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr int32_t HGCalHighDensityN
std::vector< int > rejectCoarse_
std::vector< int > rejectFine_
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

Member Function Documentation

◆ exclude()

template<class T >
bool HGCalMouseBite::exclude ( const T id)
inline

Definition at line 17 of file HGCalMouseBite.h.

References ALPAKA_ACCELERATOR_NAMESPACE::lst::binary_search(), RPCNoise_example::check, rejectCoarse_, and rejectFine_.

17  {
18  int iuv = (100 * id.cellU() + id.cellV());
19  bool check = ((id.type() == 0) ? (std::binary_search(rejectFine_.begin(), rejectFine_.end(), iuv))
20  : (std::binary_search(rejectCoarse_.begin(), rejectCoarse_.end(), iuv)));
21 #ifdef EDM_ML_DEBUG
22  edm::LogVerbatim("HGCalGeom") << "HGCalMouseBite:: DetId " << id
23  << " is checked to be in the list of masked ID's with flag " << check;
24 #endif
25  return check;
26  }
Log< level::Info, true > LogVerbatim
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE int binary_search(const unsigned int *data, unsigned int search_val, unsigned int ndata)
Definition: Hit.h:59
std::vector< int > rejectCoarse_
std::vector< int > rejectFine_

Member Data Documentation

◆ rejectCoarse_

std::vector<int> HGCalMouseBite::rejectCoarse_
private

Definition at line 29 of file HGCalMouseBite.h.

Referenced by exclude().

◆ rejectFine_

std::vector<int> HGCalMouseBite::rejectFine_
private

Definition at line 29 of file HGCalMouseBite.h.

Referenced by exclude().