CMS 3D CMS Logo

HGCMouseBite.cc
Go to the documentation of this file.
4 #include <CLHEP/Units/SystemOfUnits.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), hgTBcons_(nullptr), ifTB_(false), cut_(maxL), rot_(rot) {
12  init(angle);
13 }
14 
15 HGCMouseBite::HGCMouseBite(const HGCalTBDDDConstants& hgc, const std::vector<double>& angle, double maxL, bool rot)
16  : hgcons_(nullptr), hgTBcons_(&hgc), ifTB_(true), cut_(maxL), rot_(rot) {
17  modeUV_ = false;
18  init(angle);
19 }
20 
21 void HGCMouseBite::init(const std::vector<double>& angle) {
22  for (auto ang : angle) {
23  projXY_.push_back(std::pair<double, double>(cos(ang * CLHEP::deg), sin(ang * CLHEP::deg)));
24  }
25 #ifdef EDM_ML_DEBUG
26  edm::LogVerbatim("HGCSim") << "Creating HGCMosueBite with cut at " << cut_ << " with mode " << modeUV_ << " along "
27  << angle.size() << " axes TB Flag " << ifTB_ << " Rot " << rot_;
28  for (unsigned int k = 0; k < angle.size(); ++k)
29  edm::LogVerbatim("HGCSim") << "Axis[" << k << "] " << angle[k] << " with projections " << projXY_[k].first << ":"
30  << projXY_[k].second;
31 #endif
32 }
33 
34 bool HGCMouseBite::exclude(G4ThreeVector& point, int zside, int lay, int waferU, int waferV) {
35  bool check(false);
36  double dx(0), dy(0);
37  if (point == G4ThreeVector()) {
38  std::pair<double, double> xy;
39  if (ifTB_)
40  xy = hgTBcons_->waferPosition(waferU, false);
41  else
42  xy =
43  (modeUV_ ? hgcons_->waferPosition(lay, waferU, waferV, false, false) : hgcons_->waferPosition(waferU, false));
44  double xx = (zside > 0) ? xy.first : -xy.first;
45  if (rot_) {
46  dx = std::abs(point.y() - xy.second);
47  dy = std::abs(point.x() - xx);
48  } else {
49  dx = std::abs(point.x() - xx);
50  dy = std::abs(point.y() - xy.second);
51  }
52  } else {
53  dx = std::abs(point.x());
54  dy = std::abs(point.y());
55  }
56  for (auto proj : projXY_) {
57  double dist = dx * proj.first + dy * proj.second;
58  if (dist > cut_) {
59  check = true;
60  break;
61  }
62  }
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("HGCSim") << "HGCMouseBite:: Point " << point << " zside " << zside << " wafer " << waferU << ":"
65  << waferV << " position " << dx << ":" << dy << " check " << check;
66 #endif
67  return check;
68 }
Log< level::Info, true > LogVerbatim
const HGCalTBDDDConstants * hgTBcons_
Definition: HGCMouseBite.h:20
void init(const std::vector< double > &angle)
Definition: HGCMouseBite.cc:21
bool exclude(G4ThreeVector &point, int zside, int layer, int waferU, int waferV)
Definition: HGCMouseBite.cc:34
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
const bool ifTB_
Definition: HGCMouseBite.h:21
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< double, double > waferPosition(int wafer, bool reco) const
std::pair< double, double > waferPosition(int wafer, bool reco) const
const HGCalDDDConstants * hgcons_
Definition: HGCMouseBite.h:19
int32_t waferV(const int32_t index)
std::vector< std::pair< double, double > > projXY_
Definition: HGCMouseBite.h:25
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
*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