|
|
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);
140 return std::make_pair(wafer,
147 return std::make_pair(wafer,
155 return std::make_pair(-1, -1);
174 return std::array<int, 3>{{irad,
iphi,
type}};
175 double xx = (
z > 0) ?
x : -
x;
177 double phi = (
r == 0. ? 0. : std::atan2(
y,
xx));
187 <<
" x|r " <<
xx <<
":" <<
r <<
" phi " <<
phi <<
" o/p " << irad <<
":" <<
iphi <<
":"
190 return std::array<int, 3>{{irad,
iphi,
type}};
200 return std::make_pair(
dr,
df);
204 const auto& indx =
getIndex(lay,
true);
205 if (indx.first >= 0) {
209 double rpos =
sqrt(
xy.first *
xy.first +
xy.second *
xy.second);
210 return ((rpos >=
hgpar_->
rMinLayHex_[indx.first]) && (rpos <= hgpar_->rMaxLayHex_[indx.first]));
226 thick = 100.0 * (
type + 1);
246 else if (cellV - cellU ==
N - 1)
250 }
else if (cellV == 0) {
251 if (cellU - cellV ==
N)
255 }
else if (cellU - cellV ==
N) {
256 if (cellU == 2 *
N - 1)
260 }
else if (cellU == 2 *
N - 1) {
261 if (cellV == 2 *
N - 1)
265 }
else if (cellV == 2 *
N - 1) {
266 if (cellV - cellU ==
N - 1)
270 }
else if (cellV - cellU ==
N - 1) {
272 }
else if ((cellU > 2 *
N - 1) || (cellV > 2 *
N - 1) || (cellV >= (cellU +
N)) || (cellU > (cellV +
N))) {
296 for (
int k = 0;
k < sizew; ++
k) {
318 edm::LogVerbatim(
"HGCalGeom") <<
"DistFromEdgeHex: Local " <<
xx <<
":" <<
yy <<
" wafer " << wafer <<
" flag "
329 double xx = (
z < 0) ? -
x :
x;
332 double phi = (
r == 0. ? 0. : std::atan2(
y,
xx));
346 edm::LogVerbatim(
"HGCalGeom") <<
"DistFromEdgeTrap: Global " <<
x <<
":" <<
y <<
":" <<
z <<
" Layer " << lay
347 <<
" Index " << indx <<
":" <<
type <<
" xx " <<
xx <<
" R " <<
r <<
":" << irad <<
":"
349 <<
" Phi " <<
phi <<
":" <<
iphi <<
":" << (
iphi - 0.5) * cell <<
" cell " << cell
350 <<
" Dphi " << dphi <<
" Dist " << dist <<
":" <<
r * dphi;
360 auto itr = std::find_if(zLayerHex.begin() + 1, zLayerHex.end(), [&
k, &
zz, &zLayerHex](
double zLayer) {
362 return zz < 0.5 * (zLayerHex[
k - 1] + zLayerHex[
k]);
364 int lay = (itr == zLayerHex.end()) ? static_cast<int>(zLayerHex.size()) :
k;
381 <<
" ***** ERROR *****";
392 std::vector<HGCalParameters::hgtrap> mytrs;
401 int irmin(0), irmax(0);
409 return std::make_pair(irmin, irmax);
413 std::vector<HGCalParameters::hgtrform> mytrs;
446 bool result(
false), resultMod(
false);
452 const int32_t lay_idx =
reco ? (lay - 1) * 3 + 1 : lay;
454 auto moditr = the_modules.find(copyNumber);
455 result = resultMod = (moditr != the_modules.end());
458 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants: Layer " << lay <<
":" << lay_idx <<
" Copy " << copyNumber
462 if (moditr->second >= 0) {
464 edm::LogWarning(
"HGCalGeom") <<
"Module no. out of bound for " <<
mod <<
" to be compared with "
468 result = (cell >= 0 && cell <= cellmax);
479 << (lay > 0 && (lay <= (
int)(
layers(
reco)))) <<
" Module " <<
mod <<
":" << resultMod
480 <<
" Cell " << cell <<
":" << cellmax <<
":" << (cell >= 0 && cell <= cellmax) <<
":"
491 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:WaferType " <<
layer <<
":" << modU <<
":" << modV
500 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:WaferInfoMap " <<
layer <<
":" << modU <<
":"
508 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:WaferIn " << jtr->first <<
":" << jtr->second;
538 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants::isValidHex8:Cell " << cellU <<
":" << cellV <<
":" <<
N
539 <<
" Tests " << (cellU >= 0) <<
":" << (cellU < 2 *
N) <<
":" << (cellV >= 0) <<
":"
540 << (cellV < 2 *
N) <<
":" << ((cellV - cellU) <
N) <<
":" << ((cellU - cellV) <=
N);
542 if ((cellU < 0) || (cellU >= 2 *
N) || (cellV < 0) || (cellV >= 2 *
N))
544 if (((cellV - cellU) >=
N) || ((cellU - cellV) >
N))
555 return ((irad >=
hgpar_->
iradMinBH_[indx.first]) && (irad <= hgpar_->iradMaxBH_[indx.first]) && (
iphi > 0) &&
556 (iphi <= hgpar_->scintCells(
layer)));
582 float x(999999.),
y(999999.);
586 return std::make_pair(
x,
y);
601 edm::LogVerbatim(
"HGCalGeom") <<
"LocateCell (Wafer) " << x0 <<
":" << y0 <<
" Final " <<
x <<
":" <<
y;
608 return std::make_pair(
x,
y);
623 int kndx = cellV * 100 + cellU;
632 edm::LogVerbatim(
"HGCalGeom") <<
"Fine " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
643 edm::LogVerbatim(
"HGCalGeom") <<
"Coarse " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
660 return std::make_pair(
x,
y);
670 double xpos = xyoff.first + ((-2 *
id.waferU() +
id.waferV()) *
r);
671 double ypos = xyoff.second + (1.5 *
id.waferV() *
R);
673 edm::LogVerbatim(
"HGCalGeom") <<
"LocateCell " <<
id <<
" Lay " << lay <<
" r:R " <<
r <<
":" <<
R <<
" N "
674 << ncells <<
":" << n2 <<
" Off " << xyoff.first <<
":" << xyoff.second <<
" Pos "
675 << xpos <<
":" << ypos;
678 xpos += ((1.5 * (
id.cellV() - ncells) + 1.0) * R1);
679 ypos += ((
id.cellU() - 0.5 *
id.cellV() - n2) * 2 *
r1);
682 << ((1.5 * (
id.cellV() - ncells) + 1.0) * R1) <<
":"
683 << ((
id.cellU() - 0.5 *
id.cellV() - n2) * 2 *
r1) <<
" Pos " << xpos <<
":" << ypos;
684 return std::make_pair(xpos *
id.
zside(), ypos);
690 int type = (
id.type() > 0) ? 1 : 0;
714 return std::make_pair(
x,
y);
720 if (indx.first >= 0) {
723 double phi = (
iphi - 0.5) * indx.second;
731 <<
z <<
" phi " <<
phi <<
" R " <<
r <<
":" <<
range.first <<
":" <<
range.second;
744 return std::make_pair(
x,
y);
802 unsigned int cells(0);
854 return (((type1 == type2) || (type1 * type2 != 0)) ? uv : ((type1 == 0) ? (2 * uv + 1) / 3 : (3 * uv) / 2));
887 for (
unsigned k = 0;
k < nlayer; ++
k) {
889 cells = std::accumulate(ncells.begin(), ncells.end(),
cells);
897 std::vector<int> ncell;
905 ncell.emplace_back((
int)(cell));
911 ncell.emplace_back(
nphi);
919 ncell.emplace_back(cell);
950 double rmin(0), rmax(0),
zz(0);
971 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants:rangeR: " <<
z <<
":" <<
zz <<
" R " << rmin <<
":" << rmax;
973 return std::make_pair(rmin, rmax);
977 double rmin(0), rmax(0);
988 edm::LogVerbatim(
"HGCalGeom") <<
"HGCalDDDConstants:rangeR: " << lay <<
":" <<
index.first <<
" R " << rmin <<
":"
991 return std::make_pair(rmin, rmax);
1015 return std::make_pair(row,
col);
1020 return std::make_pair(cell, lay);
1025 edm::LogWarning(
"HGCalGeom") <<
"Wrong Layer # " << lay <<
" not in the list ***** ERROR *****";
1026 return std::make_pair(-1, -1);
1030 <<
" ***** ERROR *****";
1031 return std::make_pair(-1, -1);
1038 }
else if (
type == 2) {
1043 return std::make_pair(kx,
depth);
1051 for (
int k = 0;
k < ncopies; ++
k) {
1061 edm::LogVerbatim(
"HGCalGeom") <<
"Cannot find " <<
copy <<
" in a list of " << ncopies <<
" members";
1062 for (
int k = 0;
k < ncopies; ++
k)
1078 for (
int k = 0;
k < size_; ++
k) {
1091 if (wafer < size_) {
1104 edm::LogWarning(
"HGCalGeom") <<
"Cannot get wafer type corresponding to " <<
x <<
":" <<
y <<
" " <<
xx <<
":"
1109 edm::LogVerbatim(
"HGCalGeom") <<
"Position " <<
x <<
":" <<
y <<
" Wafer " << wafer <<
":" << size_ <<
" XX " <<
xx
1110 <<
":" <<
yy <<
" Cell " << icell <<
" Type " << celltyp;
1151 <<
waferV <<
":" << celltype;
1171 edm::LogVerbatim(
"HGCalGeom") <<
"waferFromPosition: Bad type for X " <<
x <<
":" <<
x1 <<
":" <<
xx <<
" Y " <<
y
1172 <<
":" <<
y1 <<
":" <<
yy <<
" Wafer " <<
waferU <<
":" <<
waferV <<
" Cell " << cellU
1208 double xx(0),
yy(0);
1217 return std::make_pair(
xx,
yy);
1242 return std::make_pair(
x,
y);
1263 type = (itr->second).type;
1279 type = (itr->second).type;
1335 bool withinList(
true);
1341 rotn = (itr->second).
orient;
1349 rotn = (itr->second).
second;
1372 <<
" Index " << std::hex <<
wl <<
std::dec <<
":" << withinList <<
" Type " <<
type
1373 <<
" Rotation " << rotn;
1375 return std::make_pair(
type, rotn);
1392 if (
index.first < 0)
1401 for (
unsigned int i = 0;
i <
layers(
true); ++
i) {
1417 wafer = (itr->second)[ity];
1427 double xx,
double yy,
const double& cellR,
const std::vector<double>&
posX,
const std::vector<double>&
posY)
const {
1429 const double tol(0.00001);
1431 for (
unsigned int k = 0;
k <
posX.size(); ++
k) {
1434 if (
dx <= (cellR + tol) &&
dy <= (cellY + tol)) {
1435 double xmax = (
dy <= 0.5 * cellY) ? cellR : (cellR - (
dy - 0.5 * cellY) /
tan30deg_);
1436 if (
dx <= (
xmax + tol)) {
1447 double Rc = 2 *
rmax_ / (3 *
N);
1448 double rc = 0.5 * Rc *
sqrt3_;
1449 double v0 = ((xloc / Rc - 1.0) / 1.5);
1450 int cv0 = (
v0 > 0) ? (
N + (
int)(
v0 + 0.5)) : (
N - (
int)(-
v0 + 0.5));
1451 double u0 = (0.5 * yloc / rc + 0.5 * cv0);
1452 int cu0 = (u0 > 0) ? (
N / 2 + (
int)(u0 + 0.5)) : (
N / 2 - (
int)(-u0 + 0.5));
1459 edm::LogVerbatim(
"HGCalGeom") <<
"cellHex: input " << xloc <<
":" << yloc <<
":" <<
cellType <<
" parameter " << rc
1460 <<
":" << Rc <<
" u0 " << u0 <<
":" << cu0 <<
" v0 " <<
v0 <<
":" << cv0;
1463 static constexpr
int shift[3] = {0, 1, -1};
1464 for (
int i1 = 0;
i1 < 3; ++
i1) {
1466 for (
int i2 = 0;
i2 < 3; ++
i2) {
1468 if (((cellV - cellU) <
N) && ((cellU - cellV) <=
N) && (cellU >= 0) && (cellV >= 0) && (cellU < 2 *
N) &&
1470 double xc = (1.5 * (cellV -
N) + 1.0) * Rc;
1471 double yc = (2 * cellU - cellV -
N) * rc;
1477 <<
"cellHex: local " << xc <<
":" << yc <<
" difference " <<
std::abs(xloc - xc) <<
":"
1479 << Rc <<
" (u,v) = (" << cellU <<
"," << cellV <<
")";
1498 return std::make_pair(-1, 0);
1509 return std::make_pair(indx, cell);
1549 edm::LogVerbatim(
"HGCalGeom") <<
"Input " << lay <<
":" << wafer <<
":" << cell <<
" Position " <<
x <<
":" <<
y
1558 int kndx = cellV * 100 + cellU;
1566 edm::LogVerbatim(
"HGCalGeom") <<
"Fine " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
1576 edm::LogVerbatim(
"HGCalGeom") <<
"Coarse " << cellU <<
":" << cellV <<
":" << kndx <<
":" <<
x <<
":" <<
y <<
":"
1591 << cellV <<
" Position " <<
x <<
":" <<
y <<
":" <<
rr <<
" Compare Limits "
1599 <<
" N " <<
N <<
" part " << partn.first <<
":" << partn.second <<
" Result "
1612 <<
waferV <<
") " << indx;
1630 edm::LogVerbatim(
"HGCalGeom") <<
"WaferInLayerTest: Layer " << lay <<
" wafer " << wafer <<
" index " << indx
1637 edm::LogVerbatim(
"HGCalGeom") <<
"WaferInLayerTest: Layer " << lay <<
" wafer " << wafer <<
" R-limits "
1646 double xx(0),
yy(0);
1657 return std::make_pair(
xx,
yy);
std::vector< bool > cellCoarseHalf_
__host__ __device__ V V wmax
constexpr static double tan30deg_
std::vector< double > moduleCellS_
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< 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_