|
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) {
174 std::vector<std::vector<const CaloCell*>>(3,
175 std::vector<const CaloCell*>());
176 for (
auto&
v :close) {
v.reserve(100);}
179 constexpr
double half_deta_roi{0.05};
180 constexpr
double half_deta_neigh{8.5*0.0031};
181 constexpr
double half_deta_fid{half_deta_roi + half_deta_neigh};
184 double etalim_low =
std::max(roi->
eta()-half_deta_fid, -1.4);
185 double etalim_high =
std::min(roi->
eta()+half_deta_fid, 1.4);
192 for(
const auto& iroi : roi_phi_indices) {
193 auto c_eta =
cell->eta();
194 if (iroi ==
icell and c_eta >= etalim_low and c_eta < etalim_high) {
203 for (
const auto&
v : close) {
ATH_MSG_DEBUG(
"size close " <<
v.size());}
207 auto roi_cells = std::vector<const CaloCell*> ();
208 roi_cells.reserve(close[1].
size());
211 std::back_inserter(roi_cells),
212 [&roi](
const auto&
c) {
213 return std::abs(
c->eta() - roi->
eta()) < half_deta_roi;
219 [](
const auto&
l,
const auto&
r) {
220 return l->e() <
r->e();
225 return StatusCode::FAILURE;
235 std::vector<std::vector<const CaloCell*>>(3,
236 std::vector<const CaloCell*>());
240 const auto max_cell_eta = max_cell->eta();
243 for (std::size_t iv{0
ul}; iv != close.size(); ++iv) {
246 std::back_inserter(neigh_cells[iv]),
247 [&max_cell_eta, &half_deta_neigh](
const auto&
c){
248 return abs(
c->eta()-max_cell_eta) < half_deta_neigh;
255 if (max_neigh_cell_it ==
std::end(neigh_cells[1])){
257 return StatusCode::FAILURE;
263 auto toStripData = [](
const auto& fromCells){
264 auto stripdata = std::vector<StripData>();
265 stripdata.reserve(fromCells.size());
268 back_inserter(stripdata),
276 auto low = toStripData(neigh_cells[0]);
277 auto center = toStripData(neigh_cells[1]);
278 auto high = toStripData(neigh_cells[2]);
281 Coords cell_c{max_cell->eta(), max_cell->phi()};
284 neighborhoods.
push_back(std::make_unique<LArStripNeighborhood>(low,
289 max_neigh_cell_pos));
291 return StatusCode::SUCCESS;
298 std::ofstream
out(
name() +
"_" +
304 <<
" is simulation " << std::boolalpha
308 for (
const auto& nbhd : neighborhoods) {
309 out << *nbhd <<
'\n';
314 return StatusCode::SUCCESS;
319 for(
const auto&
sd : sdv) {
320 os <<
sd.m_eta <<
' ';
325 for(
const auto&
sd : sdv) {
326 os <<
sd.m_phi <<
' ';
330 for(
const auto &
sd : sdv) {
348 std::ofstream
out(
name() +
"_" +
353 <<
" is simulation " << std::boolalpha
357 for (
const auto&
n : neighborhoods) {
dump_n(
n,
out);}
362 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.