14 : hgcons_(hgc), mode_(hgc.geomMode()), det_(det), name_(name) {
32 <<
"HGCalNumberingScheme:: input Layer " << layer <<
" Module " << module
33 <<
" Cell " << cell <<
" iz " << iz <<
" Position " << pos <<
" Mode " 38 int cellU(0), cellV(0), waferType(-1), waferU(0), waferV(0);
40 waferType = module / 1000000;
41 waferU = module % 100;
42 if ((module / 10000) % 10 > 0)
44 waferV = (module / 100) % 100;
45 if ((module / 100000) % 10 > 0)
48 cellV = (cell / 100) % 100;
50 double xx = (pos.z() > 0) ? pos.x() : -pos.x();
57 <<
"OK WaferType " << waferType <<
" Wafer " << waferU <<
":" << waferV
58 <<
" Cell " << cellU <<
":" << cellV;
63 }
else if (
mode_ == HGCalGeometryMode::Trapezoid) {
69 <<
"Radius/Phi " <<
id[0] <<
":" <<
id[1] <<
" Type " <<
id[2]
70 <<
" Layer|iz " << layer <<
":" << iz <<
" " 74 <<
"Radius/Phi " <<
id[0] <<
":" <<
id[1] <<
" Type " <<
id[2]
75 <<
" Layer|iz " << layer <<
":" << iz <<
" ERROR";
81 <<
"HGCalNumberingScheme::i/p " <<
det_ <<
":" << layer <<
":" << module
82 <<
":" << cell <<
":" << iz <<
":" << pos.x() <<
":" << pos.y() <<
":" 83 << pos.z() <<
" ID " << std::hex << index <<
std::dec <<
" wt " << wt;
91 std::pair<float, float>
xy;
99 xy =
hgcons_.
locateCell(lay,
id.waferU(),
id.waferV(),
id.cellU(),
id.cellV(),
false,
true);
114 double r1 =
std::sqrt(xy.first * xy.first + xy.second * xy.second);
115 double r2 = pos.perp();
118 std::pair<double, double> rrange =
hgcons_.
rangeR(z2,
false);
120 bool inok = ((r2 >= rrange.first) && (r2 <= rrange.second) && (z2 >= zrange.first) && (z2 <= zrange.second));
121 bool outok = ((r1 >= rrange.first) && (r1 <= rrange.second) && (z1 >= zrange.first) && (z1 <= zrange.second));
122 std::string ck = (((r1 < rrange.first - 10.0) || (r1 > rrange.second +10.0) ||
123 (z1 < zrange.first - 5.0) || (z1 > zrange.second + 5.0)) ?
124 "***** ERROR *****" :
"");
125 if (!(match && inok && outok)) {
127 <<
"HGCalNumberingScheme::Detector " <<
det_ <<
" Layer " << lay <<
" R " 128 << r2 <<
":" << r1 <<
":" << rrange.first <<
":" << rrange.second <<
" Z " 129 << z2 <<
":" << z1 <<
":" << zrange.first <<
":" << zrange.second
130 <<
" Match " << match <<
":" << inok <<
":" << outok <<
" " << ck;
132 <<
"Original " << pos.x() <<
":" << pos.y() <<
" return " << xy.first
135 double wt = 0,
xx = ((pos.z() > 0) ? pos.x() : -pos.x());
136 int waferU, waferV, cellU, cellV, waferType;
141 << xy.first <<
":" << xy.second;
HGCalNumberingScheme()=delete
void waferFromPosition(const double x, const double y, int &wafer, int &icell, int &celltyp) const
const HGCalGeometryMode::GeometryMode mode_
const HGCalDDDConstants & hgcons_
constexpr uint32_t rawId() const
get the raw id
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
std::pair< double, double > rangeR(double z, bool reco) const
std::pair< double, double > rangeZ(bool reco) const
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
Abs< T >::type abs(const T &t)
double waferZ(int layer, bool reco) const
uint32_t getUnitID(int layer, int module, int cell, int iz, const G4ThreeVector &pos, double &wt)
assigns the det id to a hit
void checkPosition(uint32_t index, const G4ThreeVector &pos) const
std::array< int, 3 > assignCellTrap(float x, float y, float z, int lay, bool reco) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.