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 zside, int lay, bool reco, bool extend, bool debug) const
 
std::array< int, 3 > assignCellTrap (float x, float y, float z, int lay, bool reco) const
 
bool cassetteMode () const
 
bool cassetteShiftScintillator (int zside, int layer, int iphi) const
 
bool cassetteShiftSilicon (int zside, int layer, int waferU, int waferV) const
 
int cassetteTile (int iphi) const
 
std::pair< double, double > cellEtaPhiTrap (int type, int irad) const
 
bool cellInLayer (int waferU, int waferV, int cellU, int cellV, int lay, int zside, 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< double, double > getRangeR (int, bool reco) 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
 
double guardRingOffset (bool reco) 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) const
 
bool isValidHex8 (int lay, int modU, int modV, int cellU, int cellV, bool fullAndPart) const
 
bool isValidTrap (int zside, 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 layerType (int lay) const
 
int levelTop (int ind=0) const
 
std::pair< float, float > localToGlobal8 (int zside, 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 zside, int lay, int waferU, int waferV, int cellU, int cellV, bool reco, bool all, bool norot, bool debug) const
 
std::pair< float, float > locateCell (const HGCSiliconDetId &, bool debug) const
 
std::pair< float, float > locateCell (const HGCScintillatorDetId &, bool debug) const
 
std::pair< float, float > locateCellHex (int cell, int wafer, bool reco) const
 
std::pair< float, float > locateCellTrap (int zside, int lay, int ieta, int iphi, bool reco, bool debug) 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
 
double sensorSizeOffset (bool reco) 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
 
HGCalParameters::tileInfo tileInfo (int zside, int layer, int ring) const
 
bool tilePhiEdge (double phi, int layer, int iphi) const
 
bool tileRingEdge (double rho, int layer, int ring) 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
 
bool trapezoidFile () const
 
unsigned int volumes () const
 
int waferCount (const int type) const
 
int waferFileIndex (unsigned int kk) const
 
std::tuple< int, int, int, int > waferFileInfo (unsigned int kk) const
 
bool waferFileInfoExist (int kk) const
 
std::tuple< int, 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 zside, const int layer, int &waferU, int &waferV, int &cellU, int &cellV, int &celltype, double &wt, bool extend, bool debug) const
 
bool waferFullInLayer (int wafer, int lay, bool reco) const
 
bool waferHexagon6 () const
 
bool waferHexagon8 () const
 
bool waferHexagon8File () const
 
bool waferHexagon8Module () const
 
HGCalParameters::waferInfo waferInfo (int lay, int waferU, int waferV) 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) 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) const
 
int waferType (int layer, int waferU, int waferV, bool fromFile) const
 
std::tuple< int, int, int > waferType (HGCSiliconDetId const &id, bool fromFile) const
 
int waferTypeL (int wafer) const
 
std::pair< int, int > waferTypeRotation (int layer, int waferU, int waferV, bool fromFile, bool debug) 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 ()=default
 

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 place, int part, int &cellU, int &cellV, bool extend, bool debug) 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) const
 

Private Attributes

const bool fullAndPart_
 
HGCalGeomTools geomTools_
 
double hexside_
 
double hexsideT_
 
HGCalCassette hgcassette_
 
std::unique_ptr< HGCalCellhgcell_
 
std::unique_ptr< HGCalCellUVhgcellUV_
 
const HGCalParametershgpar_
 
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 float dPhiMin = 0.02
 
static constexpr double k_horizontalShift = 1.0
 
static constexpr double tan30deg_ = 0.5773502693
 
static constexpr double tol_ = 0.001
 

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 35 of file HGCalDDDConstants.h.

Member Typedef Documentation

◆ HGCWaferParam

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

Definition at line 256 of file HGCalDDDConstants.h.

◆ Simrecovecs

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

Definition at line 255 of file HGCalDDDConstants.h.

Constructor & Destructor Documentation

◆ HGCalDDDConstants()

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

Definition at line 25 of file HGCalDDDConstants.cc.

References cassetteMode(), HGCalParameters::cassettes_, HGCalParameters::cassetteShift_, HGCalParameters::cellSize_, funct::cos(), fullAndPart_, getIndex(), getTrForm(), getTrFormN(), hexside_, hexsideT_, hgcassette_, hgcell_, hgcellUV_, hgpar_, mps_fire::i, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrform::lay, nano_mu_digi_cff::layer, layers(), layersInit(), SiStripPI::max, max_modules_layer_, maxCells(), maxWafersPerLayer_, mode_, modHalf_, modulesInit(), Skims_PA_cff::name, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, rmax_, rmaxT_, sectors(), HGCalParameters::sensorSeparation_, HGCalCassette::setParameter(), 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.

27 #ifdef EDM_ML_DEBUG
28  edm::LogVerbatim("HGCalGeom") << "Mode " << mode_ << " FullAndPart " << fullAndPart_;
29 #endif
30  if (waferHexagon6() || waferHexagon8()) {
33  hexside_ = 2.0 * rmax_ * tan30deg_;
34  hexsideT_ = 2.0 * rmaxT_ * tan30deg_;
35  hgcell_ = std::make_unique<HGCalCell>(2.0 * rmaxT_, hgpar_->nCellsFine_, hgpar_->nCellsCoarse_);
36  hgcellUV_ = std::make_unique<HGCalCellUV>(
38 #ifdef EDM_ML_DEBUG
39  edm::LogVerbatim("HGCalGeom") << "rmax_ " << rmax_ << ":" << rmaxT_ << ":" << hexside_ << ":" << hexsideT_
40  << " CellSize " << 0.5 * HGCalParameters::k_ScaleFromDDD * hgpar_->cellSize_[0] << ":"
42 #endif
43  }
44  if (cassetteMode()) {
46 #ifdef EDM_ML_DEBUG
47  edm::LogVerbatim("HGCalGeom") << "Setup HGCalCassette for " << hgpar_->cassettes_ << " cassettes";
48 #endif
49  }
50  // init maps and constants
51  modHalf_ = 0;
53  for (int simreco = 0; simreco < 2; ++simreco) {
54  tot_layers_[simreco] = layersInit((bool)simreco);
55  max_modules_layer_[simreco].resize(tot_layers_[simreco] + 1);
56  for (unsigned int layer = 1; layer <= tot_layers_[simreco]; ++layer) {
57  max_modules_layer_[simreco][layer] = modulesInit(layer, (bool)simreco);
58  if (simreco == 1) {
59  modHalf_ += max_modules_layer_[simreco][layer];
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with " << max_modules_layer_[simreco][layer] << ":"
63  << modHalf_ << " modules in RECO";
64  } else {
65  edm::LogVerbatim("HGCalGeom") << "Layer " << layer << " with " << max_modules_layer_[simreco][layer]
66  << " modules in SIM";
67 #endif
68  }
69  }
70 #ifdef EDM_ML_DEBUG
71  edm::LogVerbatim("HGCalGeom") << "SimReco " << simreco << " with " << tot_layers_[simreco] << " Layers";
72 #endif
73  }
74  tot_wafers_ = wafers();
75 
76 #ifdef EDM_ML_DEBUG
77  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants initialized for " << name << " with " << layers(false) << ":"
78  << layers(true) << " layers, " << wafers() << ":" << 2 * modHalf_
79  << " wafers with maximum " << maxWafersPerLayer_ << " per layer and "
80  << "maximum of " << maxCells(false) << ":" << maxCells(true) << " cells";
81 #endif
82  if (waferHexagon6() || waferHexagon8()) {
83  int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
84  for (unsigned int i = 0; i < getTrFormN(); ++i) {
85  int lay0 = getTrForm(i).lay;
86  int wmin(9999999), wmax(-9999999), kount(0);
87  for (int wafer = 0; wafer < sectors(); ++wafer) {
88  bool waferIn = waferInLayer(wafer, lay0, true);
89  if (waferHexagon8()) {
90  int kndx = HGCalWaferIndex::waferIndex(lay0,
93  waferIn_[kndx] = waferIn;
94  }
95  if (waferIn) {
96  int waferU = ((waferHexagon6()) ? wafer : HGCalWaferIndex::waferU(hgpar_->waferCopy_[wafer]));
97  if (waferU < wmin)
98  wmin = waferU;
99  if (waferU > wmax)
100  wmax = waferU;
101  ++kount;
102  }
103  }
104  if (wminT > wmin)
105  wminT = wmin;
106  if (wmaxT < wmax)
107  wmaxT = wmax;
108  if (kount1 < kount)
109  kount1 = kount;
110  kount2 += kount;
111 #ifdef EDM_ML_DEBUG
112  int lay1 = getIndex(lay0, true).first;
113  edm::LogVerbatim("HGCalGeom") << "Index " << i << " Layer " << lay0 << ":" << lay1 << " Wafer " << wmin << ":"
114  << wmax << ":" << kount;
115 #endif
116  HGCWaferParam a1{{wmin, wmax, kount}};
117  waferLayer_[lay0] = a1;
118  }
119  waferMax_ = std::array<int, 4>{{wminT, wmaxT, kount1, kount2}};
120 #ifdef EDM_ML_DEBUG
121  edm::LogVerbatim("HGCalGeom") << "Overall wafer statistics: " << wminT << ":" << wmaxT << ":" << kount1 << ":"
122  << kount2;
123 #endif
124  }
125 }
Log< level::Info, true > LogVerbatim
unsigned int layersInit(bool reco) const
HGCalCassette hgcassette_
std::unique_ptr< HGCalCellUV > hgcellUV_
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_
bool waferInLayer(int wafer, int lay, bool reco) const
std::map< int, HGCWaferParam > waferLayer_
std::unique_ptr< HGCalCell > hgcell_
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
bool waferHexagon8File() const
const HGCalGeometryMode::GeometryMode mode_
static constexpr double k_ScaleFromDDD
std::array< int, 3 > HGCWaferParam
bool cassetteMode() const
int32_t waferV(const int32_t index)
std::vector< int > waferCopy_
std::vector< double > cassetteShift_
static constexpr double tan30deg_
std::array< uint32_t, 2 > tot_layers_
__host__ __device__ V wmin
const HGCalParameters * hgpar_
void setParameter(int cassette, const std::vector< double > &shifts)
Definition: HGCalCassette.cc:8
__host__ __device__ V V wmax

◆ ~HGCalDDDConstants()

HGCalDDDConstants::~HGCalDDDConstants ( )
default

Member Function Documentation

◆ assignCell()

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

Definition at line 127 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().

127  {
128  const auto& index = getIndex(lay, reco);
129  if (index.first < 0)
130  return std::make_pair(-1, -1);
131  if (waferHexagon6()) {
132  float xx = (reco) ? x : HGCalParameters::k_ScaleFromDDD * x;
133  float yy = (reco) ? y : HGCalParameters::k_ScaleFromDDD * y;
134 
135  // First the wafer
136  int wafer = cellHex(xx, yy, rmax_, hgpar_->waferPosX_, hgpar_->waferPosY_);
137  if (wafer < 0 || wafer >= static_cast<int>(hgpar_->waferTypeT_.size())) {
138  edm::LogWarning("HGCalGeom") << "Wafer no. out of bound for " << wafer << ":" << (hgpar_->waferTypeT_).size()
139  << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
140  << " ***** ERROR *****";
141  return std::make_pair(-1, -1);
142  } else {
143  // Now the cell
144  xx -= hgpar_->waferPosX_[wafer];
145  yy -= hgpar_->waferPosY_[wafer];
146  if (hgpar_->waferTypeT_[wafer] == 1)
147  return std::make_pair(wafer,
148  cellHex(xx,
149  yy,
152  hgpar_->cellFineY_));
153  else
154  return std::make_pair(wafer,
155  cellHex(xx,
156  yy,
159  hgpar_->cellCoarseY_));
160  }
161  } else {
162  return std::make_pair(-1, -1);
163  }
164 }
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  zside,
int  lay,
bool  reco,
bool  extend,
bool  debug 
) const

Definition at line 166 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, geometryCSVtoXML::yy, and ecaldqm::zside().

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

167  {
168  int waferU(0), waferV(0), waferType(-1), cellU(0), cellV(0);
169  if (waferHexagon8()) {
170  double xx = (reco) ? HGCalParameters::k_ScaleToDDD * x : x;
171  double yy = (reco) ? HGCalParameters::k_ScaleToDDD * y : y;
172  double wt(1.0);
173 #ifdef EDM_ML_DEBUG
174  edm::LogVerbatim("HGCalGeom") << "assignCellHex x " << x << ":" << xx << " y " << y << ":" << yy << " Lay " << lay;
175 #endif
176  waferFromPosition(xx, yy, zside, lay, waferU, waferV, cellU, cellV, waferType, wt, extend, debug);
177  }
178  return std::array<int, 5>{{waferU, waferV, waferType, cellU, cellV}};
179 }
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 zside(DetId const &)
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
int waferType(DetId const &id, bool fromFile) const
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 181 of file HGCalDDDConstants.cc.

References funct::abs(), cassetteMode(), HGCalParameters::cassettes_, angle_units::operators::convertRadToDeg(), HGCalParameters::firstLayer_, getIndex(), HGCalCassette::getShift(), hgcassette_, hgpar_, hcalRecHitTable_cff::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleFromDDD, nano_mu_digi_cff::layer, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, M_PI, HGCalParameters::nphiCassette_, phi, HGCalParameters::phiOffset_, alignCSCRings::r, HGCalParameters::radiusLayer_, dt_dqm_sourceclient_common_cff::reco, HGCalParameters::scintCells(), HGCalParameters::scintCellSize(), HGCalParameters::scintType(), mathSSE::sqrt(), HGCalTileIndex::tileCassette(), tileExist(), tilePhiEdge(), tileRingEdge(), tol_, x, HGCalParameters::xLayerHex_, geometryCSVtoXML::xx, y, HGCalParameters::yLayerHex_, geometryCSVtoXML::yy, z, and ecaldqm::zside().

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

181  {
182  int irad(-1), iphi(-1), type(-1);
183  const auto& indx = getIndex(layer, reco);
184  if (indx.first < 0)
185  return std::array<int, 3>{{irad, iphi, type}};
186  int zside = (z > 0) ? 1 : -1;
187  double xx = (reco) ? (zside * x) : (zside * HGCalParameters::k_ScaleFromDDD * x);
188  double yy = (reco) ? y : HGCalParameters::k_ScaleFromDDD * y;
189  int ll = layer - hgpar_->firstLayer_;
190  xx -= hgpar_->xLayerHex_[ll];
191  yy -= hgpar_->yLayerHex_[ll];
192  double phi = (((yy == 0.0) && (xx == 0.0)) ? 0. : std::atan2(yy, xx));
193  if (phi < 0)
194  phi += (2.0 * M_PI);
195  if (indx.second != 0)
196  iphi = (1 + static_cast<int>(phi / indx.second)) % hgpar_->scintCells(layer);
197  if (iphi == 0)
199  if (cassetteMode()) {
201  auto cshift = hgcassette_.getShift(layer, -1, cassette);
202 #ifdef EDM_ML_DEBUG
203  std::ostringstream st1;
204  st1 << "Cassette " << cassette << " Shift " << cshift.first << ":" << cshift.second << " Original " << xx << ":"
205  << yy;
206 #endif
207  xx += (zside * cshift.first);
208  yy -= cshift.second;
209 #ifdef EDM_ML_DEBUG
210  st1 << " Shifted " << xx << ":" << yy;
211  edm::LogVerbatim("HGCalGeomT") << st1.str();
212 #endif
213  }
215  double r = std::sqrt(xx * xx + yy * yy);
216  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
217  irad = static_cast<int>(ir - hgpar_->radiusLayer_[type].begin());
218  irad = std::clamp(irad, hgpar_->iradMinBH_[indx.first], hgpar_->iradMaxBH_[indx.first]);
219 #ifdef EDM_ML_DEBUG
220  edm::LogVerbatim("HGCalGeomT") << "assignCellTrap Input " << x << ":" << y << ":" << z << ":" << layer << ":" << reco
221  << " x|y|r " << xx << ":" << yy << ":" << r << " phi " << phi << ":"
222  << convertRadToDeg(phi) << " o/p " << irad << ":" << iphi << ":" << type;
223 #endif
224  if (!tileExist(zside, layer, irad, iphi)) {
225  if (tileRingEdge(r, layer, irad)) {
226  if (std::abs(r - hgpar_->radiusLayer_[type][irad - 1]) < tol_) {
227  --irad;
228  if (irad <= hgpar_->iradMinBH_[indx.first])
229  irad = hgpar_->iradMinBH_[indx.first];
230  } else {
231  ++irad;
232  if (irad > hgpar_->iradMaxBH_[indx.first])
233  irad = hgpar_->iradMaxBH_[indx.first];
234  }
235 #ifdef EDM_ML_DEBUG
236  edm::LogVerbatim("HGCalGeomT") << "assignCellTrap: ring # modified to " << irad << ":"
237  << hgpar_->iradMinBH_[indx.first] << ":" << hgpar_->iradMaxBH_[indx.first];
238  ;
239 #endif
240  } else if (tilePhiEdge(phi, layer, iphi)) {
241  if (std::abs(phi - hgpar_->scintCellSize(layer) * (iphi - 1)) < tol_) {
242  --iphi;
243  if (iphi <= 0)
244  iphi = 1;
245  } else {
246  ++iphi;
247  if (iphi > hgpar_->scintCells(layer))
248  iphi = 1;
249  }
250 #ifdef EDM_ML_DEBUG
251  edm::LogVerbatim("HGCalGeomT") << "assignCellTrap: iphi # modified to " << iphi << ":"
252  << hgpar_->scintCells(layer);
253 #endif
254  }
255  }
256  return std::array<int, 3>{{irad, iphi, type}};
257 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
static constexpr double tol_
HGCalCassette hgcassette_
int scintType(const int layer) const
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
bool tileRingEdge(double rho, int layer, int ring) const
std::pair< double, double > getShift(int layer, int zside, int cassette) const
int zside(DetId const &)
double scintCellSize(const int layer) const
std::vector< double > yLayerHex_
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::pair< int, float > getIndex(int lay, bool reco) const
bool tilePhiEdge(double phi, int layer, int iphi) const
int32_t tileCassette(int32_t, int32_t, int32_t, int32_t)
#define M_PI
bool tileExist(int zside, int layer, int ring, int phi) const
std::vector< int > iradMinBH_
static constexpr double k_ScaleFromDDD
fixed size matrix
bool cassetteMode() const
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_
int scintCells(const int layer) const
std::vector< double > xLayerHex_

◆ cassetteMode()

bool HGCalDDDConstants::cassetteMode ( ) const
inline

◆ cassetteShiftScintillator()

bool HGCalDDDConstants::cassetteShiftScintillator ( int  zside,
int  layer,
int  iphi 
) const

Definition at line 273 of file HGCalDDDConstants.cc.

References cassetteMode(), cassetteTile(), HGCalCassette::getShift(), hgcassette_, hcalRecHitTable_cff::iphi, nano_mu_digi_cff::layer, edm::shift, and ecaldqm::zside().

Referenced by HGCScintSD::setDetUnitId().

273  {
274  bool shift(false);
275  if (cassetteMode()) {
276  auto cshift = hgcassette_.getShift(layer, zside, cassetteTile(iphi));
277  if ((cshift.first != 0) || (cshift.second != 0))
278  shift = true;
279  }
280  return shift;
281 }
HGCalCassette hgcassette_
std::pair< double, double > getShift(int layer, int zside, int cassette) const
int zside(DetId const &)
bool cassetteMode() const
static unsigned int const shift
int cassetteTile(int iphi) const

◆ cassetteShiftSilicon()

bool HGCalDDDConstants::cassetteShiftSilicon ( int  zside,
int  layer,
int  waferU,
int  waferV 
) const

Definition at line 259 of file HGCalDDDConstants.cc.

References cassetteMode(), HGCalCassette::getShift(), hgcassette_, hgpar_, nano_mu_digi_cff::layer, edm::shift, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and ecaldqm::zside().

Referenced by HGCalSD::setDetUnitId().

259  {
260  bool shift(false);
261  if (cassetteMode()) {
263  auto ktr = hgpar_->waferInfoMap_.find(indx);
264  if (ktr != hgpar_->waferInfoMap_.end()) {
265  auto cshift = hgcassette_.getShift(layer, zside, (ktr->second).cassette);
266  if ((cshift.first != 0) || (cshift.second != 0))
267  shift = true;
268  }
269  }
270  return shift;
271 }
HGCalCassette hgcassette_
int32_t waferU(const int32_t index)
std::pair< double, double > getShift(int layer, int zside, int cassette) const
int zside(DetId const &)
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
bool cassetteMode() const
int32_t waferV(const int32_t index)
static unsigned int const shift
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ cassetteTile()

int HGCalDDDConstants::cassetteTile ( int  iphi) const
inline

◆ cellEtaPhiTrap()

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

Definition at line 283 of file HGCalDDDConstants.cc.

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

283  {
284  double dr(0), df(0);
285  if (tileTrapezoid()) {
286  double r = 0.5 * ((hgpar_->radiusLayer_[type][irad - 1] + hgpar_->radiusLayer_[type][irad]));
287  dr = (hgpar_->radiusLayer_[type][irad] - hgpar_->radiusLayer_[type][irad - 1]);
288  df = r * hgpar_->cellSize_[type];
289  }
290  return std::make_pair(dr, df);
291 }
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 1851 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().

1852  {
1853  int num(0);
1854  const double tol(0.00001);
1855  double cellY = 2.0 * cellR * tan30deg_;
1856  for (unsigned int k = 0; k < posX.size(); ++k) {
1857  double dx = std::abs(xx - posX[k]);
1858  double dy = std::abs(yy - posY[k]);
1859  if (dx <= (cellR + tol) && dy <= (cellY + tol)) {
1860  double xmax = (dy <= 0.5 * cellY) ? cellR : (cellR - (dy - 0.5 * cellY) / tan30deg_);
1861  if (dx <= (xmax + tol)) {
1862  num = k;
1863  break;
1864  }
1865  }
1866  }
1867  return num;
1868 }
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  place,
int  part,
int &  cellU,
int &  cellV,
bool  extend,
bool  debug 
) const
private

Definition at line 1870 of file HGCalDDDConstants.cc.

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

1871  {
1872  if (cassetteMode()) {
1873  auto uv = (part == HGCalTypes::WaferFull)
1874  ? hgcellUV_->cellUVFromXY3(xloc, yloc, place, cellType, true, debug)
1875  : hgcellUV_->cellUVFromXY1(xloc, yloc, place, cellType, part, true, debug);
1876  cellU = uv.first;
1877  cellV = uv.second;
1878  } else if (waferHexagon8File()) {
1879  auto uv = hgcellUV_->cellUVFromXY3(xloc, yloc, place, cellType, extend, debug);
1880  cellU = uv.first;
1881  cellV = uv.second;
1882  } else {
1883  int ncell = (cellType == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1884  double delY = 2 * rmax_ / (3 * ncell);
1885  double delX = 0.5 * delY * sqrt3_;
1886  double delYT = (extend) ? (2 * rmaxT_ / (3 * ncell)) : delY;
1887  double delXT = 0.5 * delYT * sqrt3_;
1888  double v0 = ((xloc / delY - 1.0) / 1.5);
1889  int cv0 = (v0 > 0) ? (ncell + static_cast<int>(v0 + 0.5)) : (ncell - static_cast<int>(-v0 + 0.5));
1890  double u0 = (0.5 * yloc / delX + 0.5 * cv0);
1891  int cu0 = (u0 > 0) ? (ncell / 2 + static_cast<int>(u0 + 0.5)) : (ncell / 2 - static_cast<int>(-u0 + 0.5));
1892  cu0 = std::max(0, std::min(cu0, 2 * ncell - 1));
1893  cv0 = std::max(0, std::min(cv0, 2 * ncell - 1));
1894  if (cv0 - cu0 >= ncell)
1895  cv0 = cu0 + ncell - 1;
1896  if (debug)
1897  edm::LogVerbatim("HGCalGeom") << "cellHex: input " << xloc << ":" << yloc << ":" << cellType << " parameter "
1898  << delX << ":" << delY << " u0 " << u0 << ":" << cu0 << " v0 " << v0 << ":" << cv0;
1899  bool found(false);
1900  static constexpr int shift[3] = {0, 1, -1};
1901  for (int i1 = 0; i1 < 3; ++i1) {
1902  cellU = cu0 + shift[i1];
1903  for (int i2 = 0; i2 < 3; ++i2) {
1904  cellV = cv0 + shift[i2];
1905  if (((cellV - cellU) < ncell) && ((cellU - cellV) <= ncell) && (cellU >= 0) && (cellV >= 0) &&
1906  (cellU < 2 * ncell) && (cellV < 2 * ncell)) {
1907  double xc = (1.5 * (cellV - ncell) + 1.0) * delY;
1908  double yc = (2 * cellU - cellV - ncell) * delX;
1909  if ((std::abs(yloc - yc) <= delXT) && (std::abs(xloc - xc) <= delYT) &&
1910  ((std::abs(xloc - xc) <= 0.5 * delYT) ||
1911  (std::abs(yloc - yc) <= sqrt3_ * (delYT - std::abs(xloc - xc))))) {
1912  if (debug)
1913  edm::LogVerbatim("HGCalGeom")
1914  << "cellHex: local " << xc << ":" << yc << " difference " << std::abs(xloc - xc) << ":"
1915  << std::abs(yloc - yc) << ":" << sqrt3_ * (delY - std::abs(yloc - yc)) << " comparator " << delX
1916  << ":" << delY << " (u,v) = (" << cellU << "," << cellV << ")";
1917  found = true;
1918  break;
1919  }
1920  }
1921  }
1922  if (found)
1923  break;
1924  }
1925  if (!found) {
1926  cellU = cu0;
1927  cellV = cv0;
1928  }
1929  }
1930 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< HGCalCellUV > hgcellUV_
int32_t cellType(int type, int waferU, int waferV, int iz, int fwdBack, int orient) const
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define debug
Definition: HDRShower.cc:19
part
Definition: HCALResponse.h:20
bool waferHexagon8File() const
bool cassetteMode() const
static unsigned int const shift
const HGCalParameters * hgpar_

◆ cellInLayer()

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

Definition at line 293 of file HGCalDDDConstants.cc.

References cassetteMode(), getIndex(), HGCalWaferMask::goodCell(), HGCalGeometryMode::Hexagon8Module, hgpar_, locateCell(), mode_, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, hgcalPerformanceValidation::orient, HGCalParameters::rMinLayHex_, mathSSE::sqrt(), HGCalTypes::WaferFineThin, HGCalTypes::WaferFull, waferHexagon6(), waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalTypes::WaferOrient0, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), geometryCSVtoXML::xy, and ecaldqm::zside().

Referenced by HGCalGeometry::newCell().

293  {
294  const auto& indx = getIndex(lay, true);
295  if (indx.first >= 0) {
296  if (cassetteMode()) {
297  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
298  auto ktr = hgpar_->waferInfoMap_.find(indx);
299  int part = (ktr != hgpar_->waferInfoMap_.end()) ? (ktr->second).part : HGCalTypes::WaferFull;
300  return HGCalWaferMask::goodCell(cellU, cellV, part);
302  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
303  auto ktr = hgpar_->waferInfoMap_.find(indx);
305  if (ktr != hgpar_->waferInfoMap_.end()) {
306  thck = (ktr->second).type;
307  part = (ktr->second).part;
308  rotn = (ktr->second).orient;
309  }
311  return HGCalWaferMask::goodCell(cellU, cellV, ncell, part, rotn);
312  } else if (waferHexagon8() || waferHexagon6()) {
313  const auto& xy =
314  ((waferHexagon8()) ? locateCell(zside, lay, waferU, waferV, cellU, cellV, reco, true, false, false)
315  : locateCell(cellU, lay, waferU, reco));
316  double rpos = sqrt(xy.first * xy.first + xy.second * xy.second);
317  return ((rpos >= hgpar_->rMinLayHex_[indx.first]) && (rpos <= hgpar_->rMaxLayHex_[indx.first]));
318  } else {
319  return true;
320  }
321  } else {
322  return false;
323  }
324 }
int32_t waferU(const int32_t index)
static bool goodCell(int u, int v, int N, int type, int rotn)
bool waferHexagon8() const
int zside(DetId const &)
bool waferHexagon6() const
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
T sqrt(T t)
Definition: SSEVec.h:19
static constexpr int32_t WaferOrient0
Definition: HGCalTypes.h:61
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > rMinLayHex_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
part
Definition: HCALResponse.h:20
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
const HGCalGeometryMode::GeometryMode mode_
fixed size matrix
bool cassetteMode() const
int32_t waferV(const int32_t index)
static constexpr int32_t WaferFineThin
Definition: HGCalTypes.h:30
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ cellSizeHex()

double HGCalDDDConstants::cellSizeHex ( int  type) const

Definition at line 339 of file HGCalDDDConstants.cc.

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

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

339  {
340  int indx = ((waferHexagon8()) ? ((type >= 1) ? 1 : 0) : ((type == 1) ? 1 : 0));
341  double cell = (tileTrapezoid() ? 0.5 * hgpar_->cellSize_[indx]
343  return cell;
344 }
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 55 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::radiusLayer_.

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

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

◆ cellThickness()

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

Definition at line 326 of file HGCalDDDConstants.cc.

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

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

326  {
327  double thick(-1);
328  int type = waferType(layer, waferU, waferV, false);
329  if (type >= 0) {
330  if (waferHexagon8()) {
331  thick = 10000.0 * hgpar_->cellThickness_[type]; // cm to micron
332  } else if (waferHexagon6()) {
333  thick = 100.0 * (type + 1); // type = 1,2,3 for 100,200,300 micron
334  }
335  }
336  return thick;
337 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
std::vector< double > cellThickness_
int waferType(DetId const &id, bool fromFile) const
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 346 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().

346  {
347  int placement = (orient < 0) ? HGCalCell::cellPlacementOld : HGCalCell::cellPlacementIndex(iz, fwdBack, orient);
348  int ncell = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
349  auto cellType = HGCalCell::cellType(cellU, cellV, ncell, placement);
350  return cellType.first;
351 }
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
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:249
int32_t cellType(int type, int waferU, int waferV, int iz, int fwdBack, int orient) const
const HGCalParameters * hgpar_

◆ distFromEdgeHex()

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

Definition at line 353 of file HGCalDDDConstants.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, getLayer(), hexside_, hgpar_, 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().

353  {
354  // Assming the point is within a hexagonal plane of the wafer, calculate
355  // the shortest distance from the edge
356  if (z < 0)
357  x = -x;
358  double dist(0);
359  // Input x, y in Geant4 unit and transformed to CMSSW standard
362  if (waferHexagon8()) {
363  int ll = layerIndex(getLayer(z, false), false);
364  xx -= hgpar_->xLayerHex_[ll];
365  yy -= hgpar_->yLayerHex_[ll];
366  }
367  int sizew = static_cast<int>(hgpar_->waferPosX_.size());
368  int wafer = sizew;
369  // Transform to the local coordinate frame of the wafer first
370  for (int k = 0; k < sizew; ++k) {
371  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
372  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
373  if ((dx <= rmax_) && (dy <= hexside_) && ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy)))) {
374  wafer = k;
375  xx -= hgpar_->waferPosX_[k];
376  yy -= hgpar_->waferPosY_[k];
377  break;
378  }
379  }
380  // Look at only one quarter (both x,y are positive)
381  if (wafer < sizew) {
382  if (std::abs(yy) < 0.5 * hexside_) {
383  dist = rmax_ - std::abs(xx);
384  } else {
385  dist = 0.5 * ((rmax_ - std::abs(xx)) - sqrt3_ * (std::abs(yy) - 0.5 * hexside_));
386  }
387  } else {
388  dist = 0;
389  }
391 #ifdef EDM_ML_DEBUG
392  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeHex: Local " << xx << ":" << yy << " wafer " << wafer << " flag "
393  << (wafer < sizew) << " Distance " << rmax_ << ":" << (rmax_ - std::abs(xx)) << ":"
394  << (std::abs(yy) - 0.5 * hexside_) << ":" << 0.5 * hexside_ << ":" << dist;
395 #endif
396  return dist;
397 }
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 399 of file HGCalDDDConstants.cc.

References funct::abs(), getLayer(), hgpar_, hcalRecHitTable_cff::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().

399  {
400  // Assming the point is within the eta-phi plane of the scintillator tile,
401  // calculate the shortest distance from the edge
402  int lay = getLayer(z, false);
403  double xx = (z < 0) ? -x : x;
404  int indx = layerIndex(lay, false);
405  double r = HGCalParameters::k_ScaleFromDDD * std::sqrt(x * x + y * y);
406  double phi = (r == 0. ? 0. : std::atan2(y, xx));
407  if (phi < 0)
408  phi += (2.0 * M_PI);
409  int type = hgpar_->scintType(lay);
410  double cell = hgpar_->scintCellSize(lay);
411  // Compare with the center of the tile find distances along R and also phi
412  // Take the smaller value
413  auto ir = std::lower_bound(hgpar_->radiusLayer_[type].begin(), hgpar_->radiusLayer_[type].end(), r);
414  int irad = static_cast<int>(ir - hgpar_->radiusLayer_[type].begin());
415  irad = std::clamp(irad, hgpar_->iradMinBH_[indx], hgpar_->iradMaxBH_[indx]);
416  int iphi = 1 + static_cast<int>(phi / cell);
417  double dphi = std::max(0.0, (0.5 * cell - std::abs(phi - (iphi - 0.5) * cell)));
418  double dist = std::min((r - hgpar_->radiusLayer_[type][irad - 1]), (hgpar_->radiusLayer_[type][irad] - r));
419 #ifdef EDM_ML_DEBUG
420  edm::LogVerbatim("HGCalGeom") << "DistFromEdgeTrap: Global " << x << ":" << y << ":" << z << " Layer " << lay
421  << " Index " << indx << ":" << type << " xx " << xx << " R " << r << ":" << irad << ":"
422  << hgpar_->radiusLayer_[type][irad - 1] << ":" << hgpar_->radiusLayer_[type][irad]
423  << " Phi " << phi << ":" << iphi << ":" << (iphi - 0.5) * cell << " cell " << cell
424  << " Dphi " << dphi << " Dist " << dist << ":" << r * dphi;
425 #endif
426  return HGCalParameters::k_ScaleToDDD * std::min(r * dphi, dist);
427 }
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 1932 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().

1932  {
1933  int indx = layerIndex(lay, reco);
1934  if (indx < 0)
1935  return std::make_pair(-1, 0);
1936  float cell(0);
1937  if (waferHexagon6()) {
1938  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1939  } else {
1940  if (waferHexagon8()) {
1941  cell = (reco ? hgpar_->moduleCellR_[0] : hgpar_->moduleCellS_[0]);
1942  } else {
1943  cell = hgpar_->scintCellSize(lay);
1944  }
1945  }
1946  return std::make_pair(indx, cell);
1947 }
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 429 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(), HGCalGeometry::getClosestCell(), and HGCalGeometry::getClosestCellHex().

429  {
430  // Get the layer # from the gloabl z coordinate
431  unsigned int k = 0;
432  double zz = (reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD * std::abs(z));
433  const auto& zLayerHex = hgpar_->zLayerHex_;
434  auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&k, &zz, &zLayerHex](double zLayer) {
435  ++k;
436  return zz < 0.5 * (zLayerHex[k - 1] + zLayerHex[k]);
437  });
438  int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) : k;
439  if (waferHexagon6() && reco) {
440  int indx = layerIndex(lay, false);
441  if (indx >= 0)
442  lay = hgpar_->layerGroupO_[indx];
443  } else {
444  lay += (hgpar_->firstLayer_ - 1);
445  }
446  return lay;
447 }
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 73 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::layerOffset_.

Referenced by HGCalNumberingScheme::HGCalNumberingScheme().

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

◆ getModule()

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

Definition at line 449 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().

449  {
451  if (hexType) {
452  if (indx >= hgpar_->waferTypeL_.size())
453  edm::LogWarning("HGCalGeom") << "Wafer no. out bound for index " << indx << ":" << (hgpar_->waferTypeL_).size()
454  << ":" << (hgpar_->waferPosX_).size() << ":" << (hgpar_->waferPosY_).size()
455  << " ***** ERROR *****";
456  unsigned int type =
457  ((indx < hgpar_->waferTypeL_.size()) ? hgpar_->waferTypeL_[indx] - 1 : HGCSiliconDetId::HGCalCoarseThick);
458  mytr = hgpar_->getModule(type, reco);
459  } else {
460  mytr = hgpar_->getModule(indx, reco);
461  }
462  return mytr;
463 }
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 465 of file HGCalDDDConstants.cc.

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

465  {
466  std::vector<HGCalParameters::hgtrap> mytrs;
467  for (unsigned int k = 0; k < hgpar_->moduleLayR_.size(); ++k)
468  mytrs.emplace_back(hgpar_->getModule(k, true));
469  return mytrs;
470 }
hgtrap getModule(unsigned int k, bool reco) const
std::vector< int > moduleLayR_
const HGCalParameters * hgpar_

◆ getParameter()

const HGCalParameters* HGCalDDDConstants::getParameter ( ) const
inline

◆ getPhiBins()

int HGCalDDDConstants::getPhiBins ( int  lay) const

Definition at line 472 of file HGCalDDDConstants.cc.

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

472 { 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 80 of file HGCalDDDConstants.h.

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

80  {
82  }
int scintType(const int layer) const
bool tileTrapezoid() const
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ getRangeR()

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

Definition at line 474 of file HGCalDDDConstants.cc.

References hgpar_, layerIndex(), HGCalParameters::rMaxLayHex_, and HGCalParameters::rMinLayHex_.

474  {
475  int indx = layerIndex(lay, false);
476  if ((indx >= 0) && (indx < static_cast<int>(hgpar_->rMinLayHex_.size())))
477  return std::make_pair(hgpar_->rMinLayHex_[indx], hgpar_->rMaxLayHex_[indx]);
478  else
479  return std::make_pair(0, -1.);
480 }
int layerIndex(int lay, bool reco) const
std::vector< double > rMinLayHex_
std::vector< double > rMaxLayHex_
const HGCalParameters * hgpar_

◆ getREtaRange()

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

Definition at line 482 of file HGCalDDDConstants.cc.

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

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

482  {
483  int irmin(0), irmax(0);
484  if (tileTrapezoid()) {
485  int indx = layerIndex(lay, false);
486  if ((indx >= 0) && (indx < static_cast<int>(hgpar_->iradMinBH_.size()))) {
487  irmin = hgpar_->iradMinBH_[indx];
488  irmax = hgpar_->iradMaxBH_[indx];
489  }
490  }
491  return std::make_pair(irmin, irmax);
492 }
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 83 of file HGCalDDDConstants.h.

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

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

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

◆ getTrFormN()

unsigned int HGCalDDDConstants::getTrFormN ( ) const
inline

Definition at line 84 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::trformIndex_.

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

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

◆ getTrForms()

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

Definition at line 494 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTrackCollectionProducer::beginLuminosityBlock().

494  {
495  std::vector<HGCalParameters::hgtrform> mytrs;
496  for (unsigned int k = 0; k < hgpar_->trformIndex_.size(); ++k)
497  mytrs.emplace_back(hgpar_->getTrForm(k));
498  return mytrs;
499 }
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 510 of file HGCalDDDConstants.cc.

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

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

510  {
511  // Get the module type for a silicon wafer
512  if (waferHexagon8()) {
514  return ((itr == hgpar_->typesInLayers_.end() ? 2 : hgpar_->waferTypeL_[itr->second]));
515  } else {
516  return -1;
517  }
518 }
int32_t waferU(const int32_t index)
bool waferHexagon8() 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)
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_

◆ getTypeTrap()

int HGCalDDDConstants::getTypeTrap ( int  layer) const

Definition at line 501 of file HGCalDDDConstants.cc.

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

Referenced by HGCalTriggerGeometryV9Imp3::detIdWaferType().

501  {
502  // Get the module type for scinitllator
503  if (tileTrapezoid()) {
504  return hgpar_->scintType(layer);
505  } else {
506  return -1;
507  }
508 }
int scintType(const int layer) const
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 520 of file HGCalDDDConstants.cc.

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

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

520  {
521  int ll = layer - hgpar_->firstLayer_;
522  double x0(x), y0(y);
523  if ((!hgpar_->layerType_.empty()) && (ll < static_cast<int>(hgpar_->layerRotV_.size()))) {
524  if (forwd) {
525  x0 = x * hgpar_->layerRotV_[ll].first + y * hgpar_->layerRotV_[ll].second;
526  y0 = y * hgpar_->layerRotV_[ll].first - x * hgpar_->layerRotV_[ll].second;
527  } else {
528  x0 = x * hgpar_->layerRotV_[ll].first - y * hgpar_->layerRotV_[ll].second;
529  y0 = y * hgpar_->layerRotV_[ll].first + x * hgpar_->layerRotV_[ll].second;
530  }
531  }
532 #ifdef EDM_ML_DEBUG
533  double x1(x0), y1(y0);
534  if (ll < static_cast<int>(hgpar_->layerRotV_.size())) {
535  if (forwd) {
536  x1 = x0 * hgpar_->layerRotV_[ll].first - y0 * hgpar_->layerRotV_[ll].second;
537  y1 = y0 * hgpar_->layerRotV_[ll].first + x0 * hgpar_->layerRotV_[ll].second;
538  } else {
539  x1 = x0 * hgpar_->layerRotV_[ll].first + y0 * hgpar_->layerRotV_[ll].second;
540  y1 = y0 * hgpar_->layerRotV_[ll].first - x0 * hgpar_->layerRotV_[ll].second;
541  }
542  }
543  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << layer << ":" << ll << " mode " << forwd << " x " << x
544  << ":" << x0 << ":" << x1 << " y " << y << ":" << y0 << ":" << y1;
545 #endif
546  return std::make_pair(x0, y0);
547 }
Log< level::Info, true > LogVerbatim
std::vector< std::pair< double, double > > layerRotV_
std::vector< int > layerType_
const HGCalParameters * hgpar_

◆ guardRingOffset()

double HGCalDDDConstants::guardRingOffset ( bool  reco) const

Definition at line 549 of file HGCalDDDConstants.cc.

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

Referenced by HGCalSD::update().

549  {
551 }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ isHalfCell()

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

Definition at line 553 of file HGCalDDDConstants.cc.

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

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

553  {
554  if (waferType < 1 || cell < 0)
555  return false;
556  return waferType == 2 ? hgpar_->cellCoarseHalf_[cell] : hgpar_->cellFineHalf_[cell];
557 }
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
int waferType(DetId const &id, bool fromFile) const
const HGCalParameters * hgpar_

◆ isValidCell()

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

Definition at line 1969 of file HGCalDDDConstants.cc.

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

Referenced by isValidHex().

1969  {
1970  // Calculate the position of the cell
1971  // Works for options HGCalHexagon/HGCalHexagonFull
1972  double x = hgpar_->waferPosX_[wafer];
1973  double y = hgpar_->waferPosY_[wafer];
1974  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
1975  x += hgpar_->cellFineX_[cell];
1976  y += hgpar_->cellFineY_[cell];
1977  } else {
1978  x += hgpar_->cellCoarseX_[cell];
1979  y += hgpar_->cellCoarseY_[cell];
1980  }
1981  double rr = sqrt(x * x + y * y);
1982  bool result = ((rr >= hgpar_->rMinLayHex_[lay - 1]) && (rr <= hgpar_->rMaxLayHex_[lay - 1]) &&
1983  (wafer < static_cast<int>(hgpar_->waferPosX_.size())));
1984 #ifdef EDM_ML_DEBUG
1985  if (!result)
1986  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << wafer << ":" << cell << " Position " << x << ":" << y
1987  << ":" << rr << " Compare Limits " << hgpar_->rMinLayHex_[lay - 1] << ":"
1988  << hgpar_->rMaxLayHex_[lay - 1] << " Flag " << result;
1989 #endif
1990  return result;
1991 }
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 1993 of file HGCalDDDConstants.cc.

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

Referenced by isValidHex8().

1993  {
1994  bool result(false);
1995  auto partn = waferTypeRotation(lay, waferU, waferV, false, false);
1996 #ifdef EDM_ML_DEBUG
1997  edm::LogVerbatim("HGCalGeom") << "waferHexagon8 " << waferHexagon8File() << ":" << mode_ << ":" << cassetteMode()
1998  << " part " << partn.first << ":" << partn.second;
1999 #endif
2000  if (cassetteMode()) {
2001  result = HGCalWaferMask::goodCell(cellU, cellV, partn.first);
2002 #ifdef EDM_ML_DEBUG
2003  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV
2004  << " Result " << result << " from goodCell";
2005 #endif
2006  } else {
2007  float x(0), y(0);
2008  int kndx = cellV * 100 + cellU;
2009  if (type == 0) {
2010  auto ktr = hgpar_->cellFineIndex_.find(kndx);
2011  if (ktr != hgpar_->cellFineIndex_.end()) {
2012  x = hgpar_->cellFineX_[ktr->second];
2013  y = hgpar_->cellFineY_[ktr->second];
2014  }
2015 #ifdef EDM_ML_DEBUG
2016  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
2017  << (ktr != hgpar_->cellFineIndex_.end());
2018 #endif
2019  } else {
2020  auto ktr = hgpar_->cellCoarseIndex_.find(kndx);
2021  if (ktr != hgpar_->cellCoarseIndex_.end()) {
2022  x = hgpar_->cellCoarseX_[ktr->second];
2023  y = hgpar_->cellCoarseY_[ktr->second];
2024  }
2025 #ifdef EDM_ML_DEBUG
2026  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
2027  << (ktr != hgpar_->cellCoarseIndex_.end());
2028 #endif
2029  }
2030  const auto& xy = waferPositionNoRot(lay, waferU, waferV, true, false);
2031  x += xy.first;
2032  y += xy.second;
2033 #ifdef EDM_ML_DEBUG
2034  edm::LogVerbatim("HGCalGeom") << "With wafer (" << waferU << "," << waferV << ") " << x << ":" << y;
2035 #endif
2036  double rr = sqrt(x * x + y * y);
2037  int ll = lay - hgpar_->firstLayer_;
2038  double tol = waferHexagon8File() ? 0.5 : 0.0;
2039  result = (((rr + tol) >= hgpar_->rMinLayHex_[ll]) && (rr <= hgpar_->rMaxLayHex_[ll]));
2040 #ifdef EDM_ML_DEBUG
2041  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << ll << ":" << waferU << ":" << waferV << ":" << cellU
2042  << ":" << cellV << " Position " << x << ":" << y << ":" << rr << " Compare Limits "
2043  << hgpar_->rMinLayHex_[ll] << ":" << hgpar_->rMaxLayHex_[ll] << " Flag " << result
2044  << " from Radius Limits";
2045 #endif
2046  if (result && waferHexagon8File()) {
2047  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
2048  result = HGCalWaferMask::goodCell(cellU, cellV, N, partn.first, partn.second);
2049 #ifdef EDM_ML_DEBUG
2050  edm::LogVerbatim("HGCalGeom") << "Input " << lay << ":" << waferU << ":" << waferV << ":" << cellU << ":" << cellV
2051  << " N " << N << " part " << partn.first << ":" << partn.second << " Result "
2052  << result << " from goodCell";
2053 #endif
2054  }
2055  }
2056  return result;
2057 }
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::vector< double > cellFineY_
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile, bool debug) const
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_
bool waferHexagon8File() const
std::vector< double > cellFineX_
const HGCalGeometryMode::GeometryMode mode_
bool cassetteMode() const
int32_t waferV(const int32_t index)
std::vector< double > cellCoarseY_
const HGCalParameters * hgpar_
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug) const

◆ isValidHex()

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

Definition at line 559 of file HGCalDDDConstants.cc.

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

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

559  {
560  // Check validity for a layer|wafer|cell of pre-TDR version
561  bool result(false), resultMod(false);
562  int cellmax(0);
563  if (waferHexagon6()) {
564  int32_t copyNumber = hgpar_->waferCopy_[mod];
565  result = ((lay > 0 && lay <= static_cast<int>(layers(reco))));
566  if (result) {
567  const int32_t lay_idx = reco ? (lay - 1) * 3 + 1 : lay;
568  const auto& the_modules = hgpar_->copiesInLayers_[lay_idx];
569  auto moditr = the_modules.find(copyNumber);
570  result = resultMod = (moditr != the_modules.end());
571 #ifdef EDM_ML_DEBUG
572  if (!result)
573  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":" << lay_idx << " Copy " << copyNumber
574  << ":" << mod << " Flag " << result;
575 #endif
576  if (result) {
577  if (moditr->second >= 0) {
578  if (mod >= static_cast<int>(hgpar_->waferTypeT_.size()))
579  edm::LogWarning("HGCalGeom") << "Module no. out of bound for " << mod << " to be compared with "
580  << (hgpar_->waferTypeT_).size() << " ***** ERROR *****";
581  cellmax = ((hgpar_->waferTypeT_[mod] - 1 == HGCSiliconDetId::HGCalFine)
582  ? static_cast<int>(hgpar_->cellFineX_.size())
583  : static_cast<int>(hgpar_->cellCoarseX_.size()));
584  result = (cell >= 0 && cell <= cellmax);
585  } else {
586  result = isValidCell(lay_idx, mod, cell);
587  }
588  }
589  }
590  }
591 
592 #ifdef EDM_ML_DEBUG
593  if (!result)
594  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants: Layer " << lay << ":"
595  << (lay > 0 && (lay <= static_cast<int>(layers(reco)))) << " Module " << mod << ":"
596  << resultMod << " Cell " << cell << ":" << cellmax << ":"
597  << (cell >= 0 && cell <= cellmax) << ":" << maxCells(reco);
598 #endif
599  return result;
600 }
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 
) const

Definition at line 602 of file HGCalDDDConstants.cc.

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

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

602  {
603  // Check validity for a layer|wafer|cell of post-TDR version
604  int indx = HGCalWaferIndex::waferIndex(layer, modU, modV);
605  auto itr = hgpar_->typesInLayers_.find(indx);
606 #ifdef EDM_ML_DEBUG
607  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferType " << layer << ":" << modU << ":" << modV
608  << ":" << indx << " Test " << (itr != hgpar_->typesInLayers_.end());
609 #endif
610  if (itr == hgpar_->typesInLayers_.end()) {
611 #ifdef EDM_ML_DEBUG
612  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot find " << layer << ":" << modU << ":" << modV
613  << " in wadferIndex";
614 #endif
615  return false;
616  }
617 
618  if (fullAndPart_) {
619  auto ktr = hgpar_->waferInfoMap_.find(indx);
620 #ifdef EDM_ML_DEBUG
621  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferInfoMap " << layer << ":" << modU << ":"
622  << modV << ":" << indx << " Test " << (ktr != hgpar_->waferInfoMap_.end());
623 #endif
624  if (ktr == hgpar_->waferInfoMap_.end()) {
625 #ifdef EDM_ML_DEBUG
626  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot find " << layer << ":" << modU << ":" << modV
627  << " in wadferInfoMap";
628 #endif
629  return false;
630  }
631  } else {
632  auto jtr = waferIn_.find(indx);
633 #ifdef EDM_ML_DEBUG
634  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:WaferIn " << jtr->first << ":" << jtr->second;
635 #endif
636  if (!(jtr->second)) {
637 #ifdef EDM_ML_DEBUG
638  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot find " << layer << ":" << modU << ":" << modV
639  << " in wadferIn";
640 #endif
641  return false;
642  }
643  }
644 
645  if (fullAndPart || fullAndPart_) {
646  auto ktr = hgpar_->waferTypes_.find(indx);
647  if (ktr != hgpar_->waferTypes_.end()) {
648  if (hgpar_->waferMaskMode_ > 0) {
649  if (ktr->second.first == HGCalTypes::WaferOut) {
650 #ifdef EDM_ML_DEBUG
651  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot find " << layer << ":" << modU << ":" << modV
652  << " due to WaferOut";
653 #endif
654  return false;
655  }
656  } else {
657  if (ktr->second.first < HGCalTypes::WaferCornerMin) {
658 #ifdef EDM_ML_DEBUG
659  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot find " << layer << ":" << modU << ":" << modV
660  << " due to WaferCornerMin";
661 #endif
662  return false;
663  }
664  }
665  }
666  }
667  return true;
668 }
Log< level::Info, true > LogVerbatim
static constexpr int32_t WaferOut
Definition: HGCalTypes.h:56
std::unordered_map< int32_t, bool > waferIn_
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:74
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ isValidHex8() [2/2]

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

Definition at line 670 of file HGCalDDDConstants.cc.

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

670  {
671  // First check validity for a layer|wafer| of post TDR version
672 #ifdef EDM_ML_DEBUG
673  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: layer|wafer " << layer << ":" << modU << ":" << modV << ":"
674  << fullAndPart << " Valid " << isValidHex8(layer, modU, modV, fullAndPart);
675 #endif
676  if (!isValidHex8(layer, modU, modV, fullAndPart))
677  return false;
678  int indx = HGCalWaferIndex::waferIndex(layer, modU, modV);
679  auto itr = hgpar_->typesInLayers_.find(indx);
680  int type = hgpar_->waferTypeL_[itr->second];
681  int N = ((hgpar_->waferTypeL_[itr->second] == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_);
682 #ifdef EDM_ML_DEBUG
683  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants::isValidHex8:Cell " << cellU << ":" << cellV << ":" << N
684  << " Tests " << (cellU >= 0) << ":" << (cellU < 2 * N) << ":" << (cellV >= 0) << ":"
685  << (cellV < 2 * N) << ":" << ((cellV - cellU) < N) << ":" << ((cellU - cellV) <= N);
686 #endif
687  if ((cellU < 0) || (cellU >= 2 * N) || (cellV < 0) || (cellV >= 2 * N)) {
688 #ifdef EDM_ML_DEBUG
689  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot statisfy Cell 1 condition " << cellU << ":" << cellV
690  << ":" << N;
691 #endif
692  return false;
693  }
694  if (((cellV - cellU) >= N) || ((cellU - cellV) > N)) {
695 #ifdef EDM_ML_DEBUG
696  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:: Cannot statisfy Cell 2 condition " << cellU << ":" << cellV
697  << ":" << N;
698 #endif
699  return false;
700  }
701  return isValidCell8(layer, modU, modV, cellU, cellV, type);
702 }
Log< level::Info, true > LogVerbatim
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart) const
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  zside,
int  lay,
int  ieta,
int  iphi 
) const

Definition at line 704 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, hcalRecHitTable_cff::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, nano_mu_digi_cff::layer, convertSQLiteXML::ok, HGCalParameters::scintCells(), tileExist(), trapezoidFile(), validateGeometry_cfg::valid, and ecaldqm::zside().

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

704  {
705  // Check validity for a layer|eta|phi of scintillator
706  const auto& indx = getIndex(layer, true);
707  if (indx.first < 0)
708  return false;
709  bool ok = ((irad >= hgpar_->iradMinBH_[indx.first]) && (irad <= (hgpar_->iradMaxBH_[indx.first] + 1)) && (iphi > 0) &&
710  (iphi <= hgpar_->scintCells(layer)));
711  bool valid = ((ok && trapezoidFile()) ? tileExist(zside, layer, irad, iphi) : ok);
712 #ifdef EDM_ML_DEBUG
713  bool tileEx = trapezoidFile() ? tileExist(zside, layer, irad, iphi) : true;
714  edm::LogVerbatim("HGCalGeomT") << "HGCalDDDConstants::isValidityTrap: Input " << zside << ":" << layer << ":" << irad
715  << ":" << iphi << " Range on Ring " << hgpar_->iradMinBH_[indx.first] << ":"
716  << (hgpar_->iradMaxBH_[indx.first] + 1)
717  << " Range on phi 0:" << hgpar_->scintCells(layer) << " tileExist " << tileEx
718  << " Valid " << ok << ":" << valid;
719 #endif
720  return valid;
721 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
bool trapezoidFile() const
int zside(DetId const &)
std::pair< int, float > getIndex(int lay, bool reco) const
bool tileExist(int zside, int layer, int ring, int phi) const
std::vector< int > iradMinBH_
const HGCalParameters * hgpar_
int scintCells(const int layer) const

◆ lastLayer()

int HGCalDDDConstants::lastLayer ( bool  reco) const

Definition at line 723 of file HGCalDDDConstants.cc.

References HGCalParameters::firstLayer_, hgpar_, and tot_layers_.

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

723  {
724  return (hgpar_->firstLayer_ + tot_layers_[static_cast<int>(reco)] - 1);
725 }
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 1949 of file HGCalDDDConstants.cc.

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

Referenced by waferIndex().

1949  {
1950  int ll(-1);
1951  if (waferHexagon6() && reco) {
1952  ll = static_cast<int>(std::find(hgpar_->depthLayerF_.begin(), hgpar_->depthLayerF_.end(), index) -
1953  hgpar_->depthLayerF_.begin());
1954  if (ll == static_cast<int>(hgpar_->depthLayerF_.size()))
1955  ll = -1;
1956  } else {
1957  ll = static_cast<int>(std::find(hgpar_->layerIndex_.begin(), hgpar_->layerIndex_.end(), index) -
1958  hgpar_->layerIndex_.begin());
1959  if (ll == static_cast<int>(hgpar_->layerIndex_.size()))
1960  ll = -1;
1961  }
1962 #ifdef EDM_ML_DEBUG
1963  edm::LogVerbatim("HGCalGeom") << "LayerFromIndex for " << index << ":" << reco << ":" << waferHexagon6() << " is"
1964  << ll << ":" << (ll + hgpar_->firstLayer_);
1965 #endif
1966  return ((ll < 0) ? ll : (ll + hgpar_->firstLayer_));
1967 }
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 729 of file HGCalDDDConstants.cc.

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

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

729  {
730  int ll = lay - hgpar_->firstLayer_;
731  if (ll < 0 || ll >= static_cast<int>(hgpar_->layerIndex_.size()))
732  return -1;
733  if (waferHexagon6()) {
734  if (reco && ll >= static_cast<int>(hgpar_->depthIndex_.size()))
735  return -1;
736  return (reco ? hgpar_->depthLayerF_[ll] : hgpar_->layerIndex_[ll]);
737  } else {
738  return (hgpar_->layerIndex_[ll]);
739  }
740 }
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 742 of file HGCalDDDConstants.cc.

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

Referenced by HGCalDDDConstants().

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

◆ layerType()

int HGCalDDDConstants::layerType ( int  lay) const
inline

Definition at line 100 of file HGCalDDDConstants.h.

References HGCalParameters::firstLayer_, hgpar_, HGCalParameters::layerType_, and HGCalTypes::WaferCenter.

Referenced by HGCalCalibrationCell::findCell(), locateCell(), HGCalSD::setDetUnitId(), and waferFromPosition().

100  {
102  }
static constexpr int32_t WaferCenter
Definition: HGCalTypes.h:21
std::vector< int > layerType_
const HGCalParameters * hgpar_

◆ levelTop()

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

Definition at line 113 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::levelT_.

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

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

◆ localToGlobal8()

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

Definition at line 746 of file HGCalDDDConstants.cc.

References cassetteMode(), debug, HGCalParameters::firstLayer_, HGCalCassette::getShift(), getXY(), hgcassette_, hgpar_, caHitNtupletGeneratorKernels::if(), HGCalParameters::k_ScaleToDDD, HGCalParameters::layerType_, HGCalTypes::WaferCenterR, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, waferPositionNoRot(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, geometryCSVtoXML::xy, y, and ecaldqm::zside().

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

747  {
748  double x(localX), y(localY);
749  bool rotx =
751  if (debug)
752  edm::LogVerbatim("HGCalGeom") << "LocalToGlobal8 " << lay << ":" << (lay - hgpar_->firstLayer_) << ":" << rotx
753  << " Local (" << x << ":" << y << ") Reco " << reco;
754  if (!reco) {
757  }
758  const auto& xy = waferPositionNoRot(lay, waferU, waferV, reco, debug);
759  x += xy.first;
760  y += xy.second;
761  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
762  auto ktr = hgpar_->waferInfoMap_.find(indx);
763  if (cassetteMode() && (ktr != hgpar_->waferInfoMap_.end())) {
764  auto cshift = hgcassette_.getShift(lay, -1, (ktr->second).cassette);
765  std::ostringstream st1;
766  if (debug)
767  st1 << "Cassette " << (ktr->second).cassette << " Shift " << cshift.first << ":" << cshift.second << " Original "
768  << x << ":" << y;
769  if (!reco) {
770  x -= ((HGCalParameters::k_ScaleToDDD)*zside * cshift.first);
771  y += ((HGCalParameters::k_ScaleToDDD)*cshift.second);
772  } else {
773  x -= (zside * cshift.first);
774  y += cshift.second;
775  }
776  if (debug) {
777  st1 << " Final " << x << ":" << y;
778  edm::LogVerbatim("HGCalGeom") << st1.str();
779  }
780  }
781  if (debug)
782  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << " by adding " << xy.first << ":" << xy.second;
783  return (rotx ? getXY(lay, x, y, false) : std::make_pair(x, y));
784 }
Log< level::Info, true > LogVerbatim
HGCalCassette hgcassette_
int32_t waferU(const int32_t index)
std::pair< double, double > getShift(int layer, int zside, int cassette) const
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
int zside(DetId const &)
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:27
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
fixed size matrix
bool cassetteMode() const
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug) const

◆ locateCell() [1/4]

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

Definition at line 786 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(), HGCalGeometry::getPosition(), locateCell(), HGCScintSD::setDetUnitId(), and HGCalSD::setDetUnitId().

786  {
787  // type refers to wafer # for hexagon cell
788  float x(999999.), y(999999.);
789  const auto& index = getIndex(lay, reco);
790  int i = index.first;
791  if (i < 0)
792  return std::make_pair(x, y);
793  if (waferHexagon6()) {
794  x = hgpar_->waferPosX_[type];
795  y = hgpar_->waferPosY_[type];
796 #ifdef EDM_ML_DEBUG
797  float x0(x), y0(y);
798 #endif
800  x += hgpar_->cellFineX_[cell];
801  y += hgpar_->cellFineY_[cell];
802  } else {
803  x += hgpar_->cellCoarseX_[cell];
804  y += hgpar_->cellCoarseY_[cell];
805  }
806 #ifdef EDM_ML_DEBUG
807  edm::LogVerbatim("HGCalGeom") << "LocateCell (Wafer) " << x0 << ":" << y0 << " Final " << x << ":" << y;
808 #endif
809  if (!reco) {
812  }
813  }
814  return std::make_pair(x, y);
815 }
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  zside,
int  lay,
int  waferU,
int  waferV,
int  cellU,
int  cellV,
bool  reco,
bool  all,
bool  norot,
bool  debug 
) const

Definition at line 817 of file HGCalDDDConstants.cc.

References python.cmstools::all(), cassetteMode(), HGCalParameters::cellCoarseIndex_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineIndex_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, HGCalCell::cellPlacementIndex(), HGCalCell::cellPlacementOld, debug, HGCalParameters::firstLayer_, HGCalCassette::getShift(), getXY(), hgcassette_, hgcell_, hgpar_, caHitNtupletGeneratorKernels::if(), HGCalParameters::k_ScaleToDDD, HGCalTypes::layerFrontBack(), layerType(), hgcalPerformanceValidation::orient, HGCalParameters::typesInLayers_, HGCalTypes::WaferCenterR, waferHexagon8File(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, waferPositionNoRot(), HGCalParameters::waferTypeL_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), x, geometryCSVtoXML::xy, and y.

819  {
820  double x(0), y(0);
821  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
822  auto itr = hgpar_->typesInLayers_.find(indx);
823  int type = ((itr == hgpar_->typesInLayers_.end()) ? 2 : hgpar_->waferTypeL_[itr->second]);
824  int layertype = layerType(lay);
825  bool rotx = (norot) ? false : (layertype == HGCalTypes::WaferCenterR);
826  if (debug) {
827  edm::LogVerbatim("HGCalGeom") << "LocateCell " << lay << ":" << (lay - hgpar_->firstLayer_) << ":" << layertype
828  << ":" << rotx << ":" << waferU << ":" << waferV << ":" << indx << ":"
829  << (itr == hgpar_->typesInLayers_.end()) << ":" << type << " Flags " << reco << ":"
830  << all;
831  }
832  auto ktr = hgpar_->waferInfoMap_.end();
833  int place(HGCalCell::cellPlacementOld);
834  if (waferHexagon8File()) {
835  if (cassetteMode()) {
836  ktr = hgpar_->waferInfoMap_.find(indx);
837  if (ktr != hgpar_->waferInfoMap_.end())
838  place = HGCalCell::cellPlacementIndex(1, HGCalTypes::layerFrontBack(layertype), (ktr->second).orient);
839  }
840  auto xy = hgcell_->cellUV2XY2(cellU, cellV, place, type);
841  x = xy.first;
842  y = xy.second;
843  if (debug)
844  edm::LogVerbatim("HGCalGeom") << "Type " << type << " Place " << place << " Cell " << cellU << ":" << cellV
845  << " Position " << x << ":" << y;
846  } else {
847  int kndx = cellV * 100 + cellU;
848  if (type == 0) {
849  auto jtr = hgpar_->cellFineIndex_.find(kndx);
850  if (jtr != hgpar_->cellFineIndex_.end()) {
851  x = hgpar_->cellFineX_[jtr->second];
852  y = hgpar_->cellFineY_[jtr->second];
853  }
854  if (debug)
855  edm::LogVerbatim("HGCalGeom") << "Fine " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y << ":"
856  << (jtr != hgpar_->cellFineIndex_.end());
857  } else {
858  auto jtr = hgpar_->cellCoarseIndex_.find(kndx);
859  if (jtr != hgpar_->cellCoarseIndex_.end()) {
860  x = hgpar_->cellCoarseX_[jtr->second];
861  y = hgpar_->cellCoarseY_[jtr->second];
862  }
863  if (debug)
864  edm::LogVerbatim("HGCalGeom") << "Coarse " << cellU << ":" << cellV << ":" << kndx << ":" << x << ":" << y
865  << ":" << (jtr != hgpar_->cellCoarseIndex_.end());
866  }
867  }
868  if (!reco) {
871  }
872  if (all) {
873  const auto& xy = waferPositionNoRot(lay, waferU, waferV, reco, debug);
874  x += xy.first;
875  y += xy.second;
876  if (cassetteMode() && (ktr != hgpar_->waferInfoMap_.end())) {
877  auto cshift = hgcassette_.getShift(lay, -1, (ktr->second).cassette);
878  std::ostringstream st1;
879  if (debug)
880  st1 << "Cassette " << (ktr->second).cassette << " Shift " << cshift.first << ":" << cshift.second
881  << " Original " << x << ":" << y;
882  if (!reco) {
883  x -= ((HGCalParameters::k_ScaleToDDD)*cshift.first);
884  y += ((HGCalParameters::k_ScaleToDDD)*cshift.second);
885  } else {
886  x -= cshift.first;
887  y += cshift.second;
888  }
889  if (debug) {
890  st1 << " Final " << x << ":" << y;
891  edm::LogVerbatim("HGCalGeom") << st1.str();
892  }
893  }
894  if (debug)
895  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << " by adding " << xy.first << ":" << xy.second;
896  }
897  return (rotx ? getXY(lay, x, y, false) : std::make_pair(x, y));
898 }
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
static constexpr int32_t cellPlacementOld
Definition: HGCalCell.h:25
wafer_map cellFineIndex_
HGCalCassette hgcassette_
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
int32_t waferU(const int32_t index)
std::pair< double, double > getShift(int layer, int zside, int cassette) const
std::vector< double > cellFineY_
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
std::vector< double > cellCoarseX_
std::unique_ptr< HGCalCell > hgcell_
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
static constexpr int32_t WaferCenterR
Definition: HGCalTypes.h:27
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
wafer_map cellCoarseIndex_
bool waferHexagon8File() const
std::vector< double > cellFineX_
wafer_map typesInLayers_
fixed size matrix
bool cassetteMode() const
int32_t waferV(const int32_t index)
std::vector< double > cellCoarseY_
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
std::vector< int > waferTypeL_
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug) const
static int32_t layerFrontBack(int32_t layerOrient)
Definition: HGCalTypes.h:125
int layerType(int lay) const

◆ locateCell() [3/4]

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

Definition at line 900 of file HGCalDDDConstants.cc.

References debug, nano_mu_digi_cff::layer, locateCell(), HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and ecaldqm::zside().

900  {
901  return locateCell(id.zside(), id.layer(), id.waferU(), id.waferV(), id.cellU(), id.cellV(), true, true, false, debug);
902 }
int32_t waferU(const int32_t index)
int zside(DetId const &)
#define debug
Definition: HDRShower.cc:19
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
int32_t waferV(const int32_t index)

◆ locateCell() [4/4]

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

Definition at line 904 of file HGCalDDDConstants.cc.

References debug, hcalRecHitTable_cff::iphi, nano_mu_digi_cff::layer, locateCellTrap(), and ecaldqm::zside().

904  {
905  return locateCellTrap(id.zside(), id.layer(), id.iradius(), id.iphi(), true, debug);
906 }
int zside(DetId const &)
std::pair< float, float > locateCellTrap(int zside, int lay, int ieta, int iphi, bool reco, bool debug) const
#define debug
Definition: HDRShower.cc:19

◆ locateCellHex()

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

Definition at line 908 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().

908  {
909  float x(0), y(0);
910  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine) {
911  x = hgpar_->cellFineX_[cell];
912  y = hgpar_->cellFineY_[cell];
913  } else {
914  x = hgpar_->cellCoarseX_[cell];
915  y = hgpar_->cellCoarseY_[cell];
916  }
917  if (!reco) {
920  }
921  return std::make_pair(x, y);
922 }
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  zside,
int  lay,
int  ieta,
int  iphi,
bool  reco,
bool  debug 
) const

Definition at line 924 of file HGCalDDDConstants.cc.

References funct::abs(), cassetteMode(), HGCalParameters::cassettes_, angle_units::operators::convertRadToDeg(), funct::cos(), debug, HGCalParameters::firstLayer_, getIndex(), HGCalCassette::getShift(), hgcassette_, hgpar_, hcalRecHitTable_cff::iphi, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, HGCalParameters::k_ScaleToDDD, SiStripPI::max, SiStripPI::min, HGCalParameters::nphiCassette_, phi, HGCalParameters::phiOffset_, alignCSCRings::r, HGCalParameters::radiusLayer_, FastTimerService_cff::range, rangeR(), HGCalParameters::scintType(), funct::sin(), HGCalTileIndex::tileCassette(), trapezoidFile(), x, HGCalParameters::xLayerHex_, y, HGCalParameters::yLayerHex_, z, and HGCalParameters::zLayerHex_.

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

925  {
926  float x(0), y(0);
927  const auto& indx = getIndex(lay, reco);
928  if (indx.first >= 0) {
929  int ir = std::abs(irad);
930  int type = hgpar_->scintType(lay);
931  double phi = (iphi - 0.5) * indx.second;
932  double z = hgpar_->zLayerHex_[indx.first];
933  double r = 0.5 * (hgpar_->radiusLayer_[type][ir - 1] + hgpar_->radiusLayer_[type][ir]);
934  std::pair<double, double> range = rangeR(z, true);
935  if (debug)
936  edm::LogVerbatim("HGCalGeom") << "locateCellTrap:: Input " << lay << ":" << irad << ":" << iphi << ":" << reco
937  << " IR " << ir << ":" << hgpar_->iradMinBH_[indx.first] << ":"
938  << hgpar_->iradMaxBH_[indx.first] << " Type " << type << " Z " << indx.first << ":"
939  << z << " phi " << phi << ":" << convertRadToDeg(phi) << " R " << r << ":"
940  << range.first << ":" << range.second;
941  if (!trapezoidFile())
942  r = std::max(range.first, std::min(r, range.second));
943  x = r * std::cos(phi);
944  y = r * std::sin(phi);
945  int ll = lay - hgpar_->firstLayer_;
946  x += hgpar_->xLayerHex_[ll];
947  y += hgpar_->yLayerHex_[ll];
948  if (irad < 0)
949  x = -x;
950  if (cassetteMode()) {
952  auto cshift = hgcassette_.getShift(lay, -1, cassette);
953  std::ostringstream st1;
954  if (debug)
955  st1 << "Cassette " << cassette << " Shift " << cshift.first << ":" << cshift.second << " Original " << x << ":"
956  << y;
957  x -= cshift.first;
958  y += cshift.second;
959  if (debug) {
960  st1 << " Final " << x << ":" << y;
961  edm::LogVerbatim("HGCalGeom") << st1.str();
962  }
963  }
964  }
965  if (!reco) {
968  }
969  return std::make_pair(x, y);
970 }
std::vector< int > iradMaxBH_
Log< level::Info, true > LogVerbatim
HGCalCassette hgcassette_
int scintType(const int layer) const
bool trapezoidFile() const
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::pair< double, double > getShift(int layer, int zside, int cassette) const
std::vector< double > yLayerHex_
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
int32_t tileCassette(int32_t, int32_t, int32_t, int32_t)
std::vector< double > zLayerHex_
std::pair< double, double > rangeR(double z, bool reco) const
static constexpr double k_ScaleToDDD
#define debug
Definition: HDRShower.cc:19
std::vector< int > iradMinBH_
fixed size matrix
bool cassetteMode() const
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_
std::vector< double > xLayerHex_

◆ maskCell()

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

Definition at line 972 of file HGCalDDDConstants.cc.

References cassetteMode(), hcalRecHitTable_cff::detId, DetId::Forward, getUVMax(), HGCalWaferMask::goodCell(), hgpar_, l1ctLayer2EG_cff::id, HGCalParameters::k_CornerSize, HGCalTypes::k_OffsetRotation, nano_mu_digi_cff::layer, gpuClustering::pixelStatus::mask, HGCalWaferMask::maskCell(), N, edm::second(), findQualityFiles::v, HGCalTypes::WaferFull, waferHexagon8(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalParameters::waferTypes_, HGCalWaferIndex::waferU(), HGCalWaferIndex::waferV(), and LaserClient_cfi::wl.

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

972  {
973  bool mask(false);
974  if (corners > 2 && corners <= static_cast<int>(HGCalParameters::k_CornerSize)) {
975  if (waferHexagon8()) {
976  int N(0), layer(0), waferU(0), waferV(0), u(0), v(0);
977  if (detId.det() == DetId::Forward) {
979  N = getUVMax(id.type());
980  layer = id.layer();
981  waferU = id.waferU();
982  waferV = id.waferV();
983  u = id.cellU();
984  v = id.cellV();
985  } else {
987  N = getUVMax(id.type());
988  layer = id.layer();
989  waferU = id.waferU();
990  waferV = id.waferV();
991  u = id.cellU();
992  v = id.cellV();
993  }
995  auto itr = hgpar_->waferTypes_.find(wl);
996  auto ktr = hgpar_->waferInfoMap_.find(wl);
997 #ifdef EDM_ML_DEBUG
998  edm::LogVerbatim("HGCalGeom") << "MaskCell: Layer " << layer << " Wafer " << waferU << ":" << waferV << " Index "
999  << wl << ":" << (itr != hgpar_->waferTypes_.end()) << ":"
1000  << (ktr != hgpar_->waferInfoMap_.end());
1001 #endif
1002  if (cassetteMode()) {
1003  int part = (ktr != hgpar_->waferInfoMap_.end()) ? (ktr->second).part : HGCalTypes::WaferFull;
1004  mask = !(HGCalWaferMask::goodCell(u, v, part));
1005  } else if (itr != hgpar_->waferTypes_.end()) {
1006  if ((itr->second).second <= HGCalTypes::k_OffsetRotation)
1007  mask = HGCalWaferMask::maskCell(u, v, N, (itr->second).first, (itr->second).second, corners);
1008  else
1010  u, v, N, (itr->second).first, ((itr->second).second - HGCalTypes::k_OffsetRotation)));
1011  }
1012  }
1013  }
1014  return mask;
1015 }
Log< level::Info, true > LogVerbatim
static constexpr int k_OffsetRotation
Definition: HGCalTypes.h:91
int32_t waferU(const int32_t index)
static bool goodCell(int u, int v, int N, int type, int rotn)
bool waferHexagon8() const
constexpr uint32_t mask
Definition: gpuClustering.h:26
static constexpr uint32_t k_CornerSize
U second(std::pair< T, U > const &p)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
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
part
Definition: HCALResponse.h:20
bool cassetteMode() const
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
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 1017 of file HGCalDDDConstants.cc.

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

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

1017  {
1018  int cells(0);
1019  for (unsigned int i = 0; i < layers(reco); ++i) {
1020  int lay = reco ? hgpar_->depth_[i] : hgpar_->layer_[i];
1021  if (cells < maxCells(lay, reco))
1022  cells = maxCells(lay, reco);
1023  }
1024  return cells;
1025 }
std::vector< int > layer_
std::vector< int > depth_
int maxCells(bool reco) const
unsigned int layers(bool reco) const
fixed size matrix
const HGCalParameters * hgpar_

◆ maxCells() [2/2]

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

Definition at line 1027 of file HGCalDDDConstants.cc.

References HGCalParameters::cellCoarseX_, HGCalParameters::cellFineX_, hgcalTBTopologyTester_cfi::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().

1027  {
1028  const auto& index = getIndex(lay, reco);
1029  if (index.first < 0)
1030  return 0;
1031  if (waferHexagon6()) {
1032  unsigned int cells(0);
1033  for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
1034  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
1035  unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine) ? (hgpar_->cellFineX_.size())
1036  : (hgpar_->cellCoarseX_.size());
1037  if (cell > cells)
1038  cells = cell;
1039  }
1040  }
1041  return static_cast<int>(cells);
1042  } else if (waferHexagon8()) {
1043  int cells(0);
1044  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
1045  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
1049  : hgpar_->waferTypeL_[itr->second]);
1051  cells = std::max(cells, 3 * N * N);
1052  }
1053  }
1054  return cells;
1055  } else if (tileTrapezoid()) {
1056  return hgpar_->scintCells(index.first + hgpar_->firstLayer_);
1057  } else {
1058  return 0;
1059  }
1060 }
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)
#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 115 of file HGCalDDDConstants.h.

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

Referenced by HGCalTopology::HGCalTopology().

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

◆ maxModules()

int HGCalDDDConstants::maxModules ( ) const
inline

Definition at line 118 of file HGCalDDDConstants.h.

References modHalf_.

118 { return modHalf_; }

◆ maxModulesPerLayer()

int HGCalDDDConstants::maxModulesPerLayer ( ) const
inline

Definition at line 119 of file HGCalDDDConstants.h.

References maxWafersPerLayer_.

119 { return maxWafersPerLayer_; }

◆ maxRows()

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

Definition at line 1062 of file HGCalDDDConstants.cc.

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

1062  {
1063  int kymax(0);
1064  const auto& index = getIndex(lay, reco);
1065  int i = index.first;
1066  if (i < 0)
1067  return kymax;
1068  if (waferHexagon6()) {
1069  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
1071  int ky = ((hgpar_->waferCopy_[k]) / 100) % 100;
1072  if (ky > kymax)
1073  kymax = ky;
1074  }
1075  }
1076  } else if (waferHexagon8()) {
1077  kymax = 1 + 2 * hgpar_->waferUVMaxLayer_[index.first];
1078  }
1079  return kymax;
1080 }
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 121 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::slopeMin_.

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

121 { 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 1082 of file HGCalDDDConstants.cc.

Referenced by HGCalTopology::neighbors().

1082  {
1083  // Modify u/v for transition of type1 to type2
1084  return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
1085 }

◆ modules()

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

Definition at line 1087 of file HGCalDDDConstants.cc.

References dqmdumpme::first, getIndex(), max_modules_layer_, and dt_dqm_sourceclient_common_cff::reco.

Referenced by wafers().

1087  {
1088  if (getIndex(lay, reco).first < 0)
1089  return 0;
1090  else
1091  return max_modules_layer_[static_cast<int>(reco)][lay];
1092 }
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 1094 of file HGCalDDDConstants.cc.

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

Referenced by HGCalDDDConstants().

1094  {
1095  int nmod(0);
1096  const auto& index = getIndex(lay, reco);
1097  if (index.first < 0)
1098  return nmod;
1099  if (!tileTrapezoid()) {
1100  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1101  if (waferInLayerTest(k, index.first, hgpar_->defineFull_))
1102  ++nmod;
1103  }
1104  } else {
1105  nmod = 1 + hgpar_->lastModule_[index.first] - hgpar_->firstModule_[index.first];
1106  }
1107  return nmod;
1108 }
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 1110 of file HGCalDDDConstants.cc.

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

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

1110  {
1112 }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ numberCells() [1/2]

int HGCalDDDConstants::numberCells ( bool  reco) const

Definition at line 1114 of file HGCalDDDConstants.cc.

References hgcalTBTopologyTester_cfi::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().

1114  {
1117  ? tileCount(0, -1)
1118  : 0;
1119  if (cells == 0) {
1120  unsigned int nlayer = (reco) ? hgpar_->depth_.size() : hgpar_->layer_.size();
1121  for (unsigned k = 0; k < nlayer; ++k) {
1122  std::vector<int> ncells = numberCells(((reco) ? hgpar_->depth_[k] : hgpar_->layer_[k]), reco);
1123  cells = std::accumulate(ncells.begin(), ncells.end(), cells);
1124  }
1125  }
1126  return cells;
1127 }
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
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 1129 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().

1129  {
1130  const auto& index = getIndex(lay, reco);
1131  int i = index.first;
1132  std::vector<int> ncell;
1133  if (i >= 0) {
1134  if (waferHexagon6()) {
1135  for (unsigned int k = 0; k < hgpar_->waferTypeT_.size(); ++k) {
1137  unsigned int cell = (hgpar_->waferTypeT_[k] - 1 == HGCSiliconDetId::HGCalFine)
1138  ? (hgpar_->cellFineX_.size())
1139  : (hgpar_->cellCoarseX_.size());
1140  ncell.emplace_back(static_cast<int>(cell));
1141  }
1142  }
1143  } else if (tileTrapezoid()) {
1144  int nphi = hgpar_->scintCells(lay);
1145  for (int k = hgpar_->firstModule_[i]; k <= hgpar_->lastModule_[i]; ++k)
1146  ncell.emplace_back(nphi);
1147  } else {
1148  for (unsigned int k = 0; k < hgpar_->waferCopy_.size(); ++k) {
1149  if (waferInLayerTest(k, index.first, hgpar_->defineFull_)) {
1150  int cell = numberCellsHexagon(lay,
1153  true);
1154  ncell.emplace_back(cell);
1155  }
1156  }
1157  }
1158  }
1159  return ncell;
1160 }
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 1162 of file HGCalDDDConstants.cc.

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

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

1162  {
1163  if (wafer >= 0 && wafer < static_cast<int>(hgpar_->waferTypeT_.size())) {
1164  if (hgpar_->waferTypeT_[wafer] - 1 == HGCSiliconDetId::HGCalFine)
1165  return static_cast<int>(hgpar_->cellFineX_.size());
1166  else
1167  return static_cast<int>(hgpar_->cellCoarseX_.size());
1168  } else {
1169  return 0;
1170  }
1171 }
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 1173 of file HGCalDDDConstants.cc.

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

1173  {
1175  int type =
1176  ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick : hgpar_->waferTypeL_[itr->second]);
1177  int N = (type == 0) ? hgpar_->nCellsFine_ : hgpar_->nCellsCoarse_;
1178  if (flag)
1179  return (3 * N * N);
1180  else
1181  return N;
1182 }
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 1184 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(), ticl::LinkingAlgoByDirectionGeometric::buildLayers(), HFNoseNumberingScheme::checkPosition(), HGCalNumberingScheme::checkPosition(), HGCDigitizer::checkPosition(), locateCellTrap(), and HGCalGeometry::neighborZ().

1184  {
1185  double rmin(0), rmax(0), zz(0);
1186  if (hgpar_->detectorType_ > 0) {
1187  zz = (reco ? std::abs(z) : HGCalParameters::k_ScaleFromDDD * std::abs(z));
1188  if (hgpar_->detectorType_ <= 2) {
1190  } else {
1191  rmin = HGCalGeomTools::radius(
1193  }
1194  if ((hgpar_->detectorType_ == 2) && (zz >= hgpar_->zLayerHex_[hgpar_->firstMixedLayer_ - 1])) {
1195  rmax = HGCalGeomTools::radius(
1197  } else {
1199  }
1200  }
1201  if (!reco) {
1204  }
1205 #ifdef EDM_ML_DEBUG
1206  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << z << ":" << zz << " R " << rmin << ":" << rmax;
1207 #endif
1208  return std::make_pair(rmin, rmax);
1209 }
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 1211 of file HGCalDDDConstants.cc.

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

1211  {
1212  double rmin(0), rmax(0);
1213  const auto& index = getIndex(lay, reco);
1214  if (index.first >= 0 && index.first < static_cast<int>(hgpar_->rMinLayHex_.size())) {
1215  rmin = hgpar_->rMinLayHex_[index.first];
1216  rmax = hgpar_->rMaxLayHex_[index.first];
1217  }
1218  if (!reco) {
1221  }
1222 #ifdef EDM_ML_DEBUG
1223  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeR: " << lay << ":" << index.first << " R " << rmin << ":"
1224  << rmax;
1225 #endif
1226  return std::make_pair(rmin, rmax);
1227 }
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 1229 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().

1229  {
1230  double zmin = (hgpar_->zLayerHex_[0] - hgpar_->waferThick_);
1231  double zmax = (hgpar_->zLayerHex_[hgpar_->zLayerHex_.size() - 1] + hgpar_->waferThick_);
1232 #ifdef EDM_ML_DEBUG
1233  edm::LogVerbatim("HGCalGeom") << "HGCalDDDConstants:rangeZ: " << zmin << ":" << zmax << ":" << hgpar_->waferThick_;
1234 #endif
1235  if (!reco) {
1238  }
1239  return std::make_pair(zmin, zmax);
1240 }
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 1242 of file HGCalDDDConstants.cc.

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

1242  {
1243  int row(0), col(0);
1244  if (wafer < static_cast<int>(hgpar_->waferCopy_.size())) {
1245  int copy = hgpar_->waferCopy_[wafer];
1248  ;
1249  }
1250  return std::make_pair(row, col);
1251 }
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

◆ sensorSizeOffset()

double HGCalDDDConstants::sensorSizeOffset ( bool  reco) const

Definition at line 1253 of file HGCalDDDConstants.cc.

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

Referenced by HGCalSD::update().

1253  {
1255 }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ simToReco()

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

Definition at line 1257 of file HGCalDDDConstants.cc.

References hcalRecHitTable_cff::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().

1257  {
1258  if (!waferHexagon6()) {
1259  return std::make_pair(cell, lay);
1260  } else {
1261  const auto& index = getIndex(lay, false);
1262  int i = index.first;
1263  if (i < 0) {
1264  edm::LogWarning("HGCalGeom") << "Wrong Layer # " << lay << " not in the list ***** ERROR *****";
1265  return std::make_pair(-1, -1);
1266  }
1267  if (mod >= static_cast<int>(hgpar_->waferTypeL_.size())) {
1268  edm::LogWarning("HGCalGeom") << "Invalid Wafer # " << mod << "should be < " << (hgpar_->waferTypeL_).size()
1269  << " ***** ERROR *****";
1270  return std::make_pair(-1, -1);
1271  }
1272  int depth(-1);
1273  int kx = cell;
1274  int type = hgpar_->waferTypeL_[mod];
1275  if (type == 1) {
1276  depth = hgpar_->layerGroup_[i];
1277  } else if (type == 2) {
1278  depth = hgpar_->layerGroupM_[i];
1279  } else {
1280  depth = hgpar_->layerGroupO_[i];
1281  }
1282  return std::make_pair(kx, depth);
1283  }
1284 }
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 1286 of file HGCalDDDConstants.cc.

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

Referenced by numberCells().

1286  {
1287  int laymin(layer), laymax(layer), ringmin(ring), ringmax(ring), kount(0);
1288  if (layer == 0) {
1289  laymin = hgpar_->firstLayer_;
1290  laymax = lastLayer(true);
1291  }
1292 #ifdef EDM_ML_DEBUG
1293  edm::LogVerbatim("HGCalGeom") << "tileCount: layer " << layer << " ring " << ring << " layerMin/Max " << laymin << ":"
1294  << laymax;
1295 #endif
1296  for (int lay = laymin; lay <= laymax; ++lay) {
1297  if (ring < 0) {
1298  int ll = lay - hgpar_->firstLayer_;
1299  ringmin = hgpar_->tileRingRange_[ll].first;
1300  ringmax = hgpar_->tileRingRange_[ll].second;
1301  }
1302 #ifdef EDM_ML_DEBUG
1303  edm::LogVerbatim("HGCalGeom") << "tileCount: lay " << lay << ":" << (lay - hgpar_->firstLayer_) << " rings "
1304  << ringmin << ":" << ringmax;
1305 #endif
1306  for (int rin = ringmin; rin <= ringmax; ++rin) {
1307  int indx = HGCalTileIndex::tileIndex(lay, rin + 1, 0);
1308  auto itr = hgpar_->tileInfoMap_.find(indx);
1309 #ifdef EDM_ML_DEBUG
1310  edm::LogVerbatim("HGCalGeom") << "tileCount: rin " << rin << " indx " << indx << " itr "
1311  << (itr != hgpar_->tileInfoMap_.end());
1312 #endif
1313  if (itr != hgpar_->tileInfoMap_.end()) {
1314  for (int k = 0; k < 4; ++k) {
1315  std::bitset<24> b(itr->second.hex[k]);
1316  kount += b.count();
1317  }
1318  }
1319 #ifdef EDM_ML_DEBUG
1320  edm::LogVerbatim("HGCalGeom") << "tileCount: lay|rin " << lay << ":" << rin << " kount " << kount;
1321 #endif
1322  }
1323  }
1324  return (3 * kount);
1325 }
Log< level::Info, true > LogVerbatim
int lastLayer(bool reco) const
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
std::vector< std::pair< int, int > > tileRingRange_
double b
Definition: hdecay.h:120
const HGCalParameters * hgpar_
tileInfo_map tileInfoMap_

◆ tileExist()

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

Definition at line 1327 of file HGCalDDDConstants.cc.

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

Referenced by assignCellTrap(), HGCalGeometryLoader::build(), and isValidTrap().

1327  {
1328  int indx = HGCalTileIndex::tileIndex(layer, ring, 0);
1329  auto itr = hgpar_->tileInfoMap_.find(indx);
1330  bool ok = (itr == hgpar_->tileInfoMap_.end()) ? false : HGCalTileIndex::tileExist(itr->second.hex, zside, phi);
1331  return ok;
1332 }
int zside(DetId const &)
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_

◆ tileInfo()

HGCalParameters::tileInfo HGCalDDDConstants::tileInfo ( int  zside,
int  layer,
int  ring 
) const

Definition at line 1334 of file HGCalDDDConstants.cc.

References hgpar_, nano_mu_digi_cff::layer, relativeConstraints::ring, HGCalTileIndex::tileIndex(), and HGCalParameters::tileInfoMap_.

1334  {
1335  int indx = HGCalTileIndex::tileIndex(layer, ring, 0);
1336  auto itr = hgpar_->tileInfoMap_.find(indx);
1337  return ((itr == hgpar_->tileInfoMap_.end()) ? HGCalParameters::tileInfo() : itr->second);
1338 }
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
const HGCalParameters * hgpar_
tileInfo_map tileInfoMap_

◆ tilePhiEdge()

bool HGCalDDDConstants::tilePhiEdge ( double  phi,
int  layer,
int  iphi 
) const

Definition at line 1340 of file HGCalDDDConstants.cc.

References funct::abs(), cuy::dif1, cuy::dif2, hgpar_, hcalRecHitTable_cff::iphi, nano_mu_digi_cff::layer, phi, HGCalParameters::scintCellSize(), and tol_.

Referenced by assignCellTrap().

1340  {
1341  double dif1 = std::abs(phi - hgpar_->scintCellSize(layer) * (iphi - 1));
1342  double dif2 = std::abs(phi - hgpar_->scintCellSize(layer) * iphi);
1343 #ifdef EDM_ML_DEBUG
1344  edm::LogVerbatim("HGCalGeomT") << "HGCalDDDConstants::tilePhiEdge:: input: " << phi << ":" << layer << ":" << iphi
1345  << " Differences " << dif1 << ":" << dif2;
1346 #endif
1347  return ((dif1 < tol_) || (dif2 < tol_));
1348 }
Log< level::Info, true > LogVerbatim
static constexpr double tol_
double scintCellSize(const int layer) const
dif1
Definition: cuy.py:893
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dif2
Definition: cuy.py:895
const HGCalParameters * hgpar_

◆ tileRingEdge()

bool HGCalDDDConstants::tileRingEdge ( double  rho,
int  layer,
int  ring 
) const

Definition at line 1350 of file HGCalDDDConstants.cc.

References funct::abs(), cuy::dif1, cuy::dif2, hgpar_, nano_mu_digi_cff::layer, alignCSCRings::r, HGCalParameters::radiusLayer_, relativeConstraints::ring, HGCalParameters::scintType(), and tol_.

Referenced by assignCellTrap().

1350  {
1351  int type = hgpar_->scintType(layer);
1352  double dif1 = std::abs(r - hgpar_->radiusLayer_[type][ring - 1]);
1353  double dif2 = std::abs(r - hgpar_->radiusLayer_[type][ring]);
1354 #ifdef EDM_ML_DEBUG
1355  edm::LogVerbatim("HGCalGeomT") << "HGCalDDDConstants::tileRingEdge:: input: " << r << ":" << layer << ":" << ring
1356  << " Differences " << dif1 << ":" << dif2;
1357 #endif
1358  return ((dif1 < tol_) || (dif2 < tol_));
1359 }
Log< level::Info, true > LogVerbatim
static constexpr double tol_
int scintType(const int layer) const
dif1
Definition: cuy.py:893
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dif2
Definition: cuy.py:895
std::vector< double > radiusLayer_[2]
const HGCalParameters * hgpar_

◆ tileRings()

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

Definition at line 1360 of file HGCalDDDConstants.cc.

References HGCalParameters::firstLayer_, hgpar_, nano_mu_digi_cff::layer, HGCalParameters::tileRingRange_, and trapezoidFile().

1360  {
1361  if (trapezoidFile()) {
1362  int ll = layer - hgpar_->firstLayer_;
1363  if (ll >= 0 && ll < static_cast<int>(hgpar_->tileRingRange_.size()))
1364  return hgpar_->tileRingRange_[ll];
1365  }
1366  return std::make_pair(0, 0);
1367 }
bool trapezoidFile() const
std::vector< std::pair< int, int > > tileRingRange_
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

Definition at line 1369 of file HGCalDDDConstants.cc.

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

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

1369  {
1370  int indx = HGCalTileIndex::tileIndex(layer, ring, phi);
1371  int type(-1), sipm(-1);
1372  auto itr = hgpar_->tileInfoMap_.find(indx);
1373  if (itr != hgpar_->tileInfoMap_.end()) {
1374  type = 1 + (itr->second).type;
1375  sipm = ((itr->second).sipm == HGCalTypes::SiPMLarge) ? 0 : 1;
1376  }
1377  return std::make_pair(type, sipm);
1378 }
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
const HGCalParameters * hgpar_
tileInfo_map tileInfoMap_

◆ trapezoidFile()

bool HGCalDDDConstants::trapezoidFile ( ) const
inline

◆ 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 186 of file HGCalDDDConstants.h.

References waferMax_.

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

◆ waferFileIndex()

int HGCalDDDConstants::waferFileIndex ( unsigned int  kk) const

Definition at line 1629 of file HGCalDDDConstants.cc.

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

1629  {
1630  if (kk < hgpar_->waferInfoMap_.size()) {
1631  auto itr = hgpar_->waferInfoMap_.begin();
1632  std::advance(itr, kk);
1633  return itr->first;
1634  } else
1635  return 0;
1636 }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileInfo()

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

Definition at line 1638 of file HGCalDDDConstants.cc.

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

Referenced by HGCalSD::setDetUnitId().

1638  {
1639  if (kk < hgpar_->waferInfoMap_.size()) {
1640  auto itr = hgpar_->waferInfoMap_.begin();
1641  std::advance(itr, kk);
1642  return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient, itr->second.cassette);
1643  } else
1644  return std::make_tuple(0, 0, 0, 0);
1645 }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileInfoExist()

bool HGCalDDDConstants::waferFileInfoExist ( int  kk) const
inline

Definition at line 197 of file HGCalDDDConstants.h.

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

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

◆ waferFileInfoFromIndex()

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

Definition at line 1647 of file HGCalDDDConstants.cc.

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

1647  {
1648  auto itr = hgpar_->waferInfoMap_.find(kk);
1649  if (itr != hgpar_->waferInfoMap_.end()) {
1650  return std::make_tuple(itr->second.type, itr->second.part, itr->second.orient, itr->second.cassette);
1651  } else
1652  return std::make_tuple(0, 0, 0, 0);
1653 }
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferFileSize()

unsigned int HGCalDDDConstants::waferFileSize ( ) const
inline

Definition at line 193 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferInfoMap_.

Referenced by waferType(), and waferTypeRotation().

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

◆ waferFromCopy()

int HGCalDDDConstants::waferFromCopy ( int  copy) const

Definition at line 1380 of file HGCalDDDConstants.cc.

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

Referenced by HGCNumberingScheme::getUnitID().

1380  {
1381  const int ncopies = hgpar_->waferCopy_.size();
1382  int wafer(ncopies);
1383  bool result(false);
1384  for (int k = 0; k < ncopies; ++k) {
1385  if (copy == hgpar_->waferCopy_[k]) {
1386  wafer = k;
1387  result = true;
1388  break;
1389  }
1390  }
1391  if (!result) {
1392  wafer = -1;
1393 #ifdef EDM_ML_DEBUG
1394  edm::LogVerbatim("HGCalGeom") << "Cannot find " << copy << " in a list of " << ncopies << " members";
1395  for (int k = 0; k < ncopies; ++k)
1396  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << hgpar_->waferCopy_[k];
1397 #endif
1398  }
1399 #ifdef EDM_ML_DEBUG
1400  edm::LogVerbatim("HGCalGeom") << "WaferFromCopy " << copy << ":" << wafer << ":" << result;
1401 #endif
1402  return wafer;
1403 }
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 1405 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().

1405  {
1406  // Input x, y in Geant4 unit and transformed to CMSSW standard
1409  int size_ = static_cast<int>(hgpar_->waferCopy_.size());
1410  wafer = size_;
1411  for (int k = 0; k < size_; ++k) {
1412  double dx = std::abs(xx - hgpar_->waferPosX_[k]);
1413  double dy = std::abs(yy - hgpar_->waferPosY_[k]);
1414  if (dx <= rmax_ && dy <= hexside_) {
1415  if ((dy <= 0.5 * hexside_) || (dx * tan30deg_ <= (hexside_ - dy))) {
1416  wafer = k;
1417  celltyp = hgpar_->waferTypeT_[k];
1418  xx -= hgpar_->waferPosX_[k];
1419  yy -= hgpar_->waferPosY_[k];
1420  break;
1421  }
1422  }
1423  }
1424  if (wafer < size_) {
1425  if (celltyp - 1 == HGCSiliconDetId::HGCalFine)
1426  icell = cellHex(
1428  else
1429  icell = cellHex(xx,
1430  yy,
1433  hgpar_->cellCoarseY_);
1434  } else {
1435  wafer = -1;
1436 #ifdef EDM_ML_DEBUG
1437  edm::LogWarning("HGCalGeom") << "Cannot get wafer type corresponding to " << x << ":" << y << " " << xx << ":"
1438  << yy;
1439 #endif
1440  }
1441 #ifdef EDM_ML_DEBUG
1442  edm::LogVerbatim("HGCalGeom") << "Position " << x << ":" << y << " Wafer " << wafer << ":" << size_ << " XX " << xx
1443  << ":" << yy << " Cell " << icell << " Type " << celltyp;
1444 #endif
1445 }
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  zside,
const int  layer,
int &  waferU,
int &  waferV,
int &  cellU,
int &  cellV,
int &  celltype,
double &  wt,
bool  extend,
bool  debug 
) const

Definition at line 1447 of file HGCalDDDConstants.cc.

References funct::abs(), cassetteMode(), cellHex(), HGCalCell::cellPlacementIndex(), HGCalCell::cellPlacementOld, HGCalParameters::cellThickness_, debug, PVValHelper::dx, PVValHelper::dy, HGCalParameters::firstLayer_, HGCalWaferType::getCassette(), HGCalWaferType::getOrient(), HGCalWaferType::getPartial(), HGCalCassette::getShift(), HGCalWaferType::getType(), getXY(), hexside_, hexsideT_, HGCSiliconDetId::HGCalCoarseThick, hgcassette_, hgpar_, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, nano_mu_digi_cff::layer, HGCalTypes::layerFrontBack(), layerType(), HGCalParameters::layerType_, HGCalParameters::nCellsFine_, hgcalPerformanceValidation::orient, rmax_, rmaxT_, tan30deg_, HGCalParameters::typesInLayers_, HGCalParameters::useSimWt_, HGCalTypes::WaferCenterR, HGCalParameters::waferCopy_, HGCalTypes::WaferFull, waferHexagon8File(), 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.

1458  {
1459  // Expect x, y as in SIM step
1460  waferU = waferV = 1 + hgpar_->waferUVMax_;
1461  cellU = cellV = celltype = 0;
1462  if ((hgpar_->xLayerHex_.empty()) || (hgpar_->yLayerHex_.empty()))
1463  return;
1464  int ll = layer - hgpar_->firstLayer_;
1465  int layertype = layerType(layer);
1466  bool rotx = ((!hgpar_->layerType_.empty()) && (layertype == HGCalTypes::WaferCenterR));
1467  double xx(0), yy(0);
1468  if (rotx) {
1469  std::pair<double, double> xy =
1471  xx = xy.first - hgpar_->xLayerHex_[ll];
1472  yy = xy.second - hgpar_->yLayerHex_[ll];
1473  } else {
1476  }
1477  if (debug)
1478  edm::LogVerbatim("HGCalGeom") << "waferFromPosition:: Layer " << layer << ":" << ll << " Rot " << rotx << " X " << x
1479  << ":" << xx << " Y " << y << ":" << yy;
1480  double rmax = extend ? rmaxT_ : rmax_;
1481  double hexside = extend ? hexsideT_ : hexside_;
1482  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1483  double dx0(0), dy0(0);
1486  if (cassetteMode()) {
1488  auto ktr = hgpar_->waferInfoMap_.find(indx);
1489  if (ktr != hgpar_->waferInfoMap_.end()) {
1490  auto cshift = hgcassette_.getShift(layer, -1, (ktr->second).cassette);
1491  if (debug)
1492  edm::LogVerbatim("HGCalGeom") << "Cassette " << (ktr->second).cassette << " Shift " << cshift.first << ":"
1493  << cshift.second;
1494  dx0 = -cshift.first;
1495  dy0 = cshift.second;
1496  }
1497  }
1498  double dx = std::abs(xx - dx0 - hgpar_->waferPosX_[k]);
1499  double dy = std::abs(yy - dy0 - hgpar_->waferPosY_[k]);
1500  if (dx <= rmax && dy <= hexside) {
1501  if ((dy <= 0.5 * hexside) || (dx * tan30deg_ <= (hexside - dy))) {
1502  if (waferHexagon8File()) {
1505  if (debug)
1506  edm::LogVerbatim("HGCalGeom") << "Position (" << x << ", " << y << ") Wafer type:partial:orient:cassette "
1507  << celltype << ":" << HGCalWaferType::getPartial(index, hgpar_->waferInfoMap_)
1510  } else {
1512  celltype = ((itr == hgpar_->typesInLayers_.end()) ? HGCSiliconDetId::HGCalCoarseThick
1513  : hgpar_->waferTypeL_[itr->second]);
1514  }
1515  if (debug)
1516  edm::LogVerbatim("HGCalGeom") << "WaferFromPosition:: Input " << layer << ":" << ll << ":"
1517  << hgpar_->firstLayer_ << ":" << rotx << ":" << x << ":" << y << ":"
1518  << hgpar_->xLayerHex_[ll] << ":" << hgpar_->yLayerHex_[ll] << ":" << xx << ":"
1519  << yy << " compared with " << hgpar_->waferPosX_[k] << ":"
1520  << hgpar_->waferPosY_[k] << " difference " << dx << ":" << dy << ":"
1521  << dx * tan30deg_ << ":" << (hexside_ - dy) << " comparator " << rmax_ << ":"
1522  << rmaxT_ << ":" << hexside_ << ":" << hexsideT_ << " wafer " << waferU << ":"
1523  << waferV << ":" << celltype;
1524  xx -= (dx0 + hgpar_->waferPosX_[k]);
1525  yy -= (dy0 + hgpar_->waferPosY_[k]);
1526  break;
1527  }
1528  }
1529  }
1530  if ((std::abs(waferU) <= hgpar_->waferUVMax_) && (celltype >= 0)) {
1532  if (cassetteMode()) {
1534  auto ktr = hgpar_->waferInfoMap_.find(indx);
1535  if (ktr != hgpar_->waferInfoMap_.end()) {
1536  place = HGCalCell::cellPlacementIndex(1, HGCalTypes::layerFrontBack(layertype), (ktr->second).orient);
1537  part = (ktr->second).part;
1538  if (debug)
1539  edm::LogVerbatim("HGCalGeom") << "waferFromPosition: frontback " << layertype << ":"
1540  << HGCalTypes::layerFrontBack(layertype) << " Orient " << (ktr->second).orient
1541  << " place " << place << " part " << part;
1542  }
1543  }
1544  cellHex(xx, yy, celltype, place, part, cellU, cellV, extend, debug);
1545  wt = (((celltype < 2) && (hgpar_->useSimWt_ > 0)) ? (hgpar_->cellThickness_[celltype] / hgpar_->waferThick_) : 1.0);
1546  } else {
1547  cellU = cellV = 2 * hgpar_->nCellsFine_;
1548  wt = 1.0;
1549  celltype = -1;
1550  }
1551  if ((celltype < 0) && debug) {
1552  double x1(xx);
1553  double y1(yy);
1554  edm::LogVerbatim("HGCalGeom") << "waferfFromPosition: Bad type for X " << x << ":" << x1 << ":" << xx << " Y " << y
1555  << ":" << y1 << ":" << yy << " Wafer " << waferU << ":" << waferV << " Cell " << cellU
1556  << ":" << cellV;
1557  for (unsigned int k = 0; k < hgpar_->waferPosX_.size(); ++k) {
1558  double dx = std::abs(x1 - hgpar_->waferPosX_[k]);
1559  double dy = std::abs(y1 - hgpar_->waferPosY_[k]);
1560  edm::LogVerbatim("HGCalGeom") << "Wafer [" << k << "] Position (" << hgpar_->waferPosX_[k] << ", "
1561  << hgpar_->waferPosY_[k] << ") difference " << dx << ":" << dy << ":"
1562  << dx * tan30deg_ << ":" << hexside - dy << " Paramerers " << rmax << ":"
1563  << hexside;
1564  }
1565  }
1566  edm::LogVerbatim("HGCalGeomX") << "Input x:y:layer " << x << ":" << y << ":" << layer << " Wafer " << waferU << ":"
1567  << waferV << " Cell " << cellU << ":" << cellV << ":" << celltype << " wt " << wt;
1568 }
std::vector< double > waferPosY_
Log< level::Info, true > LogVerbatim
static int32_t cellPlacementIndex(int32_t iz, int32_t frontBack, int32_t orient)
Definition: HGCalCell.cc:237
static constexpr int32_t cellPlacementOld
Definition: HGCalCell.h:25
static int getType(int index, const HGCalParameters::waferInfo_map &wafers)
HGCalCassette hgcassette_
int32_t waferU(const int32_t index)
std::pair< double, double > getShift(int layer, int zside, int cassette) const
static int getPartial(int index, const HGCalParameters::waferInfo_map &wafers)
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
static int getOrient(int index, const HGCalParameters::waferInfo_map &wafers)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
std::vector< double > yLayerHex_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static int getCassette(int index, const HGCalParameters::waferInfo_map &wafers)
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:27
#define debug
Definition: HDRShower.cc:19
std::vector< double > cellThickness_
part
Definition: HCALResponse.h:20
bool waferHexagon8File() const
wafer_map typesInLayers_
static constexpr double k_ScaleFromDDD
bool cassetteMode() const
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_
static int32_t layerFrontBack(int32_t layerOrient)
Definition: HGCalTypes.h:125
int layerType(int lay) const

◆ waferFullInLayer()

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

Definition at line 1577 of file HGCalDDDConstants.cc.

References getIndex(), and waferInLayerTest().

1577  {
1578  const auto& indx = getIndex(lay, reco);
1579  if (indx.first < 0)
1580  return false;
1581  return waferInLayerTest(wafer, indx.first, false);
1582 }
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

◆ waferHexagon8File()

bool HGCalDDDConstants::waferHexagon8File ( ) const
inline

◆ waferHexagon8Module()

bool HGCalDDDConstants::waferHexagon8Module ( ) const
inline

◆ waferIndex()

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

Definition at line 2059 of file HGCalDDDConstants.cc.

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

Referenced by waferInLayerTest().

2059  {
2060  int layer = layerFromIndex(index, true);
2064 #ifdef EDM_ML_DEBUG
2065  edm::LogVerbatim("HGCalGeom") << "WaferIndex for " << wafer << ":" << index << " (" << layer << ":" << waferU << ":"
2066  << waferV << ") " << indx;
2067 #endif
2068  return indx;
2069 }
Log< level::Info, true > LogVerbatim
int32_t waferU(const int32_t index)
int layerFromIndex(int index, bool reco) const
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_

◆ waferInfo()

HGCalParameters::waferInfo HGCalDDDConstants::waferInfo ( int  lay,
int  waferU,
int  waferV 
) const

Definition at line 1584 of file HGCalDDDConstants.cc.

References hgpar_, HGCalWaferIndex::waferIndex(), HGCalParameters::waferInfoMap_, HGCalWaferIndex::waferU(), and HGCalWaferIndex::waferV().

Referenced by HGCalCalibrationCell::findCell(), and HGCalNumberingScheme::getUnitID().

1584  {
1585  int indx = HGCalWaferIndex::waferIndex(lay, waferU, waferV);
1586  auto itr = hgpar_->waferInfoMap_.find(indx);
1587  return ((itr == hgpar_->waferInfoMap_.end()) ? HGCalParameters::waferInfo() : itr->second);
1588 }
int32_t waferU(const int32_t index)
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
int32_t waferV(const int32_t index)
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_

◆ waferInLayer()

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

Definition at line 1570 of file HGCalDDDConstants.cc.

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

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

1570  {
1571  const auto& indx = getIndex(lay, reco);
1572  if (indx.first < 0)
1573  return false;
1574  return waferInLayerTest(wafer, indx.first, hgpar_->defineFull_);
1575 }
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 2071 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().

2071  {
2072  bool in = (waferHexagon6()) ? true : false;
2073  if (!in) {
2074  double xpos = hgpar_->waferPosX_[wafer] + hgpar_->xLayerHex_[lay];
2075  double ypos = hgpar_->waferPosY_[wafer] + hgpar_->yLayerHex_[lay];
2076  std::pair<int, int> corner = HGCalGeomTools::waferCorner(
2077  xpos, ypos, rmax_, hexside_, hgpar_->rMinLayHex_[lay], hgpar_->rMaxLayHex_[lay], in);
2078  in = (full ? (corner.first > 0) : (corner.first == static_cast<int>(HGCalParameters::k_CornerSize)));
2079  if (in && fullAndPart_) {
2080  int indx = waferIndex(wafer, lay);
2081  in = (hgpar_->waferInfoMap_.find(indx) != hgpar_->waferInfoMap_.end());
2082 #ifdef EDM_ML_DEBUG
2083  if (!in)
2084  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay << " wafer " << wafer << " index " << indx
2085  << "( " << HGCalWaferIndex::waferLayer(indx) << ", "
2086  << HGCalWaferIndex::waferU(indx) << ", " << HGCalWaferIndex::waferV(indx)
2087  << ") in " << in;
2088 #endif
2089  }
2090 #ifdef EDM_ML_DEBUG
2091  edm::LogVerbatim("HGCalGeom") << "WaferInLayerTest: Layer " << lay << " wafer " << wafer << " R-limits "
2092  << hgpar_->rMinLayHex_[lay] << ":" << hgpar_->rMaxLayHex_[lay] << " Corners "
2093  << corner.first << ":" << corner.second << " In " << in;
2094 #endif
2095  }
2096  return in;
2097 }
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

Definition at line 1655 of file HGCalDDDConstants.cc.

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.

1656  {
1657  HGCSiliconDetId detid(id);
1658  double x(0), y(0);
1659  if (useWafer) {
1660  auto xyw = waferPositionNoRot(detid.layer(), detid.waferU(), detid.waferV(), reco, debug);
1661  x = xyw.first;
1662  y = xyw.second;
1663  }
1664  auto xy = getXY(detid.layer(), (x + loc.x()), (y + loc.y()), false);
1665  double zz = (detid.zside() < 0) ? -(loc.z() + waferZ(detid.layer(), reco)) : (loc.z() + waferZ(detid.layer(), reco));
1666  double xx = (detid.zside() < 0) ? -xy.first : xy.first;
1667  return GlobalPoint(xx, xy.second, zz);
1668 }
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) const

◆ waferMax()

int HGCalDDDConstants::waferMax ( ) const
inline

Definition at line 188 of file HGCalDDDConstants.h.

References waferMax_.

Referenced by HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_().

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

◆ waferMin()

int HGCalDDDConstants::waferMin ( ) const
inline

Definition at line 189 of file HGCalDDDConstants.h.

References waferMax_.

Referenced by HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_().

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

◆ waferParameters()

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

Definition at line 1590 of file HGCalDDDConstants.cc.

References hexside_, HGCalParameters::k_ScaleToDDD, and rmax_.

1590  {
1591  if (reco)
1592  return std::make_pair(rmax_, hexside_);
1593  else
1595 }
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 1597 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().

1597  {
1598  double xx(0), yy(0);
1599  if (wafer >= 0 && wafer < static_cast<int>(hgpar_->waferPosX_.size())) {
1600  xx = hgpar_->waferPosX_[wafer];
1601  yy = hgpar_->waferPosY_[wafer];
1602  }
1603  if (!reco) {
1606  }
1607  return std::make_pair(xx, yy);
1608 }
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 
) const

Definition at line 1610 of file HGCalDDDConstants.cc.

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

1611  {
1612  int ll = lay - hgpar_->firstLayer_;
1613  bool rotx = ((!hgpar_->layerType_.empty()) && (hgpar_->layerType_[ll] == HGCalTypes::WaferCenterR));
1614 #ifdef EDM_ML_DEBUG
1615  if (debug)
1616  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << ":" << ll << " Rotation " << rotx << " U:V " << waferU << ":"
1617  << waferV;
1618 #endif
1619  auto xy = waferPositionNoRot(lay, waferU, waferV, reco, debug);
1620  std::pair<double, double> xy0 = (rotx) ? getXY(lay, xy.first, xy.second, false) : xy;
1621 #ifdef EDM_ML_DEBUG
1622  if (debug)
1623  edm::LogVerbatim("HGCalGeom") << "Without and with rotation " << xy.first << ":" << xy.second << ":" << xy0.first
1624  << ":" << xy0.second;
1625 #endif
1626  return xy0;
1627 }
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:27
#define debug
Definition: HDRShower.cc:19
fixed size matrix
int32_t waferV(const int32_t index)
const HGCalParameters * hgpar_
std::pair< double, double > waferPositionNoRot(int lay, int waferU, int waferV, bool reco, bool debug) const

◆ waferPosition() [3/3]

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

Definition at line 2123 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.

2123  {
2124  double xx(0), yy(0);
2125  int indx = HGCalWaferIndex::waferIndex(0, waferU, waferV);
2126  auto itr = hgpar_->wafersInLayers_.find(indx);
2127  if (itr != hgpar_->wafersInLayers_.end()) {
2128  xx = hgpar_->waferPosX_[itr->second];
2129  yy = hgpar_->waferPosY_[itr->second];
2130  }
2131  if (!reco) {
2134  }
2135  return std::make_pair(xx, yy);
2136 }
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 
) const
private

Definition at line 2099 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().

2100  {
2101  int ll = lay - hgpar_->firstLayer_;
2102  double x = hgpar_->xLayerHex_[ll];
2103  double y = hgpar_->yLayerHex_[ll];
2104 #ifdef EDM_ML_DEBUG
2105  if (debug)
2106  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << ":" << ll << " Shift " << hgpar_->xLayerHex_[ll] << ":"
2107  << hgpar_->yLayerHex_[ll] << " U:V " << waferU << ":" << waferV;
2108 #endif
2109  if (!reco) {
2112  }
2113  const auto& xy = waferPosition(waferU, waferV, reco);
2114  x += xy.first;
2115  y += xy.second;
2116 #ifdef EDM_ML_DEBUG
2117  if (debug)
2118  edm::LogVerbatim("HGCalGeom") << "With wafer " << x << ":" << y << ":" << xy.first << ":" << xy.second;
2119 #endif
2120  return std::make_pair(x, y);
2121 }
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 1670 of file HGCalDDDConstants.cc.

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

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

1670  {
1671  int wafer(0);
1672  if (!tileTrapezoid()) {
1673  for (unsigned int i = 0; i < layers(true); ++i) {
1674  int lay = hgpar_->depth_[i];
1675  wafer += modules(lay, true);
1676  }
1677  } else {
1678  wafer = static_cast<int>(hgpar_->moduleLayR_.size());
1679  }
1680  return wafer;
1681 }
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 1683 of file HGCalDDDConstants.cc.

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

1683  {
1684  int wafer(0);
1685  if (!tileTrapezoid()) {
1686  auto itr = waferLayer_.find(layer);
1687  if (itr != waferLayer_.end()) {
1688  unsigned ity = (type > 0 && type <= 2) ? type : 0;
1689  wafer = (itr->second)[ity];
1690  }
1691  } else {
1692  const auto& index = getIndex(layer, true);
1693  wafer = 1 + hgpar_->lastModule_[index.first] - hgpar_->firstModule_[index.first];
1694  }
1695  return wafer;
1696 }
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 202 of file HGCalDDDConstants.h.

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

202  {
204  }
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

◆ waferSize()

double HGCalDDDConstants::waferSize ( bool  reco) const
inline

Definition at line 205 of file HGCalDDDConstants.h.

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

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

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

◆ waferToCopy()

int HGCalDDDConstants::waferToCopy ( int  wafer) const
inline

Definition at line 210 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferCopy_.

210  {
211  return ((wafer >= 0) && (wafer < static_cast<int>(hgpar_->waferCopy_.size())))
212  ? hgpar_->waferCopy_[wafer]
213  : static_cast<int>(hgpar_->waferCopy_.size());
214  }
std::vector< int > waferCopy_
const HGCalParameters * hgpar_

◆ waferType() [1/3]

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

Definition at line 1698 of file HGCalDDDConstants.cc.

References DetId::Forward, hgpar_, nano_mu_digi_cff::layer, HFNoseDetId::layer(), HGCSiliconDetId::layer(), HGCSiliconDetId::type(), HFNoseDetId::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_().

1698  {
1699  int type(1);
1700  if (waferHexagon8()) {
1701  if (fromFile && (waferFileSize() > 0)) {
1702  int layer(0), waferU(0), waferV(0);
1703  if (id.det() != DetId::Forward) {
1704  HGCSiliconDetId hid(id);
1705  layer = hid.layer();
1706  waferU = hid.waferU();
1707  waferV = hid.waferV();
1708  } else {
1709  HFNoseDetId hid(id);
1710  layer = hid.layer();
1711  waferU = hid.waferU();
1712  waferV = hid.waferV();
1713  }
1715  if (itr != hgpar_->waferInfoMap_.end())
1716  type = (itr->second).type;
1717  } else {
1718  type = ((id.det() != DetId::Forward) ? HGCSiliconDetId(id).type() : HFNoseDetId(id).type());
1719  }
1720  } else if (waferHexagon6()) {
1721  type = waferTypeL(HGCalDetId(id).wafer()) - 1;
1722  }
1723  return type;
1724 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
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:51
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 
) const

Definition at line 1726 of file HGCalDDDConstants.cc.

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

1726  {
1728  if (waferHexagon8()) {
1729  if (fromFile && (waferFileSize() > 0)) {
1731  if (itr != hgpar_->waferInfoMap_.end())
1732  type = (itr->second).type;
1733  } else {
1735  if (itr != hgpar_->typesInLayers_.end())
1736  type = hgpar_->waferTypeL_[itr->second];
1737  }
1738  } else if (waferHexagon6()) {
1739  if ((waferU >= 0) && (waferU < static_cast<int>(hgpar_->waferTypeL_.size())))
1740  type = (hgpar_->waferTypeL_[waferU] - 1);
1741  }
1742  return type;
1743 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
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 
) const

Definition at line 1745 of file HGCalDDDConstants.cc.

References dqmdumpme::first, hgpar_, HGCalGeomTools::k_allCorners, HGCalGeomTools::k_fiveCorners, HGCalGeomTools::k_fourCorners, HGCalTypes::k_OffsetRotation, HGCalGeomTools::k_threeCorners, nano_mu_digi_cff::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().

1745  {
1746  const auto& index = HGCalWaferIndex::waferIndex(id.layer(), id.waferU(), id.waferV());
1747  int type(-1), part(-1), orient(-1);
1748  if (fromFile && (waferFileSize() > 0)) {
1749  auto itr = hgpar_->waferInfoMap_.find(index);
1750  if (itr != hgpar_->waferInfoMap_.end()) {
1751  type = (itr->second).type;
1752  part = (itr->second).part;
1753  orient = (itr->second).orient;
1754  }
1755  } else {
1756  auto ktr = hgpar_->typesInLayers_.find(index);
1757  if (ktr != hgpar_->typesInLayers_.end())
1758  type = hgpar_->waferTypeL_[ktr->second];
1759  auto itr = hgpar_->waferTypes_.find(index);
1760  if (itr != hgpar_->waferTypes_.end()) {
1761  if ((itr->second).second < HGCalTypes::k_OffsetRotation) {
1762  orient = (itr->second).second;
1763  if ((itr->second).first == HGCalGeomTools::k_allCorners) {
1765  } else if ((itr->second).first == HGCalGeomTools::k_fiveCorners) {
1767  } else if ((itr->second).first == HGCalGeomTools::k_fourCorners) {
1769  } else if ((itr->second).first == HGCalGeomTools::k_threeCorners) {
1771  }
1772  } else {
1773  part = (itr->second).first;
1774  orient = ((itr->second).second - HGCalTypes::k_OffsetRotation);
1775  }
1776  } else {
1778  orient = 0;
1779  }
1780  }
1781  return std::make_tuple(type, part, orient);
1782 }
static constexpr int k_OffsetRotation
Definition: HGCalTypes.h:91
static constexpr int k_fourCorners
int32_t waferU(const int32_t index)
static constexpr int32_t WaferThree
Definition: HGCalTypes.h:42
U second(std::pair< T, U > const &p)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
unsigned int waferFileSize() const
static constexpr int32_t WaferHalf
Definition: HGCalTypes.h:39
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_threeCorners
int32_t waferV(const int32_t index)
static constexpr int32_t WaferFive
Definition: HGCalTypes.h:36
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 220 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeL_.

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

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

◆ waferTypeRotation()

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

Definition at line 1784 of file HGCalDDDConstants.cc.

References debug, TauDecayModes::dec, dqmdumpme::first, hgpar_, HGCalGeomTools::k_allCorners, HGCalGeomTools::k_fiveCorners, HGCalGeomTools::k_fourCorners, HGCalTypes::k_OffsetRotation, HGCalGeomTools::k_threeCorners, nano_mu_digi_cff::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(), and HGCalSD::setDetUnitId().

1785  {
1786  int type(HGCalTypes::WaferOut), rotn(0);
1788  bool withinList(true);
1789  if (fromFile && (waferFileSize() > 0)) {
1790  auto itr = hgpar_->waferInfoMap_.find(wl);
1791  withinList = (itr != hgpar_->waferInfoMap_.end());
1792  if (withinList) {
1793  type = (itr->second).part;
1794  rotn = (itr->second).orient;
1795  }
1796  } else {
1797  auto itr = hgpar_->waferTypes_.find(wl);
1798  if (waferHexagon8()) {
1799  withinList = (itr != hgpar_->waferTypes_.end());
1800  if (withinList) {
1801  if ((itr->second).second < HGCalTypes::k_OffsetRotation) {
1802  rotn = (itr->second).second;
1803  if ((itr->second).first == HGCalGeomTools::k_allCorners) {
1805  } else if ((itr->second).first == HGCalGeomTools::k_fiveCorners) {
1807  } else if ((itr->second).first == HGCalGeomTools::k_fourCorners) {
1809  } else if ((itr->second).first == HGCalGeomTools::k_threeCorners) {
1811  }
1812  } else {
1813  type = (itr->second).first;
1814  rotn = ((itr->second).second - HGCalTypes::k_OffsetRotation);
1815  }
1816  } else {
1818  rotn = HGCalTypes::WaferCorner0;
1819  }
1820  }
1821  }
1822 #ifdef EDM_ML_DEBUG
1823  if (debug)
1824  edm::LogVerbatim("HGCalGeom") << "waferTypeRotation: Layer " << layer << " Wafer " << waferU << ":" << waferV
1825  << " Index " << std::hex << wl << std::dec << ":" << withinList << " Type " << type
1826  << " Rotation " << rotn;
1827 #endif
1828  return std::make_pair(type, rotn);
1829 }
Log< level::Info, true > LogVerbatim
static constexpr int k_OffsetRotation
Definition: HGCalTypes.h:91
static constexpr int k_fourCorners
int32_t waferU(const int32_t index)
static constexpr int32_t WaferOut
Definition: HGCalTypes.h:56
static constexpr int32_t WaferThree
Definition: HGCalTypes.h:42
bool waferHexagon8() const
U second(std::pair< T, U > const &p)
static constexpr int32_t WaferFull
Definition: HGCalTypes.h:35
unsigned int waferFileSize() const
static constexpr int32_t WaferHalf
Definition: HGCalTypes.h:39
static constexpr int32_t WaferCorner0
Definition: HGCalTypes.h:13
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_threeCorners
int32_t waferV(const int32_t index)
static constexpr int32_t WaferFive
Definition: HGCalTypes.h:36
waferInfo_map waferInfoMap_
const HGCalParameters * hgpar_
static constexpr int k_allCorners

◆ waferTypeT()

int HGCalDDDConstants::waferTypeT ( int  wafer) const
inline

Definition at line 216 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferTypeT_.

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

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

◆ waferUVMax()

int HGCalDDDConstants::waferUVMax ( ) const
inline

Definition at line 227 of file HGCalDDDConstants.h.

References hgpar_, and HGCalParameters::waferUVMax_.

Referenced by HGCalTopology::HGCalTopology().

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

◆ waferVirtual()

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

Definition at line 1831 of file HGCalDDDConstants.cc.

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

1831  {
1832  bool type(false);
1833  if (waferHexagon8()) {
1835  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1836  } else if (waferHexagon6()) {
1837  int wl = HGCalWaferIndex::waferIndex(layer, waferU, 0, true);
1838  type = (hgpar_->waferTypes_.find(wl) != hgpar_->waferTypes_.end());
1839  }
1840  return type;
1841 }
int32_t waferU(const int32_t index)
bool waferHexagon8() const
bool waferHexagon6() const
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

Definition at line 1843 of file HGCalDDDConstants.cc.

References getIndex(), hgpar_, HGCalParameters::k_ScaleToDDD, and HGCalParameters::zLayerHex_.

Referenced by HGCalSimHitValidation::analyzeHits(), HGCalTBAnalyzer::analyzeRecHits(), HGCalTBAnalyzer::analyzeSimHits(), ticl::SeedingRegionByTracks::buildFirstLayers(), ticl::LinkingAlgoByDirectionGeometric::buildLayers(), HFNoseNumberingScheme::checkPosition(), HGCalNumberingScheme::checkPosition(), HGCalGeometry::get8Corners(), HGCalGeometry::getCorners(), HGCalTriggerTools::getLayerZ(), HGCalGeometry::getNewCorners(), HGCalGeometry::getPosition(), hgcal::RecHitTools::getPositionLayer(), ticl::LinkingAlgoByDirectionGeometric::linkTracksters(), HGCalGeometry::neighborZ(), HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_(), and waferLocal2Global().

1843  {
1844  const auto& index = getIndex(lay, reco);
1845  if (index.first < 0)
1846  return 0;
1847  else
1849 }
std::pair< int, float > getIndex(int lay, bool reco) const
std::vector< double > zLayerHex_
static constexpr double k_ScaleToDDD
fixed size matrix
const HGCalParameters * hgpar_

Member Data Documentation

◆ dPhiMin

constexpr float HGCalDDDConstants::dPhiMin = 0.02
staticprivate

Definition at line 254 of file HGCalDDDConstants.h.

◆ fullAndPart_

const bool HGCalDDDConstants::fullAndPart_
private

Definition at line 262 of file HGCalDDDConstants.h.

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

◆ geomTools_

HGCalGeomTools HGCalDDDConstants::geomTools_
private

Definition at line 252 of file HGCalDDDConstants.h.

◆ hexside_

double HGCalDDDConstants::hexside_
private

◆ hexsideT_

double HGCalDDDConstants::hexsideT_
private

Definition at line 264 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and waferFromPosition().

◆ hgcassette_

HGCalCassette HGCalDDDConstants::hgcassette_
private

◆ hgcell_

std::unique_ptr<HGCalCell> HGCalDDDConstants::hgcell_
private

Definition at line 250 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and locateCell().

◆ hgcellUV_

std::unique_ptr<HGCalCellUV> HGCalDDDConstants::hgcellUV_
private

Definition at line 251 of file HGCalDDDConstants.h.

Referenced by cellHex(), and HGCalDDDConstants().

◆ hgpar_

const HGCalParameters* HGCalDDDConstants::hgpar_
private

Definition at line 257 of file HGCalDDDConstants.h.

Referenced by assignCell(), assignCellTrap(), cassetteShiftSilicon(), cassetteTile(), cellEtaPhiTrap(), cellHex(), cellInLayer(), cellSizeHex(), cellSizeTrap(), cellThickness(), cellType(), distFromEdgeHex(), distFromEdgeTrap(), firstLayer(), getIndex(), getLayer(), getLayerOffset(), getModule(), getModules(), getParameter(), getPhiBins(), getRadiusLayer(), getRangeR(), getREtaRange(), getTrForm(), getTrFormN(), getTrForms(), getTypeHex(), getTypeTrap(), getUVMax(), getXY(), guardRingOffset(), HGCalDDDConstants(), isHalfCell(), isValidCell(), isValidCell8(), isValidHex(), isValidHex8(), isValidTrap(), lastLayer(), layerFromIndex(), layerIndex(), layersInit(), layerType(), levelTop(), localToGlobal8(), locateCell(), locateCellHex(), locateCellTrap(), maskCell(), maxCells(), maxCellUV(), maxRows(), minSlope(), modulesInit(), mouseBite(), numberCells(), numberCellsHexagon(), rangeR(), rangeRLayer(), rangeZ(), rowColumnWafer(), sectors(), sensorSizeOffset(), simToReco(), tileCount(), tileExist(), tileInfo(), tilePhiEdge(), tileRingEdge(), tileRings(), tileType(), volumes(), waferFileIndex(), waferFileInfo(), waferFileInfoExist(), waferFileInfoFromIndex(), waferFileSize(), waferFromCopy(), waferFromPosition(), waferIndex(), waferInfo(), waferInLayer(), waferInLayerTest(), waferPosition(), waferPositionNoRot(), wafers(), waferSepar(), waferSize(), waferToCopy(), waferType(), waferTypeL(), waferTypeRotation(), waferTypeT(), waferUVMax(), waferVirtual(), and waferZ().

◆ k_horizontalShift

constexpr double HGCalDDDConstants::k_horizontalShift = 1.0
staticprivate

Definition at line 253 of file HGCalDDDConstants.h.

◆ max_modules_layer_

Simrecovecs HGCalDDDConstants::max_modules_layer_
private

Definition at line 267 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and modules().

◆ maxWafersPerLayer_

int32_t HGCalDDDConstants::maxWafersPerLayer_
private

Definition at line 268 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 265 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and maxModules().

◆ rmax_

double HGCalDDDConstants::rmax_
private

◆ rmaxT_

double HGCalDDDConstants::rmaxT_
private

Definition at line 264 of file HGCalDDDConstants.h.

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

◆ sqrt3_

const double HGCalDDDConstants::sqrt3_
private

Definition at line 260 of file HGCalDDDConstants.h.

Referenced by cellHex(), and distFromEdgeHex().

◆ tan30deg_

constexpr double HGCalDDDConstants::tan30deg_ = 0.5773502693
staticprivate

◆ tol_

constexpr double HGCalDDDConstants::tol_ = 0.001
staticprivate

Definition at line 259 of file HGCalDDDConstants.h.

Referenced by assignCellTrap(), tilePhiEdge(), and tileRingEdge().

◆ tot_layers_

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

Definition at line 266 of file HGCalDDDConstants.h.

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

◆ tot_wafers_

int32_t HGCalDDDConstants::tot_wafers_
private

Definition at line 265 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants().

◆ waferIn_

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

Definition at line 271 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and isValidHex8().

◆ waferLayer_

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

Definition at line 269 of file HGCalDDDConstants.h.

Referenced by HGCalDDDConstants(), and wafers().

◆ waferMax_

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

Definition at line 270 of file HGCalDDDConstants.h.

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