|
|
Go to the documentation of this file.
44 for (
int simreco = 0; simreco < 2; ++simreco) {
74 int wminT(9999999), wmaxT(-9999999), kount1(0), kount2(0);
77 int wmin(9999999),
wmax(-9999999), kount(0);
78 for (
int wafer = 0; wafer <
sectors(); ++wafer) {
103 int lay1 =
getIndex(lay0,
true).first;
104 edm::LogVerbatim(
"HGCalGeom") <<
"Index " <<
i <<
" Layer " << lay0 <<
":" << lay1 <<
" Wafer " <<
wmin <<
":"
105 <<
wmax <<
":" << kount;
110 waferMax_ = std::array<int, 4>{{wminT, wmaxT, kount1, kount2}};
112 edm::LogVerbatim(
"HGCalGeom") <<
"Overall wafer statistics: " << wminT <<
":" << wmaxT <<
":" << kount1 <<
":"
123 return std::make_pair(-1, -1);
133 <<
" ***** ERROR *****";
134 return std::make_pair(-1, -1);
137 std::pair<double, double>
xy =
getXY(lay,
xx,
yy,
false);
141 return std::make_pair(wafer,
148 return std::make_pair(wafer,
156 return std::make_pair(-1, -1);
175 return std::array<int, 3>{{irad,
iphi,
type}};
176 double xx = (
z > 0) ?
x : -
x;
178 double phi = (
r == 0. ? 0. : std::atan2(
y,
xx));
188 <<
" x|r " <<
xx <<
":" <<
r <<
" phi " <<
phi <<
" o/p " << irad <<
":" <<
iphi <<
":"
191 return std::array<int, 3>{{irad,
iphi,
type}};
201 return std::make_pair(
dr,
df);
205 const auto& indx =
getIndex(lay,
true);
206 if (indx.first >= 0) {
210 double rpos =
sqrt(
xy.first *
xy.first +
xy.second *
xy.second);
211 return ((rpos >=
hgpar_->
rMinLayHex_[indx.first]) && (rpos <= hgpar_->rMaxLayHex_[indx.first]));
227 thick = 100.0 * (
type + 1);
247 else if (cellV - cellU ==
N - 1)
251 }
else if (cellV == 0) {
252 if (cellU - cellV ==
N)
256 }
else if (cellU - cellV ==
N) {
257 if (cellU == 2 *
N - 1)
261 }
else if (cellU == 2 *
N - 1) {
262 if (cellV == 2 *
N - 1)
266 }
else if (cellV == 2 *
N - 1) {
267 if (cellV - cellU ==
N - 1)
271 }
else if (cellV - cellU ==
N - 1) {
273 }
else if ((cellU > 2 *
N - 1) || (cellV > 2 *
N - 1) || (cellV >= (cellU +
N)) || (cellU > (cellV +
N))) {
297 for (
int k = 0;
k < sizew; ++
k) {
319 edm::LogVerbatim(
"HGCalGeom") <<
"DistFromEdgeHex: Local " <<
xx <<
":" <<
yy <<
" wafer " << wafer <<
" flag "
330 double xx = (
z < 0) ? -
x :
x;
333 double phi = (
r == 0. ? 0. : std::atan2(
y,
xx));
347 edm::LogVerbatim(
"HGCalGeom") <<
"DistFromEdgeTrap: Global " <<
x <<
":" <<
y <<
":" <<
z <<
" Layer " << lay
348 <<
" Index " << indx <<
":" <<
type <<
" xx " <<
xx <<
" R " <<
r <<
":" << irad <<
":"
350 <<
" Phi " <<
phi <<
":" <<
iphi <<
":" << (
iphi - 0.5) * cell <<
" cell " << cell
351 <<
" Dphi " << dphi <<
" Dist " << dist <<
":" <<
r * dphi;
361 auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&
k, &
zz, &zLayerHex](
double zLayer) {
363 return zz < 0.5 * (zLayerHex[
k - 1] + zLayerHex[
k]);
365 int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) :
k;
382 <<
" ***** ERROR *****";
393 std::vector<HGCalParameters::hgtrap> mytrs;
402 int irmin(0), irmax(0);
410 return std::make_pair(irmin, irmax);
414 std::vector<HGCalParameters::hgtrform> mytrs;
451 return std::make_pair(x0, y0);
462 bool result(
false), resultMod(
false);
468 const int32_t lay_idx =
reco ? (lay - 1) * 3 + 1 : lay;
470 auto moditr = the_modules.find(copyNumber);
471 result = resultMod = (moditr != the_modules.end());
474 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants: Layer " << lay <<
":" << lay_idx <<
" Copy " << copyNumber
478 if (moditr->second >= 0) {
480 edm::LogWarning(
"HGCalGeom") <<
"Module no. out of bound for " <<
mod <<
" to be compared with "
484 result = (cell >= 0 && cell <= cellmax);
495 << (lay > 0 && (lay <= (
int)(
layers(
reco)))) <<
" Module " <<
mod <<
":" << resultMod
496 <<
" Cell " << cell <<
":" << cellmax <<
":" << (cell >= 0 && cell <= cellmax) <<
":"
507 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:WaferType " <<
layer <<
":" << modU <<
":" << modV
516 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:WaferInfoMap " <<
layer <<
":" << modU <<
":"
524 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:WaferIn " << jtr->first <<
":" << jtr->second;
554 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:Cell " << cellU <<
":" << cellV <<
":" <<
N
555 <<
" Tests " << (cellU >= 0) <<
":" << (cellU < 2 *
N) <<
":" << (cellV >= 0) <<
":"
556 << (cellV < 2 *
N) <<
":" << ((cellV - cellU) <
N) <<
":" << ((cellU - cellV) <=
N);
558 if ((cellU < 0) || (cellU >= 2 *
N) || (cellV < 0) || (cellV >= 2 *
N))
560 if (((cellV - cellU) >=
N) || ((cellU - cellV) >
N))
571 return ((irad >=
hgpar_->
iradMinBH_[indx.first]) && (irad <= hgpar_->iradMaxBH_[indx.first]) && (
iphi > 0) &&
572 (iphi <= hgpar_->scintCells(
layer)));
598 float x(999999.),
y(999999.);
602 return std::make_pair(
x,
y);
617 edm::LogVerbatim(
"HGCalGeom") <<
"LocateCell (Wafer) " << x0 <<
":" << y0 <<
" Final " <<
x <<
":" <<
y;
639 int kndx = cellV * 100 + cellU;
648 edm::LogVerbatim(
"HGCalGeom") <<
"Fine " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
659 edm::LogVerbatim(
"HGCalGeom") <<
"Coarse " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
686 double xpos = xyoff.first + ((-2 *
id.waferU() +
id.waferV()) *
r);
687 double ypos = xyoff.second + (1.5 *
id.waferV() *
R);
689 edm::LogVerbatim(
"HGCalGeom") <<
"LocateCell " <<
id <<
" Lay " << lay <<
" r:R " <<
r <<
":" <<
R <<
" N "
690 << ncells <<
":" <<
n2 <<
" Off " << xyoff.first <<
":" << xyoff.second <<
" Pos "
691 << xpos <<
":" << ypos;
694 xpos += ((1.5 * (
id.cellV() - ncells) + 1.0) * R1);
695 ypos += ((
id.cellU() - 0.5 *
id.cellV() -
n2) * 2 *
r1);
698 << ((1.5 * (
id.cellV() - ncells) + 1.0) * R1) <<
":"
699 << ((
id.cellU() - 0.5 *
id.cellV() -
n2) * 2 *
r1) <<
" Pos " << xpos <<
":" << ypos;
700 std::pair<double, double>
xy =
getXY(
id.
layer(), xpos, ypos,
true);
701 return std::make_pair(
xy.first *
id.zside(),
xy.second);
707 int type = (
id.type() > 0) ? 1 : 0;
731 return std::make_pair(
x,
y);
737 if (indx.first >= 0) {
740 double phi = (
iphi - 0.5) * indx.second;
748 <<
z <<
" phi " <<
phi <<
" R " <<
r <<
":" <<
range.first <<
":" <<
range.second;
761 return std::make_pair(
x,
y);
819 unsigned int cells(0);
871 return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
904 for (
unsigned k = 0;
k < nlayer; ++
k) {
906 cells = std::accumulate(ncells.begin(), ncells.end(),
cells);
914 std::vector<int> ncell;
922 ncell.emplace_back((
int)(cell));
928 ncell.emplace_back(
nphi);
936 ncell.emplace_back(cell);
967 double rmin(0), rmax(0),
zz(0);
988 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants:rangeR: " <<
z <<
":" <<
zz <<
" R " << rmin <<
":" << rmax;
990 return std::make_pair(rmin, rmax);
994 double rmin(0), rmax(0);
1005 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants:rangeR: " << lay <<
":" <<
index.first <<
" R " << rmin <<
":"
1008 return std::make_pair(rmin, rmax);
1032 return std::make_pair(row,
col);
1037 return std::make_pair(cell, lay);
1042 edm::LogWarning(
"HGCalGeom") <<
"Wrong Layer # " << lay <<
" not in the list ***** ERROR *****";
1043 return std::make_pair(-1, -1);
1047 <<
" ***** ERROR *****";
1048 return std::make_pair(-1, -1);
1055 }
else if (
type == 2) {
1060 return std::make_pair(kx,
depth);
1068 for (
int k = 0;
k < ncopies; ++
k) {
1078 edm::LogVerbatim(
"HGCalGeom") <<
"Cannot find " <<
copy <<
" in a list of " << ncopies <<
" members";
1079 for (
int k = 0;
k < ncopies; ++
k)
1095 for (
int k = 0;
k < size_; ++
k) {
1108 if (wafer < size_) {
1121 edm::LogWarning(
"HGCalGeom") <<
"Cannot get wafer type corresponding to " <<
x <<
":" <<
y <<
" " <<
xx <<
":"
1126 edm::LogVerbatim(
"HGCalGeom") <<
"Position " <<
x <<
":" <<
y <<
" Wafer " << wafer <<
":" << size_ <<
" XX " <<
xx
1127 <<
":" <<
yy <<
" Cell " << icell <<
" Type " << celltyp;
1142 cellU = cellV = celltype = 0;
1146 std::pair<double, double>
xy =
1173 <<
waferV <<
":" << celltype;
1193 edm::LogVerbatim(
"HGCalGeom") <<
"waferFromPosition: Bad type for X " <<
x <<
":" <<
x1 <<
":" <<
xx <<
" Y " <<
y
1194 <<
":" <<
y1 <<
":" <<
yy <<
" Wafer " <<
waferU <<
":" <<
waferV <<
" Cell " << cellU
1230 double xx(0),
yy(0);
1239 return std::make_pair(
xx,
yy);
1264 return std::make_pair(
x,
y);
1285 type = (itr->second).type;
1301 type = (itr->second).type;
1357 bool withinList(
true);
1363 rotn = (itr->second).
orient;
1371 rotn = (itr->second).
second;
1394 <<
" Index " << std::hex <<
wl <<
std::dec <<
":" << withinList <<
" Type " <<
type
1395 <<
" Rotation " << rotn;
1397 return std::make_pair(
type, rotn);
1414 if (
index.first < 0)
1423 for (
unsigned int i = 0;
i <
layers(
true); ++
i) {
1439 wafer = (itr->second)[ity];
1449 double xx,
double yy,
const double& cellR,
const std::vector<double>&
posX,
const std::vector<double>&
posY)
const {
1451 const double tol(0.00001);
1453 for (
unsigned int k = 0;
k <
posX.size(); ++
k) {
1456 if (
dx <= (cellR + tol) &&
dy <= (cellY + tol)) {
1457 double xmax = (
dy <= 0.5 * cellY) ? cellR : (cellR - (
dy - 0.5 * cellY) /
tan30deg_);
1458 if (
dx <= (
xmax + tol)) {
1469 double Rc = 2 *
rmax_ / (3 *
N);
1470 double rc = 0.5 * Rc *
sqrt3_;
1471 double v0 = ((xloc / Rc - 1.0) / 1.5);
1472 int cv0 = (
v0 > 0) ? (
N + (
int)(
v0 + 0.5)) : (
N - (
int)(-
v0 + 0.5));
1473 double u0 = (0.5 * yloc / rc + 0.5 * cv0);
1474 int cu0 = (u0 > 0) ? (
N / 2 + (
int)(u0 + 0.5)) : (
N / 2 - (
int)(-u0 + 0.5));
1481 edm::LogVerbatim(
"HGCalGeom") <<
"cellHex: input " << xloc <<
":" << yloc <<
":" <<
cellType <<
" parameter " << rc
1482 <<
":" << Rc <<
" u0 " << u0 <<
":" << cu0 <<
" v0 " <<
v0 <<
":" << cv0;
1485 static constexpr
int shift[3] = {0, 1, -1};
1486 for (
int i1 = 0;
i1 < 3; ++
i1) {
1488 for (
int i2 = 0;
i2 < 3; ++
i2) {
1490 if (((cellV - cellU) <
N) && ((cellU - cellV) <=
N) && (cellU >= 0) && (cellV >= 0) && (cellU < 2 *
N) &&
1492 double xc = (1.5 * (cellV -
N) + 1.0) * Rc;
1493 double yc = (2 * cellU - cellV -
N) * rc;
1499 <<
"cellHex: local " << xc <<
":" << yc <<
" difference " <<
std::abs(xloc - xc) <<
":"
1501 << Rc <<
" (u,v) = (" << cellU <<
"," << cellV <<
")";
1520 return std::make_pair(-1, 0);
1531 return std::make_pair(indx, cell);
1571 edm::LogVerbatim(
"HGCalGeom") <<
"Input " << lay <<
":" << wafer <<
":" << cell <<
" Position " <<
x <<
":" <<
y
1580 int kndx = cellV * 100 + cellU;
1588 edm::LogVerbatim(
"HGCalGeom") <<
"Fine " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
1598 edm::LogVerbatim(
"HGCalGeom") <<
"Coarse " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
1613 << cellV <<
" Position " <<
x <<
":" <<
y <<
":" <<
rr <<
" Compare Limits "
1622 <<
" N " <<
N <<
" part " << partn.first <<
":" << partn.second <<
" Result "
1636 <<
waferV <<
") " << indx;
1654 edm::LogVerbatim(
"HGCalGeom") <<
"WaferInLayerTest: Layer " << lay <<
" wafer " << wafer <<
" index " << indx
1661 edm::LogVerbatim(
"HGCalGeom") <<
"WaferInLayerTest: Layer " << lay <<
" wafer " << wafer <<
" R-limits "
1670 double xx(0),
yy(0);
1681 return std::make_pair(
xx,
yy);
std::vector< bool > cellCoarseHalf_
__host__ __device__ V V wmax
constexpr static double tan30deg_
std::vector< double > moduleCellS_
std::pair< double, double > getXY(int layer, double x, double y, bool forwd) const
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
int32_t maxWafersPerLayer_
static bool goodCell(int u, int v, int N, int type, int rotn)
int cellHex(double xx, double yy, const double &cellR, const std::vector< double > &posX, const std::vector< double > &posY) const
std::pair< double, double > rangeZ(bool reco) const
int modulesInit(int lay, bool reco) const
std::vector< double > zLayerHex_
std::unordered_map< int32_t, bool > waferIn_
bool isValidCell(int layindex, int wafer, int cell) const
std::vector< double > moduleCellR_
std::vector< double > zFrontMin_
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
hgtrap getModule(unsigned int k, bool reco) const
bool isValidHex(int lay, int mod, int cell, bool reco) const
constexpr NumType convertRadToDeg(NumType radians)
std::vector< double > rMaxLayHex_
std::vector< double > cellFineY_
int layer() const
get the layer #
std::pair< double, double > cellEtaPhiTrap(int type, int irad) const
constexpr Detector det() const
get the detector field from this detid
T mod(const T &a, const T &b)
std::pair< double, double > rangeRLayer(int lay, bool reco) const
double waferZ(int layer, bool reco) const
std::pair< int, int > getREtaRange(int lay) const
static constexpr uint32_t k_CornerSize
int32_t waferU(const int32_t index)
bool waferHexagon8() const
std::vector< double > slopeTop_
bool waferFullInLayer(int wafer, int lay, bool reco) const
std::vector< int > layerIndex_
double distFromEdgeTrap(double x, double y, double z) const
int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
const caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple cms::cuda::AtomicPairCounter const GPUCACell *__restrict__ cells
std::vector< double > yLayerHex_
double scintCellSize(const int layer) const
U second(std::pair< T, U > const &p)
wafer_map wafersInLayers_
static constexpr int32_t WaferCornerMin
std::array< int, 5 > assignCellHex(float x, float y, int lay, bool reco) const
int getPhiBins(int lay) const
std::vector< int > moduleLayR_
int getTypeHex(int layer, int waferU, int waferV) const
bool isHalfCell(int waferType, int cell) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< int > waferUVMaxLayer_
std::vector< int > iradMaxBH_
std::pair< double, double > waferParameters(bool reco) const
int lastLayer(bool reco) const
Log< level::Warning, false > LogWarning
Simrecovecs max_modules_layer_
HGCalGeomTools geomTools_
std::vector< double > waferPosY_
Sin< T >::type sin(const T &t)
int layerFromIndex(int index, bool reco) const
std::pair< int, int > waferTypeRotation(int layer, int waferU, int waferV, bool fromFile=false, bool debug=false) const
bool isValidHex8(int lay, int waferU, int waferV, bool fullAndPart=false) const
int waferType(DetId const &id, bool fromFile=false) const
bool waferHexagon6() const
std::vector< uint32_t > trformIndex_
std::pair< int, int > simToReco(int cell, int layer, int mod, bool half) const
bool isValidCell8(int lay, int waferU, int waferV, int cellU, int cellV, int type) const
Cos< T >::type cos(const T &t)
HGCalGeometryMode::GeometryMode mode_
std::vector< double > radiusLayer_[2]
std::vector< bool > cellFineHalf_
int maxCells(bool reco) const
std::vector< int > layerGroup_
std::vector< std::pair< double, double > > layerRotV_
std::vector< double > radiusMixBoundary_
std::vector< double > waferPosX_
bool waferInLayer(int wafer, int lay, bool reco) const
HGCalDDDConstants(const HGCalParameters *hp, const std::string &name)
int layerIndex(int lay, bool reco) const
int32_t waferV(const int32_t index)
std::vector< double > rMinLayHex_
int getType(double xpos, double ypos, double zpos)
unsigned int waferFileSize() const
hgtrform getTrForm(unsigned int k) const
std::vector< int > waferCopy_
std::pair< double, double > rangeR(double z, bool reco) const
std::vector< int > iradMinBH_
std::pair< int, int > assignCell(float x, float y, int lay, int subSec, bool reco) const
static int32_t getUnpackedU(int id)
double mouseBite(bool reco) const
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< double > cellSize_
bool tileTrapezoid() const
bool cellInLayer(int waferU, int waferV, int cellU, int cellV, int lay, bool reco) const
std::vector< int > firstModule_
int type() const
get the type
std::map< int, HGCWaferParam > waferLayer_
int numberCells(bool reco) const
std::vector< int > depth_
std::vector< double > rMaxFront_
std::pair< int, float > getIndex(int lay, bool reco) const
HGCalGeometryMode::GeometryMode mode_
std::vector< double > cellCoarseY_
static int32_t getUnpackedV(int id)
static constexpr int k_OffsetRotation
unsigned int layers(bool reco) const
int scintType(const int layer) const
__host__ __device__ V wmin
int scintCells(const int layer) const
std::vector< int > layerGroupO_
std::vector< HGCalParameters::hgtrform > getTrForms() const
int getTypeTrap(int layer) const
double cellSizeHex(int type) const
std::vector< int > layerGroupM_
double cellThickness(int layer, int waferU, int waferV) const
bool isValidTrap(int lay, int ieta, int iphi) const
int getUVMax(int type) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
std::pair< int, int > rowColumnWafer(const int wafer) const
bool waferVirtual(int layer, int waferU, int waferV) const
HGCalParameters::hgtrform getTrForm(unsigned int k) const
std::vector< HGCalParameters::hgtrap > getModules() const
static constexpr double k_ScaleFromDDD
std::vector< int > waferTypeT_
std::array< int, 4 > waferMax_
std::array< uint32_t, 2 > tot_layers_
int numberCellsHexagon(int wafer) const
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
static constexpr double k_ScaleToDDD
int32_t waferLayer(const int32_t index)
HGCalTypes::CellType cellType(int type, int waferU, int waferV) const
std::pair< float, float > locateCellHex(int cell, int wafer, bool reco) const
waferInfo_map waferInfoMap_
static unsigned const int shift
std::vector< double > slopeMin_
std::vector< int > depthIndex_
std::vector< double > xLayerHex_
Log< level::Info, true > LogVerbatim
std::pair< double, double > waferPosition(int wafer, bool reco) const
std::vector< int > layerCenter_
std::vector< double > rMinFront_
int maxRows(int lay, bool reco) const
std::vector< int > lastModule_
int modules(int lay, bool reco) const
int type() const
get the type
std::vector< double > cellFineX_
double distFromEdgeHex(double x, double y, double z) const
std::vector< double > cellThickness_
int getLayer(double z, bool reco) const
int waferTypeL(int wafer) const
std::vector< int > waferTypeL_
std::vector< double > cellCoarseX_
Abs< T >::type abs(const T &t)
std::vector< int > layer_
unsigned int getTrFormN() const
unsigned int layersInit(bool reco) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
wafer_map cellCoarseIndex_
std::vector< int > depthLayerF_
int32_t waferIndex(int wafer, int index) const
std::vector< double > zFrontTop_
int modifyUV(int uv, int type1, int type2) const
int waferFromCopy(int copy) const
const HGCalParameters * hgpar_
bool maskCell(const DetId &id, int corners) const
static bool maskCell(int u, int v, int N, int ncor, int fcor, int corners)
std::array< int, 3 > HGCWaferParam
bool waferInLayerTest(int wafer, int lay, bool full) const
int layer() const
get the layer #
HGCalParameters::hgtrap getModule(unsigned int k, bool hexType, bool reco) const
layer_map copiesInLayers_