10 std::vector<double>
const& zFront1,
11 std::vector<double>
const& rFront1,
12 std::vector<double>
const& slope1,
13 std::vector<double>
const& zFront2,
14 std::vector<double>
const& rFront2,
15 std::vector<double>
const& slope2,
int flag,
16 std::vector<double>&
zz,
17 std::vector<double>& rin,
18 std::vector<double>& rout) {
20 double dz1(0), dz2(0);
22 if (zf1 != zFront1.begin()) --zf1;
25 if (zf2 != zFront2.begin()) --zf2;
27 if (zb1 != zFront1.begin()) --zb1;
30 if (zb2 != zFront2.begin()) --zb2;
33 <<
"HGCalGeomTools::radius:zf " << zf <<
" : " << *zf1 <<
" : " << *zf2
34 <<
" zb " << zb <<
" : " << *zb1 <<
" : " << *zb2 <<
" Flag " <<
flag;
36 if ((zf1==zb1) && (zf2==zb2)) {
39 << zb <<
" dz " << dz1 <<
":" << dz2;
42 rin.emplace_back(
radius(zf+dz1,zFront1,rFront1,slope1));
43 rout.emplace_back(
radius(zf,zFront2,rFront2,slope2));
45 rin.emplace_back(
radius(zb+dz2,zFront1,rFront1,slope1));
46 rout.emplace_back(
radius(zb,zFront2,rFront2,slope2));
47 }
else if (zf1 == zb1) {
51 << *zb2 <<
" (" << z1 <<
") : " << zb;
54 rin.emplace_back(
radius(zf,zFront1,rFront1,slope1));
55 rout.emplace_back(
radius(zf,zFront2,rFront2,slope2));
56 if (
slope(*zb2,zFront2,slope2) <
tol) {
57 zz.emplace_back(*zb2);
58 rin.emplace_back(
radius(*zb2,zFront1,rFront1,slope1));
59 rout.emplace_back(
radius(*zb2-
tol,zFront2,rFront2,slope2));
61 zz.emplace_back(*zb2);
62 rin.emplace_back(
radius(*zb2,zFront1,rFront1,slope1));
63 rout.emplace_back(
radius(*zb2,zFront2,rFront2,slope2));
65 rin.emplace_back(
radius(zb,zFront1,rFront1,slope1));
66 rout.emplace_back(
radius(zb,zFront2,rFront2,slope2));
67 }
else if (zf2 == zb2) {
73 rin.emplace_back(
radius(zf,zFront1,rFront1,slope1));
74 rout.emplace_back(
radius(zf,zFront2,rFront2,slope2));
75 if (
slope(*zb1,zFront1,slope1) <
tol) {
76 zz.emplace_back(*zb1);
77 rin.emplace_back(
radius(*zb1-
tol,zFront1,rFront1,slope1));
78 rout.emplace_back(
radius(*zb1,zFront2,rFront2,slope2));
80 zz.emplace_back(*zb1);
81 rin.emplace_back(
radius(*zb1,zFront1,rFront1,slope1));
82 rout.emplace_back(
radius(*zb1,zFront2,rFront2,slope2));
84 rin.emplace_back(
radius(zb,zFront1,rFront1,slope1));
85 rout.emplace_back(
radius(zb,zFront2,rFront2,slope2));
91 << z1 <<
" : " << z2 <<
":" << zb;
94 rin.emplace_back(
radius(zf,zFront1,rFront1,slope1));
95 rout.emplace_back(
radius(zf,zFront2,rFront2,slope2));
97 rin.emplace_back(
radius(z1,zFront1,rFront1,slope1));
98 rout.emplace_back(
radius(z1,zFront2,rFront2,slope2));
100 rin.emplace_back(
radius(z2,zFront1,rFront1,slope1));
101 rout.emplace_back(
radius(z2,zFront2,rFront2,slope2));
103 rin.emplace_back(
radius(zb,zFront1,rFront1,slope1));
104 rout.emplace_back(
radius(zb,zFront2,rFront2,slope2));
106 double rmin = *(std::min_element(rout.begin(),rout.end()));
108 for (
auto&
rr : rout)
rr = rmin;
112 <<
"HGCalGeomTools::radius has " << zz.size() <<
" sections: "<< rmin;
113 for (
unsigned int k=0;
k<zz.size(); ++
k)
115 <<
"[" <<
k <<
"] Z = " << zz[
k] <<
" R = " << rin[
k] <<
":" << rout[
k];
120 std::vector<double>
const& rFront,
121 std::vector<double>
const&
slope) {
124 if (itrz != zFront.begin()) --itrz;
125 unsigned int ik =
static_cast<unsigned int>(itrz-zFront.begin());
126 if (ik < zFront.size() &&
std::abs(z-zFront[ik+1]) <
tol) ++ik;
127 double r = rFront[ik] + (z - zFront[ik]) * slope[ik];
130 <<
"DDHGCalGeomTools: Z " << z <<
" k " << ik <<
" R " <<
r;
136 std::vector<double>
const& zFront,
137 std::vector<double>
const& rFront) {
138 double r = rFront[0];
142 for (
unsigned int k = 0;
k < rFront.size(); ++
k) {
143 int k1 = layerf - layer0 + (
int)(
k);
144 if (k1 < (
int)(zFront.size())) {
149 if (z < zFront[k1] +
tol)
break;
154 <<
"DDHGCalGeomTools: Z " << z <<
":" << ik <<
" R " <<
r;
160 std::vector<double>
const&
slope) {
163 if (itrz != zFront.begin()) --itrz;
164 unsigned int ik =
static_cast<unsigned int>(itrz-zFront.begin());
168 << ik <<
" Slope " << slope[ik];
174 double z1,
double z2, std::vector<double>
const& zF,
175 std::vector<double>
const& rF) {
177 for (
unsigned int k = 0;
k < rF.size(); ++
k) {
178 if ((z1 > zF[
k] -
tol) && (z2 < zF[
k] +
tol)) {
184 return std::make_pair(
z, r);
188 double ypos,
double r,
189 double R,
double rMin,
196 yc[1] = ypos + 0.5 *
R;
199 yc[2] = ypos - 0.5 *
R;
202 yc[2] = ypos - 0.5 *
R;
207 yc[4] = ypos - 0.5 *
R;
209 yc[5] = ypos + 0.5 *
R;
210 int32_t nCorner(0), firstCorner(-1), firstMiss(-1);
212 std::vector<uint32_t> corners;
215 double rpos =
sqrt(xc[
k] * xc[
k] + yc[
k] * yc[
k]);
216 if ((rpos <= rMax) && (rpos >= rMin)) {
218 corners.emplace_back(k);
220 if (firstCorner < 0) firstCorner =
k;
223 if (firstMiss < 0) firstMiss =
k;
226 if ((nCorner > 1) && (firstCorner == 0) && (firstMiss < nCorner)) {
227 firstCorner = firstMiss + HGCalParameters::k_CornerSize - nCorner;
231 <<
"waferCorner:: R " << rMin <<
":" << rMax << nCorner
232 <<
" corners; first corner " << firstCorner;
236 (
std::find(corners.begin(), corners.end(),
k) != corners.end())
240 << yc[
k] <<
" R " << rpos <<
ok;
243 return std::make_pair(nCorner, firstCorner);
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Abs< T >::type abs(const T &t)
static uint32_t k_CornerSize