21 : hgpar_(
hp), sqrt3_(
std::
sqrt(3.0)), mode_(hgpar_->mode_) {
40 for (
int simreco = 0; simreco < 2; ++simreco) {
71 int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
74 int wmin(9999999),
wmax(-9999999), kount(0);
75 for (
int wafer = 0; wafer <
sectors(); ++wafer) {
93 int lay1 =
getIndex(lay0,
true).first;
94 edm::LogVerbatim(
"HGCalGeom") <<
"Index " <<
i <<
" Layer " << lay0 <<
":" << lay1 <<
" Wafer " <<
wmin <<
":" 95 <<
wmax <<
":" << kount;
100 waferMax_ = std::array<int, 4>{{wminT, wmaxT, kount1, kount2}};
102 edm::LogVerbatim(
"HGCalGeom") <<
"Overall wafer statistics: " << wminT <<
":" << wmaxT <<
":" << kount1 <<
":" 111 return std::make_pair(-1, -1);
121 <<
" ***** ERROR *****";
122 return std::make_pair(-1, -1);
128 return std::make_pair(wafer,
135 return std::make_pair(wafer,
143 return std::make_pair(-1, -1);
148 int indx = (
type == 1) ? 1 : 0;
157 thick = 100.0 * (
type + 1);
173 for (
int k = 0;
k < sizew; ++
k) {
195 edm::LogVerbatim(
"HGCalGeom") <<
"DistFromEdgeHex: Local " <<
xx <<
":" <<
yy <<
" wafer " << wafer <<
" flag " 207 auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&
k, &
zz, &zLayerHex](
double zLayer) {
209 return zz < 0.5 * (zLayerHex[
k - 1] + zLayerHex[
k]);
211 int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) :
k;
228 <<
" ***** ERROR *****";
239 std::vector<HGCalTBParameters::hgtrap> mytrs;
246 std::vector<HGCalTBParameters::hgtrform> mytrs;
260 bool result(
false), resultMod(
false);
266 const int32_t lay_idx =
reco ? (lay - 1) * 3 + 1 : lay;
268 auto moditr = the_modules.find(copyNumber);
269 result = resultMod = (moditr != the_modules.end());
272 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalTBDDDConstants: Layer " << lay <<
":" << lay_idx <<
" Copy " 273 << copyNumber <<
":" <<
mod <<
" Flag " <<
result;
276 if (moditr->second >= 0) {
278 edm::LogWarning(
"HGCalGeom") <<
"Module no. out of bound for " <<
mod <<
" to be compared with " 283 result = (cell >= 0 && cell <= cellmax);
293 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalTBDDDConstants: Layer " << lay <<
":" 294 << (lay > 0 && (lay <= static_cast<int>(
layers(
reco)))) <<
" Module " <<
mod <<
":" 295 << resultMod <<
" Cell " << cell <<
":" << cellmax <<
":" 296 << (cell >= 0 && cell <= cellmax) <<
":" <<
maxCells(
reco);
325 float x(999999.),
y(999999.);
329 return std::make_pair(
x,
y);
344 edm::LogVerbatim(
"HGCalGeom") <<
"LocateCell (Wafer) " << x0 <<
":" << y0 <<
" Final " <<
x <<
":" <<
y;
351 return std::make_pair(
x,
y);
367 return std::make_pair(
x,
y);
384 unsigned int cells(0);
393 return static_cast<int>(
cells);
414 return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
443 for (
unsigned k = 0;
k < nlayer; ++
k) {
445 cells = std::accumulate(ncells.begin(), ncells.end(),
cells);
453 std::vector<int> ncell;
460 ncell.emplace_back(static_cast<int>(cell));
479 double rmin(0), rmax(0);
486 <<
" R " << rmin <<
":" << rmax;
488 return std::make_pair(rmin, rmax);
492 double rmin(0), rmax(0);
503 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalTBDDDConstants:rangeR: " << lay <<
":" <<
index.first <<
" R " << rmin <<
":" 506 return std::make_pair(rmin, rmax);
529 return std::make_pair(row,
col);
533 return std::make_pair(cell, lay);
540 for (
int k = 0;
k < ncopies; ++
k) {
550 edm::LogVerbatim(
"HGCalGeom") <<
"Cannot find " <<
copy <<
" in a list of " << ncopies <<
" members";
551 for (
int k = 0;
k < ncopies; ++
k)
567 for (
int k = 0;
k < size_; ++
k) {
596 edm::LogWarning(
"HGCalGeom") <<
"Cannot get wafer type corresponding to " <<
x <<
":" <<
y <<
" " <<
xx <<
":" 601 edm::LogVerbatim(
"HGCalGeom") <<
"Position " <<
x <<
":" <<
y <<
" Wafer " << wafer <<
":" << size_ <<
" XX " <<
xx 602 <<
":" <<
yy <<
" Cell " << icell <<
" Type " << celltyp;
637 return std::make_pair(
xx,
yy);
647 wafer = (itr->second)[ity];
677 double xx,
double yy,
const double& cellR,
const std::vector<double>&
posX,
const std::vector<double>&
posY)
const {
679 const double tol(0.00001);
681 for (
unsigned int k = 0;
k <
posX.size(); ++
k) {
684 if (
dx <= (cellR + tol) &&
dy <= (cellY + tol)) {
685 double xmax = (
dy <= 0.5 * cellY) ? cellR : (cellR - (
dy - 0.5 * cellY) /
tan30deg_);
698 return std::make_pair(-1, 0);
703 return std::make_pair(indx, cell);
738 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