CMS 3D CMS Logo

HGCMouseBite.cc
Go to the documentation of this file.
4 #include "CLHEP/Units/GlobalSystemOfUnits.h"
5 #include <iostream>
6 
7 //#define EDM_ML_DEBUG
8 
9 HGCMouseBite::HGCMouseBite(const HGCalDDDConstants& hgc, const std::vector<double>& angle, double maxL, bool rot)
10  : hgcons_(hgc), cut_(maxL), rot_(rot) {
12  for (auto ang : angle) {
13  projXY_.push_back(std::pair<double, double>(cos(ang * CLHEP::deg), sin(ang * CLHEP::deg)));
14  }
15 #ifdef EDM_ML_DEBUG
16  edm::LogVerbatim("HGCSim") << "Creating HGCMosueBite with cut at " << cut_ << " with mode " << modeUV_ << " along "
17  << angle.size() << " axes";
18  for (unsigned int k = 0; k < angle.size(); ++k)
19  edm::LogVerbatim("HGCSim") << "Axis[" << k << "] " << angle[k] << " with projections " << projXY_[k].first << ":"
20  << projXY_[k].second;
21 #endif
22 }
23 
24 bool HGCMouseBite::exclude(G4ThreeVector& point, int zside, int lay, int waferU, int waferV) {
25  bool check(false);
26  double dx(0), dy(0);
27  if (point == G4ThreeVector()) {
28  std::pair<double, double> xy =
29  (modeUV_ ? hgcons_.waferPosition(lay, waferU, waferV, false, false) : hgcons_.waferPosition(waferU, false));
30  double xx = (zside > 0) ? xy.first : -xy.first;
31  if (rot_) {
32  dx = std::abs(point.y() - xy.second);
33  dy = std::abs(point.x() - xx);
34  } else {
35  dx = std::abs(point.x() - xx);
36  dy = std::abs(point.y() - xy.second);
37  }
38  } else {
39  dx = std::abs(point.x());
40  dy = std::abs(point.y());
41  }
42  for (auto proj : projXY_) {
43  double dist = dx * proj.first + dy * proj.second;
44  if (dist > cut_) {
45  check = true;
46  break;
47  }
48  }
49 #ifdef EDM_ML_DEBUG
50  edm::LogVerbatim("HGCSim") << "HGCMouseBite:: Point " << point << " zside " << zside << " wafer " << waferU << ":"
51  << waferV << " position " << dx << ":" << dy << " check " << check;
52 #endif
53  return check;
54 }
Log< level::Info, true > LogVerbatim
bool exclude(G4ThreeVector &point, int zside, int layer, int waferU, int waferV)
Definition: HGCMouseBite.cc:24
int32_t waferU(const int32_t index)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
bool waferHexagon8() const
int zside(DetId const &)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const HGCalDDDConstants & hgcons_
Definition: HGCMouseBite.h:15
std::pair< double, double > waferPosition(int wafer, bool reco) const
int32_t waferV(const int32_t index)
std::vector< std::pair< double, double > > projXY_
Definition: HGCMouseBite.h:19
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
HGCMouseBite(const HGCalDDDConstants &hgc, const std::vector< double > &angle, double maxLength, bool waferRotate)
Definition: HGCMouseBite.cc:9
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11