13 #include "../IO/LArStripNeighborhoodDumper.h"
14 #include "../IO/eEmNbhoodTOB.h"
25 std::optional<std::vector<std::size_t>>
wrap3(std::size_t center) {
27 return std::optional<std::vector<std::size_t>>{};
31 return std::make_optional(std::vector<std::size_t>({62
ul, 63
ul, 0
ul}));
35 return std::make_optional(std::vector<std::size_t>({63
ul, 0
ul, 1
ul}));
38 return std::make_optional(std::vector<std::size_t>(
58 return StatusCode::SUCCESS;
71 return StatusCode::FAILURE;
74 std::vector<const CaloCell*>
cells;
78 std::vector<const xAOD::eFexEMRoI*>
rois;
86 auto neighborhoodTOBs = std::make_unique<IOBitwise::IeEmNbhoodTOBContainer>();
96 CHECK(dumper.dump(
name(), *eventInfo, *neighborhoodTOBs));
100 CHECK(dumper.dumpTerse(
name(), *eventInfo, *neighborhoodTOBs));
104 CHECK(h_neighborhoodTOBs.
record(std::move(neighborhoodTOBs)));
108 return StatusCode::SUCCESS;
113 const std::vector<const CaloCell*>&
cells,
116 for (
const auto& roi :
rois) {
120 return StatusCode::SUCCESS;
126 const std::vector<const CaloCell*>&
cells,
159 auto cells_near_roi = std::vector<const CaloCell*>();
162 auto phi_ind = [](
const auto&
c) {
164 std::size_t iphi = 32 +
int(std::floor(
c->phi()/dphi));
166 std::optional<std::size_t>() : std::make_optional(iphi);
170 auto roi_phi_index = *phi_ind(roi);
173 auto roi_phi_indices = *
wrap3(roi_phi_index);
174 for (
const auto&
i : roi_phi_indices) {
179 auto close = std::vector<std::vector<const CaloCell*>>(3);
180 for (
auto&
v :close) {
v.reserve(100);}
183 constexpr
double half_deta_roi{0.05};
184 constexpr
double half_deta_neigh{8.5*0.0031};
185 constexpr
double half_deta_fid{half_deta_roi + half_deta_neigh};
188 double etalim_low =
std::max(roi->
eta()-half_deta_fid, -1.4);
189 double etalim_high =
std::min(roi->
eta()+half_deta_fid, 1.4);
196 for(
const auto& iroi : roi_phi_indices) {
197 auto c_eta =
cell->eta();
198 if (iroi ==
icell and c_eta >= etalim_low and c_eta < etalim_high) {
207 for (
const auto&
v : close) {
ATH_MSG_DEBUG(
"size close " <<
v.size());}
211 auto roi_cells = std::vector<const CaloCell*> ();
212 roi_cells.reserve(close[1].
size());
215 std::back_inserter(roi_cells),
216 [&roi](
const auto&
c) {
217 return std::abs(
c->eta() - roi->
eta()) < half_deta_roi;
223 [](
const auto&
l,
const auto&
r) {
224 return l->e() <
r->e();
229 return StatusCode::FAILURE;
238 auto neigh_cells = std::vector<std::vector<const CaloCell*>>(3);
241 const auto max_cell_eta = max_cell->eta();
244 for (std::size_t iv{0
ul}; iv != close.size(); ++iv) {
247 std::back_inserter(neigh_cells[iv]),
248 [&max_cell_eta, &half_deta_neigh](
const auto&
c){
249 return abs(
c->eta()-max_cell_eta) < half_deta_neigh;
256 if (max_neigh_cell_it ==
std::end(neigh_cells[1])){
258 return StatusCode::FAILURE;
264 auto toStripData = [](
const auto& fromCells){
265 auto stripdata = std::vector<StripData>();
266 stripdata.reserve(fromCells.size());
269 back_inserter(stripdata),
277 auto low = toStripData(neigh_cells[0]);
278 auto center = toStripData(neigh_cells[1]);
279 auto high = toStripData(neigh_cells[2]);
282 Coords cell_c{max_cell->eta(), max_cell->phi()};
286 neighborhoodTOBs.
push_back(std::make_unique<IOBitwise::eEmNbhoodTOB>(*roi, neighborhood));
288 return StatusCode::SUCCESS;