21#include "CaloDetDescr/CaloDetDescrElement.h"
37 return StatusCode::SUCCESS;
47 navInColl = readHandleTower.
cptr();
52 cellColl = readHandleCell.
cptr();
60 for(
const auto *towerItr : *navInColl)
68 uint32_t samplingPattern=0;
74 towerItr->fillToken(cellToken,
double(1.));
79 float mirror_cell_sumE = 0;
81 if ( cellToken.
size() == 0 )
continue;
93 std::unique_ptr<const CaloCell> mirroredCell{};
100 cell=mirroredCell.get();
101 mirror_cell_sumE+= cell->energy()*geoWeight;
104 ATH_MSG_WARNING(
"Failed to obtain mirrored cell for deadFEB cell with id" << std::hex << cell->ID().get_compact());
109 double cell_E_w=(*cellItr)->energy()*geoWeight;
112 size_t iCell=cellColl->
findIndex(hashid);
113 cl->addCell(iCell,geoWeight);
116 eta_cl+=cell_E_w*(*cellItr)->eta();
117 phi_cl+=cell_E_w*(*cellItr)->phi();
118 E2_cl+=cell_E_w*cell_E_w;
119 time_cl+=cell_E_w*cell_E_w*(*cellItr)->time();
122 samplingPattern |= (0x1U<<sample);
128 static const SG::AuxElement::Decorator<float> Mcell_sumE(
"mcell_sumE");
129 Mcell_sumE(*cl) = mirror_cell_sumE;
131 float eta0=towerItr->eta();
132 float phi0=towerItr->phi();
145 phi_cl=TVector2::Phi_mpi_pi(phi_cl);
152 if(E2_cl < 1e-8) time_cl=0.;
162 cl->setRawEta(eta_cl);
163 cl->setRawPhi(phi_cl);
167 cl->setAltEta(eta_cl);
168 cl->setAltPhi(phi_cl);
172 cl->setCalEta(eta_cl);
173 cl->setCalPhi(phi_cl);
177 cl->setTime(time_cl);
178 cl->setSamplingPattern(samplingPattern);
181 << std::setw(15) << cl->e()
182 << std::setw(15) << cl->eta()
183 << std::setw(15) << cl->phi() );
185 writeHandleContainer->push_back(std::move(cl));
187 return StatusCode::SUCCESS;
192 return StatusCode::SUCCESS;
200 clusCollIter!= clusColl->
end(); ++clusCollIter)
212 ATH_MSG_ERROR(
"Can't get valid links to CaloCells (CaloClusterCellLink)!");
213 return StatusCode::FAILURE;
216 unsigned int ncells=0;
228 double cell_E_w=pCell->
energy();
231 eta_cl+=cell_E_w*pCell->
eta();
232 phi_cl+=cell_E_w*pCell->
phi();
242 << std::setw(15) << cl->e()
243 << std::setw(15) << cl->eta()
244 << std::setw(15) << cl->phi()
245 << std::setw(15) << E_cl
246 << std::setw(15) << eta_cl
247 << std::setw(15) << phi_cl
248 << std::setw(15) << ncells
249 << std::setw(15) << sumw );
251 return StatusCode::SUCCESS;
257 const int subCalo =
m_calo_id->sub_calo(
id);
258 const int pos_neg =
m_calo_id->pos_neg(
id);
259 const int sampling =
m_calo_id->sampling(
id);
260 const int region =
m_calo_id->region(
id);
264 ATH_MSG_VERBOSE(
"DeadFEB cell parameter: (" << subCalo <<
"," << pos_neg <<
"," << sampling <<
"," << region <<
"," <<
eta <<
"," <<
phi <<
")");
268 sampling, region,
eta,
phi);
283 mirroredCell->
gain());
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
DataVector< INavigable4Momentum > INavigable4MomentumCollection
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
Container class for CaloCell.
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
Data object for each calorimeter readout cell.
float time() const
get time (data member)
virtual double phi() const override final
get phi (through CaloDetDescrElement)
double energy() const
get energy (data member)
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
uint16_t provenance() const
get provenance (data member)
virtual double eta() const override final
get eta (through CaloDetDescrElement)
uint16_t quality() const
get quality (data member)
CaloGain::CaloGain gain() const
get gain (data member )
virtual double et() const override final
get et
Identifier ID() const
get ID (from cached data member) non-virtual and inline for fast access
Bookkeeping of cells that make up a cluster Simplified replacement for CaloCellLink,...
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
CaloCell_ID::CaloSample getSampling() const
cell sampling
float eta() const
cell eta
float phi() const
cell phi
DataModel_detail::iterator< DataVector > iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
std::unique_ptr< const CaloCell > getMirroredCell(const CaloCell *pCell, const CaloCellContainer *ccc) const
SG::ReadHandleKey< INavigable4MomentumCollection > m_towerContainerKey
Name of input CaloTowerContainer, e.g CmbTower.
SG::ReadHandleKey< CaloCellContainer > m_cellContainerKey
Name of input CaloCellContainer, e.g. AllCalo.
virtual StatusCode initialize()
virtual StatusCode finalize()
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputKey
Name of output CaloClusterContainer, e.g. HIClusters.
StatusCode dumpClusters(xAOD::CaloClusterContainer *clusColl)
Gaudi::Property< float > m_EminMoment
For clusters w/ E less than this, set their eta/phi to tower eta/phi.
HIClusterMaker(const std::string &name, ISvcLocator *pSvcLocator)
const CaloCell_ID * m_calo_id
virtual StatusCode execute(const EventContext &ctx) const
This is a "hash" representation of an Identifier.
const_iterator begin() const
CHILDPAR getParameter(const_child_ptr data) const
NavigationTokenIterator const_iterator
const_iterator end() const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
CaloClusterCellLink::iterator cell_iterator
Iterator of the underlying CaloClusterCellLink (non-const version).
void prefetchNext(Iter iter, Iter endIter)
Prefetch next object in sequence.
bool inTowerBoundary(float eta0, float phi0, float eta, float phi)
bool test(const uint16_t prov, const LArProvenance check)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Functions to prefetch blocks of memory.