CMS 3D CMS Logo

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

#include <HGCGuardRing.h>

Public Member Functions

bool exclude (G4ThreeVector &point, int zside, int frontBack, int layer, int waferU, int waferV)
 
 HGCGuardRing (const HGCalDDDConstants &hgc)
 

Private Member Functions

bool insidePolygon (double x, double y, const std::vector< std::pair< double, double > > &xyv)
 

Private Attributes

const double guardRingOffset_
 
const HGCalDDDConstantshgcons_
 
const HGCalGeometryMode::GeometryMode modeUV_
 
double offset_
 
const double sensorSizeOffset_
 
const double waferSize_
 
double xmax_
 
double ymax_
 

Static Private Attributes

static constexpr double sqrt3_ = 1.732050807568877
 

Detailed Description

Definition at line 9 of file HGCGuardRing.h.

Constructor & Destructor Documentation

◆ HGCGuardRing()

HGCGuardRing::HGCGuardRing ( const HGCalDDDConstants hgc)

Definition at line 9 of file HGCGuradRing.cc.

References guardRingOffset_, modeUV_, offset_, sensorSizeOffset_, sqrt3_, waferSize_, xmax_, and ymax_.

10  : hgcons_(hgc),
16  xmax_ = 0.5 * (waferSize_ - offset_);
17  ymax_ = xmax_ / sqrt3_;
18 #ifdef EDM_ML_DEBUG
19  edm::LogVerbatim("HGCSim") << "Creating HGCGuardRing with wafer size " << waferSize_ << ", Offsets "
20  << sensorSizeOffset_ << ":" << guardRingOffset_ << ":" << offset_ << ", and mode "
21  << modeUV_ << " xmax|ymax " << xmax_ << ":" << ymax_;
22 #endif
23 }
Log< level::Info, true > LogVerbatim
const double sensorSizeOffset_
Definition: HGCGuardRing.h:20
double ymax_
Definition: HGCGuardRing.h:21
const HGCalParameters * getParameter() const
HGCalGeometryMode::GeometryMode geomMode() const
const double waferSize_
Definition: HGCGuardRing.h:20
const double guardRingOffset_
Definition: HGCGuardRing.h:20
double xmax_
Definition: HGCGuardRing.h:21
const HGCalDDDConstants & hgcons_
Definition: HGCGuardRing.h:18
double offset_
Definition: HGCGuardRing.h:21
const HGCalGeometryMode::GeometryMode modeUV_
Definition: HGCGuardRing.h:19
static constexpr double sqrt3_
Definition: HGCGuardRing.h:17
double waferSize(bool reco) const

Member Function Documentation

◆ exclude()

bool HGCGuardRing::exclude ( G4ThreeVector &  point,
int  zside,
int  frontBack,
int  layer,
int  waferU,
int  waferV 
)

Definition at line 25 of file HGCGuradRing.cc.

References funct::abs(), HGCalCell::cellPlacementIndex(), RPCNoise_example::check, PVValHelper::dx, PVValHelper::dy, HGCalWaferType::getOrient(), HGCalDDDConstants::getParameter(), HGCalWaferType::getPartial(), HGCalGeometryMode::Hexagon8Cassette, HGCalGeometryMode::Hexagon8Module, hgcons_, insidePolygon(), pixelTopology::layer, modeUV_, offset_, hgcalPerformanceValidation::orient, point, sqrt3_, HGCalTypes::WaferFull, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, waferSize_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), HGCalWaferMask::waferXY(), xmax_, ymax_, and ecaldqm::zside().

25  {
26  bool check(false);
30  if (partial == HGCalTypes::WaferFull) {
31  double dx = std::abs(point.x());
32  double dy = std::abs(point.y());
33  if (dx > xmax_) {
34  check = true;
35  } else if (dy > (2 * ymax_)) {
36  check = true;
37  } else {
38  check = (dx > (sqrt3_ * (2 * ymax_ - dy)));
39  }
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HGCSim") << "HGCGuardRing:: Point " << point << " zside " << zside << " layer " << layer
42  << " wafer " << waferU << ":" << waferV << " partial type " << partial << ":"
43  << HGCalTypes::WaferFull << " x " << dx << ":" << xmax_ << " y " << dy << ":" << ymax_
44  << " check " << check;
45 #endif
46  } else {
49  std::vector<std::pair<double, double> > wxy =
50  HGCalWaferMask::waferXY(partial, orient, zside, waferSize_, offset_, 0.0, 0.0);
51  check = insidePolygon(point.x(), point.y(), wxy);
52  } else {
53  int placement = HGCalCell::cellPlacementIndex(zside, frontBack, orient);
54  std::vector<std::pair<double, double> > wxy =
55  HGCalWaferMask::waferXY(partial, placement, waferSize_, offset_, 0.0, 0.0);
56  check = insidePolygon(point.x(), point.y(), wxy);
57  }
58  }
59  }
60  return check;
61 }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
double ymax_
Definition: HGCGuardRing.h:21
const HGCalParameters * getParameter() const
int32_t waferU(const int32_t index)
static int getPartial(int index, const HGCalParameters::waferInfo_map &wafers)
int zside(DetId const &)
static std::vector< std::pair< double, double > > waferXY(int part, int orient, int zside, double waferSize, double offset, double xpos, double ypos)
static int getOrient(int index, const HGCalParameters::waferInfo_map &wafers)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
const double waferSize_
Definition: HGCGuardRing.h:20
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double xmax_
Definition: HGCGuardRing.h:21
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
const HGCalDDDConstants & hgcons_
Definition: HGCGuardRing.h:18
bool insidePolygon(double x, double y, const std::vector< std::pair< double, double > > &xyv)
Definition: HGCGuradRing.cc:63
double offset_
Definition: HGCGuardRing.h:21
const HGCalGeometryMode::GeometryMode modeUV_
Definition: HGCGuardRing.h:19
int32_t waferV(const int32_t index)
static constexpr double sqrt3_
Definition: HGCGuardRing.h:17
waferInfo_map waferInfoMap_
*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

◆ insidePolygon()

bool HGCGuardRing::insidePolygon ( double  x,
double  y,
const std::vector< std::pair< double, double > > &  xyv 
)
private

Definition at line 63 of file HGCGuradRing.cc.

References counter, dqmdumpme::first, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, SiStripPI::max, SiStripPI::min, edm::second(), x, testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, y, testProducerWithPsetDescEmpty_cfi::y1, and testProducerWithPsetDescEmpty_cfi::y2.

Referenced by exclude().

63  {
64  int counter(0);
65  double x1(xyv[0].first), y1(xyv[0].second);
66  for (unsigned i1 = 1; i1 <= xyv.size(); i1++) {
67  unsigned i2 = (i1 % xyv.size());
68  double x2(xyv[i2].first), y2(xyv[i2].second);
69  if (y > std::min(y1, y2)) {
70  if (y <= std::max(y1, y2)) {
71  if (x <= std::max(x1, x2)) {
72  if (y1 != y2) {
73  double xinter = (y - y1) * (x2 - x1) / (y2 - y1) + x1;
74  if ((x1 == x2) || (x <= xinter))
75  ++counter;
76  }
77  }
78  }
79  }
80  x1 = x2;
81  y1 = y2;
82  }
83 
84  if (counter % 2 == 0)
85  return false;
86  else
87  return true;
88 }
U second(std::pair< T, U > const &p)
static std::atomic< unsigned int > counter

Member Data Documentation

◆ guardRingOffset_

const double HGCGuardRing::guardRingOffset_
private

Definition at line 20 of file HGCGuardRing.h.

Referenced by HGCGuardRing().

◆ hgcons_

const HGCalDDDConstants& HGCGuardRing::hgcons_
private

Definition at line 18 of file HGCGuardRing.h.

Referenced by exclude().

◆ modeUV_

const HGCalGeometryMode::GeometryMode HGCGuardRing::modeUV_
private

Definition at line 19 of file HGCGuardRing.h.

Referenced by exclude(), and HGCGuardRing().

◆ offset_

double HGCGuardRing::offset_
private

Definition at line 21 of file HGCGuardRing.h.

Referenced by exclude(), and HGCGuardRing().

◆ sensorSizeOffset_

const double HGCGuardRing::sensorSizeOffset_
private

Definition at line 20 of file HGCGuardRing.h.

Referenced by HGCGuardRing().

◆ sqrt3_

constexpr double HGCGuardRing::sqrt3_ = 1.732050807568877
staticprivate

Definition at line 17 of file HGCGuardRing.h.

Referenced by exclude(), and HGCGuardRing().

◆ waferSize_

const double HGCGuardRing::waferSize_
private

Definition at line 20 of file HGCGuardRing.h.

Referenced by exclude(), and HGCGuardRing().

◆ xmax_

double HGCGuardRing::xmax_
private

Definition at line 21 of file HGCGuardRing.h.

Referenced by exclude(), and HGCGuardRing().

◆ ymax_

double HGCGuardRing::ymax_
private

Definition at line 21 of file HGCGuardRing.h.

Referenced by exclude(), and HGCGuardRing().