Skip to content
Snippets Groups Projects
Commit 3832776e authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'R22_CaloClusterCellLinkContainerThinning' into 'master'

CaloTPCnv: support for CaloClusterCellLinkContainer thinning

See merge request atlas/athena!38266
parents 202124d9 2b801abb
No related branches found
No related tags found
No related merge requests found
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
#include "CaloTPCnv/CaloClusterCellLinkContainerCnv_p1.h" #include "CaloTPCnv/CaloClusterCellLinkContainerCnv_p1.h"
#include "AthenaKernel/getThinningCache.h" #include "AthenaKernel/getThinningCache.h"
#include "AthenaKernel/ThinningCache.h"
namespace { namespace {
...@@ -54,38 +55,48 @@ CaloClusterCellLinkContainerCnv_p1::persToTransWithKey (const CaloClusterCellLin ...@@ -54,38 +55,48 @@ CaloClusterCellLinkContainerCnv_p1::persToTransWithKey (const CaloClusterCellLin
void void
CaloClusterCellLinkContainerCnv_p1::transToPersWithKey (const CaloClusterCellLinkContainer* trans, CaloClusterCellLinkContainerCnv_p1::transToPersWithKey (const CaloClusterCellLinkContainer* trans,
CaloClusterCellLinkContainer_p1* pers, CaloClusterCellLinkContainer_p1* pers,
const std::string& /*key*/, const std::string& key,
MsgStream &msg) const MsgStream &msg) const
{ {
const SG::ThinningDecisionBase* dec = nullptr; const SG::ThinningCache* tcache = SG::getThinningCache();
const SG::ThinningDecisionBase* dec_cells = nullptr;
const SG::ThinningDecisionBase* dec_clusts = tcache ? tcache->thinning (key) : nullptr;
const size_t nClusters=trans->size(); const size_t nClusters=trans->size();
if (nClusters>0) { if (nClusters>0) {
//we assume here all clusters in a container are built from the same cell container //we assume here all clusters in a container are built from the same cell container
m_linkCnv.transToPers((*trans)[0]->getCellContainerLink(),pers->m_cellCont,msg); m_linkCnv.transToPers((*trans)[0]->getCellContainerLink(),pers->m_cellCont,msg);
dec = SG::getThinningDecision ((*trans)[0]->getCellContainerLink().dataID()); if (tcache) {
dec_cells = SG::getThinningDecision ((*trans)[0]->getCellContainerLink().dataID());
}
} }
size_t minCapacity=0; size_t minCapacity=0;
pers->m_nCellsPerCluster.reserve(nClusters); pers->m_nCellsPerCluster.reserve(nClusters);
size_t icluster = 0;
for(const CaloClusterCellLink* cccl: *trans) { for(const CaloClusterCellLink* cccl: *trans) {
const size_t nCells=cccl->size(); if (!dec_clusts || !dec_clusts->thinned (icluster)) {
pers->m_nCellsPerCluster.push_back(nCells); const size_t nCells=cccl->size();
minCapacity+=nCells; pers->m_nCellsPerCluster.push_back(nCells);
pers->m_indices.reserve(minCapacity); minCapacity+=nCells;
//pers->m_weights.reserve(minCapacity); pers->m_indices.reserve(minCapacity);
CaloClusterCellLink::const_iterator it = cccl->begin(); //pers->m_weights.reserve(minCapacity);
CaloClusterCellLink::const_iterator end = cccl->end(); CaloClusterCellLink::const_iterator it = cccl->begin();
for (; it != end; ++it) { CaloClusterCellLink::const_iterator end = cccl->end();
unsigned ndx = it.index(); for (; it != end; ++it) {
if (dec) ndx = dec->index (ndx); unsigned ndx = it.index();
if (it.weight() == 1.0) { //standard weight if (dec_cells) ndx = dec_cells->index (ndx);
pers->m_indices.push_back(ndx & INDEXBIT_MASK); if (it.weight() == 1.0) { //standard weight
} pers->m_indices.push_back(ndx & INDEXBIT_MASK);
else { }
pers->m_indices.push_back((ndx & INDEXBIT_MASK) | HAS_WEIGHT_BIT); else {
pers->m_weights.push_back(it.weight()); pers->m_indices.push_back((ndx & INDEXBIT_MASK) | HAS_WEIGHT_BIT);
} pers->m_weights.push_back(it.weight());
}//end loop over cells in cellLink object }
}//end loop over cells in cellLink object
}
++icluster;
}//end loop over transient CaloClusterCellLinkContainer }//end loop over transient CaloClusterCellLinkContainer
return; return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment