36 edm4hep::CalorimeterHitCollection col;
40 if (ltdha <= 0)
return;
41 const int nlay =
static_cast<int>(std::lround(ph::Q(ltdha + 2)));
42 if (nlay <= 0)
return;
45 for (
int il = 0; il < nlay && ofs > ltdha; ++il) {
46 const int layer_len =
static_cast<int>(std::lround(ph::Q(ofs + 1)));
47 if (layer_len <= 0 || layer_len > kMaxLayerLen)
break;
48 const int lnum =
static_cast<int>(std::lround(ph::Q(ofs + 2)));
49 const int loc =
static_cast<int>(std::lround(ph::Q(ofs + 3)));
50 const int ntd =
static_cast<int>(std::lround(ph::Q(ofs + 9)));
52 if (ntd > 0 && ntd < kMaxNtd) {
53 for (
int it = 0; it < ntd; ++it) {
54 const int base = ofs + 9 + 4 * it;
55 const float c1 = ph::Q(base + 1);
56 const float c2 = ph::Q(base + 2);
57 const float z = ph::Q(base + 3);
58 const float e = ph::Q(base + 4);
61 if (loc == 0 && c1 > 0.f) {
62 const float phi = c2 / c1;
63 x = c1 * std::cos(phi);
64 y = c1 * std::sin(phi);
67 auto hit = col.create();
69 hit.setEnergyError(0.f);
72 hit.setCellID(
static_cast<std::uint64_t
>(loc));
73 hit.setPosition({ x * kCm2Mm, y * kCm2Mm, z * kCm2Mm });