21 #include <type_traits>
23 namespace ActsExamples {
36 mval_cell.
value = cell;
46 std::vector<std::pair<DigitizedParameters, std::set<ModuleClusters::simhit_t>>>
51 std::vector<std::pair<DigitizedParameters, std::set<simhit_t>>> retv;
53 if (std::holds_alternative<Cluster::Cell>(mval.value)) {
57 throw std::runtime_error(
"Invalid cluster!");
60 dpars.
indices = mval.paramIndices;
61 dpars.
values = mval.paramValues;
63 dpars.
cluster = std::get<Cluster>(mval.value);
64 retv.emplace_back(
std::move(dpars), mval.sources);
71 if (std::holds_alternative<ActsExamples::Cluster::Cell>(mval.
value)) {
72 return std::get<ActsExamples::Cluster::Cell>(mval.
value).bin[0];
74 throw std::domain_error(
"ModuleValue does not contain cell!");
78 if (std::holds_alternative<ActsExamples::Cluster::Cell>(mval.
value)) {
79 return std::get<ActsExamples::Cluster::Cell>(mval.
value).bin[1];
81 throw std::domain_error(
"ModuleValue does not contain cell!");
93 std::vector<ModuleValue> cells;
95 if (std::holds_alternative<Cluster::Cell>(mval.value)) {
96 cells.push_back(mval);
105 std::vector<ModuleValue> newVals;
107 if (not cells.empty()) {
109 std::vector<std::vector<ModuleValue>>
merged =
110 Acts::Ccl::createClusters<std::vector<ModuleValue>,
111 std::vector<std::vector<ModuleValue>>>(
114 for (std::vector<ModuleValue>& cellv : merged) {
122 newVals.push_back(
squash(remerged));
137 std::vector<Acts::BoundIndices>& indices) {
138 std::vector<size_t> retv;
139 for (
size_t i = 0;
i < indices.size();
i++) {
140 auto idx = indices.at(
i);
151 std::vector<ModuleValue>
values) {
152 std::vector<std::vector<ModuleValue>> retv;
154 std::vector<bool> used(values.size(),
false);
155 for (
size_t i = 0;
i < values.size();
i++) {
161 std::vector<ModuleValue>& thisvec = retv.back();
170 for (
size_t j =
i + 1;
j < values.size();
j++) {
195 left = p_i +
m_nsigma * std::sqrt(v_i);
196 right = p_j -
m_nsigma * std::sqrt(v_j);
198 left = p_j +
m_nsigma * std::sqrt(v_j);
199 right = p_i -
m_nsigma * std::sqrt(v_i);
229 std::vector<Acts::ActsScalar> weights;
233 if (std::holds_alternative<Cluster::Cell>(other.value)) {
234 weights.push_back(std::get<Cluster::Cell>(other.value).activation);
236 weights.push_back(1);
238 tot += weights.back();
239 tot2 += weights.back() * weights.back();
243 for (
size_t i = 0;
i < values.size();
i++) {
259 weights.at(
i) * weights.at(
i) / (tot2 > 0 ? tot2 : 1);
273 size_t b0min = SIZE_MAX;
275 size_t b1min = SIZE_MAX;
278 for (
size_t i = 0;
i < values.size();
i++) {
280 if (not std::holds_alternative<Cluster::Cell>(other.
value)) {
291 b0max = std::max(b0max, b0);
293 b1max = std::max(b1max, b1);
295 float p0 = binningData[0].center(b0);
296 float w0 = binningData[0].width(b0);
297 float p1 = binningData[1].center(b1);
298 float w1 = binningData[1].width(b1);
305 weights.at(
i) * weights.at(
i) * w1 * w1 / 12);
330 mval.
sources.merge(other.sources);