46 edm4hep::CalorimeterHitCollection hpc_col;
47 edm4hep::CalorimeterHitCollection femc_col;
51 auto record = [&](
int paIdx,
int ns,
const edm4hep::CalorimeterHit& hit) {
52 if (paIdx < 0)
return;
56 auto& showers = out.
pa_shower_hits[
static_cast<std::size_t
>(paIdx)];
57 if (ns >=
static_cast<int>(showers.size())) {
58 showers.resize(
static_cast<std::size_t
>(ns) + 1);
60 showers[
static_cast<std::size_t
>(ns)].push_back(hit);
65 if (lemca <= 0)
return;
66 const int nsh =
static_cast<int>(std::lround(ph::Q(lemca + 2)));
69 int show_ofs = lemca + 2;
70 for (
int ns = 0; ns < nsh; ++ns) {
71 const int len =
static_cast<int>(std::lround(ph::Q(show_ofs + 1)));
72 const int idet =
static_cast<int>(std::lround(ph::Q(show_ofs + 2)));
73 const int nclu =
static_cast<int>(std::lround(ph::Q(show_ofs + 10)));
74 const int nwdcl =
static_cast<int>(std::lround(ph::Q(show_ofs + 11)));
76 if (idet == kIdetHPC && nclu > 0 && nclu < 200 && nwdcl == kNwdHPC) {
77 for (
int nc = 0; nc < nclu; ++nc) {
78 const int base = show_ofs + 11 + kNwdHPC * nc;
79 const std::int32_t i1 = ph::IQ(base + 1);
80 const std::int32_t i2 = ph::IQ(base + 2);
81 const std::int32_t i3 = ph::IQ(base + 3);
82 const float w1 = ph::Q(base + 1);
83 const float w2 = ph::Q(base + 2);
84 const float w3 = ph::Q(base + 3);
85 float pe, pxc, pyc, pzc, psz;
int player;
87 pe, player, pxc, pyc, pzc, psz);
88 if (pe <= 0.f)
continue;
89 auto hit = hpc_col.create();
91 hit.setEnergyError(kNotMeasured);
99 record(paIdx, ns, hit);
101 }
else if (idet == kIdetFEMC && nclu > 0 && nclu <= 10 && nwdcl == kNwdFEMC) {
106 const float showX = ph::Q(show_ofs + 4);
107 const float showY = ph::Q(show_ofs + 5);
108 const float showZ = ph::Q(show_ofs + 6);
109 for (
int nc = 0; nc < nclu; ++nc) {
110 const int base = show_ofs + 11 + kNwdFEMC * nc;
111 const float layer_e = ph::Q(base + 1);
112 const int packed =
static_cast<int>(std::lround(ph::Q(base + 2)));
113 const int layer = packed / 1000;
114 const int nhits = packed % 1000;
115 auto hit = femc_col.create();
116 hit.setEnergy(layer_e);
117 hit.setEnergyError(0.f);
120 hit.setCellID(
static_cast<std::uint64_t
>(nhits));
126 record(paIdx, ns, hit);
135 ctx_.emca = std::move(out);
void padDecode(std::int32_t i1, std::int32_t i2, std::int32_t i3, float w1, float w2, float w3, float &E, int &layer, float &X, float &Y, float &Z, float &sigZ)