21 : hgpar_(
hp), sqrt3_(
std::
sqrt(3.0)), mode_(hgpar_->mode_) {
39 for (
int simreco = 0; simreco < 2; ++simreco) {
69 int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
72 int wmin(9999999),
wmax(-9999999), kount(0);
73 for (
int wafer = 0; wafer <
sectors(); ++wafer) {
91 int lay1 =
getIndex(lay0,
true).first;
92 edm::LogVerbatim(
"HGCalGeom") <<
"Index " <<
i <<
" Layer " << lay0 <<
":" << lay1 <<
" Wafer " <<
wmin <<
":" 93 <<
wmax <<
":" << kount;
98 waferMax_ = std::array<int, 4>{{wminT, wmaxT, kount1, kount2}};
100 edm::LogVerbatim(
"HGCalGeom") <<
"Overall wafer statistics: " << wminT <<
":" << wmaxT <<
":" << kount1 <<
":" 109 return std::make_pair(-1, -1);
119 <<
" ***** ERROR *****";
120 return std::make_pair(-1, -1);
126 return std::make_pair(wafer,
133 return std::make_pair(wafer,
141 return std::make_pair(-1, -1);
146 int indx = (
type == 1) ? 1 : 0;
155 thick = 100.0 * (
type + 1);
171 for (
int k = 0;
k < sizew; ++
k) {
193 edm::LogVerbatim(
"HGCalGeom") <<
"DistFromEdgeHex: Local " <<
xx <<
":" <<
yy <<
" wafer " << wafer <<
" flag " 205 auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&
k, &
zz, &zLayerHex](
double zLayer) {
207 return zz < 0.5 * (zLayerHex[
k - 1] + zLayerHex[
k]);
209 int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) :
k;
226 <<
" ***** ERROR *****";
237 std::vector<HGCalTBParameters::hgtrap> mytrs;
244 std::vector<HGCalTBParameters::hgtrform> mytrs;
258 bool result(
false), resultMod(
false);
264 const int32_t lay_idx =
reco ? (lay - 1) * 3 + 1 : lay;
266 auto moditr = the_modules.find(copyNumber);
267 result = resultMod = (moditr != the_modules.end());
270 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalTBDDDConstants: Layer " << lay <<
":" << lay_idx <<
" Copy " 271 << copyNumber <<
":" <<
mod <<
" Flag " <<
result;
274 if (moditr->second >= 0) {
276 edm::LogWarning(
"HGCalGeom") <<
"Module no. out of bound for " <<
mod <<
" to be compared with " 281 result = (cell >= 0 && cell <= cellmax);
291 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalTBDDDConstants: Layer " << lay <<
":" 292 << (lay > 0 && (lay <= static_cast<int>(
layers(
reco)))) <<
" Module " <<
mod <<
":" 293 << resultMod <<
" Cell " << cell <<
":" << cellmax <<
":" 294 << (cell >= 0 && cell <= cellmax) <<
":" <<
maxCells(
reco);
323 float x(999999.),
y(999999.);
327 return std::make_pair(
x,
y);
342 edm::LogVerbatim(
"HGCalGeom") <<
"LocateCell (Wafer) " << x0 <<
":" << y0 <<
" Final " <<
x <<
":" <<
y;
349 return std::make_pair(
x,
y);
365 return std::make_pair(
x,
y);
382 unsigned int cells(0);
391 return static_cast<int>(
cells);
412 return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
441 for (
unsigned k = 0;
k < nlayer; ++
k) {
443 cells = std::accumulate(ncells.begin(), ncells.end(),
cells);
451 std::vector<int> ncell;
458 ncell.emplace_back(static_cast<int>(cell));
477 double rmin(0), rmax(0);
484 <<
" R " << rmin <<
":" << rmax;
486 return std::make_pair(rmin, rmax);
490 double rmin(0), rmax(0);
501 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalTBDDDConstants:rangeR: " << lay <<
":" <<
index.first <<
" R " << rmin <<
":" 504 return std::make_pair(rmin, rmax);
527 return std::make_pair(row,
col);
531 return std::make_pair(cell, lay);
538 for (
int k = 0;
k < ncopies; ++
k) {
548 edm::LogVerbatim(
"HGCalGeom") <<
"Cannot find " <<
copy <<
" in a list of " << ncopies <<
" members";
549 for (
int k = 0;
k < ncopies; ++
k)
565 for (
int k = 0;
k < size_; ++
k) {
594 edm::LogWarning(
"HGCalGeom") <<
"Cannot get wafer type corresponding to " <<
x <<
":" <<
y <<
" " <<
xx <<
":" 599 edm::LogVerbatim(
"HGCalGeom") <<
"Position " <<
x <<
":" <<
y <<
" Wafer " << wafer <<
":" << size_ <<
" XX " <<
xx 600 <<
":" <<
yy <<
" Cell " << icell <<
" Type " << celltyp;
635 return std::make_pair(
xx,
yy);
645 wafer = (itr->second)[ity];
675 double xx,
double yy,
const double& cellR,
const std::vector<double>&
posX,
const std::vector<double>&
posY)
const {
677 const double tol(0.00001);
679 for (
unsigned int k = 0;
k <
posX.size(); ++
k) {
682 if (
dx <= (cellR + tol) &&
dy <= (cellY + tol)) {
683 double xmax = (
dy <= 0.5 * cellY) ? cellR : (cellR - (
dy - 0.5 * cellY) /
tan30deg_);
696 return std::make_pair(-1, 0);
701 return std::make_pair(indx, cell);
736 edm::LogVerbatim(
"HGCalGeom") <<
"Input " << lay <<
":" << wafer <<
":" << cell <<
" Position " <<
x <<
":" <<
y const HGCalGeometryMode::GeometryMode mode_
std::vector< double > moduleCellR_
Log< level::Info, true > LogVerbatim
std::vector< double > cellFineX_
std::pair< double, double > rangeZ(bool reco) const
std::vector< int > layer_
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
int32_t waferIndex(int wafer, int index) const
bool waferInLayer(int wafer, int lay, bool reco) const
std::vector< bool > cellCoarseHalf_
static int32_t getUnpackedU(int id)
int lastLayer(bool reco) const
std::vector< int > waferCopy_
static constexpr double k_ScaleFromDDD
std::vector< double > rMaxLayHex_
std::vector< HGCalTBParameters::hgtrform > getTrForms() const
std::array< uint32_t, 2 > tot_layers_
int numberCellsHexagon(int wafer) const
double waferZ(int layer, bool reco) const
bool isHalfCell(int waferType, int cell) const
std::vector< int > waferTypeL_
std::pair< double, double > waferParameters(bool reco) const
static int32_t getUnpackedV(int id)
std::vector< double > cellCoarseY_
bool waferVirtual(int layer, int wafer) const
std::vector< int > moduleLayR_
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
std::array< int, 4 > waferMax_
std::vector< HGCalTBParameters::hgtrap > getModules() const
const HGCalTBParameters * hgpar_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > layerIndex_
std::vector< double > cellCoarseX_
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
double mouseBite(bool reco) const
std::pair< int, float > getIndex(int lay, bool reco) const
std::pair< double, double > rangeR(double z, bool reco) const
static constexpr double k_ScaleToDDD
std::vector< double > waferPosX_
hgtrform getTrForm(unsigned int k) const
unsigned int layersInit(bool reco) const
std::pair< double, double > rangeRLayer(int lay, bool reco) const
std::vector< int > depthIndex_
std::vector< double > zLayerHex_
int layerFromIndex(int index, bool reco) const
int maxRows(int lay, bool reco) const
std::vector< int > waferTypeT_
std::map< int, HGCWaferParam > waferLayer_
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
std::array< int, 3 > HGCWaferParam
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
std::pair< double, double > waferPosition(int wafer, bool reco) const
bool isValidCell(int layindex, int wafer, int cell) const
int layerIndex(int lay, bool reco) const
bool waferHexagon6() const
double cellThickness(int layer, int wafer) const
double cellSizeHex(int type) const
bool waferFullInLayer(int wafer, int lay, bool reco) const
unsigned int getTrFormN() const
HGCalTBParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
std::vector< double > rMinLayHex_
static constexpr double tan30deg_
std::vector< double > cellFineY_
std::vector< double > cellSize_
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::pair< int, int > rowColumnWafer(const int wafer) const
double distFromEdgeHex(double x, double y, double z) const
int modifyUV(int uv, int type1, int type2) const
layer_map copiesInLayers_
std::vector< int > depth_
std::vector< uint32_t > trformIndex_
unsigned int layers(bool reco) const
Simrecovecs max_modules_layer_
#define TYPELOOKUP_DATA_REG(_dataclass_)
std::vector< int > depthLayerF_
std::vector< bool > cellFineHalf_
std::vector< int > layerGroupO_
int waferType(DetId const &id) const
bool isValidHex(int lay, int mod, int cell, bool reco) const
bool waferInLayerTest(int wafer, int lay) const
int maxCells(bool reco) const
int32_t maxWafersPerLayer_
Log< level::Warning, false > LogWarning
int modulesInit(int lay, bool reco) const
__host__ __device__ V wmin
int getLayer(double z, bool reco) const
T mod(const T &a, const T &b)
int modules(int lay, bool reco) const
int waferFromCopy(int copy) const
HGCalTBParameters::hgtrform getTrForm(unsigned int k) const
std::vector< double > moduleCellS_
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
std::vector< double > waferPosY_
int numberCells(bool reco) const
HGCalTBDDDConstants(const HGCalTBParameters *hp, const std::string &name)
__host__ __device__ V V wmax
hgtrap getModule(unsigned int k, bool reco) const