13 #include "../IO/LArStripNeighborhoodDumper.h"
24 std::optional<std::vector<std::size_t>>
wrap3(std::size_t center) {
26 return std::optional<std::vector<std::size_t>>{};
30 return std::make_optional(std::vector<std::size_t>({62
ul, 63
ul, 0
ul}));
34 return std::make_optional(std::vector<std::size_t>({63
ul, 0
ul, 1
ul}));
37 return std::make_optional(std::vector<std::size_t>(
57 return StatusCode::SUCCESS;
70 return StatusCode::FAILURE;
73 std::vector<const CaloCell*>
cells;
77 std::vector<const xAOD::eFexEMRoI*>
rois;
85 auto neighborhoods = std::make_unique<LArStripNeighborhoodContainer>();
93 CHECK(dumper.dump(
name(), *eventInfo, *neighborhoods));
97 CHECK(dumper.dumpTerse(
name(), *eventInfo, *neighborhoods));
105 return StatusCode::SUCCESS;
110 const std::vector<const CaloCell*>&
cells,
113 for (
const auto& roi :
rois) {
117 return StatusCode::SUCCESS;
123 const std::vector<const CaloCell*>&
cells,
156 auto cells_near_roi = std::vector<const CaloCell*>();
159 auto phi_ind = [](
const auto&
c) {
161 std::size_t iphi = 32 +
int(std::floor(
c->phi()/dphi));
163 std::optional<std::size_t>() : std::make_optional(iphi);
167 auto roi_phi_index = *phi_ind(roi);
170 auto roi_phi_indices = *
wrap3(roi_phi_index);
171 for (
const auto&
i : roi_phi_indices) {
176 auto close = std::vector<std::vector<const CaloCell*>>(3);
177 for (
auto&
v :close) {
v.reserve(100);}
180 constexpr
double half_deta_roi{0.05};
181 constexpr
double half_deta_neigh{8.5*0.0031};
182 constexpr
double half_deta_fid{half_deta_roi + half_deta_neigh};
185 double etalim_low =
std::max(roi->
eta()-half_deta_fid, -1.4);
186 double etalim_high =
std::min(roi->
eta()+half_deta_fid, 1.4);
193 for(
const auto& iroi : roi_phi_indices) {
194 auto c_eta =
cell->eta();
195 if (iroi ==
icell and c_eta >= etalim_low and c_eta < etalim_high) {
204 for (
const auto&
v : close) {
ATH_MSG_DEBUG(
"size close " <<
v.size());}
208 auto roi_cells = std::vector<const CaloCell*> ();
209 roi_cells.reserve(close[1].
size());
212 std::back_inserter(roi_cells),
213 [&roi](
const auto&
c) {
214 return std::abs(
c->eta() - roi->
eta()) < half_deta_roi;
220 [](
const auto&
l,
const auto&
r) {
221 return l->e() <
r->e();
226 return StatusCode::FAILURE;
235 auto neigh_cells = std::vector<std::vector<const CaloCell*>>(3);
238 const auto max_cell_eta = max_cell->eta();
241 for (std::size_t iv{0
ul}; iv != close.size(); ++iv) {
244 std::back_inserter(neigh_cells[iv]),
245 [&max_cell_eta, &half_deta_neigh](
const auto&
c){
246 return abs(
c->eta()-max_cell_eta) < half_deta_neigh;
253 if (max_neigh_cell_it ==
std::end(neigh_cells[1])){
255 return StatusCode::FAILURE;
261 auto toStripData = [](
const auto& fromCells){
262 auto stripdata = std::vector<StripData>();
263 stripdata.reserve(fromCells.size());
266 back_inserter(stripdata),
274 auto low = toStripData(neigh_cells[0]);
275 auto center = toStripData(neigh_cells[1]);
276 auto high = toStripData(neigh_cells[2]);
279 Coords cell_c{max_cell->eta(), max_cell->phi()};
282 neighborhoods.
push_back(std::make_unique<LArStripNeighborhood>(low,
287 max_neigh_cell_pos));
289 return StatusCode::SUCCESS;