CMS 3D CMS Logo

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

#include <HGCalDDDConstants.h>

Public Member Functions

std::pair< int, int > assignCell (float x, float y, int lay, int subSec, bool reco) const
 
std::array< int, 5 > assignCellHex (float x, float y, int lay, bool reco, bool extend=false, bool debug=false) const
 
std::array< int, 3 > assignCellTrap (float x, float y, float z, int lay, bool reco) const
 
std::pair< double, double > cellEtaPhiTrap (int type, int irad) const
 
bool cellInLayer (int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
 
double cellSizeHex (int type) const
 
std::pair< double, double > cellSizeTrap (int type, int irad) const
 
double cellThickness (int layer, int waferU, int waferV) const
 
int32_t cellType (int type, int waferU, int waferV, int iz, int fwdBack, int orient) const
 
double distFromEdgeHex (double x, double y, double z) const
 
double distFromEdgeTrap (double x, double y, double z) const
 
void etaPhiFromPosition (const double x, const double y, const double z, const int layer, int &ieta, int &iphi, int &type, double &wt) const
 
int firstLayer () const
 
HGCalGeometryMode::GeometryMode geomMode () const
 
int getLayer (double z, bool reco) const
 
int getLayerOffset () const
 
HGCalParameters::hgtrap getModule (unsigned int k, bool hexType, bool reco) const
 
std::vector< HGCalParameters::hgtrapgetModules () const
 
const HGCalParametersgetParameter () const
 
int getPhiBins (int lay) const
 
const std::vector< double > & getRadiusLayer (int layer) const
 
std::pair< int, int > getREtaRange (int lay) const
 
HGCalParameters::hgtrform getTrForm (unsigned int k) const
 
unsigned int getTrFormN () const
 
std::vector< HGCalParameters::hgtrformgetTrForms () const
 
int getTypeHex (int layer, int waferU, int waferV) const
 
int getTypeTrap (int layer) const
 
int getUVMax (int type) const
 
std::pair< double, double > getXY (int layer, double x, double y, bool forwd) const
 
 HGCalDDDConstants (const HGCalParameters *hp, const std::string &name)
 
bool isHalfCell (int waferType, int cell) const
 
bool isValidHex (int lay, int mod, int cell, bool reco) const
 
bool isValidHex8 (int lay, int waferU, int waferV, bool fullAndPart=false) const
 
bool isValidHex8 (int lay, int modU, int modV, int cellU, int cellV, bool fullAndPart=false) const
 
bool isValidTrap (int lay, int ieta, int iphi) const
 
int lastLayer (bool reco) const
 
int layerIndex (int lay, bool reco) const
 
unsigned int layers (bool reco) const
 
unsigned int layersInit (bool reco) const
 
int levelTop (int ind=0) const
 
std::pair< float, float > localToGlobal8 (int lay, int waferU, int waferV, double localX, double localY, bool reco, bool debug) const
 
std::pair< float, float > locateCell (int cell, int lay, int type, bool reco) const
 
std::pair< float, float > locateCell (int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool norot=false, bool debug=false) const
 
std::pair< float, float > locateCell (const HGCSiliconDetId &, bool debug=false) const
 
std::pair< float, float > locateCell (const HGCScintillatorDetId &, bool debug=false) const
 
std::pair< float, float > locateCellHex (int cell, int wafer, bool reco) const
 
std::pair< float, float > locateCellTrap (int lay, int ieta, int iphi, bool reco) const
 
bool maskCell (const DetId &id, int corners) const
 
int maxCells (bool reco) const
 
int maxCells (int lay, bool reco) const
 
int maxCellUV () const
 
int maxModules () const
 
int maxModulesPerLayer () const
 
int maxRows (int lay, bool reco) const
 
double minSlope () const
 
int modifyUV (int uv, int type1, int type2) const
 
int modules (int lay, bool reco) const
 
int modulesInit (int lay, bool reco) const
 
double mouseBite (bool reco) const
 
int numberCells (bool reco) const
 
std::vector< int > numberCells (int lay, bool reco) const
 
int numberCellsHexagon (int wafer) const
 
int numberCellsHexagon (int lay, int waferU, int waferV, bool flag) const
 
std::pair< double, double > rangeR (double z, bool reco) const
 
std::pair< double, double > rangeRLayer (int lay, bool reco) const
 
std::pair< double, double > rangeZ (bool reco) const
 
std::pair< int, int > rowColumnWafer (const int wafer) const
 
int sectors () const
 
std::pair< int, int > simToReco (int cell, int layer, int mod, bool half) const
 
int tileCount (int layer, int ring) const
 
bool tileExist (int zside, int layer, int ring, int phi) const
 
std::pair< int, int > tileRings (int layer) const
 
int tileSiPM (int sipm) const
 
bool tileTrapezoid () const
 
std::pair< int, int > tileType (int layer, int ring, int phi) const
 
unsigned int volumes () const
 
int waferCount (const int type) const
 
int waferFileIndex (unsigned int kk) const
 
std::tuple< int, int, int > waferFileInfo (unsigned int kk) const
 
bool waferFileInfoExist (int kk) const
 
std::tuple< int, int, int > waferFileInfoFromIndex (int kk) const
 
unsigned int waferFileSize () const
 
int waferFromCopy (int copy) const
 
void waferFromPosition (const double x, const double y, int &wafer, int &icell, int &celltyp) const
 
void waferFromPosition (const double x, const double y, const int layer, int &waferU, int &waferV, int &cellU, int &cellV, int &celltype, double &wt, bool extend=false, bool debug=false) const
 
bool waferFullInLayer (int wafer, int lay, bool reco) const
 
bool waferHexagon6 () const
 
bool waferHexagon8 () const
 
bool waferInLayer (int wafer, int lay, bool reco) const
 
GlobalPoint waferLocal2Global (HepGeom::Point3D< float > &loc, const DetId &id, bool useWafer, bool reco, bool debug) const
 
int waferMax () const
 
int waferMin () const
 
std::pair< double, double > waferParameters (bool reco) const
 
std::pair< double, double > waferPosition (int wafer, bool reco) const
 
std::pair< double, double > waferPosition (int lay, int waferU, int waferV, bool reco, bool debug=false) const
 
int wafers () const
 
int wafers (int layer, int type) const
 
double waferSepar (bool reco) const
 
double waferSize (bool reco) const
 
int waferToCopy (int wafer) const
 
int waferType (DetId const &id, bool fromFile=false) const
 
int waferType (int layer, int waferU, int waferV, bool fromFile=false) const
 
std::tuple< int, int, int > waferType (HGCSiliconDetId const &id, bool fromFile=false) const
 
int waferTypeL (int wafer) const
 
std::pair< int, int > waferTypeRotation (int layer, int waferU, int waferV, bool fromFile=false, bool debug=false) const
 
int waferTypeT (int wafer) const
 
int waferUVMax () const
 
bool waferVirtual (int layer, int waferU, int waferV) const
 
double waferZ (int layer, bool reco) const
 
 ~HGCalDDDConstants ()
 

Private Types

typedef std::array< int, 3 > HGCWaferParam
 
typedef std::array< std::vector< int32_t >, 2 > Simrecovecs
 

Private Member Functions

int cellHex (double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
 
void cellHex (double xloc, double yloc, int cellType, int &cellU, int &cellV, bool extend=false, bool debug=false) const
 
std::pair< int, float > getIndex (int lay, bool reco) const
 
bool isValidCell (int layindex, int wafer, int cell) const
 
bool isValidCell8 (int lay, int waferU, int waferV, int cellU, int cellV, int type) const
 
int layerFromIndex (int index, bool reco) const
 
int32_t waferIndex (int wafer, int index) const
 
bool waferInLayerTest (int wafer, int lay, bool full) const
 
std::pair< double, double > waferPosition (int waferU, int waferV, bool reco) const
 
std::pair< double, double > waferPositionNoRot (int lay, int waferU, int waferV, bool reco, bool debug=false) const
 

Private Attributes

const float dPhiMin = 0.02
 
const bool fullAndPart_
 
HGCalGeomTools geomTools_
 
double hexside_
 
double hexsideT_
 
const HGCalParametershgpar_
 
const double k_horizontalShift = 1.0
 
Simrecovecs max_modules_layer_
 
int32_t maxWafersPerLayer_
 
const HGCalGeometryMode::GeometryMode mode_
 
int32_t modHalf_
 
double rmax_
 
double rmaxT_
 
const double sqrt3_
 
std::array< uint32_t, 2 > tot_layers_
 
int32_t tot_wafers_
 
std::unordered_map< int32_t, bool > waferIn_
 
std::map< int, HGCWaferParamwaferLayer_
 
std::array< int, 4 > waferMax_
 

Static Private Attributes

static constexpr double tan30deg_ = 0.5773502693
 

Detailed Description

this class reads the constant section of the numbering xml-files of the high granulairy calorimeter

Date
2014/03/20 00:06:50
Author
Sunanda Banerjee, SINP sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h

Definition at line 29 of file HGCalDDDConstants.h.

Member Typedef Documentation

◆ HGCWaferParam

typedef std::array<int, 3> HGCalDDDConstants::HGCWaferParam
private

Definition at line 273 of file HGCalDDDConstants.h.

◆ Simrecovecs

typedef std::array<std::vector<int32_t>, 2> HGCalDDDConstants::Simrecovecs
private

Definition at line 272 of file HGCalDDDConstants.h.

Constructor & Destructor Documentation

◆ HGCalDDDConstants()

HGCalDDDConstants::HGCalDDDConstants ( const HGCalParameters hp,
const std::string &  name 
)

Definition at line 28 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, funct::cos(), fullAndPart_, getIndex(), getTrForm(), getTrFormN(), hexside_, hexsideT_, hgpar_, mps_fire::i, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrform::lay, phase1PixelTopology::layer, layers(), layersInit(), SiStripPI::max, max_modules_layer_, maxCells(), maxWafersPerLayer_, mode_, modHalf_, modulesInit(), Skims_PA_cff::name, rmax_, rmaxT_, sectors(), HGCalParameters::sensorSeparation_, tan30deg_, tot_layers_, tot_wafers_, HGCalParameters::waferCopy_, waferHexagon6(), waferHexagon8(), waferIn_, HGCalWaferIndex::waferIndex(), waferInLayer(), waferLayer_, waferMax_, HGCalParameters::waferR_, wafers(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), cms::cuda::wmax, and cms::cuda::wmin.

29  : hgpar_(hp),
30  sqrt3_(std::sqrt(3.0)),
31  mode_(hgpar_->mode_),
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HGCalGeom") << "Mode " << mode_ << " FullAndPart " << fullAndPart_;
35 #endif
36  if (waferHexagon6() || waferHexagon8()) {
39  hexside_ = 2.0 * rmax_ * tan30deg_;
40  hexsideT_ = 2.0 * rmaxT_ * tan30deg_;
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("HGCalGeom") << "rmax_ " << rmax_ << ":" << rmaxT_ << ":" << hexside_ << ":" << hexsideT_
43  << " CellSize " << 0.5 * HGCalParameters::k_ScaleFromDDD * hgpar_->cellSize_[0] << ":"
45 #endif
46  }
47  // init maps and constants
48  modHalf_ = 0;
50  for (int simreco = 0; simreco < 2; ++simreco) {
51  tot_layers_[simreco] = layersInit((bool)simreco);
52  max_modules_layer_[simreco].resize(tot_layers_[simreco] + 1);
53  for (unsigned int layer = 1; layer <= tot_layers_[simreco]; ++layer) {
54  max_modules_layer_[simreco][layer] = modulesInit(layer, (bool)simreco);
55  if (simreco == 1) {
56  modHalf_ += max_modules_layer_[simreco][layer];
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with " << max_modules_layer_[simreco][layer] << ":"
60  << modHalf_ << " modules in RECO";
61  } else {
62  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with " << max_modules_layer_[simreco][layer]
63  << " modules in SIM";
64 #endif
65  }
66  }
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "SimReco " << simreco << " with " << tot_layers_[simreco] << " Layers";
69 #endif
70  }
71  tot_wafers_ = wafers();
72 
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants initialized for " << name << " with " << layers(false) << ":"
75  << layers(true) << " layers, " << wafers() << ":" << 2 * modHalf_
76  << " wafers with maximum " << maxWafersPerLayer_ << " per layer and "
77  << "maximum of " << maxCells(false) << ":" << maxCells(true) << " cells";
78 #endif
79  if (waferHexagon6() || waferHexagon8()) {
80  int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
81  for (unsigned int i = 0; i < getTrFormN(); ++i) {
82  int lay0 = getTrForm(i).lay;
83  int wmin(9999999), wmax(-9999999), kount(0);
84  for (int wafer = 0; wafer < sectors(); ++wafer) {
85  bool waferIn = waferInLayer(wafer, lay0, true);
86  if (waferHexagon8()) {
87  int kndx = HGCalWaferIndex::waferIndex(lay0,
90  waferIn_[kndx] = waferIn;
91  }
92  if (waferIn) {
93  int waferU = ((waferHexagon6()) ? wafer : HGCalWaferIndex::waferU(hgpar_->waferCopy_[wafer]));
94  if (waferU < wmin)
95  wmin = waferU;
96  if (waferU > wmax)
97  wmax = waferU;
98  ++kount;
99  }
100  }
101  if (wminT > wmin)
102  wminT = wmin;
103  if (wmaxT < wmax)
104  wmaxT = wmax;
105  if (kount1 < kount)
106  kount1 = kount;
107  kount2 += kount;
108 #ifdef EDM_ML_DEBUG
109  int lay1 = getIndex(lay0, true).first;
110  edm::LogVerbatim("HGCalGeom") << "Index " << i << " Layer " << lay0 << ":" << lay1 << " Wafer " << wmin << ":"
111  << wmax << ":" << kount;
112 #endif
113  HGCWaferParam a1{{wmin, wmax, kount}};
114  waferLayer_[lay0] = a1;
115  }
116  waferMax_ = std::array<int, 4>{{wminT, wmaxT, kount1, kount2}};
117 #ifdef EDM_ML_DEBUG
118  edm::LogVerbatim("HGCalGeom") << "Overall wafer statistics: " << wminT << ":" << wmaxT << ":" << kount1 << ":"
119  << kount2;
120 #endif
121  }
122 }
Log< level::Info, true > LogVerbatim
unsigned int layersInit(bool reco) const
Simrecovecs max_modules_layer_
int32_t waferU(const int32_t index)
bool waferHexagon8() const
int modulesInit(int lay, bool reco) const
std::unordered_map< int32_t, bool > waferIn_
bool waferHexagon6() const
HGCalGeometryMode::GeometryMode mode_
constexpr std::array< uint8_t, layerIndexSize > layer
bool waferInLayer(int wafer, int lay, bool reco) const
std::map< int, HGCWaferParam > waferLayer_
int maxCells(bool reco) const
std::vector< double > cellSize_
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::pair< int, float > getIndex(int lay, bool reco) const
unsigned int layers(bool reco) const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::array< int, 4 > waferMax_
unsigned int getTrFormN() const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
const HGCalGeometryMode::GeometryMode mode_
static constexpr double k_ScaleFromDDD
std::array< int, 3 > HGCWaferParam
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
static constexpr double tan30deg_
std::array< uint32_t, 2 > tot_layers_
__host__ __device__ V wmin
const HGCalParameters * hgpar_
__host__ __device__ V V wmax

◆ ~HGCalDDDConstants()

HGCalDDDConstants::~HGCalDDDConstants ( )

Definition at line 124 of file HGCalDDDConstants.cc.

124 {}

Member Function Documentation

◆ assignCell()

std::pair< int, int > HGCalDDDConstants::assignCell ( float  x,
float  y,
int  lay,
int  subSec,
bool  reco 
) const

Definition at line 126 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellHex(), HGCalParameters::cellSize_, getIndex(), hgpar_, HGCalParameters::k_ScaleFromDDD, dt_dqm_sourceclient_common_cff::reco, rmax_, findQualityFiles::size, waferHexagon6(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

Referenced by HGCNumberingScheme::assignCell(), and HGCalGeometry::getClosestCell().

126  {
127  const auto& index = getIndex(lay, reco);
128  if (index.first < 0)
129  return std::make_pair(-1, -1);
130  if (waferHexagon6()) {
131  float xx = (reco) ? x : HGCalParameters::k_ScaleFromDDD * x;
132  float yy = (reco) ? y : HGCalParameters::k_ScaleFromDDD * y;
133 
134  // First the wafer
135  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
136  if (wafer < 0 || wafer >= (int)(hgpar_->waferTypeT_.size())) {
137  edm::LogWarning("HGCalGeom") << "Wafer no. out of bound for " << wafer << ":" << (hgpar_->waferTypeT_).size()
138  << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
139  << " ***** ERROR *****";
140  return std::make_pair(-1, -1);
141  } else {
142  // Now the cell
143  xx -= hgpar_->waferPosX_[wafer];
144  yy -= hgpar_->waferPosY_[wafer];
145  if (hgpar_->waferTypeT_[wafer] == 1)
146  return std::make_pair(wafer,
147  cellHex(xx,
148  yy,
151  hgpar_->cellFineY_));
152  else
153  return std::make_pair(wafer,
154  cellHex(xx,
155  yy,
158  hgpar_->cellCoarseY_));
159  }
160  } else {
161  return std::make_pair(-1, -1);
162  }
163 }
size
Write out results.
std::vector< double > waferPosY_
std::vector< double > cellFineY_
bool waferHexagon6() const
std::vector< double > cellCoarseX_
std::vector< double > cellSize_
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > cellFineX_
static constexpr double k_ScaleFromDDD
fixed size matrix
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
Log< level::Warning, false > LogWarning
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const

◆ assignCellHex()

std::array< int, 5 > HGCalDDDConstants::assignCellHex ( float  x,
float  y,
int  lay,
bool  reco,
bool  extend = false,
bool  debug = false 
) const

Definition at line 165 of file HGCalDDDConstants.cc.

References debug, HGCalParameters::k_ScaleToDDD, dt_dqm_sourceclient_common_cff::reco, waferFromPosition(), waferHexagon8(), waferType(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

Referenced by HGCalGeometry::getClosestCell(), and HGCalGeometry::getClosestCellHex().

166  {
167  int waferU(0), waferV(0), waferType(-1), cellU(0), cellV(0);
168  if (waferHexagon8()) {
169  double xx = (reco) ? HGCalParameters::k_ScaleToDDD * x : x;
170  double yy = (reco) ? HGCalParameters::k_ScaleToDDD * y : y;
171  double wt(1.0);
172 #ifdef EDM_ML_DEBUG
173  edm::LogVerbatim("HGCalGeom") << "assignCellHex x " << x << ":" << xx << " y " << y << ":" << yy << " Lay " << lay;
174 #endif
175  waferFromPosition(xx, yy, lay, waferU, waferV, cellU, cellV, waferType, wt, extend, debug);
176  }
177  return std::array<int, 5>{{waferU, waferV, waferType, cellU, cellV}};
178 }
Log< level::Info, true > LogVerbatim
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
int32_t waferU(const int32_t index)
bool waferHexagon8() const
int waferType(DetId const &id, bool fromFile=false) const
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
int32_t waferV(const int32_t index)

◆ assignCellTrap()

std::array< int, 3 > HGCalDDDConstants::assignCellTrap ( float  x,
float  y,
float  z,
int  lay,
bool  reco 
) const

Definition at line 180 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, createfilelist::int, LEDCalibrationChannels::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleFromDDD, phase1PixelTopology::layer, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, M_PI, phi, alignCSCRings::r, HGCalParameters::radiusLayer_, HGCalParameters::scintType(), mathSSE::sqrt(), x, geometryCSVtoXML::xx, y, and z.

Referenced by HGCalGeometry::getClosestCell(), and HGCalNumberingScheme::getUnitID().

180  {
181  int irad(-1), iphi(-1), type(-1);
182  const auto& indx = getIndex(layer, reco);
183  if (indx.first < 0)
184  return std::array<int, 3>{{irad, iphi, type}};
185  double xx = (z > 0) ? x : -x;
186  double r = (reco ? std::sqrt(x * x + y * y) : HGCalParameters::k_ScaleFromDDD * std::sqrt(x * x + y * y));
187  double phi = (r == 0. ? 0. : std::atan2(y, xx));
188  if (phi < 0)
189  phi += (2.0 * M_PI);
191  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
192  irad = (int)(ir - hgpar_->radiusLayer_[type].begin());
193  irad = std::clamp(irad, hgpar_->iradMinBH_[indx.first], hgpar_->iradMaxBH_[indx.first]);
194  iphi = 1 + (int)(phi / indx.second);
195 #ifdef EDM_ML_DEBUG
196  edm::LogVerbatim("HGCalGeom") << "assignCellTrap Input " << x << ":" << y << ":" << z << ":" << layer << ":" << reco
197  << " x|r " << xx << ":" << r << " phi " << phi << " o/p " << irad << ":" << iphi << ":"
198  << type;
199 #endif
200  return std::array<int, 3>{{irad, iphi, type}};
201 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
int scintType(const int layer) const
constexpr std::array< uint8_t, layerIndexSize > layer
T sqrt(T t)
Definition: SSEVec.h:19
std::pair< int, float > getIndex(int lay, bool reco) const
#define M_PI
std::vector< int > iradMinBH_
fixed size matrix
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ cellEtaPhiTrap()

std::pair< double, double > HGCalDDDConstants::cellEtaPhiTrap ( int  type,
int  irad 
) const

Definition at line 203 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, hgcalPerformanceValidation::df, flavorHistoryFilter_cfi::dr, hgpar_, alignCSCRings::r, HGCalParameters::radiusLayer_, and tileTrapezoid().

203  {
204  double dr(0), df(0);
205  if (tileTrapezoid()) {
206  double r = 0.5 * ((hgpar_->radiusLayer_[type][irad - 1] + hgpar_->radiusLayer_[type][irad]));
207  dr = (hgpar_->radiusLayer_[type][irad] - hgpar_->radiusLayer_[type][irad - 1]);
208  df = r * hgpar_->cellSize_[type];
209  }
210  return std::make_pair(dr, df);
211 }
std::vector< double > cellSize_
bool tileTrapezoid() const
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ cellHex() [1/2]

int HGCalDDDConstants::cellHex ( double  xx,
double  yy,
const double &  cellR,
const std::vector< double > &  posX,
const std::vector< double > &  posY 
) const
private

Definition at line 1502 of file HGCalDDDConstants.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, dqmdumpme::k, EgammaValidation_cff::num, RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, tan30deg_, TrackerOfflineValidation_Dqm_cff::xmax, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

Referenced by assignCell(), and waferFromPosition().

1503  {
1504  int num(0);
1505  const double tol(0.00001);
1506  double cellY = 2.0 * cellR * tan30deg_;
1507  for (unsigned int k = 0; k < posX.size(); ++k) {
1508  double dx = std::abs(xx - posX[k]);
1509  double dy = std::abs(yy - posY[k]);
1510  if (dx <= (cellR + tol) && dy <= (cellY + tol)) {
1511  double xmax = (dy <= 0.5 * cellY) ? cellR : (cellR - (dy - 0.5 * cellY) / tan30deg_);
1512  if (dx <= (xmax + tol)) {
1513  num = k;
1514  break;
1515  }
1516  }
1517  }
1518  return num;
1519 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double tan30deg_

◆ cellHex() [2/2]

void HGCalDDDConstants::cellHex ( double  xloc,
double  yloc,
int  cellType,
int &  cellU,
int &  cellV,
bool  extend = false,
bool  debug = false 
) const
private

Definition at line 1521 of file HGCalDDDConstants.cc.

References funct::abs(), cellType(), debug, newFWLiteAna::found, hgpar_, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, SiStripPI::max, SiStripPI::min, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, rmax_, rmaxT_, edm::shift, sqrt3_, and V0Monitor_cff::v0.

1522  {
1523  int N = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1524  double Rc = 2 * rmax_ / (3 * N);
1525  double rc = 0.5 * Rc * sqrt3_;
1526  double RcT = (extend) ? (2 * rmaxT_ / (3 * N)) : Rc;
1527  double rcT = 0.5 * RcT * sqrt3_;
1528  double v0 = ((xloc / Rc - 1.0) / 1.5);
1529  int cv0 = (v0 > 0) ? (N + (int)(v0 + 0.5)) : (N - (int)(-v0 + 0.5));
1530  double u0 = (0.5 * yloc / rc + 0.5 * cv0);
1531  int cu0 = (u0 > 0) ? (N / 2 + (int)(u0 + 0.5)) : (N / 2 - (int)(-u0 + 0.5));
1532  cu0 = std::max(0, std::min(cu0, 2 * N - 1));
1533  cv0 = std::max(0, std::min(cv0, 2 * N - 1));
1534  if (cv0 - cu0 >= N)
1535  cv0 = cu0 + N - 1;
1536 #ifdef EDM_ML_DEBUG
1537  if (debug)
1538  edm::LogVerbatim("HGCalGeom") << "cellHex: input " << xloc << ":" << yloc << ":" << cellType << " parameter " << rc
1539  << ":" << Rc << " u0 " << u0 << ":" << cu0 << " v0 " << v0 << ":" << cv0;
1540 #endif
1541  bool found(false);
1542  static constexpr int shift[3] = {0, 1, -1};
1543  for (int i1 = 0; i1 < 3; ++i1) {
1544  cellU = cu0 + shift[i1];
1545  for (int i2 = 0; i2 < 3; ++i2) {
1546  cellV = cv0 + shift[i2];
1547  if (((cellV - cellU) < N) && ((cellU - cellV) <= N) && (cellU >= 0) && (cellV >= 0) && (cellU < 2 * N) &&
1548  (cellV < 2 * N)) {
1549  double xc = (1.5 * (cellV - N) + 1.0) * Rc;
1550  double yc = (2 * cellU - cellV - N) * rc;
1551  if ((std::abs(yloc - yc) <= rcT) && (std::abs(xloc - xc) <= RcT) &&
1552  ((std::abs(xloc - xc) <= 0.5 * RcT) || (std::abs(yloc - yc) <= sqrt3_ * (RcT - std::abs(xloc - xc))))) {
1553 #ifdef EDM_ML_DEBUG
1554  if (debug)
1555  edm::LogVerbatim("HGCalGeom")
1556  << "cellHex: local " << xc << ":" << yc << " difference " << std::abs(xloc - xc) << ":"
1557  << std::abs(yloc - yc) << ":" << sqrt3_ * (Rc - std::abs(yloc - yc)) << " comparator " << rc << ":"
1558  << Rc << " (u,v) = (" << cellU << "," << cellV << ")";
1559 #endif
1560  found = true;
1561  break;
1562  }
1563  }
1564  }
1565  if (found)
1566  break;
1567  }
1568  if (!found) {
1569  cellU = cu0;
1570  cellV = cv0;
1571  }
1572 }
Log< level::Info, true > LogVerbatim
int32_t cellType(int type, int waferU, int waferV, int iz, int fwdBack, int orient) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define debug
Definition: HDRShower.cc:19
#define N
Definition: blowfish.cc:9
static unsigned int const shift
const HGCalParameters * hgpar_

◆ cellInLayer()

bool HGCalDDDConstants::cellInLayer ( int  waferU,
int  waferV,
int  cellU,
int  cellV,
int  lay,
bool  reco 
) const

Definition at line 213 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, locateCell(), HGCalParameters::rMinLayHex_, mathSSE::sqrt(), waferHexagon6(), waferHexagon8(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and geometryCSVtoXML::xy.

Referenced by HGCalGeometry::newCell().

213  {
214  const auto& indx = getIndex(lay, true);
215  if (indx.first >= 0) {
216  if (waferHexagon8() || waferHexagon6()) {
217  const auto& xy = ((waferHexagon8()) ? locateCell(lay, waferU, waferV, cellU, cellV, reco, true, false, false)
218  : locateCell(cellU, lay, waferU, reco));
219  double rpos = sqrt(xy.first * xy.first + xy.second * xy.second);
220  return ((rpos >= hgpar_->rMinLayHex_[indx.first]) && (rpos <= hgpar_->rMaxLayHex_[indx.first]));
221  } else {
222  return true;
223  }
224  } else {
225  return false;
226  }
227 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
T sqrt(T t)
Definition: SSEVec.h:19
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > rMinLayHex_
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
fixed size matrix
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_

◆ cellSizeHex()

double HGCalDDDConstants::cellSizeHex ( int  type) const

Definition at line 242 of file HGCalDDDConstants.cc.

References HGCalParameters::cellSize_, hgpar_, HGCalParameters::k_ScaleFromDDD, tileTrapezoid(), and waferHexagon8().

Referenced by HGCalGeometryLoader::build(), and hgcal::RecHitTools::getRadiusToSide().

242  {
243  int indx = ((waferHexagon8()) ? ((type >= 1) ? 1 : 0) : ((type == 1) ? 1 : 0));
244  double cell = (tileTrapezoid() ? 0.5 * hgpar_->cellSize_[indx]
246  return cell;
247 }
bool waferHexagon8() const
std::vector< double > cellSize_
bool tileTrapezoid() const
static constexpr double k_ScaleFromDDD
const HGCalParameters * hgpar_

◆ cellSizeTrap()

std::pair<double, double> HGCalDDDConstants::cellSizeTrap ( int  type,
int  irad 
) const
inline

Definition at line 40 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::radiusLayer_.

Referenced by HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), and HGCalGeometry::getNewCorners().

40  {
41  return std::make_pair(hgpar_->radiusLayer_[type][irad - 1], hgpar_->radiusLayer_[type][irad]);
42  }
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ cellThickness()

double HGCalDDDConstants::cellThickness ( int  layer,
int  waferU,
int  waferV 
) const

Definition at line 229 of file HGCalDDDConstants.cc.

References HGCalParameters::cellThickness_, hgpar_, phase1PixelTopology::layer, waferHexagon6(), waferHexagon8(), waferType(), HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

Referenced by HGCalTBAnalyzer::analyzeSimHits(), and hgcal::RecHitTools::getSiThickness().

229  {
230  double thick(-1);
231  int type = waferType(layer, waferU, waferV, false);
232  if (type >= 0) {
233  if (waferHexagon8()) {
234  thick = 10000.0 * hgpar_->cellThickness_[type]; // cm to micron
235  } else if (waferHexagon6()) {
236  thick = 100.0 * (type + 1); // type = 1,2,3 for 100,200,300 micron
237  }
238  }
239  return thick;
240 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
constexpr std::array< uint8_t, layerIndexSize > layer
int waferType(DetId const &id, bool fromFile=false) const
std::vector< double > cellThickness_
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_

◆ cellType()

int32_t HGCalDDDConstants::cellType ( int  type,
int  waferU,
int  waferV,
int  iz,
int  fwdBack,
int  orient 
) const

Definition at line 249 of file HGCalDDDConstants.cc.

References HGCalCell::cellPlacementIndex(), HGCalCell::cellPlacementOld, HGCalCell::cellType(), hgpar_, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, and hgcalPerformanceValidation::orient.

Referenced by cellHex(), and HGCalTopology::neighbors().

249  {
250  int placement = (orient < 0) ? HGCalCell::cellPlacementOld : HGCalCell::cellPlacementIndex(iz, fwdBack, orient);
251  int ncell = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
252  auto cellType = HGCalCell::cellType(cellU, cellV, ncell, placement);
253  return cellType.first;
254 }
static constexpr int32_t cellPlacementOld
Definition: HGCalCell.h:25
static std::pair< int32_t, int32_t > cellType(int32_t u, int32_t v, int32_t ncell, int32_t placementIndex)
Definition: HGCalCell.cc:242
int32_t cellType(int type, int waferU, int waferV, int iz, int fwdBack, int orient) const
static int32_t cellPlacementIndex(int32_t iz, int32_t fwdBack, int32_t orient)
Definition: HGCalCell.cc:230
const HGCalParameters * hgpar_

◆ distFromEdgeHex()

double HGCalDDDConstants::distFromEdgeHex ( double  x,
double  y,
double  z 
) const

Definition at line 256 of file HGCalDDDConstants.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, getLayer(), hexside_, hgpar_, createfilelist::int, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, layerIndex(), rmax_, sqrt3_, tan30deg_, waferHexagon8(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, x, HGCalParameters::xLayerHex_, geometryCSVtoXML::xx, y, HGCalParameters::yLayerHex_, geometryCSVtoXML::yy, and z.

Referenced by HFNoseSD::isItinFidVolume(), and HGCalSD::isItinFidVolume().

256  {
257  // Assming the point is within a hexagonal plane of the wafer, calculate
258  // the shortest distance from the edge
259  if (z < 0)
260  x = -x;
261  double dist(0);
262  // Input x, y in Geant4 unit and transformed to CMSSW standard
265  if (waferHexagon8()) {
266  int ll = layerIndex(getLayer(z, false), false);
267  xx -= hgpar_->xLayerHex_[ll];
268  yy -= hgpar_->yLayerHex_[ll];
269  }
270  int sizew = (int)(hgpar_->waferPosX_.size());
271  int wafer = sizew;
272  // Transform to the local coordinate frame of the wafer first
273  for (int k = 0; k < sizew; ++k) {
274  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
275  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
276  if ((dx <= rmax_) && (dy <= hexside_) && ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy)))) {
277  wafer = k;
278  xx -= hgpar_->waferPosX_[k];
279  yy -= hgpar_->waferPosY_[k];
280  break;
281  }
282  }
283  // Look at only one quarter (both x,y are positive)
284  if (wafer < sizew) {
285  if (std::abs(yy) < 0.5 * hexside_) {
286  dist = rmax_ - std::abs(xx);
287  } else {
288  dist = 0.5 * ((rmax_ - std::abs(xx)) - sqrt3_ * (std::abs(yy) - 0.5 * hexside_));
289  }
290  } else {
291  dist = 0;
292  }
294 #ifdef EDM_ML_DEBUG
295  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeHex: Local " << xx << ":" << yy << " wafer " << wafer << " flag "
296  << (wafer < sizew) << " Distance " << rmax_ << ":" << (rmax_ - std::abs(xx)) << ":"
297  << (std::abs(yy) - 0.5 * hexside_) << ":" << 0.5 * hexside_ << ":" << dist;
298 #endif
299  return dist;
300 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
bool waferHexagon8() const
std::vector< double > yLayerHex_
int layerIndex(int lay, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr double k_ScaleToDDD
static constexpr double k_ScaleFromDDD
int getLayer(double z, bool reco) const
static constexpr double tan30deg_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::vector< double > xLayerHex_

◆ distFromEdgeTrap()

double HGCalDDDConstants::distFromEdgeTrap ( double  x,
double  y,
double  z 
) const

Definition at line 302 of file HGCalDDDConstants.cc.

References funct::abs(), getLayer(), hgpar_, createfilelist::int, LEDCalibrationChannels::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, layerIndex(), pfDeepBoostedJetPreprocessParams_cfi::lower_bound, M_PI, SiStripPI::max, SiStripPI::min, phi, alignCSCRings::r, HGCalParameters::radiusLayer_, HGCalParameters::scintCellSize(), HGCalParameters::scintType(), mathSSE::sqrt(), x, geometryCSVtoXML::xx, y, and z.

Referenced by HGCScintSD::isItinFidVolume().

302  {
303  // Assming the point is within the eta-phi plane of the scintillator tile,
304  // calculate the shortest distance from the edge
305  int lay = getLayer(z, false);
306  double xx = (z < 0) ? -x : x;
307  int indx = layerIndex(lay, false);
308  double r = HGCalParameters::k_ScaleFromDDD * std::sqrt(x * x + y * y);
309  double phi = (r == 0. ? 0. : std::atan2(y, xx));
310  if (phi < 0)
311  phi += (2.0 * M_PI);
312  int type = hgpar_->scintType(lay);
313  double cell = hgpar_->scintCellSize(lay);
314  // Compare with the center of the tile find distances along R and also phi
315  // Take the smaller value
316  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
317  int irad = (int)(ir - hgpar_->radiusLayer_[type].begin());
318  irad = std::clamp(irad, hgpar_->iradMinBH_[indx], hgpar_->iradMaxBH_[indx]);
319  int iphi = 1 + (int)(phi / cell);
320  double dphi = std::max(0.0, (0.5 * cell - std::abs(phi - (iphi - 0.5) * cell)));
321  double dist = std::min((r - hgpar_->radiusLayer_[type][irad - 1]), (hgpar_->radiusLayer_[type][irad] - r));
322 #ifdef EDM_ML_DEBUG
323  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeTrap: Global " << x << ":" << y << ":" << z << " Layer " << lay
324  << " Index " << indx << ":" << type << " xx " << xx << " R " << r << ":" << irad << ":"
325  << hgpar_->radiusLayer_[type][irad - 1] << ":" << hgpar_->radiusLayer_[type][irad]
326  << " Phi " << phi << ":" << iphi << ":" << (iphi - 0.5) * cell << " cell " << cell
327  << " Dphi " << dphi << " Dist " << dist << ":" << r * dphi;
328 #endif
329  return HGCalParameters::k_ScaleToDDD * std::min(r * dphi, dist);
330 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
int scintType(const int layer) const
double scintCellSize(const int layer) const
T sqrt(T t)
Definition: SSEVec.h:19
int layerIndex(int lay, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
static constexpr double k_ScaleToDDD
std::vector< int > iradMinBH_
static constexpr double k_ScaleFromDDD
int getLayer(double z, bool reco) const
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ etaPhiFromPosition()

void HGCalDDDConstants::etaPhiFromPosition ( const double  x,
const double  y,
const double  z,
const int  layer,
int &  ieta,
int &  iphi,
int &  type,
double &  wt 
) const

◆ firstLayer()

int HGCalDDDConstants::firstLayer ( ) const
inline

◆ geomMode()

HGCalGeometryMode::GeometryMode HGCalDDDConstants::geomMode ( ) const
inline

◆ getIndex()

std::pair< int, float > HGCalDDDConstants::getIndex ( int  lay,
bool  reco 
) const
private

Definition at line 1574 of file HGCalDDDConstants.cc.

References hgpar_, layerIndex(), HGCalParameters::moduleCellR_, HGCalParameters::moduleCellS_, HGCalParameters::scintCellSize(), waferHexagon6(), and waferHexagon8().

Referenced by assignCell(), assignCellTrap(), cellInLayer(), HGCalDDDConstants(), isValidTrap(), locateCell(), locateCellTrap(), maxCells(), maxRows(), modules(), modulesInit(), numberCells(), rangeRLayer(), simToReco(), waferFullInLayer(), waferInLayer(), wafers(), and waferZ().

1574  {
1575  int indx = layerIndex(lay, reco);
1576  if (indx < 0)
1577  return std::make_pair(-1, 0);
1578  float cell(0);
1579  if (waferHexagon6()) {
1580  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1581  } else {
1582  if (waferHexagon8()) {
1583  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1584  } else {
1585  cell = hgpar_->scintCellSize(lay);
1586  }
1587  }
1588  return std::make_pair(indx, cell);
1589 }
std::vector< double > moduleCellR_
bool waferHexagon8() const
bool waferHexagon6() const
double scintCellSize(const int layer) const
int layerIndex(int lay, bool reco) const
std::vector< double > moduleCellS_
fixed size matrix
const HGCalParameters * hgpar_

◆ getLayer()

int HGCalDDDConstants::getLayer ( double  z,
bool  reco 
) const

Definition at line 332 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::firstLayer_, hgpar_, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerGroupO_, layerIndex(), dt_dqm_sourceclient_common_cff::reco, waferHexagon6(), z, HGCalParameters::zLayerHex_, and geometryCSVtoXML::zz.

Referenced by distFromEdgeHex(), distFromEdgeTrap(), HGCMouseBite::exclude(), HGCalGeometry::getClosestCell(), and HGCalGeometry::getClosestCellHex().

332  {
333  // Get the layer # from the gloabl z coordinate
334  unsigned int k = 0;
335  double zz = (reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD * std::abs(z));
336  const auto& zLayerHex = hgpar_->zLayerHex_;
337  auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&k, &zz, &zLayerHex](double zLayer) {
338  ++k;
339  return zz < 0.5 * (zLayerHex[k - 1] + zLayerHex[k]);
340  });
341  int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) : k;
342  if (waferHexagon6() && reco) {
343  int indx = layerIndex(lay, false);
344  if (indx >= 0)
345  lay = hgpar_->layerGroupO_[indx];
346  } else {
347  lay += (hgpar_->firstLayer_ - 1);
348  }
349  return lay;
350 }
bool waferHexagon6() const
int layerIndex(int lay, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > zLayerHex_
std::vector< int > layerGroupO_
fixed size matrix
const HGCalParameters * hgpar_

◆ getLayerOffset()

int HGCalDDDConstants::getLayerOffset ( ) const
inline

Definition at line 58 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::layerOffset_.

Referenced by HGCalNumberingScheme::getUnitID().

58 { return hgpar_->layerOffset_; }
const HGCalParameters * hgpar_

◆ getModule()

HGCalParameters::hgtrap HGCalDDDConstants::getModule ( unsigned int  k,
bool  hexType,
bool  reco 
) const

Definition at line 352 of file HGCalDDDConstants.cc.

References HGCalParameters::getModule(), HGCSiliconDetId::HGCalCoarseThick, hgpar_, findQualityFiles::size, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, and HGCalParameters::waferTypeL_.

Referenced by HGCalGeometryLoader::build(), and HGCalGeometry::getSummary().

352  {
354  if (hexType) {
355  if (indx >= hgpar_->waferTypeL_.size())
356  edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx << ":" << (hgpar_->waferTypeL_).size()
357  << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
358  << " ***** ERROR *****";
359  unsigned int type =
360  ((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx] - 1 : HGCSiliconDetId::HGCalCoarseThick);
361  mytr = hgpar_->getModule(type, reco);
362  } else {
363  mytr = hgpar_->getModule(indx, reco);
364  }
365  return mytr;
366 }
size
Write out results.
std::vector< double > waferPosY_
hgtrap getModule(unsigned int k, bool reco) const
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_

◆ getModules()

std::vector< HGCalParameters::hgtrap > HGCalDDDConstants::getModules ( ) const

Definition at line 368 of file HGCalDDDConstants.cc.

References HGCalParameters::getModule(), hgpar_, dqmdumpme::k, and HGCalParameters::moduleLayR_.

368  {
369  std::vector<HGCalParameters::hgtrap> mytrs;
370  for (unsigned int k = 0; k < hgpar_->moduleLayR_.size(); ++k)
371  mytrs.emplace_back(hgpar_->getModule(k, true));
372  return mytrs;
373 }
hgtrap getModule(unsigned int k, bool reco) const
std::vector< int > moduleLayR_
const HGCalParameters * hgpar_

◆ getParameter()

const HGCalParameters* HGCalDDDConstants::getParameter ( ) const
inline

Definition at line 61 of file HGCalDDDConstants.h.

References hgpar_.

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getSummary(), and HeterogeneousHGCalHEFCellPositionsFiller::produce().

61 { return hgpar_; }
const HGCalParameters * hgpar_

◆ getPhiBins()

int HGCalDDDConstants::getPhiBins ( int  lay) const

Definition at line 375 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::scintCells(), and tileTrapezoid().

375 { return (tileTrapezoid() ? hgpar_->scintCells(lay) : 0); }
bool tileTrapezoid() const
const HGCalParameters * hgpar_
int scintCells(const int layer) const

◆ getRadiusLayer()

const std::vector<double>& HGCalDDDConstants::getRadiusLayer ( int  layer) const
inline

Definition at line 64 of file HGCalDDDConstants.h.

References hgpar_, phase1PixelTopology::layer, HGCalParameters::radiusLayer_, HGCalParameters::scintType(), and tileTrapezoid().

64  {
65  int type = (tileTrapezoid() ? hgpar_->scintType(layer) : 0);
66  return hgpar_->radiusLayer_[type];
67  }
int scintType(const int layer) const
constexpr std::array< uint8_t, layerIndexSize > layer
bool tileTrapezoid() const
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ getREtaRange()

std::pair< int, int > HGCalDDDConstants::getREtaRange ( int  lay) const

Definition at line 377 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, layerIndex(), and tileTrapezoid().

Referenced by HGCalTriggerGeometryV9Imp2::getModuleFromTriggerCell(), and HGCalTriggerGeometryV9Imp2::getTriggerCellsFromModule().

377  {
378  int irmin(0), irmax(0);
379  if (tileTrapezoid()) {
380  int indx = layerIndex(lay, false);
381  if ((indx >= 0) && (indx < static_cast<int>(hgpar_->iradMinBH_.size()))) {
382  irmin = hgpar_->iradMinBH_[indx];
383  irmax = hgpar_->iradMaxBH_[indx];
384  }
385  }
386  return std::make_pair(irmin, irmax);
387 }
std::vector< int > iradMaxBH_
int layerIndex(int lay, bool reco) const
bool tileTrapezoid() const
std::vector< int > iradMinBH_
const HGCalParameters * hgpar_

◆ getTrForm()

HGCalParameters::hgtrform HGCalDDDConstants::getTrForm ( unsigned int  k) const
inline

Definition at line 68 of file HGCalDDDConstants.h.

References HGCalParameters::getTrForm(), hgpar_, and dqmdumpme::k.

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getSummary(), and HGCalDDDConstants().

68 { return hgpar_->getTrForm(k); }
hgtrform getTrForm(unsigned int k) const
const HGCalParameters * hgpar_

◆ getTrFormN()

unsigned int HGCalDDDConstants::getTrFormN ( ) const
inline

Definition at line 69 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::trformIndex_.

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getSummary(), and HGCalDDDConstants().

69 { return hgpar_->trformIndex_.size(); }
std::vector< uint32_t > trformIndex_
const HGCalParameters * hgpar_

◆ getTrForms()

std::vector< HGCalParameters::hgtrform > HGCalDDDConstants::getTrForms ( ) const

Definition at line 389 of file HGCalDDDConstants.cc.

References HGCalParameters::getTrForm(), hgpar_, dqmdumpme::k, and HGCalParameters::trformIndex_.

Referenced by HGCalTrackCollectionProducer::beginLuminosityBlock().

389  {
390  std::vector<HGCalParameters::hgtrform> mytrs;
391  for (unsigned int k = 0; k < hgpar_->trformIndex_.size(); ++k)
392  mytrs.emplace_back(hgpar_->getTrForm(k));
393  return mytrs;
394 }
std::vector< uint32_t > trformIndex_
hgtrform getTrForm(unsigned int k) const
const HGCalParameters * hgpar_

◆ getTypeHex()

int HGCalDDDConstants::getTypeHex ( int  layer,
int  waferU,
int  waferV 
) const

Definition at line 405 of file HGCalDDDConstants.cc.

References hgpar_, phase1PixelTopology::layer, HGCalParameters::typesInLayers_, waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

Referenced by HGCalGeometryLoader::build(), HGCalTriggerGeometryV9Imp2::detIdWaferType(), HGCalTriggerGeometryV9Imp3::detIdWaferType(), and HGCalTopology::neighbors().

405  {
406  // Get the module type for a silicon wafer
407  if (waferHexagon8()) {
409  return ((itr == hgpar_->typesInLayers_.end() ? 2 : hgpar_->waferTypeL_[itr->second]));
410  } else {
411  return -1;
412  }
413 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
wafer_map typesInLayers_
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ getTypeTrap()

int HGCalDDDConstants::getTypeTrap ( int  layer) const

Definition at line 396 of file HGCalDDDConstants.cc.

References hgpar_, phase1PixelTopology::layer, HGCalParameters::scintType(), and tileTrapezoid().

Referenced by HGCalTriggerGeometryV9Imp3::detIdWaferType().

396  {
397  // Get the module type for scinitllator
398  if (tileTrapezoid()) {
399  return hgpar_->scintType(layer);
400  } else {
401  return -1;
402  }
403 }
int scintType(const int layer) const
constexpr std::array< uint8_t, layerIndexSize > layer
bool tileTrapezoid() const
const HGCalParameters * hgpar_

◆ getUVMax()

int HGCalDDDConstants::getUVMax ( int  type) const
inline

◆ getXY()

std::pair< double, double > HGCalDDDConstants::getXY ( int  layer,
double  x,
double  y,
bool  forwd 
) const

Definition at line 415 of file HGCalDDDConstants.cc.

References HGCalParameters::firstLayer_, hgpar_, phase1PixelTopology::layer, HGCalParameters::layerRotV_, HGCalParameters::layerType_, x, testProducerWithPsetDescEmpty_cfi::x1, y, and testProducerWithPsetDescEmpty_cfi::y1.

Referenced by localToGlobal8(), locateCell(), waferFromPosition(), waferLocal2Global(), and waferPosition().

415  {
416  int ll = layer - hgpar_->firstLayer_;
417  double x0(x), y0(y);
418  if ((!hgpar_->layerType_.empty()) && (ll < static_cast<int>(hgpar_->layerRotV_.size()))) {
419  if (forwd) {
420  x0 = x * hgpar_->layerRotV_[ll].first + y * hgpar_->layerRotV_[ll].second;
421  y0 = y * hgpar_->layerRotV_[ll].first - x * hgpar_->layerRotV_[ll].second;
422  } else {
423  x0 = x * hgpar_->layerRotV_[ll].first - y * hgpar_->layerRotV_[ll].second;
424  y0 = y * hgpar_->layerRotV_[ll].first + x * hgpar_->layerRotV_[ll].second;
425  }
426  }
427 #ifdef EDM_ML_DEBUG
428  double x1(x0), y1(y0);
429  if (ll < static_cast<int>(hgpar_->layerRotV_.size())) {
430  if (forwd) {
431  x1 = x0 * hgpar_->layerRotV_[ll].first - y0 * hgpar_->layerRotV_[ll].second;
432  y1 = y0 * hgpar_->layerRotV_[ll].first + x0 * hgpar_->layerRotV_[ll].second;
433  } else {
434  x1 = x0 * hgpar_->layerRotV_[ll].first + y0 * hgpar_->layerRotV_[ll].second;
435  y1 = y0 * hgpar_->layerRotV_[ll].first - x0 * hgpar_->layerRotV_[ll].second;
436  }
437  }
438  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << layer << ":" << ll << " mode " << forwd << " x " << x
439  << ":" << x0 << ":" << x1 << " y " << y << ":" << y0 << ":" << y1;
440 #endif
441  return std::make_pair(x0, y0);
442 }
Log< level::Info, true > LogVerbatim
std::vector< std::pair< double, double > > layerRotV_
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< int > layerType_
const HGCalParameters * hgpar_

◆ isHalfCell()

bool HGCalDDDConstants::isHalfCell ( int  waferType,
int  cell 
) const

Definition at line 444 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseHalf_, HGCalParameters::cellFineHalf_, hgpar_, and waferType().

Referenced by hgcal::RecHitTools::isHalfCell().

444  {
445  if (waferType < 1 || cell < 0)
446  return false;
447  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
448 }
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
int waferType(DetId const &id, bool fromFile=false) const
const HGCalParameters * hgpar_

◆ isValidCell()

bool HGCalDDDConstants::isValidCell ( int  layindex,
int  wafer,
int  cell 
) const
private

Definition at line 1611 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, HGCSiliconDetId::HGCalFine, hgpar_, createfilelist::int, mps_fire::result, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, and y.

Referenced by isValidHex().

1611  {
1612  // Calculate the position of the cell
1613  // Works for options HGCalHexagon/HGCalHexagonFull
1614  double x = hgpar_->waferPosX_[wafer];
1615  double y = hgpar_->waferPosY_[wafer];
1616  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
1617  x += hgpar_->cellFineX_[cell];
1618  y += hgpar_->cellFineY_[cell];
1619  } else {
1620  x += hgpar_->cellCoarseX_[cell];
1621  y += hgpar_->cellCoarseY_[cell];
1622  }
1623  double rr = sqrt(x * x + y * y);
1624  bool result = ((rr >= hgpar_->rMinLayHex_[lay - 1]) && (rr <= hgpar_->rMaxLayHex_[lay - 1]) &&
1625  (wafer < (int)(hgpar_->waferPosX_.size())));
1626 #ifdef EDM_ML_DEBUG
1627  if (!result)
1628  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << wafer << ":" << cell << " Position " << x << ":" << y
1629  << ":" << rr << " Compare Limits " << hgpar_->rMinLayHex_[lay - 1] << ":"
1630  << hgpar_->rMaxLayHex_[lay - 1] << " Flag " << result;
1631 #endif
1632  return result;
1633 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
std::vector< double > cellFineX_
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_

◆ isValidCell8()

bool HGCalDDDConstants::isValidCell8 ( int  lay,
int  waferU,
int  waferV,
int  cellU,
int  cellV,
int  type 
) const
private

Definition at line 1635 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseIndex_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineIndex_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, HGCalParameters::firstLayer_, HGCalWaferMask::goodCell(), HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Module, hgpar_, mode_, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, mps_fire::result, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), waferPositionNoRot(), waferTypeRotation(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, geometryCSVtoXML::xy, and y.

Referenced by isValidHex8().

1635  {
1636  float x(0), y(0);
1637  int kndx = cellV * 100 + cellU;
1638  if (type == 0) {
1639  auto ktr = hgpar_->cellFineIndex_.find(kndx);
1640  if (ktr != hgpar_->cellFineIndex_.end()) {
1641  x = hgpar_->cellFineX_[ktr->second];
1642  y = hgpar_->cellFineY_[ktr->second];
1643  }
1644 #ifdef EDM_ML_DEBUG
1645  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
1646  << (ktr != hgpar_->cellFineIndex_.end());
1647 #endif
1648  } else {
1649  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
1650  if (ktr != hgpar_->cellCoarseIndex_.end()) {
1651  x = hgpar_->cellCoarseX_[ktr->second];
1652  y = hgpar_->cellCoarseY_[ktr->second];
1653  }
1654 #ifdef EDM_ML_DEBUG
1655  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
1656  << (ktr != hgpar_->cellCoarseIndex_.end());
1657 #endif
1658  }
1659  const auto& xy = waferPositionNoRot(lay, waferU, waferV, true, false);
1660  x += xy.first;
1661  y += xy.second;
1662 #ifdef EDM_ML_DEBUG
1663  edm::LogVerbatim("HGCalGeom") << "With wafer (" << waferU << "," << waferV << ") " << x << ":" << y;
1664 #endif
1665  double rr = sqrt(x * x + y * y);
1666  int ll = lay - hgpar_->firstLayer_;
1667  bool result = ((rr >= hgpar_->rMinLayHex_[ll]) && (rr <= hgpar_->rMaxLayHex_[ll]));
1668 #ifdef EDM_ML_DEBUG
1669  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << ll << ":" << waferU << ":" << waferV << ":" << cellU << ":"
1670  << cellV << " Position " << x << ":" << y << ":" << rr << " Compare Limits "
1671  << hgpar_->rMinLayHex_[ll] << ":" << hgpar_->rMaxLayHex_[ll] << " Flag " << result;
1672 #endif
1674  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1675  auto partn = waferTypeRotation(lay, waferU, waferV, false, false);
1676  result = HGCalWaferMask::goodCell(cellU, cellV, N, partn.first, partn.second);
1677 #ifdef EDM_ML_DEBUG
1678  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV
1679  << " N " << N << " part " << partn.first << ":" << partn.second << " Result "
1680  << result;
1681 #endif
1682  }
1683  return result;
1684 }
Log< level::Info, true > LogVerbatim
wafer_map cellFineIndex_
int32_t waferU(const int32_t index)
static bool goodCell(int u, int v, int N, int type, int rotn)
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile=false, bool debug=false) const
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
#define N
Definition: blowfish.cc:9
wafer_map cellCoarseIndex_
std::vector< double > cellFineX_
const HGCalGeometryMode::GeometryMode mode_
int32_t waferV(const int32_t index)
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug=false) const
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_

◆ isValidHex()

bool HGCalDDDConstants::isValidHex ( int  lay,
int  mod,
int  cell,
bool  reco 
) const

Definition at line 450 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCalParameters::copiesInLayers_, HGCSiliconDetId::HGCalFine, hgpar_, createfilelist::int, isValidCell(), layers(), maxCells(), mod(), mps_fire::result, findQualityFiles::size, HGCalParameters::waferCopy_, waferHexagon6(), and HGCalParameters::waferTypeT_.

Referenced by HGCNumberingScheme::getUnitID(), and HGCalTopology::valid().

450  {
451  // Check validity for a layer|wafer|cell of pre-TDR version
452  bool result(false), resultMod(false);
453  int cellmax(0);
454  if (waferHexagon6()) {
455  int32_t copyNumber = hgpar_->waferCopy_[mod];
456  result = ((lay > 0 && lay <= (int)(layers(reco))));
457  if (result) {
458  const int32_t lay_idx = reco ? (lay - 1) * 3 + 1 : lay;
459  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
460  auto moditr = the_modules.find(copyNumber);
461  result = resultMod = (moditr != the_modules.end());
462 #ifdef EDM_ML_DEBUG
463  if (!result)
464  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":" << lay_idx << " Copy " << copyNumber
465  << ":" << mod << " Flag " << result;
466 #endif
467  if (result) {
468  if (moditr->second >= 0) {
469  if (mod >= (int)(hgpar_->waferTypeT_.size()))
470  edm::LogWarning("HGCalGeom") << "Module no. out of bound for " << mod << " to be compared with "
471  << (hgpar_->waferTypeT_).size() << " ***** ERROR *****";
472  cellmax = ((hgpar_->waferTypeT_[mod] - 1 == HGCSiliconDetId::HGCalFine) ? (int)(hgpar_->cellFineX_.size())
473  : (int)(hgpar_->cellCoarseX_.size()));
474  result = (cell >= 0 && cell <= cellmax);
475  } else {
476  result = isValidCell(lay_idx, mod, cell);
477  }
478  }
479  }
480  }
481 
482 #ifdef EDM_ML_DEBUG
483  if (!result)
484  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":"
485  << (lay > 0 && (lay <= (int)(layers(reco)))) << " Module " << mod << ":" << resultMod
486  << " Cell " << cell << ":" << cellmax << ":" << (cell >= 0 && cell <= cellmax) << ":"
487  << maxCells(reco);
488 #endif
489  return result;
490 }
size
Write out results.
Log< level::Info, true > LogVerbatim
bool isValidCell(int layindex, int wafer, int cell) const
layer_map copiesInLayers_
bool waferHexagon6() const
std::vector< double > cellCoarseX_
int maxCells(bool reco) const
unsigned int layers(bool reco) const
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferCopy_
std::vector< int > waferTypeT_
Log< level::Warning, false > LogWarning
const HGCalParameters * hgpar_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ isValidHex8() [1/2]

bool HGCalDDDConstants::isValidHex8 ( int  lay,
int  waferU,
int  waferV,
bool  fullAndPart = false 
) const

Definition at line 492 of file HGCalDDDConstants.cc.

References fullAndPart_, hgpar_, phase1PixelTopology::layer, HGCalParameters::typesInLayers_, HGCalTypes::WaferCornerMin, waferIn_, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalParameters::waferMaskMode_, HGCalTypes::WaferOut, and HGCalParameters::waferTypes_.

Referenced by HGCalTopology::addHGCSiliconId(), isValidHex8(), HGCalTopology::valid(), and HGCalTopology::validModule().

492  {
493  // Check validity for a layer|wafer|cell of post-TDR version
494  int indx = HGCalWaferIndex::waferIndex(layer, modU, modV);
495  auto itr = hgpar_->typesInLayers_.find(indx);
496 #ifdef EDM_ML_DEBUG
497  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferType " << layer << ":" << modU << ":" << modV
498  << ":" << indx << " Test " << (itr != hgpar_->typesInLayers_.end());
499 #endif
500  if (itr == hgpar_->typesInLayers_.end())
501  return false;
502 
503  if (fullAndPart_) {
504  auto ktr = hgpar_->waferInfoMap_.find(indx);
505 #ifdef EDM_ML_DEBUG
506  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferInfoMap " << layer << ":" << modU << ":"
507  << modV << ":" << indx << " Test " << (ktr != hgpar_->waferInfoMap_.end());
508 #endif
509  if (ktr == hgpar_->waferInfoMap_.end())
510  return false;
511  } else {
512  auto jtr = waferIn_.find(indx);
513 #ifdef EDM_ML_DEBUG
514  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferIn " << jtr->first << ":" << jtr->second;
515 #endif
516  if (!(jtr->second))
517  return false;
518  }
519 
520  if (fullAndPart || fullAndPart_) {
521  auto ktr = hgpar_->waferTypes_.find(indx);
522  if (ktr != hgpar_->waferTypes_.end()) {
523  if (hgpar_->waferMaskMode_ > 0) {
524  if (ktr->second.first == HGCalTypes::WaferOut)
525  return false;
526  } else {
527  if (ktr->second.first < HGCalTypes::WaferCornerMin)
528  return false;
529  }
530  }
531  }
532  return true;
533 }
Log< level::Info, true > LogVerbatim
static constexpr int32_t WaferOut
Definition: HGCalTypes.h:55
std::unordered_map< int32_t, bool > waferIn_
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
wafer_map typesInLayers_
static constexpr int32_t WaferCornerMin
Definition: HGCalTypes.h:73
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ isValidHex8() [2/2]

bool HGCalDDDConstants::isValidHex8 ( int  lay,
int  modU,
int  modV,
int  cellU,
int  cellV,
bool  fullAndPart = false 
) const

Definition at line 535 of file HGCalDDDConstants.cc.

References hgpar_, isValidCell8(), isValidHex8(), phase1PixelTopology::layer, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::typesInLayers_, HGCalWaferIndex::waferIndex(), and HGCalParameters::waferTypeL_.

535  {
536  // First check validity for a layer|wafer| of post TDR version
537  if (!isValidHex8(layer, modU, modV, fullAndPart))
538  return false;
539  int indx = HGCalWaferIndex::waferIndex(layer, modU, modV);
540  auto itr = hgpar_->typesInLayers_.find(indx);
541  int type = hgpar_->waferTypeL_[itr->second];
542  int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_);
543 #ifdef EDM_ML_DEBUG
544  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:Cell " << cellU << ":" << cellV << ":" << N
545  << " Tests " << (cellU >= 0) << ":" << (cellU < 2 * N) << ":" << (cellV >= 0) << ":"
546  << (cellV < 2 * N) << ":" << ((cellV - cellU) < N) << ":" << ((cellU - cellV) <= N);
547 #endif
548  if ((cellU < 0) || (cellU >= 2 * N) || (cellV < 0) || (cellV >= 2 * N))
549  return false;
550  if (((cellV - cellU) >= N) || ((cellU - cellV) > N))
551  return false;
552 
553  return isValidCell8(layer, modU, modV, cellU, cellV, type);
554 }
Log< level::Info, true > LogVerbatim
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart=false) const
constexpr std::array< uint8_t, layerIndexSize > layer
bool isValidCell8(int lay, int waferU, int waferV, int cellU, int cellV, int type) const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
#define N
Definition: blowfish.cc:9
wafer_map typesInLayers_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ isValidTrap()

bool HGCalDDDConstants::isValidTrap ( int  lay,
int  ieta,
int  iphi 
) const

Definition at line 556 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, LEDCalibrationChannels::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, and phase1PixelTopology::layer.

Referenced by HGCalTopology::addHGCSCintillatorId(), and HGCalTopology::valid().

556  {
557  // Check validity for a layer|eta|phi of scintillator
558  const auto& indx = getIndex(layer, true);
559  if (indx.first < 0)
560  return false;
561  return ((irad >= hgpar_->iradMinBH_[indx.first]) && (irad <= (hgpar_->iradMaxBH_[indx.first] + 1)) && (iphi > 0) &&
562  (iphi <= hgpar_->scintCells(layer)));
563 }
std::vector< int > iradMaxBH_
constexpr std::array< uint8_t, layerIndexSize > layer
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< int > iradMinBH_
const HGCalParameters * hgpar_

◆ lastLayer()

int HGCalDDDConstants::lastLayer ( bool  reco) const

Definition at line 565 of file HGCalDDDConstants.cc.

References HGCalParameters::firstLayer_, hgpar_, and tot_layers_.

Referenced by HGCalGeometry::neighborZ(), HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_(), and tileCount().

565 { return (hgpar_->firstLayer_ + tot_layers_[(int)reco] - 1); }
fixed size matrix
std::array< uint32_t, 2 > tot_layers_
const HGCalParameters * hgpar_

◆ layerFromIndex()

int HGCalDDDConstants::layerFromIndex ( int  index,
bool  reco 
) const
private

Definition at line 1591 of file HGCalDDDConstants.cc.

References HGCalParameters::depthLayerF_, spr::find(), HGCalParameters::firstLayer_, hgpar_, HGCalParameters::layerIndex_, and waferHexagon6().

Referenced by waferIndex().

1591  {
1592  int ll(-1);
1593  if (waferHexagon6() && reco) {
1594  ll = static_cast<int>(std::find(hgpar_->depthLayerF_.begin(), hgpar_->depthLayerF_.end(), index) -
1595  hgpar_->depthLayerF_.begin());
1596  if (ll == static_cast<int>(hgpar_->depthLayerF_.size()))
1597  ll = -1;
1598  } else {
1599  ll = static_cast<int>(std::find(hgpar_->layerIndex_.begin(), hgpar_->layerIndex_.end(), index) -
1600  hgpar_->layerIndex_.begin());
1601  if (ll == static_cast<int>(hgpar_->layerIndex_.size()))
1602  ll = -1;
1603  }
1604 #ifdef EDM_ML_DEBUG
1605  edm::LogVerbatim("HGCalGeom") << "LayerFromIndex for " << index << ":" << reco << ":" << waferHexagon6() << " is"
1606  << ll << ":" << (ll + hgpar_->firstLayer_);
1607 #endif
1608  return ((ll < 0) ? ll : (ll + hgpar_->firstLayer_));
1609 }
Log< level::Info, true > LogVerbatim
std::vector< int > depthLayerF_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool waferHexagon6() const
std::vector< int > layerIndex_
fixed size matrix
const HGCalParameters * hgpar_

◆ layerIndex()

int HGCalDDDConstants::layerIndex ( int  lay,
bool  reco 
) const

Definition at line 569 of file HGCalDDDConstants.cc.

References HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::firstLayer_, hgpar_, HGCalParameters::layerIndex_, and waferHexagon6().

Referenced by HGCalGeometryLoader::build(), distFromEdgeHex(), distFromEdgeTrap(), getIndex(), getLayer(), getREtaRange(), and HGCalGeometry::getSummary().

569  {
570  int ll = lay - hgpar_->firstLayer_;
571  if (ll < 0 || ll >= (int)(hgpar_->layerIndex_.size()))
572  return -1;
573  if (waferHexagon6()) {
574  if (reco && ll >= (int)(hgpar_->depthIndex_.size()))
575  return -1;
576  return (reco ? hgpar_->depthLayerF_[ll] : hgpar_->layerIndex_[ll]);
577  } else {
578  return (hgpar_->layerIndex_[ll]);
579  }
580 }
std::vector< int > depthLayerF_
bool waferHexagon6() const
std::vector< int > layerIndex_
fixed size matrix
std::vector< int > depthIndex_
const HGCalParameters * hgpar_

◆ layers()

unsigned int HGCalDDDConstants::layers ( bool  reco) const

◆ layersInit()

unsigned int HGCalDDDConstants::layersInit ( bool  reco) const

Definition at line 582 of file HGCalDDDConstants.cc.

References HGCalParameters::depthIndex_, hgpar_, and HGCalParameters::layerIndex_.

Referenced by HGCalDDDConstants().

582  {
583  return (reco ? hgpar_->depthIndex_.size() : hgpar_->layerIndex_.size());
584 }
std::vector< int > layerIndex_
fixed size matrix
std::vector< int > depthIndex_
const HGCalParameters * hgpar_

◆ levelTop()

int HGCalDDDConstants::levelTop ( int  ind = 0) const
inline

Definition at line 100 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::levelT_.

Referenced by SimG4HGCalValidation::beginRun(), HGCScintSD::update(), HGCalSD::update(), HFNoseSD::update(), and HGCSD::update().

100 { return hgpar_->levelT_[ind]; }
std::vector< int > levelT_
const HGCalParameters * hgpar_

◆ localToGlobal8()

std::pair< float, float > HGCalDDDConstants::localToGlobal8 ( int  lay,
int  waferU,
int  waferV,
double  localX,
double  localY,
bool  reco,
bool  debug 
) const

Definition at line 586 of file HGCalDDDConstants.cc.

References debug, HGCalParameters::firstLayer_, getXY(), hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::layerType_, phase1PixelTopology::localX(), pixelTopology::localY(), HGCalTypes::WaferCenterR, waferPositionNoRot(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, geometryCSVtoXML::xy, and y.

Referenced by HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), and HGCalGeometry::getNewCorners().

587  {
588  double x(localX), y(localY);
589  bool rotx =
591  if (debug)
592  edm::LogVerbatim("HGCalGeom") << "LocalToGlobal8 " << lay << ":" << (lay - hgpar_->firstLayer_) << ":" << rotx
593  << " Local (" << x << ":" << y << ") Reco " << reco;
594  if (!reco) {
597  }
598  const auto& xy = waferPositionNoRot(lay, waferU, waferV, reco, debug);
599  x += xy.first;
600  y += xy.second;
601  if (debug)
602  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << " by adding " << xy.first << ":" << xy.second;
603  return (rotx ? getXY(lay, x, y, false) : std::make_pair(x, y));
604 }
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
std::vector< int > layerType_
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:26
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
constexpr uint16_t localX(uint16_t px)
constexpr uint16_t localY(uint16_t py, uint16_t n)
fixed size matrix
int32_t waferV(const int32_t index)
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug=false) const
const HGCalParameters * hgpar_

◆ locateCell() [1/4]

std::pair< float, float > HGCalDDDConstants::locateCell ( int  cell,
int  lay,
int  type,
bool  reco 
) const

Definition at line 606 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, getIndex(), HGCSiliconDetId::HGCalFine, hgpar_, mps_fire::i, HGCalParameters::k_ScaleToDDD, waferHexagon6(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, and y.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeSimHits(), cellInLayer(), HFNoseNumberingScheme::checkPosition(), HGCalNumberingScheme::checkPosition(), HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), HGCNumberingScheme::getLocalCoords(), HGCalGeometry::getNewCorners(), and HGCalGeometry::getPosition().

606  {
607  // type refers to wafer # for hexagon cell
608  float x(999999.), y(999999.);
609  const auto& index = getIndex(lay, reco);
610  int i = index.first;
611  if (i < 0)
612  return std::make_pair(x, y);
613  if (waferHexagon6()) {
614  x = hgpar_->waferPosX_[type];
615  y = hgpar_->waferPosY_[type];
616 #ifdef EDM_ML_DEBUG
617  float x0(x), y0(y);
618 #endif
620  x += hgpar_->cellFineX_[cell];
621  y += hgpar_->cellFineY_[cell];
622  } else {
623  x += hgpar_->cellCoarseX_[cell];
624  y += hgpar_->cellCoarseY_[cell];
625  }
626 #ifdef EDM_ML_DEBUG
627  edm::LogVerbatim("HGCalGeom") << "LocateCell (Wafer) " << x0 << ":" << y0 << " Final " << x << ":" << y;
628 #endif
629  if (!reco) {
632  }
633  }
634  return std::make_pair(x, y);
635 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< double > cellFineY_
bool waferHexagon6() const
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
static constexpr double k_ScaleToDDD
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_

◆ locateCell() [2/4]

std::pair< float, float > HGCalDDDConstants::locateCell ( int  lay,
int  waferU,
int  waferV,
int  cellU,
int  cellV,
bool  reco,
bool  all,
bool  norot = false,
bool  debug = false 
) const

Definition at line 637 of file HGCalDDDConstants.cc.

References python.cmstools::all(), HGCalParameters::cellCoarseIndex_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineIndex_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, debug, HGCalParameters::firstLayer_, getXY(), hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::layerType_, HGCalParameters::typesInLayers_, HGCalTypes::WaferCenterR, HGCalWaferIndex::waferIndex(), waferPositionNoRot(), HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, geometryCSVtoXML::xy, and y.

638  {
639  double x(0), y(0);
640  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
641  auto itr = hgpar_->typesInLayers_.find(indx);
642  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 : hgpar_->waferTypeL_[itr->second]);
643  bool rotx = (norot) ? false
644  : ((!hgpar_->layerType_.empty()) &&
646  if (debug) {
647  edm::LogVerbatim("HGCalGeom") << "LocateCell " << lay << ":" << (lay - hgpar_->firstLayer_) << ":" << rotx << ":"
648  << waferU << ":" << waferV << ":" << indx << ":"
649  << (itr == hgpar_->typesInLayers_.end()) << ":" << type << " Flags " << reco << ":"
650  << all;
651  }
652  int kndx = cellV * 100 + cellU;
653  if (type == 0) {
654  auto ktr = hgpar_->cellFineIndex_.find(kndx);
655  if (ktr != hgpar_->cellFineIndex_.end()) {
656  x = hgpar_->cellFineX_[ktr->second];
657  y = hgpar_->cellFineY_[ktr->second];
658  }
659  if (debug)
660  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
661  << (ktr != hgpar_->cellFineIndex_.end());
662  } else {
663  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
664  if (ktr != hgpar_->cellCoarseIndex_.end()) {
665  x = hgpar_->cellCoarseX_[ktr->second];
666  y = hgpar_->cellCoarseY_[ktr->second];
667  }
668  if (debug)
669  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
670  << (ktr != hgpar_->cellCoarseIndex_.end());
671  }
672  if (!reco) {
675  }
676  if (all) {
677  const auto& xy = waferPositionNoRot(lay, waferU, waferV, reco, debug);
678  x += xy.first;
679  y += xy.second;
680  if (debug)
681  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << " by adding " << xy.first << ":" << xy.second;
682  }
683  return (rotx ? getXY(lay, x, y, false) : std::make_pair(x, y));
684 }
Log< level::Info, true > LogVerbatim
wafer_map cellFineIndex_
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
int32_t waferU(const int32_t index)
std::vector< double > cellFineY_
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
std::vector< double > cellCoarseX_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > layerType_
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:26
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
wafer_map cellCoarseIndex_
std::vector< double > cellFineX_
wafer_map typesInLayers_
fixed size matrix
int32_t waferV(const int32_t index)
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug=false) const
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ locateCell() [3/4]

std::pair< float, float > HGCalDDDConstants::locateCell ( const HGCSiliconDetId id,
bool  debug = false 
) const

Definition at line 686 of file HGCalDDDConstants.cc.

References debug, geomTools_, getXY(), hgpar_, phase1PixelTopology::layer, HGCalParameters::layerCenter_, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, dttmaxenums::R, alignCSCRings::r, diffTwoXMLs::r1, HGCalParameters::sensorSeparation_, HGCalGeomTools::shiftXY(), sqrt3_, HGCalParameters::waferSize_, and geometryCSVtoXML::xy.

686  {
687  int lay(id.layer());
688  double r = 0.5 * (hgpar_->waferSize_ + hgpar_->sensorSeparation_);
689  double R = 2.0 * r / sqrt3_;
690  int ncells = (id.type() == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
691  int n2 = ncells / 2;
692  auto xyoff = geomTools_.shiftXY(hgpar_->layerCenter_[lay - 1], (2.0 * r));
693  double xpos = xyoff.first + ((-2 * id.waferU() + id.waferV()) * r);
694  double ypos = xyoff.second + (1.5 * id.waferV() * R);
695 #ifdef EDM_ML_DEBUG
696  if (debug)
697  edm::LogVerbatim("HGCalGeom") << "LocateCell " << id << " Lay " << lay << " r:R " << r << ":" << R << " N "
698  << ncells << ":" << n2 << " Off " << xyoff.first << ":" << xyoff.second << " Pos "
699  << xpos << ":" << ypos;
700 #endif
701  double R1 = hgpar_->waferSize_ / (3.0 * ncells);
702  double r1 = 0.5 * R1 * sqrt3_;
703  xpos += ((1.5 * (id.cellV() - ncells) + 1.0) * R1);
704  ypos += ((id.cellU() - 0.5 * id.cellV() - n2) * 2 * r1);
705 #ifdef EDM_ML_DEBUG
706  if (debug)
707  edm::LogVerbatim("HGCalGeom") << "LocateCell r1:R1 " << r1 << ":" << R1 << " dx:dy "
708  << ((1.5 * (id.cellV() - ncells) + 1.0) * R1) << ":"
709  << ((id.cellU() - 0.5 * id.cellV() - n2) * 2 * r1) << " Pos " << xpos << ":" << ypos;
710 #endif
711  std::pair<double, double> xy = getXY(id.layer(), xpos, ypos, true);
712  return std::make_pair(xy.first * id.zside(), xy.second);
713 }
Log< level::Info, true > LogVerbatim
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
std::pair< double, double > shiftXY(int waferPosition, double waferSize) const
constexpr std::array< uint8_t, layerIndexSize > layer
HGCalGeomTools geomTools_
std::vector< int > layerCenter_
#define debug
Definition: HDRShower.cc:19
const HGCalParameters * hgpar_

◆ locateCell() [4/4]

std::pair< float, float > HGCalDDDConstants::locateCell ( const HGCScintillatorDetId id,
bool  debug = false 
) const

Definition at line 715 of file HGCalDDDConstants.cc.

References angle_units::operators::convertRadToDeg(), funct::cos(), debug, hgpar_, LEDCalibrationChannels::iphi, phase1PixelTopology::layer, phi, alignCSCRings::r, HGCalParameters::radiusLayer_, HGCalParameters::scintCellSize(), funct::sin(), and ecaldqm::zside().

715  {
716  int lay(id.layer()), iphi(id.iphi()), ir(id.iradiusAbs());
717  double phi = (iphi - 0.5) * hgpar_->scintCellSize(lay);
718  int type = (id.type() > 0) ? 1 : 0;
719  double r = (((ir + 1) < static_cast<int>(hgpar_->radiusLayer_[type].size()))
720  ? (0.5 * (hgpar_->radiusLayer_[type][ir] + hgpar_->radiusLayer_[type][ir - 1]))
721  : (1.5 * hgpar_->radiusLayer_[type][ir] - 0.5 * hgpar_->radiusLayer_[type][ir - 1]));
722 #ifdef EDM_ML_DEBUG
723  if (debug)
724  edm::LogVerbatim("HGCalGeom") << "LocateCell lay:ir:iphi:type " << lay << ":" << ir << ":" << iphi << ":" << type
725  << " r:phi " << r << ":" << convertRadToDeg(phi) << " x:y "
726  << (r * cos(phi) * id.zside()) << ":" << (r * sin(phi));
727 #endif
728  return std::make_pair(r * cos(phi) * id.zside(), r * sin(phi));
729 }
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
int zside(DetId const &)
constexpr std::array< uint8_t, layerIndexSize > layer
double scintCellSize(const int layer) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define debug
Definition: HDRShower.cc:19
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ locateCellHex()

std::pair< float, float > HGCalDDDConstants::locateCellHex ( int  cell,
int  wafer,
bool  reco 
) const

Definition at line 731 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, HGCSiliconDetId::HGCalFine, hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::waferTypeT_, x, and y.

Referenced by HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), HGCalGeometry::getNewCorners(), and HGCalGeometry::getPosition().

731  {
732  float x(0), y(0);
733  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
734  x = hgpar_->cellFineX_[cell];
735  y = hgpar_->cellFineY_[cell];
736  } else {
737  x = hgpar_->cellCoarseX_[cell];
738  y = hgpar_->cellCoarseY_[cell];
739  }
740  if (!reco) {
743  }
744  return std::make_pair(x, y);
745 }
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
static constexpr double k_ScaleToDDD
std::vector< double > cellFineX_
fixed size matrix
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_

◆ locateCellTrap()

std::pair< float, float > HGCalDDDConstants::locateCellTrap ( int  lay,
int  ieta,
int  iphi,
bool  reco 
) const

Definition at line 747 of file HGCalDDDConstants.cc.

References funct::abs(), funct::cos(), getIndex(), hgpar_, LEDCalibrationChannels::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleToDDD, SiStripPI::max, SiStripPI::min, mode_, phi, alignCSCRings::r, HGCalParameters::radiusLayer_, FastTimerService_cff::range, rangeR(), HGCalParameters::scintType(), funct::sin(), HGCalGeometryMode::TrapezoidFile, HGCalGeometryMode::TrapezoidModule, x, y, z, and HGCalParameters::zLayerHex_.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalGeometryLoader::build(), and HGCalNumberingScheme::checkPosition().

747  {
748  float x(0), y(0);
749  const auto& indx = getIndex(lay, reco);
750  if (indx.first >= 0) {
751  int ir = std::abs(irad);
752  int type = hgpar_->scintType(lay);
753  double phi = (iphi - 0.5) * indx.second;
754  double z = hgpar_->zLayerHex_[indx.first];
755  double r = 0.5 * (hgpar_->radiusLayer_[type][ir - 1] + hgpar_->radiusLayer_[type][ir]);
756  std::pair<double, double> range = rangeR(z, true);
757 #ifdef EDM_ML_DEBUG
758  edm::LogVerbatim("HGCalGeom") << "locateCellTrap:: Input " << lay << ":" << irad << ":" << iphi << ":" << reco
759  << " IR " << ir << ":" << hgpar_->iradMinBH_[indx.first] << ":"
760  << hgpar_->iradMaxBH_[indx.first] << " Type " << type << " Z " << indx.first << ":"
761  << z << " phi " << phi << " R " << r << ":" << range.first << ":" << range.second;
762 #endif
764  r = std::max(range.first, std::min(r, range.second));
765  x = r * std::cos(phi);
766  y = r * std::sin(phi);
767  if (irad < 0)
768  x = -x;
769  }
770  if (!reco) {
773  }
774  return std::make_pair(x, y);
775 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
int scintType(const int layer) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > zLayerHex_
std::pair< double, double > rangeR(double z, bool reco) const
static constexpr double k_ScaleToDDD
std::vector< int > iradMinBH_
const HGCalGeometryMode::GeometryMode mode_
fixed size matrix
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ maskCell()

bool HGCalDDDConstants::maskCell ( const DetId id,
int  corners 
) const

Definition at line 777 of file HGCalDDDConstants.cc.

References DetId::det(), DetId::Forward, getUVMax(), HGCalWaferMask::goodCell(), hgpar_, triggerObjects_cff::id, HGCalParameters::k_CornerSize, HGCalWaferMask::k_OffsetRotation, phase1PixelTopology::layer, HGCalWaferMask::maskCell(), N, edm::second(), findQualityFiles::v, waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferTypes_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and LaserClient_cfi::wl.

Referenced by hgcal::RecHitTools::maskCell(), HGCalTopology::maskCell(), HFNoseSD::setDetUnitId(), HGCalSD::setDetUnitId(), and HGCalTopology::valid().

777  {
778  bool mask(false);
779  if (corners > 2 && corners <= (int)(HGCalParameters::k_CornerSize)) {
780  if (waferHexagon8()) {
781  int N(0), layer(0), waferU(0), waferV(0), u(0), v(0);
782  if (detId.det() == DetId::Forward) {
783  HFNoseDetId id(detId);
784  N = getUVMax(id.type());
785  layer = id.layer();
786  waferU = id.waferU();
787  waferV = id.waferV();
788  u = id.cellU();
789  v = id.cellV();
790  } else {
791  HGCSiliconDetId id(detId);
792  N = getUVMax(id.type());
793  layer = id.layer();
794  waferU = id.waferU();
795  waferV = id.waferV();
796  u = id.cellU();
797  v = id.cellV();
798  }
800  auto itr = hgpar_->waferTypes_.find(wl);
801 #ifdef EDM_ML_DEBUG
802  edm::LogVerbatim("HGCalGeom") << "MaskCell: Layer " << layer << " Wafer " << waferU << ":" << waferV << " Index "
803  << wl << ":" << (itr != hgpar_->waferTypes_.end());
804 #endif
805  if (itr != hgpar_->waferTypes_.end()) {
806  if ((itr->second).second <= HGCalWaferMask::k_OffsetRotation)
807  mask = HGCalWaferMask::maskCell(u, v, N, (itr->second).first, (itr->second).second, corners);
808  else
809  mask = !(HGCalWaferMask::goodCell(
810  u, v, N, (itr->second).first, ((itr->second).second - HGCalWaferMask::k_OffsetRotation)));
811  }
812  }
813  }
814  return mask;
815 }
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
static bool goodCell(int u, int v, int N, int type, int rotn)
bool waferHexagon8() const
static constexpr uint32_t k_CornerSize
constexpr std::array< uint8_t, layerIndexSize > layer
U second(std::pair< T, U > const &p)
int getUVMax(int type) const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
#define N
Definition: blowfish.cc:9
static constexpr int k_OffsetRotation
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_
static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners)

◆ maxCells() [1/2]

int HGCalDDDConstants::maxCells ( bool  reco) const

Definition at line 817 of file HGCalDDDConstants.cc.

References cells, HGCalParameters::depth_, hgpar_, mps_fire::i, HGCalParameters::layer_, and layers().

Referenced by HGCalDDDConstants(), HGCalTopology::HGCalTopology(), and isValidHex().

817  {
818  int cells(0);
819  for (unsigned int i = 0; i < layers(reco); ++i) {
820  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
821  if (cells < maxCells(lay, reco))
822  cells = maxCells(lay, reco);
823  }
824  return cells;
825 }
std::vector< int > layer_
std::vector< int > depth_
int maxCells(bool reco) const
unsigned int layers(bool reco) const
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
fixed size matrix
const HGCalParameters * hgpar_

◆ maxCells() [2/2]

int HGCalDDDConstants::maxCells ( int  lay,
bool  reco 
) const

Definition at line 827 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, cells, HGCalParameters::defineFull_, HGCalParameters::firstLayer_, getIndex(), HGCSiliconDetId::HGCalCoarseThick, HGCSiliconDetId::HGCalFine, hgpar_, dqmdumpme::k, SiStripPI::max, N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::scintCells(), tileTrapezoid(), HGCalParameters::typesInLayers_, HGCalParameters::waferCopy_, waferHexagon6(), waferHexagon8(), HGCalWaferIndex::waferIndex(), waferInLayerTest(), HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

827  {
828  const auto& index = getIndex(lay, reco);
829  if (index.first < 0)
830  return 0;
831  if (waferHexagon6()) {
832  unsigned int cells(0);
833  for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
834  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
835  unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size())
836  : (hgpar_->cellCoarseX_.size());
837  if (cell > cells)
838  cells = cell;
839  }
840  }
841  return (int)(cells);
842  } else if (waferHexagon8()) {
843  int cells(0);
844  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
845  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
849  : hgpar_->waferTypeL_[itr->second]);
851  cells = std::max(cells, 3 * N * N);
852  }
853  }
854  return cells;
855  } else if (tileTrapezoid()) {
856  return hgpar_->scintCells(index.first + hgpar_->firstLayer_);
857  } else {
858  return 0;
859  }
860 }
bool waferInLayerTest(int wafer, int lay, bool full) const
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
std::vector< double > cellCoarseX_
std::pair< int, float > getIndex(int lay, bool reco) const
bool tileTrapezoid() const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
#define N
Definition: blowfish.cc:9
std::vector< double > cellFineX_
wafer_map typesInLayers_
fixed size matrix
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
int scintCells(const int layer) const
std::vector< int > waferTypeL_

◆ maxCellUV()

int HGCalDDDConstants::maxCellUV ( ) const
inline

Definition at line 102 of file HGCalDDDConstants.h.

References hgpar_, HGCalParameters::nCellsFine_, and tileTrapezoid().

Referenced by HGCalTopology::HGCalTopology().

102 { return (tileTrapezoid() ? hgpar_->nCellsFine_ : 2 * hgpar_->nCellsFine_); }
bool tileTrapezoid() const
const HGCalParameters * hgpar_

◆ maxModules()

int HGCalDDDConstants::maxModules ( ) const
inline

Definition at line 105 of file HGCalDDDConstants.h.

References modHalf_.

105 { return modHalf_; }

◆ maxModulesPerLayer()

int HGCalDDDConstants::maxModulesPerLayer ( ) const
inline

Definition at line 106 of file HGCalDDDConstants.h.

References maxWafersPerLayer_.

106 { return maxWafersPerLayer_; }

◆ maxRows()

int HGCalDDDConstants::maxRows ( int  lay,
bool  reco 
) const

Definition at line 862 of file HGCalDDDConstants.cc.

References HGCalParameters::defineFull_, getIndex(), hgpar_, mps_fire::i, dqmdumpme::k, HGCalParameters::waferCopy_, waferHexagon6(), waferHexagon8(), waferInLayerTest(), and HGCalParameters::waferUVMaxLayer_.

862  {
863  int kymax(0);
864  const auto& index = getIndex(lay, reco);
865  int i = index.first;
866  if (i < 0)
867  return kymax;
868  if (waferHexagon6()) {
869  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
871  int ky = ((hgpar_->waferCopy_[k]) / 100) % 100;
872  if (ky > kymax)
873  kymax = ky;
874  }
875  }
876  } else if (waferHexagon8()) {
877  kymax = 1 + 2 * hgpar_->waferUVMaxLayer_[index.first];
878  }
879  return kymax;
880 }
bool waferInLayerTest(int wafer, int lay, bool full) const
bool waferHexagon8() const
bool waferHexagon6() const
std::vector< int > waferUVMaxLayer_
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix
std::vector< int > waferCopy_
const HGCalParameters * hgpar_

◆ minSlope()

double HGCalDDDConstants::minSlope ( ) const
inline

Definition at line 108 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::slopeMin_.

Referenced by HGCScintSD::update(), HGCalSD::update(), HFNoseSD::update(), and HGCSD::update().

108 { return hgpar_->slopeMin_[0]; }
std::vector< double > slopeMin_
const HGCalParameters * hgpar_

◆ modifyUV()

int HGCalDDDConstants::modifyUV ( int  uv,
int  type1,
int  type2 
) const

Definition at line 882 of file HGCalDDDConstants.cc.

Referenced by HGCalTopology::neighbors().

882  {
883  // Modify u/v for transition of type1 to type2
884  return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
885 }

◆ modules()

int HGCalDDDConstants::modules ( int  lay,
bool  reco 
) const

Definition at line 887 of file HGCalDDDConstants.cc.

References first, getIndex(), createfilelist::int, and max_modules_layer_.

Referenced by wafers().

887  {
888  if (getIndex(lay, reco).first < 0)
889  return 0;
890  else
891  return max_modules_layer_[(int)reco][lay];
892 }
Simrecovecs max_modules_layer_
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix

◆ modulesInit()

int HGCalDDDConstants::modulesInit ( int  lay,
bool  reco 
) const

Definition at line 894 of file HGCalDDDConstants.cc.

References HGCalParameters::defineFull_, HGCalParameters::firstModule_, getIndex(), hgpar_, dqmdumpme::k, HGCalParameters::lastModule_, tileTrapezoid(), waferInLayerTest(), and HGCalParameters::waferPosX_.

Referenced by HGCalDDDConstants().

894  {
895  int nmod(0);
896  const auto& index = getIndex(lay, reco);
897  if (index.first < 0)
898  return nmod;
899  if (!tileTrapezoid()) {
900  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
901  if (waferInLayerTest(k, index.first, hgpar_->defineFull_))
902  ++nmod;
903  }
904  } else {
905  nmod = 1 + hgpar_->lastModule_[index.first] - hgpar_->firstModule_[index.first];
906  }
907  return nmod;
908 }
bool waferInLayerTest(int wafer, int lay, bool full) const
std::vector< int > firstModule_
std::pair< int, float > getIndex(int lay, bool reco) const
bool tileTrapezoid() const
std::vector< int > lastModule_
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_

◆ mouseBite()

double HGCalDDDConstants::mouseBite ( bool  reco) const

Definition at line 910 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, and HGCalParameters::mouseBite_.

Referenced by HFNoseSD::update(), and HGCalSD::update().

910  {
912 }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ numberCells() [1/2]

int HGCalDDDConstants::numberCells ( bool  reco) const

Definition at line 914 of file HGCalDDDConstants.cc.

References cells, HGCalParameters::depth_, hgpar_, dqmdumpme::k, HGCalParameters::layer_, dt_dqm_sourceclient_common_cff::reco, HGCalGeomParameters::scintillatorCassette, HGCalGeomParameters::scintillatorFile, tileCount(), tileTrapezoid(), and HGCalParameters::waferMaskMode_.

Referenced by HGCalTopology::allGeomModules().

914  {
917  ? tileCount(0, -1)
918  : 0;
919  if (cells == 0) {
920  unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size();
921  for (unsigned k = 0; k < nlayer; ++k) {
922  std::vector<int> ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco);
923  cells = std::accumulate(ncells.begin(), ncells.end(), cells);
924  }
925  }
926  return cells;
927 }
std::vector< int > layer_
static constexpr int scintillatorCassette
std::vector< int > depth_
static constexpr int scintillatorFile
int tileCount(int layer, int ring) const
bool tileTrapezoid() const
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
int numberCells(bool reco) const
fixed size matrix
const HGCalParameters * hgpar_

◆ numberCells() [2/2]

std::vector< int > HGCalDDDConstants::numberCells ( int  lay,
bool  reco 
) const

Definition at line 929 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCalParameters::defineFull_, HGCalParameters::firstModule_, getIndex(), HGCSiliconDetId::HGCalFine, hgpar_, mps_fire::i, dqmdumpme::k, nphi, numberCellsHexagon(), HGCalParameters::scintCells(), tileTrapezoid(), HGCalParameters::waferCopy_, waferHexagon6(), waferInLayerTest(), HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

929  {
930  const auto& index = getIndex(lay, reco);
931  int i = index.first;
932  std::vector<int> ncell;
933  if (i >= 0) {
934  if (waferHexagon6()) {
935  for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
937  unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine)
938  ? (hgpar_->cellFineX_.size())
939  : (hgpar_->cellCoarseX_.size());
940  ncell.emplace_back((int)(cell));
941  }
942  }
943  } else if (tileTrapezoid()) {
944  int nphi = hgpar_->scintCells(lay);
945  for (int k = hgpar_->firstModule_[i]; k <= hgpar_->lastModule_[i]; ++k)
946  ncell.emplace_back(nphi);
947  } else {
948  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
949  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
950  int cell = numberCellsHexagon(lay,
953  true);
954  ncell.emplace_back(cell);
955  }
956  }
957  }
958  }
959  return ncell;
960 }
const int nphi
bool waferInLayerTest(int wafer, int lay, bool full) const
int32_t waferU(const int32_t index)
bool waferHexagon6() const
std::vector< double > cellCoarseX_
std::vector< int > firstModule_
std::pair< int, float > getIndex(int lay, bool reco) const
bool tileTrapezoid() const
int numberCellsHexagon(int wafer) const
std::vector< double > cellFineX_
fixed size matrix
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_
int scintCells(const int layer) const

◆ numberCellsHexagon() [1/2]

int HGCalDDDConstants::numberCellsHexagon ( int  wafer) const

Definition at line 962 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, HGCSiliconDetId::HGCalFine, hgpar_, and HGCalParameters::waferTypeT_.

Referenced by HGCalGeometry::newCell(), numberCells(), and HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_().

962  {
963  if (wafer >= 0 && wafer < (int)(hgpar_->waferTypeT_.size())) {
964  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine)
965  return (int)(hgpar_->cellFineX_.size());
966  else
967  return (int)(hgpar_->cellCoarseX_.size());
968  } else {
969  return 0;
970  }
971 }
std::vector< double > cellCoarseX_
std::vector< double > cellFineX_
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_

◆ numberCellsHexagon() [2/2]

int HGCalDDDConstants::numberCellsHexagon ( int  lay,
int  waferU,
int  waferV,
bool  flag 
) const

Definition at line 973 of file HGCalDDDConstants.cc.

References RemoveAddSevLevel::flag, HGCSiliconDetId::HGCalCoarseThick, hgpar_, if(), N, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::typesInLayers_, HGCalWaferIndex::waferIndex(), HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

973  {
975  int type =
976  ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
977  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
978  if (flag)
979  return (3 * N * N);
980  else
981  return N;
982 }
int32_t waferU(const int32_t index)
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
#define N
Definition: blowfish.cc:9
wafer_map typesInLayers_
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ rangeR()

std::pair< double, double > HGCalDDDConstants::rangeR ( double  z,
bool  reco 
) const

Definition at line 984 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::detectorType_, HGCalParameters::firstLayer_, HGCalParameters::firstMixedLayer_, hgpar_, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalGeomTools::radius(), HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, z, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zLayerHex_, and geometryCSVtoXML::zz.

Referenced by ticl::SeedingRegionByTracks::buildFirstLayers(), HFNoseNumberingScheme::checkPosition(), HGCalNumberingScheme::checkPosition(), HGCDigitizer::checkPosition(), locateCellTrap(), and HGCalGeometry::neighborZ().

984  {
985  double rmin(0), rmax(0), zz(0);
986  if (hgpar_->detectorType_ > 0) {
987  zz = (reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD * std::abs(z));
988  if (hgpar_->detectorType_ <= 2) {
990  } else {
991  rmin = HGCalGeomTools::radius(
993  }
994  if ((hgpar_->detectorType_ == 2) && (zz >= hgpar_->zLayerHex_[hgpar_->firstMixedLayer_ - 1])) {
995  rmax = HGCalGeomTools::radius(
997  } else {
999  }
1000  }
1001  if (!reco) {
1004  }
1005 #ifdef EDM_ML_DEBUG
1006  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << z << ":" << zz << " R " << rmin << ":" << rmax;
1007 #endif
1008  return std::make_pair(rmin, rmax);
1009 }
Log< level::Info, true > LogVerbatim
std::vector< double > zFrontMin_
static void radius(double zf, double zb, std::vector< double > const &zFront1, std::vector< double > const &rFront1, std::vector< double > const &slope1, std::vector< double > const &zFront2, std::vector< double > const &rFront2, std::vector< double > const &slope2, int flag, std::vector< double > &zz, std::vector< double > &rin, std::vector< double > &rout)
std::vector< double > rMaxFront_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > slopeTop_
std::vector< double > zLayerHex_
std::vector< double > slopeMin_
static constexpr double k_ScaleToDDD
std::vector< double > radiusMixBoundary_
std::vector< double > rMinFront_
fixed size matrix
std::vector< double > zFrontTop_
const HGCalParameters * hgpar_

◆ rangeRLayer()

std::pair< double, double > HGCalDDDConstants::rangeRLayer ( int  lay,
bool  reco 
) const

Definition at line 1011 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::rMaxLayHex_, and HGCalParameters::rMinLayHex_.

1011  {
1012  double rmin(0), rmax(0);
1013  const auto& index = getIndex(lay, reco);
1014  if (index.first >= 0 && index.first < static_cast<int>(hgpar_->rMinLayHex_.size())) {
1015  rmin = hgpar_->rMinLayHex_[index.first];
1016  rmax = hgpar_->rMaxLayHex_[index.first];
1017  }
1018  if (!reco) {
1021  }
1022 #ifdef EDM_ML_DEBUG
1023  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << lay << ":" << index.first << " R " << rmin << ":"
1024  << rmax;
1025 #endif
1026  return std::make_pair(rmin, rmax);
1027 }
Log< level::Info, true > LogVerbatim
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ rangeZ()

std::pair< double, double > HGCalDDDConstants::rangeZ ( bool  reco) const

Definition at line 1029 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::waferThick_, HGCalParameters::zLayerHex_, SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Referenced by HFNoseNumberingScheme::checkPosition(), HGCalNumberingScheme::checkPosition(), and HGCDigitizer::checkPosition().

1029  {
1030  double zmin = (hgpar_->zLayerHex_[0] - hgpar_->waferThick_);
1031  double zmax = (hgpar_->zLayerHex_[hgpar_->zLayerHex_.size() - 1] + hgpar_->waferThick_);
1032 #ifdef EDM_ML_DEBUG
1033  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeZ: " << zmin << ":" << zmax << ":" << hgpar_->waferThick_;
1034 #endif
1035  if (!reco) {
1038  }
1039  return std::make_pair(zmin, zmax);
1040 }
Log< level::Info, true > LogVerbatim
std::vector< double > zLayerHex_
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ rowColumnWafer()

std::pair< int, int > HGCalDDDConstants::rowColumnWafer ( const int  wafer) const

Definition at line 1042 of file HGCalDDDConstants.cc.

References cuy::col, filterCSVwithJSON::copy, HGCalTypes::getUnpackedU(), HGCalTypes::getUnpackedV(), hgpar_, and HGCalParameters::waferCopy_.

1042  {
1043  int row(0), col(0);
1044  if (wafer < (int)(hgpar_->waferCopy_.size())) {
1045  int copy = hgpar_->waferCopy_[wafer];
1048  ;
1049  }
1050  return std::make_pair(row, col);
1051 }
static int32_t getUnpackedU(int id)
Definition: HGCalTypes.cc:16
static int32_t getUnpackedV(int id)
Definition: HGCalTypes.cc:22
std::vector< int > waferCopy_
col
Definition: cuy.py:1009
const HGCalParameters * hgpar_

◆ sectors()

int HGCalDDDConstants::sectors ( ) const
inline

◆ simToReco()

std::pair< int, int > HGCalDDDConstants::simToReco ( int  cell,
int  layer,
int  mod,
bool  half 
) const

Definition at line 1053 of file HGCalDDDConstants.cc.

References LEDCalibrationChannels::depth, getIndex(), hgpar_, mps_fire::i, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, mod(), findQualityFiles::size, waferHexagon6(), and HGCalParameters::waferTypeL_.

Referenced by HGCalTimingAnalyzer::analyzeSimHits(), HGCalTBAnalyzer::analyzeSimHits(), CaloParticleDebugger::fillSimHits(), and CaloTruthAccumulator::fillSimHits().

1053  {
1054  if (!waferHexagon6()) {
1055  return std::make_pair(cell, lay);
1056  } else {
1057  const auto& index = getIndex(lay, false);
1058  int i = index.first;
1059  if (i < 0) {
1060  edm::LogWarning("HGCalGeom") << "Wrong Layer # " << lay << " not in the list ***** ERROR *****";
1061  return std::make_pair(-1, -1);
1062  }
1063  if (mod >= (int)(hgpar_->waferTypeL_).size()) {
1064  edm::LogWarning("HGCalGeom") << "Invalid Wafer # " << mod << "should be < " << (hgpar_->waferTypeL_).size()
1065  << " ***** ERROR *****";
1066  return std::make_pair(-1, -1);
1067  }
1068  int depth(-1);
1069  int kx = cell;
1070  int type = hgpar_->waferTypeL_[mod];
1071  if (type == 1) {
1072  depth = hgpar_->layerGroup_[i];
1073  } else if (type == 2) {
1074  depth = hgpar_->layerGroupM_[i];
1075  } else {
1076  depth = hgpar_->layerGroupO_[i];
1077  }
1078  return std::make_pair(kx, depth);
1079  }
1080 }
size
Write out results.
std::vector< int > layerGroupM_
bool waferHexagon6() const
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< int > layerGroup_
std::vector< int > layerGroupO_
Log< level::Warning, false > LogWarning
const HGCalParameters * hgpar_
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > waferTypeL_

◆ tileCount()

int HGCalDDDConstants::tileCount ( int  layer,
int  ring 
) const

Definition at line 1082 of file HGCalDDDConstants.cc.

References b, HGCalParameters::firstLayer_, hgpar_, dqmdumpme::k, lastLayer(), phase1PixelTopology::layer, relativeConstraints::ring, HGCalTileIndex::tileIndex(), HGCalParameters::tileInfoMap_, and HGCalParameters::tileRingRange_.

Referenced by numberCells().

1082  {
1083  int laymin(layer), laymax(layer), ringmin(ring), ringmax(ring), kount(0);
1084  if (layer == 0) {
1085  laymin = hgpar_->firstLayer_;
1086  laymax = lastLayer(true);
1087  }
1088  for (int lay = laymin; lay <= laymax; ++lay) {
1089  if (ring < 0) {
1090  int ll = lay - hgpar_->firstLayer_;
1091  ringmin = hgpar_->tileRingRange_[ll].first;
1092  ringmax = hgpar_->tileRingRange_[ll].second;
1093  }
1094  for (int rin = ringmin; rin <= ringmax; ++rin) {
1095  int indx = HGCalTileIndex::tileIndex(lay, rin + 1, 0);
1096  auto itr = hgpar_->tileInfoMap_.find(indx);
1097  if (itr != hgpar_->tileInfoMap_.end()) {
1098  for (int k = 0; k < 4; ++k) {
1099  std::bitset<24> b(itr->second.hex[k]);
1100  kount += b.count();
1101  }
1102  }
1103  }
1104  }
1105  return (3 * kount);
1106 }
int lastLayer(bool reco) const
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
std::vector< std::pair< int, int > > tileRingRange_
double b
Definition: hdecay.h:118
const HGCalParameters * hgpar_
tileInfo_map tileInfoMap_

◆ tileExist()

bool HGCalDDDConstants::tileExist ( int  zside,
int  layer,
int  ring,
int  phi 
) const
inline

Definition at line 124 of file HGCalDDDConstants.h.

References hgpar_, phase1PixelTopology::layer, convertSQLiteXML::ok, phi, relativeConstraints::ring, HGCalTileIndex::tileExist(), HGCalTileIndex::tileIndex(), HGCalParameters::tileInfoMap_, and ecaldqm::zside().

Referenced by HGCalGeometryLoader::build().

124  {
125  int indx = HGCalTileIndex::tileIndex(layer, ring, 0);
126  auto itr = hgpar_->tileInfoMap_.find(indx);
127  bool ok = (itr == hgpar_->tileInfoMap_.end()) ? false : HGCalTileIndex::tileExist(itr->second.hex, zside, phi);
128  return ok;
129  }
int zside(DetId const &)
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
bool tileExist(const int32_t *hex, int32_t zside, int32_t phi)
const HGCalParameters * hgpar_
tileInfo_map tileInfoMap_

◆ tileRings()

std::pair<int, int> HGCalDDDConstants::tileRings ( int  layer) const
inline

Definition at line 130 of file HGCalDDDConstants.h.

References HGCalParameters::firstLayer_, hgpar_, phase1PixelTopology::layer, mode_, HGCalParameters::tileRingRange_, and HGCalGeometryMode::TrapezoidFile.

130  {
132  int ll = layer - hgpar_->firstLayer_;
133  if (ll >= 0 && ll < static_cast<int>(hgpar_->tileRingRange_.size()))
134  return hgpar_->tileRingRange_[ll];
135  }
136  return std::make_pair(0, 0);
137  }
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< std::pair< int, int > > tileRingRange_
const HGCalGeometryMode::GeometryMode mode_
const HGCalParameters * hgpar_

◆ tileSiPM()

int HGCalDDDConstants::tileSiPM ( int  sipm) const
inline

◆ tileTrapezoid()

bool HGCalDDDConstants::tileTrapezoid ( ) const
inline

◆ tileType()

std::pair<int, int> HGCalDDDConstants::tileType ( int  layer,
int  ring,
int  phi 
) const
inline

Definition at line 143 of file HGCalDDDConstants.h.

References hgpar_, phase1PixelTopology::layer, phi, relativeConstraints::ring, HGCalTypes::SiPMLarge, HGCalTileIndex::tileIndex(), and HGCalParameters::tileInfoMap_.

Referenced by HGCalGeometryLoader::build(), HGCalTopology::encode(), HGCalNumberingScheme::getUnitID(), and HGCalGeometry::newCell().

143  {
144  int indx = HGCalTileIndex::tileIndex(layer, ring, phi);
145  int type(-1), sipm(-1);
146  auto itr = hgpar_->tileInfoMap_.find(indx);
147  if (itr != hgpar_->tileInfoMap_.end()) {
148  type = 1 + (itr->second).type;
149  sipm = ((itr->second).sipm == HGCalTypes::SiPMLarge) ? 0 : 1;
150  }
151  return std::make_pair(type, sipm);
152  }
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
const HGCalParameters * hgpar_
tileInfo_map tileInfoMap_

◆ volumes()

unsigned int HGCalDDDConstants::volumes ( ) const
inline

Definition at line 153 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::moduleLayR_.

Referenced by HGCalGeometryLoader::build().

153 { return hgpar_->moduleLayR_.size(); }
std::vector< int > moduleLayR_
const HGCalParameters * hgpar_

◆ waferCount()

int HGCalDDDConstants::waferCount ( const int  type) const
inline

Definition at line 176 of file HGCalDDDConstants.h.

References waferMax_.

176 { return ((type == 0) ? waferMax_[2] : waferMax_[3]); }
std::array< int, 4 > waferMax_

◆ waferFileIndex()

int HGCalDDDConstants::waferFileIndex ( unsigned int  kk) const
inline

Definition at line 183 of file HGCalDDDConstants.h.

References hgpar_, GetRecoTauVFromDQM_MC_cff::kk, and HGCalParameters::waferInfoMap_.

183  {
184  if (kk < hgpar_->waferInfoMap_.size()) {
185  auto itr = hgpar_->waferInfoMap_.begin();
186  std::advance(itr, kk);
187  return itr->first;
188  } else
189  return 0;
190  }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileInfo()

std::tuple<int, int, int> HGCalDDDConstants::waferFileInfo ( unsigned int  kk) const
inline

Definition at line 191 of file HGCalDDDConstants.h.

References hgpar_, GetRecoTauVFromDQM_MC_cff::kk, and HGCalParameters::waferInfoMap_.

191  {
192  if (kk < hgpar_->waferInfoMap_.size()) {
193  auto itr = hgpar_->waferInfoMap_.begin();
194  std::advance(itr, kk);
195  return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
196  } else
197  return std::make_tuple(0, 0, 0);
198  }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileInfoExist()

bool HGCalDDDConstants::waferFileInfoExist ( int  kk) const
inline

Definition at line 206 of file HGCalDDDConstants.h.

References hgpar_, GetRecoTauVFromDQM_MC_cff::kk, and HGCalParameters::waferInfoMap_.

206 { return (hgpar_->waferInfoMap_.find(kk) != hgpar_->waferInfoMap_.end()); }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileInfoFromIndex()

std::tuple<int, int, int> HGCalDDDConstants::waferFileInfoFromIndex ( int  kk) const
inline

Definition at line 199 of file HGCalDDDConstants.h.

References hgpar_, GetRecoTauVFromDQM_MC_cff::kk, and HGCalParameters::waferInfoMap_.

199  {
200  auto itr = hgpar_->waferInfoMap_.find(kk);
201  if (itr != hgpar_->waferInfoMap_.end()) {
202  return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient);
203  } else
204  return std::make_tuple(0, 0, 0);
205  }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileSize()

unsigned int HGCalDDDConstants::waferFileSize ( ) const
inline

Definition at line 182 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferInfoMap_.

Referenced by waferType(), and waferTypeRotation().

182 { return hgpar_->waferInfoMap_.size(); }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFromCopy()

int HGCalDDDConstants::waferFromCopy ( int  copy) const

Definition at line 1108 of file HGCalDDDConstants.cc.

References filterCSVwithJSON::copy, hgpar_, dqmdumpme::k, mps_fire::result, and HGCalParameters::waferCopy_.

Referenced by HGCNumberingScheme::getUnitID().

1108  {
1109  const int ncopies = hgpar_->waferCopy_.size();
1110  int wafer(ncopies);
1111  bool result(false);
1112  for (int k = 0; k < ncopies; ++k) {
1113  if (copy == hgpar_->waferCopy_[k]) {
1114  wafer = k;
1115  result = true;
1116  break;
1117  }
1118  }
1119  if (!result) {
1120  wafer = -1;
1121 #ifdef EDM_ML_DEBUG
1122  edm::LogVerbatim("HGCalGeom") << "Cannot find " << copy << " in a list of " << ncopies << " members";
1123  for (int k = 0; k < ncopies; ++k)
1124  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << hgpar_->waferCopy_[k];
1125 #endif
1126  }
1127 #ifdef EDM_ML_DEBUG
1128  edm::LogVerbatim("HGCalGeom") << "WaferFromCopy " << copy << ":" << wafer << ":" << result;
1129 #endif
1130  return wafer;
1131 }
Log< level::Info, true > LogVerbatim
std::vector< int > waferCopy_
const HGCalParameters * hgpar_

◆ waferFromPosition() [1/2]

void HGCalDDDConstants::waferFromPosition ( const double  x,
const double  y,
int &  wafer,
int &  icell,
int &  celltyp 
) const

Definition at line 1133 of file HGCalDDDConstants.cc.

References funct::abs(), HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellHex(), HGCalParameters::cellSize_, PVValHelper::dx, PVValHelper::dy, hexside_, HGCSiliconDetId::HGCalFine, hgpar_, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, rmax_, tan30deg_, HGCalParameters::waferCopy_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferTypeT_, x, geometryCSVtoXML::xx, y, and geometryCSVtoXML::yy.

Referenced by assignCellHex(), HFNoseNumberingScheme::checkPosition(), HGCalNumberingScheme::checkPosition(), HFNoseNumberingScheme::getUnitID(), HGCNumberingScheme::getUnitID(), and HGCalNumberingScheme::getUnitID().

1133  {
1134  // Input x, y in Geant4 unit and transformed to CMSSW standard
1137  int size_ = static_cast<int>(hgpar_->waferCopy_.size());
1138  wafer = size_;
1139  for (int k = 0; k < size_; ++k) {
1140  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
1141  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
1142  if (dx <= rmax_ && dy <= hexside_) {
1143  if ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy))) {
1144  wafer = k;
1145  celltyp = hgpar_->waferTypeT_[k];
1146  xx -= hgpar_->waferPosX_[k];
1147  yy -= hgpar_->waferPosY_[k];
1148  break;
1149  }
1150  }
1151  }
1152  if (wafer < size_) {
1153  if (celltyp - 1 == HGCSiliconDetId::HGCalFine)
1154  icell = cellHex(
1156  else
1157  icell = cellHex(xx,
1158  yy,
1161  hgpar_->cellCoarseY_);
1162  } else {
1163  wafer = -1;
1164 #ifdef EDM_ML_DEBUG
1165  edm::LogWarning("HGCalGeom") << "Cannot get wafer type corresponding to " << x << ":" << y << " " << xx << ":"
1166  << yy;
1167 #endif
1168  }
1169 #ifdef EDM_ML_DEBUG
1170  edm::LogVerbatim("HGCalGeom") << "Position " << x << ":" << y << " Wafer " << wafer << ":" << size_ << " XX " << xx
1171  << ":" << yy << " Cell " << icell << " Type " << celltyp;
1172 #endif
1173 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
std::vector< double > cellFineY_
std::vector< double > cellCoarseX_
std::vector< double > cellSize_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > cellFineX_
static constexpr double k_ScaleFromDDD
std::vector< int > waferCopy_
static constexpr double tan30deg_
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
Log< level::Warning, false > LogWarning
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const

◆ waferFromPosition() [2/2]

void HGCalDDDConstants::waferFromPosition ( const double  x,
const double  y,
const int  layer,
int &  waferU,
int &  waferV,
int &  cellU,
int &  cellV,
int &  celltype,
double &  wt,
bool  extend = false,
bool  debug = false 
) const

Definition at line 1175 of file HGCalDDDConstants.cc.

References funct::abs(), cellHex(), HGCalParameters::cellThickness_, debug, PVValHelper::dx, PVValHelper::dy, HGCalParameters::firstLayer_, HGCalWaferType::getType(), getXY(), HGCalGeometryMode::Hexagon8File, HGCalGeometryMode::Hexagon8Module, hexside_, hexsideT_, HGCSiliconDetId::HGCalCoarseThick, hgpar_, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, phase1PixelTopology::layer, HGCalParameters::layerType_, mode_, HGCalParameters::nCellsFine_, rmax_, rmaxT_, tan30deg_, HGCalParameters::typesInLayers_, HGCalTypes::WaferCenterR, HGCalParameters::waferCopy_, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferThick_, HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), HGCalParameters::waferUVMax_, HGCalWaferIndex::waferV(), x, testProducerWithPsetDescEmpty_cfi::x1, HGCalParameters::xLayerHex_, geometryCSVtoXML::xx, geometryCSVtoXML::xy, y, testProducerWithPsetDescEmpty_cfi::y1, HGCalParameters::yLayerHex_, and geometryCSVtoXML::yy.

1185  {
1186  waferU = waferV = 1 + hgpar_->waferUVMax_;
1187  cellU = cellV = celltype = 0;
1188  if ((hgpar_->xLayerHex_.empty()) || (hgpar_->yLayerHex_.empty()))
1189  return;
1190  int ll = layer - hgpar_->firstLayer_;
1191  bool rotx = ((!hgpar_->layerType_.empty()) && (hgpar_->layerType_[ll] == HGCalTypes::WaferCenterR));
1192  double xx(0), yy(0);
1193  if (rotx) {
1194  std::pair<double, double> xy =
1196  xx = xy.first - hgpar_->xLayerHex_[ll];
1197  yy = xy.second - hgpar_->yLayerHex_[ll];
1198  } else {
1201  }
1202 #ifdef EDM_ML_DEBUG
1203  if (debug)
1204  edm::LogVerbatim("HGCalGeom") << "waferFromPosition:: Layer " << layer << ":" << ll << " Rot " << rotx << " X " << x
1205  << ":" << xx << " Y " << y << ":" << yy;
1206 #endif
1207  double rmax = extend ? rmaxT_ : rmax_;
1208  double hexside = extend ? hexsideT_ : hexside_;
1209  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1210  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
1211  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
1212  if (dx <= rmax && dy <= hexside) {
1213  if ((dy <= 0.5 * hexside) || (dx * tan30deg_ <= (hexside - dy))) {
1219  } else {
1221  celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick
1222  : hgpar_->waferTypeL_[itr->second]);
1223  }
1224 #ifdef EDM_ML_DEBUG
1225  if (debug)
1226  edm::LogVerbatim("HGCalGeom") << "WaferFromPosition:: Input " << layer << ":" << ll << ":"
1227  << hgpar_->firstLayer_ << ":" << rotx << ":" << x << ":" << y << ":"
1228  << hgpar_->xLayerHex_[ll] << ":" << hgpar_->yLayerHex_[ll] << ":" << xx << ":"
1229  << yy << " compared with " << hgpar_->waferPosX_[k] << ":"
1230  << hgpar_->waferPosY_[k] << " difference " << dx << ":" << dy << ":"
1231  << dx * tan30deg_ << ":" << (hexside_ - dy) << " comparator " << rmax_ << ":"
1232  << rmaxT_ << ":" << hexside_ << ":" << hexsideT_ << " wafer " << waferU << ":"
1233  << waferV << ":" << celltype;
1234 #endif
1235  xx -= hgpar_->waferPosX_[k];
1236  yy -= hgpar_->waferPosY_[k];
1237  break;
1238  }
1239  }
1240  }
1241  if ((std::abs(waferU) <= hgpar_->waferUVMax_) && (celltype >= 0)) {
1242  cellHex(xx, yy, celltype, cellU, cellV, extend, debug);
1243  wt = (((celltype < 2) && (mode_ != HGCalGeometryMode::Hexagon8Module))
1244  ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_)
1245  : 1.0);
1246  } else {
1247  cellU = cellV = 2 * hgpar_->nCellsFine_;
1248  wt = 1.0;
1249  celltype = -1;
1250  }
1251  if ((celltype < 0) && debug) {
1252  double x1(xx);
1253  double y1(yy);
1254  edm::LogVerbatim("HGCalGeom") << "waferfFromPosition: Bad type for X " << x << ":" << x1 << ":" << xx << " Y " << y
1255  << ":" << y1 << ":" << yy << " Wafer " << waferU << ":" << waferV << " Cell " << cellU
1256  << ":" << cellV;
1257  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1258  double dx = std::abs(x1 - hgpar_->waferPosX_[k]);
1259  double dy = std::abs(y1 - hgpar_->waferPosY_[k]);
1260  edm::LogVerbatim("HGCalGeom") << "Wafer [" << k << "] Position (" << hgpar_->waferPosX_[k] << ", "
1261  << hgpar_->waferPosY_[k] << ") difference " << dx << ":" << dy << ":"
1262  << dx * tan30deg_ << ":" << hexside - dy << " Paramerers " << rmax << ":"
1263  << hexside;
1264  }
1265  }
1266 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
constexpr std::array< uint8_t, layerIndexSize > layer
int getType(double xpos, double ypos, double zpos)
std::vector< double > yLayerHex_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::vector< int > layerType_
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:26
#define debug
Definition: HDRShower.cc:19
std::vector< double > cellThickness_
wafer_map typesInLayers_
const HGCalGeometryMode::GeometryMode mode_
static constexpr double k_ScaleFromDDD
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
static constexpr double tan30deg_
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::vector< int > waferTypeL_
std::vector< double > xLayerHex_

◆ waferFullInLayer()

bool HGCalDDDConstants::waferFullInLayer ( int  wafer,
int  lay,
bool  reco 
) const

Definition at line 1275 of file HGCalDDDConstants.cc.

References getIndex(), and waferInLayerTest().

1275  {
1276  const auto& indx = getIndex(lay, reco);
1277  if (indx.first < 0)
1278  return false;
1279  return waferInLayerTest(wafer, indx.first, false);
1280 }
bool waferInLayerTest(int wafer, int lay, bool full) const
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix

◆ waferHexagon6()

bool HGCalDDDConstants::waferHexagon6 ( ) const
inline

◆ waferHexagon8()

bool HGCalDDDConstants::waferHexagon8 ( ) const
inline

◆ waferIndex()

int32_t HGCalDDDConstants::waferIndex ( int  wafer,
int  index 
) const
private

Definition at line 1686 of file HGCalDDDConstants.cc.

References hgpar_, phase1PixelTopology::layer, layerFromIndex(), HGCalParameters::waferCopy_, HGCalWaferIndex::waferIndex(), HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

Referenced by waferInLayerTest().

1686  {
1687  int layer = layerFromIndex(index, true);
1691 #ifdef EDM_ML_DEBUG
1692  edm::LogVerbatim("HGCalGeom") << "WaferIndex for " << wafer << ":" << index << " (" << layer << ":" << waferU << ":"
1693  << waferV << ") " << indx;
1694 #endif
1695  return indx;
1696 }
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
int layerFromIndex(int index, bool reco) const
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
const HGCalParameters * hgpar_

◆ waferInLayer()

bool HGCalDDDConstants::waferInLayer ( int  wafer,
int  lay,
bool  reco 
) const

Definition at line 1268 of file HGCalDDDConstants.cc.

References HGCalParameters::defineFull_, getIndex(), hgpar_, and waferInLayerTest().

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getSummary(), and HGCalDDDConstants().

1268  {
1269  const auto& indx = getIndex(lay, reco);
1270  if (indx.first < 0)
1271  return false;
1272  return waferInLayerTest(wafer, indx.first, hgpar_->defineFull_);
1273 }
bool waferInLayerTest(int wafer, int lay, bool full) const
std::pair< int, float > getIndex(int lay, bool reco) const
fixed size matrix
const HGCalParameters * hgpar_

◆ waferInLayerTest()

bool HGCalDDDConstants::waferInLayerTest ( int  wafer,
int  lay,
bool  full 
) const
private

Definition at line 1698 of file HGCalDDDConstants.cc.

References TCMET_cfi::corner, full, fullAndPart_, hexside_, hgpar_, recoMuon::in, HGCalParameters::k_CornerSize, rmax_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalGeomTools::waferCorner(), waferHexagon6(), waferIndex(), HGCalParameters::waferInfoMap_, HGCalWaferIndex::waferLayer(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), HGCalParameters::xLayerHex_, and HGCalParameters::yLayerHex_.

Referenced by maxCells(), maxRows(), modulesInit(), numberCells(), waferFullInLayer(), and waferInLayer().

1698  {
1699  bool in = (waferHexagon6()) ? true : false;
1700  if (!in) {
1701  double xpos = hgpar_->waferPosX_[wafer] + hgpar_->xLayerHex_[lay];
1702  double ypos = hgpar_->waferPosY_[wafer] + hgpar_->yLayerHex_[lay];
1703  std::pair<int, int> corner = HGCalGeomTools::waferCorner(
1704  xpos, ypos, rmax_, hexside_, hgpar_->rMinLayHex_[lay], hgpar_->rMaxLayHex_[lay], in);
1705  in = (full ? (corner.first > 0) : (corner.first == (int)(HGCalParameters::k_CornerSize)));
1706  if (in && fullAndPart_) {
1707  int indx = waferIndex(wafer, lay);
1708  in = (hgpar_->waferInfoMap_.find(indx) != hgpar_->waferInfoMap_.end());
1709 #ifdef EDM_ML_DEBUG
1710  if (!in)
1711  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay << " wafer " << wafer << " index " << indx
1712  << "( " << HGCalWaferIndex::waferLayer(indx) << ", "
1713  << HGCalWaferIndex::waferU(indx) << ", " << HGCalWaferIndex::waferV(indx)
1714  << ") in " << in;
1715 #endif
1716  }
1717 #ifdef EDM_ML_DEBUG
1718  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay << " wafer " << wafer << " R-limits "
1719  << hgpar_->rMinLayHex_[lay] << ":" << hgpar_->rMaxLayHex_[lay] << " Corners "
1720  << corner.first << ":" << corner.second << " In " << in;
1721 #endif
1722  }
1723  return in;
1724 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
int32_t waferLayer(const int32_t index)
bool waferHexagon6() const
static constexpr uint32_t k_CornerSize
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
std::vector< double > yLayerHex_
Definition: GenABIO.cc:168
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
int32_t waferIndex(int wafer, int index) const
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
std::vector< double > waferPosX_
std::vector< double > xLayerHex_

◆ waferLocal2Global()

GlobalPoint HGCalDDDConstants::waferLocal2Global ( HepGeom::Point3D< float > &  loc,
const DetId id,
bool  useWafer,
bool  reco,
bool  debug 
) const
inline

Definition at line 210 of file HGCalDDDConstants.h.

References debug, getXY(), HGCSiliconDetId::layer(), dt_dqm_sourceclient_common_cff::reco, waferPositionNoRot(), HGCSiliconDetId::waferU(), HGCSiliconDetId::waferV(), waferZ(), x, geometryCSVtoXML::xx, geometryCSVtoXML::xy, y, HGCSiliconDetId::zside(), and geometryCSVtoXML::zz.

211  {
212  HGCSiliconDetId detid(id);
213  double x(0), y(0);
214  if (useWafer) {
215  auto xyw = waferPositionNoRot(detid.layer(), detid.waferU(), detid.waferV(), reco, debug);
216  x = xyw.first;
217  y = xyw.second;
218  }
219  auto xy = getXY(detid.layer(), (x + loc.x()), (y + loc.y()), false);
220  double zz =
221  (detid.zside() < 0) ? -(loc.z() + waferZ(detid.layer(), reco)) : (loc.z() + waferZ(detid.layer(), reco));
222  double xx = (detid.zside() < 0) ? -xy.first : xy.first;
223  return GlobalPoint(xx, xy.second, zz);
224  }
double waferZ(int layer, bool reco) const
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
#define debug
Definition: HDRShower.cc:19
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug=false) const

◆ waferMax()

int HGCalDDDConstants::waferMax ( ) const
inline

Definition at line 177 of file HGCalDDDConstants.h.

References waferMax_.

Referenced by HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_().

177 { return waferMax_[1]; }
std::array< int, 4 > waferMax_

◆ waferMin()

int HGCalDDDConstants::waferMin ( ) const
inline

Definition at line 178 of file HGCalDDDConstants.h.

References waferMax_.

Referenced by HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_().

178 { return waferMax_[0]; }
std::array< int, 4 > waferMax_

◆ waferParameters()

std::pair< double, double > HGCalDDDConstants::waferParameters ( bool  reco) const

Definition at line 1282 of file HGCalDDDConstants.cc.

References hexside_, HGCalParameters::k_ScaleToDDD, and rmax_.

1282  {
1283  if (reco)
1284  return std::make_pair(rmax_, hexside_);
1285  else
1287 }
static constexpr double k_ScaleToDDD
fixed size matrix

◆ waferPosition() [1/3]

std::pair< double, double > HGCalDDDConstants::waferPosition ( int  wafer,
bool  reco 
) const

Definition at line 1289 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

Referenced by HGCalGeometryLoader::build(), HGCMouseBite::exclude(), and waferPositionNoRot().

1289  {
1290  double xx(0), yy(0);
1291  if (wafer >= 0 && wafer < (int)(hgpar_->waferPosX_.size())) {
1292  xx = hgpar_->waferPosX_[wafer];
1293  yy = hgpar_->waferPosY_[wafer];
1294  }
1295  if (!reco) {
1298  }
1299  return std::make_pair(xx, yy);
1300 }
std::vector< double > waferPosY_
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_
std::vector< double > waferPosX_

◆ waferPosition() [2/3]

std::pair< double, double > HGCalDDDConstants::waferPosition ( int  lay,
int  waferU,
int  waferV,
bool  reco,
bool  debug = false 
) const

Definition at line 1302 of file HGCalDDDConstants.cc.

References debug, HGCalParameters::firstLayer_, getXY(), hgpar_, HGCalParameters::layerType_, HGCalTypes::WaferCenterR, waferPositionNoRot(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and geometryCSVtoXML::xy.

1303  {
1304  int ll = lay - hgpar_->firstLayer_;
1305  bool rotx = ((!hgpar_->layerType_.empty()) && (hgpar_->layerType_[ll] == HGCalTypes::WaferCenterR));
1306 #ifdef EDM_ML_DEBUG
1307  if (debug)
1308  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << ":" << ll << " Rotation " << rotx << " U:V " << waferU << ":"
1309  << waferV;
1310 #endif
1311  auto xy = waferPositionNoRot(lay, waferU, waferV, reco, debug);
1312  std::pair<double, double> xy0 = (rotx) ? getXY(lay, xy.first, xy.second, false) : xy;
1313 #ifdef EDM_ML_DEBUG
1314  if (debug)
1315  edm::LogVerbatim("HGCalGeom") << "Without and with rotation " << xy.first << ":" << xy.second << ":" << xy0.first
1316  << ":" << xy0.second;
1317 #endif
1318  return xy0;
1319 }
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
std::vector< int > layerType_
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:26
#define debug
Definition: HDRShower.cc:19
fixed size matrix
int32_t waferV(const int32_t index)
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug=false) const
const HGCalParameters * hgpar_

◆ waferPosition() [3/3]

std::pair< double, double > HGCalDDDConstants::waferPosition ( int  waferU,
int  waferV,
bool  reco 
) const
private

Definition at line 1750 of file HGCalDDDConstants.cc.

References hgpar_, HGCalParameters::k_ScaleToDDD, HGCalWaferIndex::waferIndex(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::wafersInLayers_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), geometryCSVtoXML::xx, and geometryCSVtoXML::yy.

1750  {
1751  double xx(0), yy(0);
1752  int indx = HGCalWaferIndex::waferIndex(0, waferU, waferV);
1753  auto itr = hgpar_->wafersInLayers_.find(indx);
1754  if (itr != hgpar_->wafersInLayers_.end()) {
1755  xx = hgpar_->waferPosX_[itr->second];
1756  yy = hgpar_->waferPosY_[itr->second];
1757  }
1758  if (!reco) {
1761  }
1762  return std::make_pair(xx, yy);
1763 }
std::vector< double > waferPosY_
int32_t waferU(const int32_t index)
wafer_map wafersInLayers_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
static constexpr double k_ScaleToDDD
fixed size matrix
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_
std::vector< double > waferPosX_

◆ waferPositionNoRot()

std::pair< double, double > HGCalDDDConstants::waferPositionNoRot ( int  lay,
int  waferU,
int  waferV,
bool  reco,
bool  debug = false 
) const
private

Definition at line 1726 of file HGCalDDDConstants.cc.

References debug, HGCalParameters::firstLayer_, hgpar_, HGCalParameters::k_ScaleToDDD, waferPosition(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, HGCalParameters::xLayerHex_, geometryCSVtoXML::xy, y, and HGCalParameters::yLayerHex_.

Referenced by isValidCell8(), localToGlobal8(), locateCell(), waferLocal2Global(), and waferPosition().

1727  {
1728  int ll = lay - hgpar_->firstLayer_;
1729  double x = hgpar_->xLayerHex_[ll];
1730  double y = hgpar_->yLayerHex_[ll];
1731 #ifdef EDM_ML_DEBUG
1732  if (debug)
1733  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << ":" << ll << " Shift " << hgpar_->xLayerHex_[ll] << ":"
1734  << hgpar_->yLayerHex_[ll] << " U:V " << waferU << ":" << waferV;
1735 #endif
1736  if (!reco) {
1739  }
1740  const auto& xy = waferPosition(waferU, waferV, reco);
1741  x += xy.first;
1742  y += xy.second;
1743 #ifdef EDM_ML_DEBUG
1744  if (debug)
1745  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << ":" << xy.first << ":" << xy.second;
1746 #endif
1747  return std::make_pair(x, y);
1748 }
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
std::vector< double > yLayerHex_
std::pair< double, double > waferPosition(int wafer, bool reco) const
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
fixed size matrix
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_
std::vector< double > xLayerHex_

◆ wafers() [1/2]

int HGCalDDDConstants::wafers ( ) const

Definition at line 1474 of file HGCalDDDConstants.cc.

References HGCalParameters::depth_, hgpar_, mps_fire::i, createfilelist::int, layers(), HGCalParameters::moduleLayR_, modules(), and tileTrapezoid().

Referenced by HGCalTopology::allGeomModules(), and HGCalDDDConstants().

1474  {
1475  int wafer(0);
1476  if (!tileTrapezoid()) {
1477  for (unsigned int i = 0; i < layers(true); ++i) {
1478  int lay = hgpar_->depth_[i];
1479  wafer += modules(lay, true);
1480  }
1481  } else {
1482  wafer = (int)(hgpar_->moduleLayR_.size());
1483  }
1484  return wafer;
1485 }
std::vector< int > depth_
std::vector< int > moduleLayR_
unsigned int layers(bool reco) const
bool tileTrapezoid() const
int modules(int lay, bool reco) const
const HGCalParameters * hgpar_

◆ wafers() [2/2]

int HGCalDDDConstants::wafers ( int  layer,
int  type 
) const

Definition at line 1487 of file HGCalDDDConstants.cc.

References HGCalParameters::firstModule_, getIndex(), hgpar_, HGCalParameters::lastModule_, phase1PixelTopology::layer, tileTrapezoid(), and waferLayer_.

1487  {
1488  int wafer(0);
1489  if (!tileTrapezoid()) {
1490  auto itr = waferLayer_.find(layer);
1491  if (itr != waferLayer_.end()) {
1492  unsigned ity = (type > 0 && type <= 2) ? type : 0;
1493  wafer = (itr->second)[ity];
1494  }
1495  } else {
1496  const auto& index = getIndex(layer, true);
1497  wafer = 1 + hgpar_->lastModule_[index.first] - hgpar_->firstModule_[index.first];
1498  }
1499  return wafer;
1500 }
constexpr std::array< uint8_t, layerIndexSize > layer
std::map< int, HGCWaferParam > waferLayer_
std::vector< int > firstModule_
std::pair< int, float > getIndex(int lay, bool reco) const
bool tileTrapezoid() const
std::vector< int > lastModule_
const HGCalParameters * hgpar_

◆ waferSepar()

double HGCalDDDConstants::waferSepar ( bool  reco) const
inline

Definition at line 207 of file HGCalDDDConstants.h.

References hgpar_, HGCalParameters::k_ScaleToDDD, and HGCalParameters::sensorSeparation_.

207  {
209  }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ waferSize()

double HGCalDDDConstants::waferSize ( bool  reco) const
inline

Definition at line 225 of file HGCalDDDConstants.h.

References hgpar_, HGCalParameters::k_ScaleToDDD, and HGCalParameters::waferSize_.

Referenced by HFNoseSD::update(), and HGCalSD::update().

225  {
227  }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ waferToCopy()

int HGCalDDDConstants::waferToCopy ( int  wafer) const
inline

Definition at line 230 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

230  {
231  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferCopy_.size())))
232  ? hgpar_->waferCopy_[wafer]
233  : static_cast<int>(hgpar_->waferCopy_.size());
234  }
std::vector< int > waferCopy_
const HGCalParameters * hgpar_

◆ waferType() [1/3]

int HGCalDDDConstants::waferType ( DetId const &  id,
bool  fromFile = false 
) const

Definition at line 1321 of file HGCalDDDConstants.cc.

References DetId::Forward, hgpar_, HFNoseDetId::layer(), HGCSiliconDetId::layer(), phase1PixelTopology::layer, HFNoseDetId::type(), HGCSiliconDetId::type(), waferFileSize(), waferHexagon6(), waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, waferTypeL(), HGCalWaferIndex::waferU(), HFNoseDetId::waferU(), HGCSiliconDetId::waferU(), HGCalWaferIndex::waferV(), HGCSiliconDetId::waferV(), and HFNoseDetId::waferV().

Referenced by HGCalSimHitValidation::analyzeHits(), assignCellHex(), cellThickness(), HGCalNumberingScheme::getUnitID(), isHalfCell(), HGCalUncalibRecHitRecWeightsAlgo< HGCDataFrame >::makeRecHit(), and HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_().

1321  {
1322  int type(1);
1323  if (waferHexagon8()) {
1324  if (fromFile && (waferFileSize() > 0)) {
1325  int layer(0), waferU(0), waferV(0);
1326  if (id.det() != DetId::Forward) {
1327  HGCSiliconDetId hid(id);
1328  layer = hid.layer();
1329  waferU = hid.waferU();
1330  waferV = hid.waferV();
1331  } else {
1332  HFNoseDetId hid(id);
1333  layer = hid.layer();
1334  waferU = hid.waferU();
1335  waferV = hid.waferV();
1336  }
1338  if (itr != hgpar_->waferInfoMap_.end())
1339  type = (itr->second).type;
1340  } else {
1341  type = ((id.det() != DetId::Forward) ? HGCSiliconDetId(id).type() : HFNoseDetId(id).type());
1342  }
1343  } else if (waferHexagon6()) {
1344  type = waferTypeL(HGCalDetId(id).wafer()) - 1;
1345  }
1346  return type;
1347 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned int waferFileSize() const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
int type() const
get the type
Definition: HFNoseDetId.h:50
int32_t waferV(const int32_t index)
int waferTypeL(int wafer) const
int type() const
get the type
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferType() [2/3]

int HGCalDDDConstants::waferType ( int  layer,
int  waferU,
int  waferV,
bool  fromFile = false 
) const

Definition at line 1349 of file HGCalDDDConstants.cc.

References HGCSiliconDetId::HGCalCoarseThick, hgpar_, createfilelist::int, phase1PixelTopology::layer, HGCalParameters::typesInLayers_, waferFileSize(), waferHexagon6(), waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

1349  {
1351  if (waferHexagon8()) {
1352  if (fromFile && (waferFileSize() > 0)) {
1354  if (itr != hgpar_->waferInfoMap_.end())
1355  type = (itr->second).type;
1356  } else {
1358  if (itr != hgpar_->typesInLayers_.end())
1359  type = hgpar_->waferTypeL_[itr->second];
1360  }
1361  } else if (waferHexagon6()) {
1362  if ((waferU >= 0) && (waferU < (int)(hgpar_->waferTypeL_.size())))
1363  type = (hgpar_->waferTypeL_[waferU] - 1);
1364  }
1365  return type;
1366 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned int waferFileSize() const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
wafer_map typesInLayers_
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ waferType() [3/3]

std::tuple< int, int, int > HGCalDDDConstants::waferType ( HGCSiliconDetId const &  id,
bool  fromFile = false 
) const

Definition at line 1368 of file HGCalDDDConstants.cc.

References first, hgpar_, HGCalGeomTools::k_allCorners, HGCalGeomTools::k_fiveCorners, HGCalGeomTools::k_fourCorners, HGCalWaferMask::k_OffsetRotation, HGCalGeomTools::k_threeCorners, phase1PixelTopology::layer, hgcalPerformanceValidation::orient, edm::second(), HGCalParameters::typesInLayers_, waferFileSize(), HGCalTypes::WaferFive, HGCalTypes::WaferFull, HGCalTypes::WaferHalf, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalTypes::WaferThree, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

1368  {
1369  const auto& index = HGCalWaferIndex::waferIndex(id.layer(), id.waferU(), id.waferV());
1370  int type(-1), part(-1), orient(-1);
1371  if (fromFile && (waferFileSize() > 0)) {
1372  auto itr = hgpar_->waferInfoMap_.find(index);
1373  if (itr != hgpar_->waferInfoMap_.end()) {
1374  type = (itr->second).type;
1375  part = (itr->second).part;
1376  orient = (itr->second).orient;
1377  }
1378  } else {
1379  auto ktr = hgpar_->typesInLayers_.find(index);
1380  if (ktr != hgpar_->typesInLayers_.end())
1381  type = hgpar_->waferTypeL_[ktr->second];
1382  auto itr = hgpar_->waferTypes_.find(index);
1383  if (itr != hgpar_->waferTypes_.end()) {
1384  if ((itr->second).second < HGCalWaferMask::k_OffsetRotation) {
1385  orient = (itr->second).second;
1386  if ((itr->second).first == HGCalGeomTools::k_allCorners) {
1388  } else if ((itr->second).first == HGCalGeomTools::k_fiveCorners) {
1390  } else if ((itr->second).first == HGCalGeomTools::k_fourCorners) {
1392  } else if ((itr->second).first == HGCalGeomTools::k_threeCorners) {
1394  }
1395  } else {
1396  part = (itr->second).first;
1397  orient = ((itr->second).second - HGCalWaferMask::k_OffsetRotation);
1398  }
1399  } else {
1401  orient = 0;
1402  }
1403  }
1404  return std::make_tuple(type, part, orient);
1405 }
static constexpr int k_fourCorners
int32_t waferU(const int32_t index)
static constexpr int32_t WaferThree
Definition: HGCalTypes.h:41
constexpr std::array< uint8_t, layerIndexSize > layer
U second(std::pair< T, U > const &p)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:34
unsigned int waferFileSize() const
static constexpr int32_t WaferHalf
Definition: HGCalTypes.h:38
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
static constexpr int k_fiveCorners
part
Definition: HCALResponse.h:20
wafer_map typesInLayers_
static constexpr int k_OffsetRotation
static constexpr int k_threeCorners
int32_t waferV(const int32_t index)
static constexpr int32_t WaferFive
Definition: HGCalTypes.h:35
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
static constexpr int k_allCorners
std::vector< int > waferTypeL_

◆ waferTypeL()

int HGCalDDDConstants::waferTypeL ( int  wafer) const
inline

Definition at line 240 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeL_.

Referenced by HGCalTBAnalyzer::analyzeRecHits(), PFRecHitQTestThresholdInThicknessNormalizedMIPs::test(), and waferType().

240  {
241  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferTypeL_.size()))) ? hgpar_->waferTypeL_[wafer] : 0;
242  }
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ waferTypeRotation()

std::pair< int, int > HGCalDDDConstants::waferTypeRotation ( int  layer,
int  waferU,
int  waferV,
bool  fromFile = false,
bool  debug = false 
) const

Definition at line 1407 of file HGCalDDDConstants.cc.

References debug, TauDecayModes::dec, first, hgpar_, HGCalGeomTools::k_allCorners, HGCalGeomTools::k_fiveCorners, HGCalGeomTools::k_fourCorners, HGCalWaferMask::k_OffsetRotation, HGCalGeomTools::k_threeCorners, phase1PixelTopology::layer, hgcalPerformanceValidation::orient, edm::second(), HGCalTypes::WaferCorner0, waferFileSize(), HGCalTypes::WaferFive, HGCalTypes::WaferFull, HGCalTypes::WaferHalf, waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalTypes::WaferOut, HGCalTypes::WaferThree, HGCalParameters::waferTypes_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and LaserClient_cfi::wl.

Referenced by isValidCell8().

1408  {
1409  int type(HGCalTypes::WaferOut), rotn(0);
1411  bool withinList(true);
1412  if (fromFile && (waferFileSize() > 0)) {
1413  auto itr = hgpar_->waferInfoMap_.find(wl);
1414  withinList = (itr != hgpar_->waferInfoMap_.end());
1415  if (withinList) {
1416  type = (itr->second).part;
1417  rotn = (itr->second).orient;
1418  }
1419  } else {
1420  auto itr = hgpar_->waferTypes_.find(wl);
1421  if (waferHexagon8()) {
1422  withinList = (itr != hgpar_->waferTypes_.end());
1423  if (withinList) {
1424  if ((itr->second).second < HGCalWaferMask::k_OffsetRotation) {
1425  rotn = (itr->second).second;
1426  if ((itr->second).first == HGCalGeomTools::k_allCorners) {
1428  } else if ((itr->second).first == HGCalGeomTools::k_fiveCorners) {
1430  } else if ((itr->second).first == HGCalGeomTools::k_fourCorners) {
1432  } else if ((itr->second).first == HGCalGeomTools::k_threeCorners) {
1434  }
1435  } else {
1436  type = (itr->second).first;
1437  rotn = ((itr->second).second - HGCalWaferMask::k_OffsetRotation);
1438  }
1439  } else {
1441  rotn = HGCalTypes::WaferCorner0;
1442  }
1443  }
1444  }
1445 #ifdef EDM_ML_DEBUG
1446  if (debug)
1447  edm::LogVerbatim("HGCalGeom") << "waferTypeRotation: Layer " << layer << " Wafer " << waferU << ":" << waferV
1448  << " Index " << std::hex << wl << std::dec << ":" << withinList << " Type " << type
1449  << " Rotation " << rotn;
1450 #endif
1451  return std::make_pair(type, rotn);
1452 }
Log< level::Info, true > LogVerbatim
static constexpr int k_fourCorners
int32_t waferU(const int32_t index)
static constexpr int32_t WaferOut
Definition: HGCalTypes.h:55
static constexpr int32_t WaferThree
Definition: HGCalTypes.h:41
bool waferHexagon8() const
constexpr std::array< uint8_t, layerIndexSize > layer
U second(std::pair< T, U > const &p)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:34
unsigned int waferFileSize() const
static constexpr int32_t WaferHalf
Definition: HGCalTypes.h:38
static constexpr int32_t WaferCorner0
Definition: HGCalTypes.h:12
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
#define debug
Definition: HDRShower.cc:19
static constexpr int k_fiveCorners
part
Definition: HCALResponse.h:20
static constexpr int k_OffsetRotation
static constexpr int k_threeCorners
int32_t waferV(const int32_t index)
static constexpr int32_t WaferFive
Definition: HGCalTypes.h:35
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
static constexpr int k_allCorners

◆ waferTypeT()

int HGCalDDDConstants::waferTypeT ( int  wafer) const
inline

Definition at line 236 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeT_.

Referenced by HGCalGeometryLoader::build(), HGCalGeometry::getClosestCell(), and hgcal::RecHitTools::isHalfCell().

236  {
237  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferTypeT_.size()))) ? hgpar_->waferTypeT_[wafer] : 0;
238  }
std::vector< int > waferTypeT_
const HGCalParameters * hgpar_

◆ waferUVMax()

int HGCalDDDConstants::waferUVMax ( ) const
inline

Definition at line 248 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferUVMax_.

Referenced by HGCalTopology::HGCalTopology().

248 { return hgpar_->waferUVMax_; }
const HGCalParameters * hgpar_

◆ waferVirtual()

bool HGCalDDDConstants::waferVirtual ( int  layer,
int  waferU,
int  waferV 
) const

Definition at line 1454 of file HGCalDDDConstants.cc.

References hgpar_, phase1PixelTopology::layer, waferHexagon6(), waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferTypes_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and LaserClient_cfi::wl.

1454  {
1455  bool type(false);
1456  if (waferHexagon8()) {
1458  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1459  } else if (waferHexagon6()) {
1460  int wl = HGCalWaferIndex::waferIndex(layer, waferU, 0, true);
1461  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1462  }
1463  return type;
1464 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
constexpr std::array< uint8_t, layerIndexSize > layer
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_

◆ waferZ()

double HGCalDDDConstants::waferZ ( int  layer,
bool  reco 
) const

Member Data Documentation

◆ dPhiMin

const float HGCalDDDConstants::dPhiMin = 0.02
private

Definition at line 271 of file HGCalDDDConstants.h.

◆ fullAndPart_

const bool HGCalDDDConstants::fullAndPart_
private

Definition at line 278 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), isValidHex8(), and waferInLayerTest().

◆ geomTools_

HGCalGeomTools HGCalDDDConstants::geomTools_
private

Definition at line 269 of file HGCalDDDConstants.h.

Referenced by locateCell().

◆ hexside_

double HGCalDDDConstants::hexside_
private

◆ hexsideT_

double HGCalDDDConstants::hexsideT_
private

Definition at line 280 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and waferFromPosition().

◆ hgpar_

const HGCalParameters* HGCalDDDConstants::hgpar_
private

◆ k_horizontalShift

const double HGCalDDDConstants::k_horizontalShift = 1.0
private

Definition at line 270 of file HGCalDDDConstants.h.

◆ max_modules_layer_

Simrecovecs HGCalDDDConstants::max_modules_layer_
private

Definition at line 283 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

◆ maxWafersPerLayer_

int32_t HGCalDDDConstants::maxWafersPerLayer_
private

Definition at line 284 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModulesPerLayer().

◆ mode_

const HGCalGeometryMode::GeometryMode HGCalDDDConstants::mode_
private

◆ modHalf_

int32_t HGCalDDDConstants::modHalf_
private

Definition at line 281 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

◆ rmax_

double HGCalDDDConstants::rmax_
private

◆ rmaxT_

double HGCalDDDConstants::rmaxT_
private

Definition at line 280 of file HGCalDDDConstants.h.

Referenced by cellHex(), HGCalDDDConstants(), and waferFromPosition().

◆ sqrt3_

const double HGCalDDDConstants::sqrt3_
private

Definition at line 276 of file HGCalDDDConstants.h.

Referenced by cellHex(), distFromEdgeHex(), and locateCell().

◆ tan30deg_

constexpr double HGCalDDDConstants::tan30deg_ = 0.5773502693
staticprivate

◆ tot_layers_

std::array<uint32_t, 2> HGCalDDDConstants::tot_layers_
private

Definition at line 282 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), lastLayer(), and layers().

◆ tot_wafers_

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 281 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().

◆ waferIn_

std::unordered_map<int32_t, bool> HGCalDDDConstants::waferIn_
private

Definition at line 287 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and isValidHex8().

◆ waferLayer_

std::map<int, HGCWaferParam> HGCalDDDConstants::waferLayer_
private

Definition at line 285 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and wafers().

◆ waferMax_

std::array<int, 4> HGCalDDDConstants::waferMax_
private

Definition at line 286 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), waferCount(), waferMax(), and waferMin().