|
ATLAS Offline Software
|
Go to the documentation of this file.
22 std::optional<std::vector<std::size_t>>
wrap3(std::size_t center) {
24 return std::optional<std::vector<std::size_t>>{};
28 return std::make_optional(std::vector<std::size_t>({62
ul, 63
ul, 0
ul}));
32 return std::make_optional(std::vector<std::size_t>({63
ul, 0
ul, 1
ul}));
35 return std::make_optional(std::vector<std::size_t>(
55 return StatusCode::SUCCESS;
68 return StatusCode::FAILURE;
71 std::vector<const CaloCell*>
cells;
75 std::vector<const xAOD::eFexEMRoI*>
rois;
83 auto neighborhoods = std::make_unique<LArStripNeighborhoodContainer>();
102 return StatusCode::SUCCESS;
107 const std::vector<const CaloCell*>&
cells,
110 for (
const auto& roi :
rois) {
114 return StatusCode::SUCCESS;
120 const std::vector<const CaloCell*>&
cells,
153 auto cells_near_roi = std::vector<const CaloCell*>();
156 auto phi_ind = [](
const auto&
c) {
158 std::size_t iphi = 32 +
int(std::floor(
c->phi()/dphi));
160 std::optional<std::size_t>() : std::make_optional(iphi);
164 auto roi_phi_index = *phi_ind(roi);
167 auto roi_phi_indices = *
wrap3(roi_phi_index);
168 for (
const auto&
i : roi_phi_indices) {
173 auto close = std::vector<std::vector<const CaloCell*>>(3);
174 for (
auto&
v :close) {
v.reserve(100);}
177 constexpr
double half_deta_roi{0.05};
178 constexpr
double half_deta_neigh{8.5*0.0031};
179 constexpr
double half_deta_fid{half_deta_roi + half_deta_neigh};
182 double etalim_low =
std::max(roi->
eta()-half_deta_fid, -1.4);
183 double etalim_high =
std::min(roi->
eta()+half_deta_fid, 1.4);
190 for(
const auto& iroi : roi_phi_indices) {
191 auto c_eta =
cell->eta();
192 if (iroi ==
icell and c_eta >= etalim_low and c_eta < etalim_high) {
201 for (
const auto&
v : close) {
ATH_MSG_DEBUG(
"size close " <<
v.size());}
205 auto roi_cells = std::vector<const CaloCell*> ();
206 roi_cells.reserve(close[1].
size());
209 std::back_inserter(roi_cells),
210 [&roi](
const auto&
c) {
211 return std::abs(
c->eta() - roi->
eta()) < half_deta_roi;
217 [](
const auto&
l,
const auto&
r) {
218 return l->e() <
r->e();
223 return StatusCode::FAILURE;
232 auto neigh_cells = std::vector<std::vector<const CaloCell*>>(3);
235 const auto max_cell_eta = max_cell->eta();
238 for (std::size_t iv{0
ul}; iv != close.size(); ++iv) {
241 std::back_inserter(neigh_cells[iv]),
242 [&max_cell_eta, &half_deta_neigh](
const auto&
c){
243 return abs(
c->eta()-max_cell_eta) < half_deta_neigh;
250 if (max_neigh_cell_it ==
std::end(neigh_cells[1])){
252 return StatusCode::FAILURE;
258 auto toStripData = [](
const auto& fromCells){
259 auto stripdata = std::vector<StripData>();
260 stripdata.reserve(fromCells.size());
263 back_inserter(stripdata),
271 auto low = toStripData(neigh_cells[0]);
272 auto center = toStripData(neigh_cells[1]);
273 auto high = toStripData(neigh_cells[2]);
276 Coords cell_c{max_cell->eta(), max_cell->phi()};
279 neighborhoods.
push_back(std::make_unique<LArStripNeighborhood>(low,
284 max_neigh_cell_pos));
286 return StatusCode::SUCCESS;
293 std::ofstream
out(
name() +
"_" +
299 <<
" is simulation " << std::boolalpha
303 for (
const auto& nbhd : neighborhoods) {
304 out << *nbhd <<
'\n';
309 return StatusCode::SUCCESS;
314 for(
const auto&
sd : sdv) {
315 os <<
sd.m_eta <<
' ';
320 for(
const auto&
sd : sdv) {
321 os <<
sd.m_phi <<
' ';
325 for(
const auto &
sd : sdv) {
343 std::ofstream
out(
name() +
"_" +
348 <<
" is simulation " << std::boolalpha
352 for (
const auto&
n : neighborhoods) {
dump_n(
n,
out);}
357 return StatusCode::SUCCESS;
std::optional< std::vector< std::size_t > > wrap3(std::size_t center)
std::string find(const std::string &s)
return a remapped string
uint64_t eventNumber() const
The current event's event number.
ToolHandle< ICaloCellsProducer > m_cellProducer
virtual StatusCode initialize() override
std::pair< double, double > Coords
StatusCode dumpTerse(const xAOD::EventInfo &eventInfo, const LArStripNeighborhoodContainer &) const
Class describing a LVL1 eFEX EM region of interest.
StatusCode findNeighborhood(const xAOD::eFexEMRoI *, const std::vector< const CaloCell * > &, LArStripNeighborhoodContainer &) const
@ IS_SIMULATION
true: simulation, false: data
uint32_t runNumber() const
The current event's run number.
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteHandleKey< LArStripNeighborhoodContainer > m_neighKey
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Gaudi::Property< bool > m_dump
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Egamma1_LArStrip_Fex(const std::string &name, ISvcLocator *pSvcLocator)
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Out copy_if(In first, const In &last, Out res, const Pred &p)
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
void dump_stripdataVector(const StripDataVector &sdv, std::ostream &os)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::string to_string(const DetectorType &type)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
float eta() const
setter for the above
Gaudi::Property< bool > m_dumpTerse
Class describing the basic event information.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Data object for each calorimeter readout cell.
StatusCode findNeighborhoods(const std::vector< const xAOD::eFexEMRoI * > &, const std::vector< const CaloCell * > &, LArStripNeighborhoodContainer &) const
StatusCode dump(const xAOD::EventInfo &eventInfo, const LArStripNeighborhoodContainer &) const
float mcEventWeight(size_t i=0) const
The weight of one specific MC event used in the simulation.
float phi() const
Seed supercell index within central tower (0 -> 3)
ToolHandle< eFexRoIAlgTool > m_roiAlgTool
std::vector< StripData > StripDataVector
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
void dump_n(const LArStripNeighborhood *n, std::ostream &os)
virtual StatusCode execute(const EventContext &) const override
bool eventType(EventType type) const
Check for one particular bitmask value.