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

Merge branch 'optimizeIDCItr' into 'master'

IDC: Optimize iteration in various tools

See merge request !33639
parents c5bba65b d6e17cd4
No related branches found
No related tags found
No related merge requests found
Showing
with 29 additions and 38 deletions
...@@ -138,7 +138,7 @@ namespace InDet{ ...@@ -138,7 +138,7 @@ namespace InDet{
const COLLECTION* RDO_Collection(*rdoCollections); const COLLECTION* RDO_Collection(*rdoCollections);
if (!RDO_Collection || RDO_Collection->empty()) continue; if (!RDO_Collection || RDO_Collection->empty()) continue;
PixelClusterContainer::IDC_WriteHandle lock = clusterContainer->getWriteHandle(rdoCollections.hashId()); PixelClusterContainer::IDC_WriteHandle lock = clusterContainer->getWriteHandle(rdoCollections.hashId());
if( lock.alreadyPresent() ) continue; if( lock.OnlineAndPresentInAnotherView() ) continue;
// Use one of the specific clustering AlgTools to make clusters // Use one of the specific clustering AlgTools to make clusters
std::unique_ptr<PixelClusterCollection> clusterCollection (m_clusteringTool->clusterize(*RDO_Collection, *m_idHelper)); std::unique_ptr<PixelClusterCollection> clusterCollection (m_clusteringTool->clusterize(*RDO_Collection, *m_idHelper));
...@@ -172,7 +172,7 @@ namespace InDet{ ...@@ -172,7 +172,7 @@ namespace InDet{
if (!RDO_Collection) continue; if (!RDO_Collection) continue;
PixelClusterContainer::IDC_WriteHandle lock = clusterContainer->getWriteHandle(listOfPixIds[i]); PixelClusterContainer::IDC_WriteHandle lock = clusterContainer->getWriteHandle(listOfPixIds[i]);
if( lock.alreadyPresent() ) continue; if( lock.OnlineAndPresentInAnotherView() ) continue;
// Use one of the specific clustering AlgTools to make clusters // Use one of the specific clustering AlgTools to make clusters
std::unique_ptr<PixelClusterCollection> clusterCollection (m_clusteringTool->clusterize(*RDO_Collection, *m_idHelper)); std::unique_ptr<PixelClusterCollection> clusterCollection (m_clusteringTool->clusterize(*RDO_Collection, *m_idHelper));
......
...@@ -119,7 +119,7 @@ namespace InDet { ...@@ -119,7 +119,7 @@ namespace InDet {
const InDetRawDataCollection<SCT_RDORawData>* rd{*rdoCollections}; const InDetRawDataCollection<SCT_RDORawData>* rd{*rdoCollections};
ATH_MSG_DEBUG("RDO collection size=" << rd->size() << ", Hash=" << rd->identifyHash()); ATH_MSG_DEBUG("RDO collection size=" << rd->size() << ", Hash=" << rd->identifyHash());
SCT_ClusterContainer::IDC_WriteHandle lock{clusterContainer->getWriteHandle(rdoCollections.hashId())}; SCT_ClusterContainer::IDC_WriteHandle lock{clusterContainer->getWriteHandle(rdoCollections.hashId())};
if (lock.alreadyPresent()) { if (lock.OnlineAndPresentInAnotherView()) {
ATH_MSG_DEBUG("Item already in cache , Hash=" << rd->identifyHash()); ATH_MSG_DEBUG("Item already in cache , Hash=" << rd->identifyHash());
continue; continue;
} }
...@@ -187,7 +187,7 @@ namespace InDet { ...@@ -187,7 +187,7 @@ namespace InDet {
SCT_ClusterContainer::IDC_WriteHandle lock{clusterContainer->getWriteHandle(listOfSCTIds[i])}; SCT_ClusterContainer::IDC_WriteHandle lock{clusterContainer->getWriteHandle(listOfSCTIds[i])};
if (lock.alreadyPresent()) { if (lock.OnlineAndPresentInAnotherView()) {
ATH_MSG_DEBUG("Item already in cache , Hash=" << listOfSCTIds[i]); ATH_MSG_DEBUG("Item already in cache , Hash=" << listOfSCTIds[i]);
continue; continue;
} }
......
...@@ -96,7 +96,7 @@ namespace InDet { ...@@ -96,7 +96,7 @@ namespace InDet {
for(const auto& rdoCollections : *rdoContainer) { for(const auto& rdoCollections : *rdoContainer) {
const InDetRawDataCollection<TRT_RDORawData>* currentCollection(rdoCollections); const InDetRawDataCollection<TRT_RDORawData>* currentCollection(rdoCollections);
InDet::TRT_DriftCircleContainer::IDC_WriteHandle lock = rioContainer->getWriteHandle(currentCollection->identifyHash()); InDet::TRT_DriftCircleContainer::IDC_WriteHandle lock = rioContainer->getWriteHandle(currentCollection->identifyHash());
if( lock.alreadyPresent() ) continue; if( lock.OnlineAndPresentInAnotherView() ) continue;
std::unique_ptr<TRT_DriftCircleCollection> p_rio(m_driftcircle_tool->convert(m_mode_rio_production, std::unique_ptr<TRT_DriftCircleCollection> p_rio(m_driftcircle_tool->convert(m_mode_rio_production,
currentCollection, ctx, m_trtBadChannels)); currentCollection, ctx, m_trtBadChannels));
if(p_rio && !p_rio->empty()) { if(p_rio && !p_rio->empty()) {
...@@ -120,7 +120,7 @@ namespace InDet { ...@@ -120,7 +120,7 @@ namespace InDet {
const InDetRawDataCollection<TRT_RDORawData>* RDO_Collection (rdoContainer->indexFindPtr(id)); const InDetRawDataCollection<TRT_RDORawData>* RDO_Collection (rdoContainer->indexFindPtr(id));
if (!RDO_Collection) continue; if (!RDO_Collection) continue;
InDet::TRT_DriftCircleContainer::IDC_WriteHandle lock = rioContainer->getWriteHandle(id); InDet::TRT_DriftCircleContainer::IDC_WriteHandle lock = rioContainer->getWriteHandle(id);
if( lock.alreadyPresent() ) continue; if( lock.OnlineAndPresentInAnotherView() ) continue;
// Use one of the specific clustering AlgTools to make clusters // Use one of the specific clustering AlgTools to make clusters
std::unique_ptr<TRT_DriftCircleCollection> p_rio(m_driftcircle_tool->convert(m_mode_rio_production, std::unique_ptr<TRT_DriftCircleCollection> p_rio(m_driftcircle_tool->convert(m_mode_rio_production,
......
...@@ -221,7 +221,7 @@ StatusCode SiTrackerSpacePointFinder::execute (const EventContext& ctx) const ...@@ -221,7 +221,7 @@ StatusCode SiTrackerSpacePointFinder::execute (const EventContext& ctx) const
// Create SpacePointCollection // Create SpacePointCollection
IdentifierHash idHash = colNext->identifyHash(); IdentifierHash idHash = colNext->identifyHash();
SpacePointContainer::IDC_WriteHandle lock = spacePointContainer_SCT->getWriteHandle(idHash); SpacePointContainer::IDC_WriteHandle lock = spacePointContainer_SCT->getWriteHandle(idHash);
if(lock.alreadyPresent()){ if(lock.OnlineAndPresentInAnotherView()){
ATH_MSG_DEBUG("SCT Hash " << idHash << " is already in cache"); ATH_MSG_DEBUG("SCT Hash " << idHash << " is already in cache");
++sctCacheCount; ++sctCacheCount;
continue; //Skip if already present in cache continue; //Skip if already present in cache
...@@ -277,7 +277,7 @@ StatusCode SiTrackerSpacePointFinder::execute (const EventContext& ctx) const ...@@ -277,7 +277,7 @@ StatusCode SiTrackerSpacePointFinder::execute (const EventContext& ctx) const
nReceivedClustersPIX = (*colNext)->size(); nReceivedClustersPIX = (*colNext)->size();
IdentifierHash idHash = (*colNext)->identifyHash(); IdentifierHash idHash = (*colNext)->identifyHash();
SpacePointContainer::IDC_WriteHandle lock = spacePointContainerPixel->getWriteHandle(idHash); SpacePointContainer::IDC_WriteHandle lock = spacePointContainerPixel->getWriteHandle(idHash);
if(lock.alreadyPresent()){ if(lock.OnlineAndPresentInAnotherView()){
ATH_MSG_DEBUG("pixel Hash " << idHash << " is already in cache"); ATH_MSG_DEBUG("pixel Hash " << idHash << " is already in cache");
++pixCacheCount; ++pixCacheCount;
continue; continue;
......
...@@ -86,12 +86,11 @@ StatusCode Muon::RpcRdoToPrepDataTool::decode( std::vector<IdentifierHash>& idVe ...@@ -86,12 +86,11 @@ StatusCode Muon::RpcRdoToPrepDataTool::decode( std::vector<IdentifierHash>& idVe
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
ATH_MSG_DEBUG("Core decode processed in Legacy decode (hash vector)"); ATH_MSG_DEBUG("Core decode processed in Legacy decode (hash vector)");
if (msgLvl(MSG::DEBUG)){
auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); for (const auto &[hash, ptr] : m_rpcPrepDataContainer->GetAllHashPtrPair()){
for (auto hash : prd_hashes){ ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash);
ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash); }
} }
// For additional information on container contents, this function can be used // For additional information on container contents, this function can be used
// Muon::RpcRdoToPrepDataToolCore::printPrepData(); // Muon::RpcRdoToPrepDataToolCore::printPrepData();
...@@ -106,12 +105,11 @@ StatusCode Muon::RpcRdoToPrepDataTool::decode( const std::vector<uint32_t>& robI ...@@ -106,12 +105,11 @@ StatusCode Muon::RpcRdoToPrepDataTool::decode( const std::vector<uint32_t>& robI
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
ATH_MSG_DEBUG("Core decode processed in Legacy decode (ROB vector)"); ATH_MSG_DEBUG("Core decode processed in Legacy decode (ROB vector)");
if (msgLvl(MSG::DEBUG)){
auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); for (const auto &[hash, ptr] : m_rpcPrepDataContainer->GetAllHashPtrPair()){
for (auto hash : prd_hashes){ ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash);
ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash); }
} }
// For additional information on container contents, this function can be used // For additional information on container contents, this function can be used
// Muon::RpcRdoToPrepDataToolCore::printPrepData(); // Muon::RpcRdoToPrepDataToolCore::printPrepData();
......
...@@ -179,7 +179,7 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){ ...@@ -179,7 +179,7 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){
ATH_MSG_DEBUG("Transferring local decoding from Core to cache container inside MT"); ATH_MSG_DEBUG("Transferring local decoding from Core to cache container inside MT");
// Take m_rpcPrepDataContainer and transfer contents to m_rpcPrepDataContainerFromCache // Take m_rpcPrepDataContainer and transfer contents to m_rpcPrepDataContainerFromCache
auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); auto prd_hashes = m_rpcPrepDataContainer->GetAllCurrentHashes(); //deliberately GetAllCurrentHashes
for (auto hash : prd_hashes) { for (auto hash : prd_hashes) {
// Remove collection from local-thread container and place into unique_ptr to move to cache // Remove collection from local-thread container and place into unique_ptr to move to cache
std::unique_ptr<Muon::RpcPrepDataCollection> coll ( m_rpcPrepDataContainer->removeCollection(hash) ); std::unique_ptr<Muon::RpcPrepDataCollection> coll ( m_rpcPrepDataContainer->removeCollection(hash) );
...@@ -200,7 +200,7 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){ ...@@ -200,7 +200,7 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){
} }
// Take m_rpcCoinDataContainer and transfer contents to m_rpcCoinDataContainerFromCache // Take m_rpcCoinDataContainer and transfer contents to m_rpcCoinDataContainerFromCache
auto coin_hashes = m_rpcCoinDataContainer->GetAllCurrentHashes(); auto coin_hashes = m_rpcCoinDataContainer->GetAllCurrentHashes(); //deliberately GetAllCurrentHashes
for (auto hash : coin_hashes) { for (auto hash : coin_hashes) {
// Remove collection from local-thread container and place into unique_ptr to move to cache // Remove collection from local-thread container and place into unique_ptr to move to cache
std::unique_ptr<Muon::RpcCoinDataCollection> coll ( m_rpcCoinDataContainer->removeCollection(hash) ); std::unique_ptr<Muon::RpcCoinDataCollection> coll ( m_rpcCoinDataContainer->removeCollection(hash) );
...@@ -220,17 +220,14 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){ ...@@ -220,17 +220,14 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::transferOutputToCache(){
ATH_MSG_DEBUG("Coin hash " << hash << " has been moved to cache container"); ATH_MSG_DEBUG("Coin hash " << hash << " has been moved to cache container");
} }
if (msgLvl(MSG::DEBUG)){
auto prd_hashes_cache_check = m_rpcPrepDataContainerFromCache->GetAllCurrentHashes(); for (const auto &[hash, ptr] : m_rpcPrepDataContainerFromCache->GetAllHashPtrPair()){
for (auto hash : prd_hashes_cache_check){ ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash);
ATH_MSG_DEBUG("Contents of CONTAINER in this view : " << hash); }
} for (const auto &[hash, ptr] : m_rpcPrepDataContainer->GetAllHashPtrPair()){
ATH_MSG_DEBUG("Contents of LOCAL in this view : " << hash);
auto prd_hashes_local_check = m_rpcPrepDataContainer->GetAllCurrentHashes(); }
for (auto hash : prd_hashes_local_check){
ATH_MSG_DEBUG("Contents of LOCAL in this view : " << hash);
} }
// For additional information on the contents of the cache-based container, this function can be used // For additional information on the contents of the cache-based container, this function can be used
//printMT(); //printMT();
......
...@@ -47,8 +47,7 @@ StatusCode TileDigitsFlxMonitorAlgorithm::fillHistograms( const EventContext& ct ...@@ -47,8 +47,7 @@ StatusCode TileDigitsFlxMonitorAlgorithm::fillHistograms( const EventContext& ct
SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey, ctx); SG::ReadHandle<TileDigitsContainer> digitsContainer(m_digitsContainerKey, ctx);
ATH_CHECK( digitsContainer.isValid() ); ATH_CHECK( digitsContainer.isValid() );
for (IdentifierHash hash : digitsContainer->GetAllCurrentHashes()) { for (const TileDigitsCollection* digitsCollection : *digitsContainer) {
const TileDigitsCollection* digitsCollection = digitsContainer->indexFindPtr (hash);
int fragId = digitsCollection->identify(); int fragId = digitsCollection->identify();
unsigned int drawer = (fragId & 0x3F); unsigned int drawer = (fragId & 0x3F);
......
...@@ -68,8 +68,7 @@ StatusCode TileBeamElemDumper::execute (const EventContext& ctx) const ...@@ -68,8 +68,7 @@ StatusCode TileBeamElemDumper::execute (const EventContext& ctx) const
<< ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec << ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec
<< std::endl; << std::endl;
for (IdentifierHash hash : cont->GetAllCurrentHashes()) { for (auto coll : *cont) {
const TileBeamElemCollection* coll = cont->indexFindPtr (hash);
fout << static_cast<std::string> (*coll); fout << static_cast<std::string> (*coll);
fout << "\n"; fout << "\n";
} }
......
...@@ -76,8 +76,7 @@ StatusCode TileDigitsDumper::execute (const EventContext& ctx) const ...@@ -76,8 +76,7 @@ StatusCode TileDigitsDumper::execute (const EventContext& ctx) const
<< ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec << ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec
<< std::endl; << std::endl;
for (IdentifierHash hash : cont->GetAllCurrentHashes()) { for (const TileDigitsCollection* coll : *cont) {
const TileDigitsCollection* coll = cont->indexFindPtr (hash);
fout << static_cast<std::string> (*coll); fout << static_cast<std::string> (*coll);
coll->printExtra (fout); coll->printExtra (fout);
fout << "\n"; fout << "\n";
......
...@@ -76,8 +76,7 @@ StatusCode TileRawChannelDumper::execute (const EventContext& ctx) const ...@@ -76,8 +76,7 @@ StatusCode TileRawChannelDumper::execute (const EventContext& ctx) const
<< ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec << ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec
<< std::endl; << std::endl;
for (IdentifierHash hash : cont->GetAllCurrentHashes()) { for (const TileRawChannelCollection* coll : *cont) {
const TileRawChannelCollection* coll = cont->indexFindPtr (hash);
fout << static_cast<std::string> (*coll); fout << static_cast<std::string> (*coll);
fout << "\n"; fout << "\n";
} }
......
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