ATLAS Offline Software
Loading...
Searching...
No Matches
LArDigitThinnerFromEMClust.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <iostream>
8
9#include "Identifier/Identifier.h"
14#include "CaloEvent/CaloCell.h"
17
18
20 ISvcLocator* pSvcLocator) :
21 AthReentrantAlgorithm(name, pSvcLocator)
22 , m_onlineID(nullptr)
23 , m_inputContainerKey("FREE")
24 , m_outputContainerKey("LArDigitContainer_EMClust")
25 , m_larCablingKey("LArOnOffIdMap")
26{
27 declareProperty("InputContainerName", m_inputContainerKey);
28 declareProperty("OutputContainerName",m_outputContainerKey);
29 declareProperty("ClusterContainer",m_clusterContainerKey);
30 declareProperty("LArOnOffMap",m_larCablingKey);
31}
32
34
35
37 ATH_CHECK( detStore()->retrieve(m_onlineID, "LArOnlineID") );
38 ATH_CHECK( m_inputContainerKey.initialize());
39 ATH_CHECK( m_outputContainerKey.initialize());
40 ATH_CHECK( m_clusterContainerKey.initialize());
41 ATH_CHECK( m_larCablingKey.initialize());
42 return StatusCode::SUCCESS;
43}
44
46 return StatusCode::SUCCESS;
47}
48
49
50StatusCode LArDigitThinnerFromEMClust::execute(const EventContext& ctx) const {
51
52 //Get inputs from read handles:
55
56 //Write output via write handle
58 ATH_CHECK(outputContainer.record(std::make_unique<ConstDataVector<LArDigitContainer> >(SG::VIEW_ELEMENTS)));
59
60 //Get cable map via read conditions handle
62 const LArOnOffIdMapping* larCabling=*larCablingHdl;
63
64 auto clusteredDigits = std::make_unique<std::bitset<200000> >();
65
66 //Loop over Clusters:
67 for (const xAOD::CaloCluster* clus : *clusterContainer) {
68
69 //Loop over cells in cluster:
70 xAOD::CaloCluster::const_cell_iterator cellIter = clus->cell_begin();
71 xAOD::CaloCluster::const_cell_iterator cellIterEnd = clus->cell_end();
72 for( ;cellIter!=cellIterEnd;cellIter++) {
73 const CaloCell* cell = (*cellIter);
74 if (cell) {
75 Identifier id = cell->ID();
76 HWIdentifier hwid = larCabling->createSignalChannelID(id);
77 IdentifierHash idHash = m_onlineID->channel_Hash(hwid);
78 size_t index = (size_t) (idHash);
79 clusteredDigits->set(index);
80 }
81 }//end loop over cells in cluster
82 }//end loop over cluster
83
84
85 for (const LArDigit* dig : *inputContainer) {
86 HWIdentifier channelID = dig->channelID();
87 IdentifierHash idHash = m_onlineID->channel_Hash(channelID);
88 size_t index = (size_t) (idHash);
89 if (clusteredDigits->test(index)) outputContainer->push_back(dig);
90 }
91
92 ATH_MSG_DEBUG("Copied " << outputContainer->size() << " of " << inputContainer->size() << " digits.");
93
94 return StatusCode::SUCCESS;
95}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
DataVector adapter that acts like it holds const pointers.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
DataVector adapter that acts like it holds const pointers.
This is a "hash" representation of an Identifier.
SG::ReadHandleKey< LArDigitContainer > m_inputContainerKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterContainerKey
LArDigitThinnerFromEMClust(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKey< ConstDataVector< LArDigitContainer > > m_outputContainerKey
StatusCode execute(const EventContext &ctx) const override
SG::ReadCondHandleKey< LArOnOffIdMapping > m_larCablingKey
Liquid Argon digit base class.
Definition LArDigit.h:25
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version)
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition index.py:1
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.