11 #include "../IO/LArStripNeighborhoodDumper.h"
24 std::optional<std::vector<std::size_t>>
wrap5(std::size_t center) {
26 return std::optional<std::vector<std::size_t>>{};
30 return std::make_optional(std::vector<std::size_t>({61
ul, 62
ul, 63
ul, 0
ul, 1
ul}));
34 return std::make_optional(std::vector<std::size_t>({62
ul, 63
ul, 0
ul, 1
ul, 2
ul}));
37 return std::make_optional(std::vector<std::size_t>(
59 return StatusCode::SUCCESS;
72 return StatusCode::FAILURE;
75 std::vector<const CaloCell*>
cells;
79 std::vector<const xAOD::eFexEMRoI*>
rois;
87 auto neighborhoods = std::make_unique<LArStripNeighborhoodContainer>();
88 auto phimax = std::make_unique<std::vector<int>>();
97 CHECK(dumper.dump(
name(), *eventInfo, *neighborhoods));
101 CHECK(dumper.dumpTerse(
name(), *eventInfo, *neighborhoods));
107 return StatusCode::SUCCESS;
112 const std::vector<const CaloCell*>&
cells,
114 std::vector<int>& phimax)
const{
116 for (
const auto& roi :
rois) {
120 return StatusCode::SUCCESS;
126 const std::vector<const CaloCell*>&
cells,
128 std::vector<int>& phimax)
const {
157 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);
169 const std::optional<std::size_t> roi_phi_index_opt = phi_ind(roi);
170 if (not roi_phi_index_opt.has_value()) {
171 return StatusCode::FAILURE;
173 const std::size_t roi_phi_index = *roi_phi_index_opt;
176 auto roi_phi_indices = *
wrap5(roi_phi_index);
179 auto close = std::deque<std::vector<const CaloCell*>>(5);
180 for (
auto&
v :close) {
v.reserve(100);}
183 constexpr
double half_deta_roi{0.05};
185 constexpr
double half_deta_neigh{8.5*0.003125};
187 constexpr
double half_deta_fid{half_deta_roi + half_deta_neigh};
190 double etalim_low =
std::max(roi->
eta()-half_deta_fid, -1.4);
191 double etalim_high =
std::min(roi->
eta()+half_deta_fid, 1.4);
198 for(
const auto& iroi : roi_phi_indices) {
199 auto c_eta =
cell->eta();
200 if (iroi ==
icell and c_eta >= etalim_low and c_eta < etalim_high) {
210 auto roi_cells = std::deque<std::vector<const CaloCell*>>(5);
213 for (std::size_t
i{0
ul};
i != close.size(); ++
i) {
214 roi_cells[
i].reserve(close[
i].
size());
217 std::back_inserter(roi_cells[
i]),
218 [&roi](
const auto&
c) {
219 return std::abs(
c->eta() - roi->
eta()) < half_deta_roi;
225 [](
const auto&
l,
const auto&
r) {
226 return l->e() <
r->e();
232 roi_max_it.push_back(
it);
236 auto max_row = std::max_element(
std::begin(roi_max_it),
238 [](
const auto&
l,
const auto&
r) {
239 return (*l)->e() < (*r)->e();
242 int max_row_pos =
std::distance( roi_max_it.begin(), max_row );
244 phimax.push_back(max_row_pos);
276 auto neigh_cells = std::vector<std::vector<const CaloCell*>>(3);
278 const CaloCell* max_cell{*(*max_row)};
279 const auto max_cell_eta = max_cell->
eta();
283 for (std::size_t iv{0
ul}; iv != close.size(); ++iv) {
286 std::back_inserter(neigh_cells[iv]),
287 [&max_cell_eta, &half_deta_neigh](
const auto&
c){
288 return abs(
c->eta()-max_cell_eta) < half_deta_neigh;
297 if (max_neigh_cell_it ==
std::end(neigh_cells[1])){
299 return StatusCode::FAILURE;
307 auto toStripData = [](
const auto& fromCells){
308 auto stripdata = std::vector<StripData>();
309 stripdata.reserve(fromCells.size());
312 back_inserter(stripdata),
320 auto low = toStripData(neigh_cells[0]);
321 auto center = toStripData(neigh_cells[1]);
322 auto high = toStripData(neigh_cells[2]);
325 Coords cell_c{max_cell->eta(), max_cell->phi()};
329 neighborhoods.
push_back(std::make_unique<LArStripNeighborhood>(low,
334 max_neigh_cell_pos));
336 return StatusCode::SUCCESS;