80 std::vector<unsigned> retv;
81 for (
auto elem : elems)
83 retv.push_back(invec[elem]);
89 IdxSet &
idx,
const std::vector<unsigned> &subvecelems,
90 const std::vector<unsigned> &subvecidx)
const {
92 if (subvecelems.size() != subvecidx.size()) {
93 throw std::invalid_argument(
94 "Setting FPGATrackSimGenScanBinningBase::setIdxSubVec with mismatched "
98 for (
unsigned i = 0;
i < subvecelems.size();
i++) {
99 if (subvecelems[
i] >=
idx.size()) {
100 throw std::invalid_argument(
101 "FPGATrackSimGenScanBinningBase::setIdxSubVec input out of range");
103 idx[subvecelems[
i]] = subvecidx[
i];
111 std::vector<ParSet> retv;
112 for (
unsigned corners = 0; corners <
unsigned((1 << scanpars.size())); corners++)
116 for (
auto &
par : scanpars)
118 newidx[
par] =
idx[
par] + ((corners >> scanDimCnt) & 1);
138 slicevarmin =
std::min(slicevarmin, slicevarhit);
139 slicevarmax =
std::max(slicevarmax, slicevarhit);
142 return ( slicevar > slicevarmin) && (slicevar < slicevarmax);
158 rowparmin =
std::min(rowparmin, rowparhit);
159 rowparmax =
std::max(rowparmax, rowparhit);
166 return {lowbin, highbin};
186 auto emplace_result =
m_map.try_emplace(
188 if (!emplace_result.second) {
189 emplace_result.first->second <<
",\n";
191 emplace_result.first->second <<
val;
214 if (std::abs(
pars.qOverPt) > 0)
216 zhit =
pars.z0 + 1.0 /
tan(
theta) * asin(
r * CurvatureConstant *
pars.qOverPt) / (CurvatureConstant *
pars.qOverPt);
230 double r = hit->
getR();
231 double phi_hit = hit->
getGPhi();
249 double dr12x = xy2.first - xy1.first;
250 double dr12y = xy2.second - xy1.second;
251 double dr12mag = std::hypot(dr12x, dr12y);
252 double cos_rot = dr12y / dr12mag;
253 double sin_rot = -dr12x / dr12mag;
254 return std::pair<double, double>(cos_rot, sin_rot);
259 return std::pair<double, double>(xy.first * ang.first + xy.second * ang.second,
260 -xy.first * ang.second + xy.second * ang.first);
267 auto xy1 = getXY(m_R1, keypars.
phi1);
268 auto xy2 = getXY(m_R2, keypars.
phi2);
270 result.rotang = getRotationAngles(xy1, xy2);
281 return rotateXY(xyh, rotang);
296 auto xy1 = getXY(m_R1, retv.
phi1);
297 auto xy2 = getXY(m_R2, retv.
phi2);
298 double ysqr = (xy2.first - xy1.first) * (xy2.first - xy1.first) + (xy2.second - xy1.second) * (xy2.second - xy1.second);
299 double sign = (
R > 0) - (
R < 0);
300 retv.
xm = -1 *
sign * (std::abs(
R) - sqrt(
R *
R - ysqr / 4.0));
320 double xm = keypars.
xm;
322 auto rotated_coords = getRotatedConfig(keypars);
323 auto xy1p = rotated_coords.xy1p;
324 auto rotang = rotated_coords.rotang;
325 auto y = rotated_coords.y;
328 auto revang = rotang;
329 revang.second = -rotang.second;
333 double Rinv = 2 * xm / (xm * xm + (
y / 2) * (
y / 2));
334 double d = (
y *
y / 4.0 - xm * xm) / (2.0 * xm);
335 double sign = (xm > 0) - (xm < 0);
339 std::pair<double, double> xycp(-
d + xy1p.first,
y / 2.0 + xy1p.second);
343 auto xyc = rotateXY(xycp, revang);
359 return (keypars.
z2 - keypars.
z1) / (m_R2 - m_R1) * (
r - m_R1) + keypars.
z1;
365 auto rotated_coords = getRotatedConfig(keypars);
366 auto xy1p = rotated_coords.xy1p;
367 auto rotang = rotated_coords.rotang;
368 auto y = rotated_coords.y;
370 auto xyhp = getRotatedHit(rotang, hit);
371 double xh = xyhp.first - xy1p.first;
372 double yh = xyhp.second - xy1p.second;
375 double sign = ((yh > 0) && (yh <
y)) ? 1 : -1;
376 if ((std::abs(yh) < std::abs(xh)) || (std::abs(
y - yh) < std::abs(xh)))
378 return ((xh > 0) ? 1 : -1) * 100000;
381 double xm_taylor =
sign *
y *
y / (
y *
y - 4 * xh * xh - 4 * (yh -
y / 2.0) * (yh -
y / 2.0)) * xh;
389 auto rotated_coords = getRotatedConfig(keypars);
391 auto rotang = rotated_coords.rotang;
393 auto xyhp = getRotatedHit(rotang, hit);
395 double xh = xyhp.first-rotated_coords.xy1p.first;
397 return xh - xExpected(keypars,hit);
403 auto rotated_coords = getRotatedConfig(keypars);
405 auto rotang = rotated_coords.rotang;
406 auto y = rotated_coords.y;
408 auto xyhp = getRotatedHit(rotang, hit);
410 double yh = xyhp.second-rotated_coords.xy1p.second;
412 return keypars.
xm * (keypars.
xm * keypars.
xm + yh * (
y - yh)) / (keypars.
xm * keypars.
xm + (
y / 2) * (
y / 2));
417 return m_keylyrtool.deltaX(parSetToKeyPars(parset), hit);