diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.cxx index 82caf276d460936747a19365cd43a62e337f38a2..8c5c12dcc57f7def04eb874004b71a5d82fe0404 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -30,15 +30,15 @@ TRT_CablingData::~TRT_CablingData() delete i->second; } - // Fill m_identfierForAllStraws with zeros (TB case) -void TRT_CablingData::zero_identfierForAllStraws + // Fill m_identifierForAllStraws with zeros (TB case) +void TRT_CablingData::zero_identifierForAllStraws (int, std::vector<Identifier> ) { return; } - // Fill m_identfierHashForAllStraws with zeros (TB case) -void TRT_CablingData::zero_identfierHashForAllStraws + // Fill m_identifierHashForAllStraws with zeros (TB case) +void TRT_CablingData::zero_identifierHashForAllStraws (int, std::vector<IdentifierHash> ) { return; @@ -61,8 +61,29 @@ TRT_CablingData::find_idandhash (int rod, int bufferPosition) return offsetvec[bufferPosition]; } +const TRT_CablingData::idandhash_t& +TRT_CablingData::find_idandhash (int rod, int bufferPosition) const +{ + assert (rod >= 0); + assert (bufferPosition >= 0); + unsigned int rodhi = ((unsigned)rod & 0xffff0000) >> 16; + unsigned int rodlo = (rod & 0x0000ffff); + auto it = m_rodoffset_to_id.find (rodhi); + if (it != m_rodoffset_to_id.end()) { + const rodvec_t& rodvec = it->second; + if (rodlo < rodvec.size()) { + const offsetvec_t& offsetvec = rodvec[rodlo]; + if ((unsigned)bufferPosition < offsetvec.size()) + return offsetvec[bufferPosition]; + } + } + + static const idandhash_t dum; + return dum; +} + // Set value of Identifier for each straw (TB case) -void TRT_CablingData::set_identfierForAllStraws(int rod, +void TRT_CablingData::set_identifierForAllStraws(int rod, int bufferPosition, Identifier strawID) { find_idandhash (rod, bufferPosition).first = strawID; @@ -76,49 +97,49 @@ void TRT_CablingData::set_identfierForAllStraws(int rod, // Set value of Identifier for each straw (DC1, DC2) -void TRT_CablingData::set_identfierForAllStraws(Identifier strawID) +void TRT_CablingData::set_identifierForAllStraws(Identifier strawID) { - m_identfierForAllStraws.push_back(strawID); + m_identifierForAllStraws.push_back(strawID); } // Set value of IdentifierHash for each straw (TB case) -void TRT_CablingData::set_identfierHashForAllStraws(int rod, +void TRT_CablingData::set_identifierHashForAllStraws(int rod, int bufferPosition, IdentifierHash hashId) { find_idandhash (rod, bufferPosition).second = hashId; } // Set value of IdentifierHash for each straw (DC1, DC2) -void TRT_CablingData::set_identfierHashForAllStraws(IdentifierHash hashId) +void TRT_CablingData::set_identifierHashForAllStraws(IdentifierHash hashId) { - m_identfierHashForAllStraws.push_back(hashId); + m_identifierHashForAllStraws.push_back(hashId); } -Identifier TRT_CablingData::get_identfierForAllStraws(int rod, - int bufferPosition) +Identifier TRT_CablingData::get_identifierForAllStraws(int rod, + int bufferPosition) const { return find_idandhash (rod, bufferPosition).first; } -IdentifierHash TRT_CablingData::get_identfierHashForAllStraws - (int rod, int bufferPosition) +IdentifierHash TRT_CablingData::get_identifierHashForAllStraws + (int rod, int bufferPosition) const { return find_idandhash (rod, bufferPosition).second; } // Get value of Identifier for each straw (DC1, DC2) -Identifier TRT_CablingData::get_identfierForAllStraws(int shift) +Identifier TRT_CablingData::get_identifierForAllStraws(int shift) const { - return m_identfierForAllStraws[shift]; + return m_identifierForAllStraws[shift]; } // Get value of IdentifierHash for each straw (DC1, DC2) -IdentifierHash TRT_CablingData::get_identfierHashForAllStraws(int shift) +IdentifierHash TRT_CablingData::get_identifierHashForAllStraws(int shift) const { - return m_identfierHashForAllStraws[shift]; + return m_identifierHashForAllStraws[shift]; } // Get buffer offset from Identifier diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.h b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.h index d5d11712724a15b60074551979ad3a4ca37f1697..9c638934237b17cbb226fb8dfc83c923a82d7b08 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.h +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -24,37 +24,37 @@ public: //Destructor virtual ~TRT_CablingData(); - // Initialize m_identfierForAllStraws with zeros (TB case) - void zero_identfierForAllStraws(int rod, std::vector<Identifier> tempbuff); + // Initialize m_identifierForAllStraws with zeros (TB case) + void zero_identifierForAllStraws(int rod, std::vector<Identifier> tempbuff); - // Initialize m_identfierHashForAllStraws with zeros (TB case) - void zero_identfierHashForAllStraws(int rod, std::vector<IdentifierHash> tempbuff); + // Initialize m_identifierHashForAllStraws with zeros (TB case) + void zero_identifierHashForAllStraws(int rod, std::vector<IdentifierHash> tempbuff); // Set value of Identifier for each straw (TB case) - void set_identfierForAllStraws(int rod, int bufferPosition, + void set_identifierForAllStraws(int rod, int bufferPosition, Identifier strawID); // Set value of Identifier for each straw (DC1, DC2) - void set_identfierForAllStraws(Identifier strawID); + void set_identifierForAllStraws(Identifier strawID); // Set value of IdentifierHash for each straw (TB case) - void set_identfierHashForAllStraws(int rod, int bufferPosition, + void set_identifierHashForAllStraws(int rod, int bufferPosition, IdentifierHash hashId); // Set value of IdentifierHash for each straw (DC1, DC2) - void set_identfierHashForAllStraws(IdentifierHash hashId); + void set_identifierHashForAllStraws(IdentifierHash hashId); // Get value of Identifier for each straw (TB case) - Identifier get_identfierForAllStraws(int rod, int bufferPosition); + Identifier get_identifierForAllStraws(int rod, int bufferPosition) const; // Get value of IdentifierHash for each straw (TB case) - IdentifierHash get_identfierHashForAllStraws(int rod, int bufferPosition); + IdentifierHash get_identifierHashForAllStraws(int rod, int bufferPosition) const; // Get value of Identifier for each straw (DC1, DC2) - Identifier get_identfierForAllStraws(int shift); + Identifier get_identifierForAllStraws(int shift) const; // Get value of IdentifierHash for each straw (DC1, DC2) - IdentifierHash get_identfierHashForAllStraws(int shift); + IdentifierHash get_identifierHashForAllStraws(int shift) const; // Get buffer offset from Identifier uint32_t get_BufferOffset( Identifier StrawId ); @@ -77,10 +77,10 @@ private: std::vector<uint32_t> m_allRobs; // Identifiers for all straws - std::vector<Identifier> m_identfierForAllStraws; + std::vector<Identifier> m_identifierForAllStraws; // Hashed Identifiers for all straws; - std::vector<IdentifierHash> m_identfierHashForAllStraws; + std::vector<IdentifierHash> m_identifierHashForAllStraws; // Buffer Offsets for all Identifiers; struct idpair @@ -106,6 +106,7 @@ private: rodmap_t m_rodoffset_to_id; idandhash_t& find_idandhash (int rod, int bufferPosition); + const idandhash_t& find_idandhash (int rod, int bufferPosition) const; }; #endif // TRT_CABLINGDATA_H diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingSvc.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingSvc.cxx index 812a967af72e81797b1c7458199800b1a42badc9..7a5f9d1fcd1e3d21207a98147c8a83b264d88b76 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingSvc.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_CablingSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -237,8 +237,8 @@ Identifier TRT_CablingSvc::getIdentifier(const eformat::SubDetector& // TB04, SR1 or DC3 Case if ( m_TRTLayout == 1 || m_TRTLayout == 4 || m_TRTLayout == 5 || m_TRTLayout == 6 ) { - hashId = m_cabling->get_identfierHashForAllStraws(intRod, bufferOffset); - return m_cabling->get_identfierForAllStraws(intRod, bufferOffset); + hashId = m_cabling->get_identifierHashForAllStraws(intRod, bufferOffset); + return m_cabling->get_identifierForAllStraws(intRod, bufferOffset); } // DC1, DC2 Case @@ -247,30 +247,30 @@ Identifier TRT_CablingSvc::getIdentifier(const eformat::SubDetector& { shift = m_shiftForLeftEndCapStraws + intRod * m_numberOfStrawsInROD + straw; - hashId = m_cabling->get_identfierHashForAllStraws(shift); - return m_cabling->get_identfierForAllStraws(shift); + hashId = m_cabling->get_identifierHashForAllStraws(shift); + return m_cabling->get_identifierForAllStraws(shift); } if (subdetector == eformat::TRT_BARREL_A_SIDE) { shift = m_shiftForLeftBarrelStraws + intRod * m_numberOfStrawsInBarrelROD + straw; - hashId = m_cabling->get_identfierHashForAllStraws(shift); - return m_cabling->get_identfierForAllStraws(shift); + hashId = m_cabling->get_identifierHashForAllStraws(shift); + return m_cabling->get_identifierForAllStraws(shift); } if (subdetector == eformat::TRT_BARREL_C_SIDE) { shift = m_shiftForRightBarrelStraws + intRod * m_numberOfStrawsInBarrelROD + straw; - hashId = m_cabling->get_identfierHashForAllStraws(shift); - return m_cabling->get_identfierForAllStraws(shift); + hashId = m_cabling->get_identifierHashForAllStraws(shift); + return m_cabling->get_identifierForAllStraws(shift); } shift = m_shiftForRightEndCapStraws + intRod * m_numberOfStrawsInROD + straw; - hashId = m_cabling->get_identfierHashForAllStraws(shift); - return m_cabling->get_identfierForAllStraws(shift); + hashId = m_cabling->get_identifierHashForAllStraws(shift); + return m_cabling->get_identifierForAllStraws(shift); } diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC1.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC1.cxx index bc6d0a3a7765b3e497f989560d6e744e787cab28..adac042b1ba4e7df98cad3a859547a7fc2ef0ad4 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC1.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -332,10 +332,10 @@ void TRT_FillCablingData_DC1::defineTables() for (straw = 0; straw < 1664; ++straw) { Id = defineIdentifier(det_id, phi * 3 + i, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); @@ -352,10 +352,10 @@ void TRT_FillCablingData_DC1::defineTables() for (straw = 0; straw < 1642; ++straw) { Id = defineIdentifier(det_id, phi, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); } @@ -368,10 +368,10 @@ void TRT_FillCablingData_DC1::defineTables() for (straw = 0; straw < 1642; ++straw) { Id = defineIdentifier(det_id, phi, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); } @@ -386,17 +386,17 @@ void TRT_FillCablingData_DC1::defineTables() for (straw = 0; straw < 1664; ++straw) { Id = defineIdentifier(det_id, phi * 3 + i, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); } } } -// ATH_MSG_DEBUG( " m_identfierForAllStraws size " << m_identfierForAllStraws.size() ); +// ATH_MSG_DEBUG( " m_identifierForAllStraws size " << m_identifierForAllStraws.size() ); // Initialize m_allRobs //EventFormat::ModuleType type = EventFormat::ROD_TYPE; diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC2.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC2.cxx index 2adf5eac53370724c7678b4fc4d29eceac42d30f..79b466fc6b1404125526fe4843cb4bf43e6a348b 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC2.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -341,10 +341,10 @@ void TRT_FillCablingData_DC2::defineTables() for (straw = 0; straw < m_numberOfStrawsInROD; ++straw) { Id = defineIdentifier(det_id, phi * 2 + i, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); @@ -358,10 +358,10 @@ void TRT_FillCablingData_DC2::defineTables() for (straw = 0; straw < m_numberOfStrawsInBarrelROD; ++straw) { Id = defineIdentifier(det_id, phi, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); } @@ -373,10 +373,10 @@ void TRT_FillCablingData_DC2::defineTables() for (straw = 0; straw < m_numberOfStrawsInBarrelROD; ++straw) { Id = defineIdentifier(det_id, phi, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); } @@ -390,10 +390,10 @@ void TRT_FillCablingData_DC2::defineTables() for (straw = 0; straw < m_numberOfStrawsInROD; ++straw) { Id = defineIdentifier(det_id, phi * 2 + i, straw); - m_cabling->set_identfierForAllStraws(Id); + m_cabling->set_identifierForAllStraws(Id); IdLayer = m_id_trt->layer_id(Id); if ( !m_id_trt->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(hashId); + m_cabling->set_identifierHashForAllStraws(hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << m_id_trt->show_to_string(IdLayer) ); } diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx index 729a2dac71f2f1e339d8a46bc1104bbf6afbbd5e..1d8efe197f1564c1c16140b30c4a6e3963e36378 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /* @@ -27,7 +27,7 @@ * o 330000 is 2 is EC A * o 340000 is -2 is EC C * - * The m_identfier* and m_collID vectors are indexed by ROB source ID - 1. + * The m_identifier* and m_collID vectors are indexed by ROB source ID - 1. * The magic mapping between ROB source IDs and phi sector indices is in * getRobID() and in fillCollID(). Everything else should just fall * through and gets the Right Answer. @@ -661,8 +661,8 @@ void TRT_FillCablingData_DC3::defineTables() if ( strawNumber < 0 ) { - m_cabling->set_identfierForAllStraws( rodId, ii, NULLstrawID ); - m_cabling->set_identfierHashForAllStraws( rodId, ii, NULLhashId ); + m_cabling->set_identifierForAllStraws( rodId, ii, NULLstrawID ); + m_cabling->set_identifierHashForAllStraws( rodId, ii, NULLhashId ); continue; } @@ -712,7 +712,7 @@ void TRT_FillCablingData_DC3::defineTables() // << strawLayerId << " " << strawInLayerId << " " << std::hex // << strawID << std::dec << endl; - m_cabling->set_identfierForAllStraws( rodId, ii, strawID ); + m_cabling->set_identifierForAllStraws( rodId, ii, strawID ); Identifier Lid = m_TRTHelper->layer_id( SubDet, Phi, moduleId, strawLayerId ); @@ -731,7 +731,7 @@ void TRT_FillCablingData_DC3::defineTables() } - m_cabling->set_identfierHashForAllStraws( rodId, ii, hashId ); + m_cabling->set_identifierHashForAllStraws( rodId, ii, hashId ); } @@ -918,7 +918,7 @@ void TRT_FillCablingData_DC3::defineTables() strawInLayerId ); - m_cabling->set_identfierForAllStraws( rodId, BufferLocation, + m_cabling->set_identifierForAllStraws( rodId, BufferLocation, strawID ); @@ -944,7 +944,7 @@ void TRT_FillCablingData_DC3::defineTables() } - m_cabling->set_identfierHashForAllStraws( rodId, + m_cabling->set_identifierHashForAllStraws( rodId, BufferLocation, hashId ); } // loop over bufferOffsets @@ -1555,8 +1555,8 @@ void TRT_FillCablingData_DC3::defineTables_broken_FDR() if ( strawNumber < 0 ) { - m_cabling->set_identfierForAllStraws( rodId, ii, NULLstrawID ); - m_cabling->set_identfierHashForAllStraws( rodId, ii, NULLhashId ); + m_cabling->set_identifierForAllStraws( rodId, ii, NULLstrawID ); + m_cabling->set_identifierHashForAllStraws( rodId, ii, NULLhashId ); continue; } @@ -1606,7 +1606,7 @@ void TRT_FillCablingData_DC3::defineTables_broken_FDR() // << strawLayerId << " " << strawInLayerId << " " << std::hex // << strawID << std::dec << endl; - m_cabling->set_identfierForAllStraws( rodId, ii, strawID ); + m_cabling->set_identifierForAllStraws( rodId, ii, strawID ); Identifier Lid = m_TRTHelper->layer_id( SubDet, Phi, moduleId, strawLayerId ); @@ -1625,7 +1625,7 @@ void TRT_FillCablingData_DC3::defineTables_broken_FDR() } - m_cabling->set_identfierHashForAllStraws( rodId, ii, hashId ); + m_cabling->set_identifierHashForAllStraws( rodId, ii, hashId ); } @@ -1697,7 +1697,7 @@ void TRT_FillCablingData_DC3::defineTables_broken_FDR() strawInLayerId ); - m_cabling->set_identfierForAllStraws( rodId, BufferLocation, + m_cabling->set_identifierForAllStraws( rodId, BufferLocation, strawID ); @@ -1723,9 +1723,9 @@ void TRT_FillCablingData_DC3::defineTables_broken_FDR() } - m_cabling->set_identfierHashForAllStraws( rodId, - BufferLocation, - hashId ); + m_cabling->set_identifierHashForAllStraws( rodId, + BufferLocation, + hashId ); } // loop over bufferOffsets } // loop over inner, outer Z RODs } // Endcap @@ -1984,7 +1984,7 @@ std::vector<IdentifierHash> & ids) * Input : Straw ID * Output: list of ROB Source IDs */ -std::vector<uint32_t> TRT_FillCablingData_DC3::getRobID(Identifier id) +std::vector<uint32_t> TRT_FillCablingData_DC3::getRobID(Identifier id) const { std::vector<uint32_t> v; uint32_t Source=0; diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h index 9dba829ceb41014f90282705a8892493e34e8ee8..43e6e5cede46cc0bfd1ced121fbb064d75b30663 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_DC3.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -51,7 +51,7 @@ class TRT_FillCablingData_DC3: public AthAlgTool { TRT_CablingData* fillData(); // Get ROBIDs for each Detector Element (Straw Layer) - std::vector<uint32_t> getRobID(Identifier id); + std::vector<uint32_t> getRobID(Identifier id) const; private: //Define map of collection IDs for all ROBs diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.cxx index e0802e2245413f4bc4c374dfe88538c35e4296ed..ceea4282cdd96ab05b0dd614a12c7492f1a9d100 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -13,7 +13,7 @@ * We need to map between phi sector index used in the offline and * the Source IDs programmed in the hardware. * - * The m_identfier* and m_collID vectors are indexed by ROB source ID - 1. + * The m_identifier* and m_collID vectors are indexed by ROB source ID - 1. * The magic mapping between ROB source IDs and phi sector indices is in * getRobID() and in fillCollID(). Everything else should just fall * through and gets the Right Answer. @@ -603,7 +603,7 @@ void TRT_FillCablingData_SR1::defineTables() if ( map_it == con_map.end() ) { - m_cabling->set_identfierForAllStraws( pos->first, + m_cabling->set_identifierForAllStraws( pos->first, i + ConnectorCount*444, NULLstrawID ); continue; @@ -649,7 +649,7 @@ void TRT_FillCablingData_SR1::defineTables() strawInLayerId ); - m_cabling->set_identfierForAllStraws( pos->first, BufferLocation, + m_cabling->set_identifierForAllStraws( pos->first, BufferLocation, strawID ); @@ -675,7 +675,7 @@ void TRT_FillCablingData_SR1::defineTables() } - m_cabling->set_identfierHashForAllStraws( pos->first, + m_cabling->set_identifierHashForAllStraws( pos->first, BufferLocation, hashId ); } @@ -688,7 +688,7 @@ void TRT_FillCablingData_SR1::defineTables() if ( map_it == con_map.end() ) { - m_cabling->set_identfierForAllStraws( pos->first, i, + m_cabling->set_identifierForAllStraws( pos->first, i, NULLstrawID ); continue; } @@ -717,7 +717,7 @@ void TRT_FillCablingData_SR1::defineTables() strawInLayerId ); - m_cabling->set_identfierForAllStraws( pos->first, BufferLocation, + m_cabling->set_identifierForAllStraws( pos->first, BufferLocation, strawID ); @@ -743,9 +743,9 @@ void TRT_FillCablingData_SR1::defineTables() } - m_cabling->set_identfierHashForAllStraws( pos->first, - BufferLocation, - hashId ); + m_cabling->set_identifierHashForAllStraws( pos->first, + BufferLocation, + hashId ); } // loop over bufferOffsets } // Endcap } // loop over GCM @@ -988,7 +988,7 @@ std::vector<IdentifierHash> & ids) * Input : Straw ID * Output: list of ROB Source IDs */ -std::vector<uint32_t> TRT_FillCablingData_SR1::getRobID(Identifier id) +std::vector<uint32_t> TRT_FillCablingData_SR1::getRobID(Identifier id) const { std::vector<uint32_t> v; @@ -1009,17 +1009,12 @@ std::vector<uint32_t> TRT_FillCablingData_SR1::getRobID(Identifier id) id_phi_module = id_phi_module + 32 * id_barrel_ec; - std::vector<u_int32_t> SourceList = m_phi_to_source[id_phi_module]; - - vector<uint32_t>::iterator it1 = SourceList.begin(); - vector<uint32_t>::iterator it2 = SourceList.end(); - - while( it1 != it2 ) - { - eformat::helper::SourceIdentifier sid( *it1 ); - v.push_back(sid.code()); - - ++it1; + const auto& it = m_phi_to_source.find (id_phi_module); + if (it != m_phi_to_source.end()) { + for (u_int32_t id : it->second) { + eformat::helper::SourceIdentifier sid( id ); + v.push_back(sid.code()); + } } return v; diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.h b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.h index 9f3f089c5b1d786c18aa82fb37c77073568250eb..83b18c07d1a8ac7b1bb7df7f283a2e81272c8ce9 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.h +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -60,7 +60,7 @@ public: void defineCollID(); // Get ROBIDs for each Detector Element (Straw Layer) - std::vector<uint32_t> getRobID(Identifier id); + std::vector<uint32_t> getRobID(Identifier id) const; void fillCollID(uint32_t rob_id, std::vector<IdentifierHash> & ids); diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.cxx index e7f73973ba008b31579b97800d985f709640cb18..9748130fe47d614fedd3843268fe079e521289c1 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -13,7 +13,7 @@ * We need to map between phi sector index used in the offline and * the Source IDs programmed in the hardware. * - * The m_identfier* and m_collID vectors are indexed by ROB source ID - 1. + * The m_identifier* and m_collID vectors are indexed by ROB source ID - 1. * The magic mapping between ROB source IDs and phi sector indices is in * getRobID() and in fillCollID(). Everything else should just fall * through and gets the Right Answer. @@ -709,7 +709,7 @@ void TRT_FillCablingData_SR1_ECC::defineTables() if ( map_it == con_map.end() ) { - m_cabling->set_identfierForAllStraws( pos->first, + m_cabling->set_identifierForAllStraws( pos->first, i + ConnectorCount*444, NULLstrawID ); continue; @@ -755,7 +755,7 @@ void TRT_FillCablingData_SR1_ECC::defineTables() strawInLayerId ); - m_cabling->set_identfierForAllStraws( pos->first, BufferLocation, + m_cabling->set_identifierForAllStraws( pos->first, BufferLocation, strawID ); @@ -781,7 +781,7 @@ void TRT_FillCablingData_SR1_ECC::defineTables() } - m_cabling->set_identfierHashForAllStraws( pos->first, + m_cabling->set_identifierHashForAllStraws( pos->first, BufferLocation, hashId ); } @@ -794,7 +794,7 @@ void TRT_FillCablingData_SR1_ECC::defineTables() if ( map_it == con_map.end() ) { - m_cabling->set_identfierForAllStraws( pos->first, i, + m_cabling->set_identifierForAllStraws( pos->first, i, NULLstrawID ); continue; } @@ -832,7 +832,7 @@ void TRT_FillCablingData_SR1_ECC::defineTables() // ATH_MSG_INFO( m_TRTHelper->print_to_string( strawID ) << " bufferOffset: " << BufferLocation ); - m_cabling->set_identfierForAllStraws( pos->first, BufferLocation, + m_cabling->set_identifierForAllStraws( pos->first, BufferLocation, strawID ); @@ -858,9 +858,9 @@ void TRT_FillCablingData_SR1_ECC::defineTables() } - m_cabling->set_identfierHashForAllStraws( pos->first, - BufferLocation, - hashId ); + m_cabling->set_identifierHashForAllStraws( pos->first, + BufferLocation, + hashId ); } // loop over bufferOffsets } // Endcap } // loop over GCM @@ -1104,7 +1104,7 @@ std::vector<IdentifierHash> & ids) * Input : Straw ID * Output: list of ROB Source IDs */ -std::vector<uint32_t> TRT_FillCablingData_SR1_ECC::getRobID(Identifier id) +std::vector<uint32_t> TRT_FillCablingData_SR1_ECC::getRobID(Identifier id) const { std::vector<uint32_t> v; @@ -1125,17 +1125,12 @@ std::vector<uint32_t> TRT_FillCablingData_SR1_ECC::getRobID(Identifier id) id_phi_module = id_phi_module + 32 * id_barrel_ec; - std::vector<u_int32_t> SourceList = m_phi_to_source[id_phi_module]; - - vector<uint32_t>::iterator it1 = SourceList.begin(); - vector<uint32_t>::iterator it2 = SourceList.end(); - - while( it1 != it2 ) - { - eformat::helper::SourceIdentifier sid( *it1 ); - v.push_back(sid.code()); - - ++it1; + const auto& it = m_phi_to_source.find (id_phi_module); + if (it != m_phi_to_source.end()) { + for (uint32_t id : it->second) { + eformat::helper::SourceIdentifier sid( id ); + v.push_back(sid.code()); + } } return v; diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.h b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.h index 2e7fdef4b83778938b3588af97120c82d930889b..ace91b0c14252fb9538adc8b4e893cf7fabfa518 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.h +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_SR1_ECC.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -59,7 +59,7 @@ public: void defineCollID(); // Get ROBIDs for each Detector Element (Straw Layer) - std::vector<uint32_t> getRobID(Identifier id); + std::vector<uint32_t> getRobID(Identifier id) const; void fillCollID(uint32_t rob_id, std::vector<IdentifierHash> & ids); diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.cxx b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.cxx index a4027d1d212f11beea420cea3128192c0433b05a..a026add7b34bd780ee0d8cf50547f1335b18e00a 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.cxx +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -12,7 +12,7 @@ * We need to map between phi sector index used in the offline and * the Source IDs programmed in the hardware. * - * The m_identfier* and m_collID vectors are indexed by ROB source ID - 1. + * The m_identifier* and m_collID vectors are indexed by ROB source ID - 1. * The magic mapping between ROB source IDs and phi sector indices is in * getRobID() and in fillCollID(). Everything else should just fall * through and gets the Right Answer. @@ -168,8 +168,8 @@ void TRT_FillCablingData_TB04::defineTables() tempbuff.push_back(id); tempbuff2.push_back(0); } - m_cabling->zero_identfierForAllStraws(rod, tempbuff); - m_cabling->zero_identfierHashForAllStraws(rod, tempbuff2); + m_cabling->zero_identifierForAllStraws(rod, tempbuff); + m_cabling->zero_identifierHashForAllStraws(rod, tempbuff2); std::ostringstream ssFile; ssFile << rod; @@ -264,13 +264,13 @@ void TRT_FillCablingData_TB04::defineTables() // Construct an Identifier and put it in the list strawID = m_TRTHelper->straw_id(barrelId, phiModuleId, moduleId, strawLayerId, strawInLayerId); - m_cabling->set_identfierForAllStraws(0x310000 + rodSourceId, BufferLocation, strawID); + m_cabling->set_identifierForAllStraws(0x310000 + rodSourceId, BufferLocation, strawID); // Construct Hash and put it in the list IdLayer = m_TRTHelper->layer_id(strawID); if ( !m_TRTHelper->get_hash(IdLayer, hashId, &m_cntx) ) - m_cabling->set_identfierHashForAllStraws(0x310000 + rodSourceId, - BufferLocation, hashId); + m_cabling->set_identifierHashForAllStraws(0x310000 + rodSourceId, + BufferLocation, hashId); else ATH_MSG_DEBUG( "defineTables: unable to get hash for IdLayer " << IdLayer ); @@ -404,7 +404,7 @@ std::vector<IdentifierHash> & ids) * Input : Straw ID * Output: list of ROB Source IDs */ -std::vector<uint32_t> TRT_FillCablingData_TB04::getRobID(Identifier id) +std::vector<uint32_t> TRT_FillCablingData_TB04::getRobID(Identifier id) const { std::vector<uint32_t> v; diff --git a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.h b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.h index 62325be70e69a59083bce353a0b32e0a88c5b278..48a9276d6e9dea4baaccd3098479494c31dfe343 100644 --- a/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.h +++ b/InnerDetector/InDetDetDescr/TRT_Cabling/src/TRT_FillCablingData_TB04.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // @@ -56,7 +56,7 @@ public: void defineCollID(); // Get ROBIDs for each Detector Element (Straw Layer) - std::vector<uint32_t> getRobID(Identifier id); + std::vector<uint32_t> getRobID(Identifier id) const; void fillCollID(uint32_t rob_id, std::vector<IdentifierHash> & ids);