18 return StatusCode::SUCCESS;
25 ATH_CHECK(outContainer.record(std::make_unique<xAOD::RpcStripContainer>(),
26 std::make_unique<xAOD::RpcStripAuxContainer>()));
30 auto createCluster = [&](std::vector<const xAOD::RpcStrip*>& constituents) {
31 if (constituents.empty())
return;
32 xAOD::RpcStrip* cluster = outContainer->push_back(std::make_unique<xAOD::RpcStrip>());
33 (*cluster) = (*constituents[constituents.size()/2]);
36 constituents[constituents.size() -1]->localPosition<1>().
x())};
42 float midTime{0.f}, midTimeCov{0.f};
44 links.emplace_back(*inContainer, strip->index());
45 midTime+= strip->time();
46 midTimeCov+=strip->timeCovariance();
48 midTime /= constituents.size();
49 midTimeCov /= constituents.size();
52 spread+=
std::pow(midTime - strip->time(), 2);
54 spread /=
std::pow(constituents.size(), 2);
63 std::size_t seenHits{};
65 seenHits+=hitsPerChamber.
size();
67 std::vector<std::vector<const xAOD::RpcStrip*>> sortedHits{};
69 const unsigned int layerHash = strip->layerHash();
70 if (layerHash >= sortedHits.size()) {
71 sortedHits.resize(layerHash +1);
73 sortedHits[layerHash].push_back(strip);
76 for (std::vector<const xAOD::RpcStrip*>& hitsInLay : sortedHits){
77 if (hitsInLay.empty())
continue;
79 std::sort(hitsInLay.begin(), hitsInLay.end(),
81 return a->stripNumber() < b->stripNumber();
83 uint16_t lastChannel = hitsInLay[0]->stripNumber();
84 std::vector<const xAOD::RpcStrip*> groupedHits{};
86 if (strip->stripNumber() - lastChannel -1
u >
m_maxHoles ||
87 (!groupedHits.empty() && 1
u*(strip->stripNumber() - groupedHits[0]->stripNumber()) >
m_maxSize)){
88 createCluster(groupedHits);
90 groupedHits.push_back(strip);
92 createCluster(groupedHits);
95 }
while (hitsPerChamber.next());
96 if (seenHits != inContainer->size()) {
97 ATH_MSG_FATAL(
"Detected inconsistency between the hits in container "<<inContainer->size()<<
98 " and what's returned by the chamber viewer "<<seenHits);
99 return StatusCode::FAILURE;
101 return StatusCode::SUCCESS;