diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..ec7a6ce334d8a33090e0b705f75d3e434b35a802 --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h index efd2e08ebd0e9240a79690ed0cfc26b40857093b..2631924a59c7042bc5fbbae2c6444459d0648e34 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINER_P1_H @@ -18,6 +20,9 @@ class InDetBSErrContainer_p1 friend class InDetBSErrContainerCnv_p1; private: std::vector<std::pair<IdentifierHash, int32_t>* > m_bsErrs; + // Pointer data member is fine for ROOT persistency but has an overhead. + // https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#pointers-and-references-in-persistency + // https://its.cern.ch/jira/browse/ATLASRECTS-4937 }; // inlines diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p2.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..352830b13ac224fba00b677757890e0b2f8b23ae --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p2.h @@ -0,0 +1,25 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINER_P2_H +#define INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINER_P2_H + +#include "Identifier/IdentifierHash.h" + +#include <utility> +#include <vector> + +class InDetBSErrContainer_p2 +{ + public: + /// Default constructor + InDetBSErrContainer_p2 () {}; + friend class InDetBSErrContainerCnv_p2; + private: + std::vector<std::pair<IdentifierHash, int>> m_bsErrs; +}; + +#endif // InDetBSErrContainer_p2 diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h index 7646e6ce64fc60aface5358900eb495ebc59e5e7..b0a90ef02e503493118bf20c13fa8ba5560635b2 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h @@ -1,10 +1,13 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETBYTESTREAMERRORSATHENAPOOL_INDETBYTESTREAMERRORSATHENAPOOLDICT_H #define INDETBYTESTREAMERRORSATHENAPOOL_INDETBYTESTREAMERRORSATHENAPOOLDICT_H #include "InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h" +#include "InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p2.h" #include "InDetByteStreamErrorsAthenaPool/TRT_BSErrContainer_p1.h" #include "InDetByteStreamErrorsAthenaPool/TRT_BSIdErrContainer_p1.h" #include "InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h" diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h index b7c3fe1bade3ddc749466698a23e5c81533649c6..7b933c532b037d2a0d470728c1b1c199083bf041 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINER_P1_H diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml index c554a2c40f15a95d7472f60208ac31f6d911615b..39bb05e4c11f260d35f54e29701b7cb733179c5f 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml @@ -1,5 +1,6 @@ <lcgdict> <class name="InDetBSErrContainer_p1" id="FA64DC17-D07E-4305-9B21-18C64F1B4C47" /> + <class name="InDetBSErrContainer_p2" id="ECBBC13B-0A44-4694-AD24-574A7598C627" /> <class name="TRT_BSErrContainer_p1" id="D461AC01-02CA-4A9E-886B-24EC14309121" /> <class name="TRT_BSIdErrContainer_p1" id="26F44F1E-D1F5-43B3-93E9-09376AB37491" /> <class name="SCT_ByteStreamFractionContainer_p1" id="EB75984C-F651-4F40-BA1C-9C2A0A558A55" /> diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.cxx index 92a3fc3e06ddb9ebd6abc3b05da0d662f8cc4ce5..81cfe9d02cae24811578e4742a7e3d66ec1d6334 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -12,19 +12,20 @@ InDetBSErrContainer_PERS* InDetBSErrContainerCnv::createPersistent(InDetBSErrContainer* transCont) { - MsgStream log(msgSvc(), "InDetBSErrContainerCnv" ); - InDetBSErrContainer_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + MsgStream log{msgSvc(), "InDetBSErrContainerCnv"}; + InDetBSErrContainer_PERS* persObj{m_TPConverter_PERS.createPersistent(transCont, log)}; return persObj; } InDetBSErrContainer* InDetBSErrContainerCnv::createTransient() { - MsgStream log(msgSvc(), "InDetBSErrContainerCnv" ); - static pool::Guid p1_guid("FA64DC17-D07E-4305-9B21-18C64F1B4C47"); - if( compareClassGuid(p1_guid) ) { - /** using auto_ptr ensures deletion of the persistent object */ - std::auto_ptr< InDetBSErrContainer_p1 > col_vect( poolReadObject< InDetBSErrContainer_p1 >() ); - return m_TPConverter.createTransient( col_vect.get(), log ); + MsgStream log{msgSvc(), "InDetBSErrContainerCnv"}; + static const pool::Guid p1_guid{"FA64DC17-D07E-4305-9B21-18C64F1B4C47"}; + static const pool::Guid p2_guid{"ECBBC13B-0A44-4694-AD24-574A7598C627"}; + if (compareClassGuid(p1_guid)) { + return m_TPConverter_p1.createTransient(poolReadObject<InDetBSErrContainer_p1>(), log); + } else if (compareClassGuid(p2_guid)) { + return m_TPConverter_PERS.createTransient(poolReadObject<InDetBSErrContainer_p2>(), log); } throw std::runtime_error("Unsupported persistent version of Data Collection"); } diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.h index 9866fd7495516ea9e48c070f03f8030cd7df46be..4d6249d8befe03803198a8d8a727f22917f5741c 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -17,9 +19,10 @@ #include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" #include "InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h" #include "InDetBSErrContainerCnv_p1.h" +#include "InDetBSErrContainerCnv_p2.h" /** the latest persistent representation type of DataCollection: */ -typedef InDetBSErrContainer_p1 InDetBSErrContainer_PERS; +typedef InDetBSErrContainer_p2 InDetBSErrContainer_PERS; typedef T_AthenaPoolCustomCnv<InDetBSErrContainer, InDetBSErrContainer_PERS > InDetBSErrContainerCnvBase; class InDetBSErrContainerCnv : public InDetBSErrContainerCnvBase { @@ -30,6 +33,7 @@ protected: virtual InDetBSErrContainer_PERS* createPersistent (InDetBSErrContainer* transCont); virtual InDetBSErrContainer* createTransient (); - InDetBSErrContainerCnv_p1 m_TPConverter; + InDetBSErrContainerCnv_p1 m_TPConverter_p1; + InDetBSErrContainerCnv_p2 m_TPConverter_PERS; // The latest one should be PERS. Currently p2 is PERS. }; #endif diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx index a4c676d04e6d11f88aba27442dfa5a8b7cb6de11..a4963345dcd945ef84350c7fcb7719c4f3acb330 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.cxx @@ -1,15 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h" -#include "InDetByteStreamErrors/InDetBSErrContainer.h" #include "InDetBSErrContainerCnv_p1.h" -#include "Identifier/IdentifierHash.h" -#include "AthAllocators/DataPool.h" - -void InDetBSErrContainerCnv_p1::transToPers(const InDetBSErrContainer* transCont, InDetBSErrContainer_p1* persCont, MsgStream & /*log */) +void InDetBSErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE (const InDetBSErrContainer* transCont, InDetBSErrContainer_p1* persCont, MsgStream& /*log*/) { InDetBSErrContainer::const_iterator it = transCont->begin(); InDetBSErrContainer::const_iterator itEnd = transCont->end(); @@ -24,9 +19,8 @@ void InDetBSErrContainerCnv_p1::transToPers(const InDetBSErrContainer* transCont return; } -void InDetBSErrContainerCnv_p1::persToTrans(const InDetBSErrContainer_p1* persCont, InDetBSErrContainer* transCont, MsgStream & /*log */) +void InDetBSErrContainerCnv_p1::persToTrans(const InDetBSErrContainer_p1* persCont, InDetBSErrContainer* transCont, MsgStream& /*log*/) { - std::vector<std::pair<IdentifierHash, int>* >::const_iterator it = (persCont->m_bsErrs).begin(); std::vector<std::pair<IdentifierHash, int>* >::const_iterator itEnd = (persCont->m_bsErrs).end(); transCont->reserve((persCont->m_bsErrs).size()); @@ -40,7 +34,7 @@ void InDetBSErrContainerCnv_p1::persToTrans(const InDetBSErrContainer_p1* persC //================================================================ InDetBSErrContainer* InDetBSErrContainerCnv_p1::createTransient(const InDetBSErrContainer_p1* persObj, MsgStream& log) { - std::auto_ptr<InDetBSErrContainer> trans(new InDetBSErrContainer()); + std::unique_ptr<InDetBSErrContainer> trans(std::make_unique<InDetBSErrContainer>()); persToTrans(persObj, trans.get(), log); return(trans.release()); } diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.h index 076db36c5faa93cfe3ecce7c33854bbdc9df96cd..75a3a374b4c07c6bb8aa05c7e3ee07c51b55623c 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p1.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINERCNV_P1_H diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p2.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f85312b1241fdec8eaac2a68699f1df849553b1f --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p2.cxx @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetBSErrContainerCnv_p2.h" + +void InDetBSErrContainerCnv_p2::transToPers(const InDetBSErrContainer* transCont, InDetBSErrContainer_p2* persCont, MsgStream& log) +{ + (persCont->m_bsErrs).reserve(transCont->size()); + for (const std::pair<IdentifierHash, int>* bsErr: *transCont) { + if (bsErr==nullptr) { + log << MSG::WARNING << "const std::pair<IdentifierHash, int>* is nullptr and skipped." << endmsg; + continue; + } + (persCont->m_bsErrs).push_back(*bsErr); + } + + return; +} + +void InDetBSErrContainerCnv_p2::persToTrans(const InDetBSErrContainer_p2* persCont, InDetBSErrContainer* transCont, MsgStream& /*log*/) +{ + transCont->reserve((persCont->m_bsErrs).size()); + for (const std::pair<IdentifierHash, int>& bsErr: persCont->m_bsErrs) { + transCont->push_back(std::make_unique<std::pair<IdentifierHash, int>>(bsErr)); + } + + return; +} + +//================================================================ +InDetBSErrContainer* InDetBSErrContainerCnv_p2::createTransient(const InDetBSErrContainer_p2* persObj, MsgStream& log) { + std::unique_ptr<InDetBSErrContainer> trans{std::make_unique<InDetBSErrContainer>()}; + persToTrans(persObj, trans.get(), log); + return trans.release(); +} diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p2.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..851284f35d4d815bbe4d3f06cba6882f723223bc --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/InDetBSErrContainerCnv_p2.h @@ -0,0 +1,30 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINERCNV_P2_H +#define INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINERCNV_P2_H + +#include "InDetByteStreamErrors/InDetBSErrContainer.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p2.h" + +class InDetBSErrContainerCnv_p2 : public T_AthenaPoolTPCnvBase<InDetBSErrContainer, InDetBSErrContainer_p2> +{ + public: + InDetBSErrContainerCnv_p2() {}; + + virtual void persToTrans(const InDetBSErrContainer_p2* persCont, + InDetBSErrContainer* transCont, + MsgStream& log); + virtual void transToPers(const InDetBSErrContainer* transCont, + InDetBSErrContainer_p2* persCont, + MsgStream& log); + virtual InDetBSErrContainer* createTransient(const InDetBSErrContainer_p2* persObj, + MsgStream& log); + +}; + +#endif // INDETBYTESTREAMERRORSATHENAPOOL_INDETBSERRCONTAINERCNV_P2_H diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx index a896010a4d8dc358cf1f91b143a1e52cb1fe682b..2dc51be413f05321a648622944d980ad39acbad2 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -22,8 +22,8 @@ SCT_ByteStreamFractionContainerCnv::createTransient() { MsgStream log(msgSvc(), "SCT_ByteStreamFractionContainerCnv" ); const pool::Guid p1_guid("EB75984C-F651-4F40-BA1C-9C2A0A558A55"); if( compareClassGuid(p1_guid) ) { - /** using auto_ptr ensures deletion of the persistent object */ - std::auto_ptr< SCT_ByteStreamFractionContainer_p1 > col_vect( poolReadObject< SCT_ByteStreamFractionContainer_p1 >() ); + /** using unique_ptr ensures deletion of the persistent object */ + std::unique_ptr< SCT_ByteStreamFractionContainer_p1 > col_vect( poolReadObject< SCT_ByteStreamFractionContainer_p1 >() ); return m_TPConverter.createTransient( col_vect.get(), log ); } throw std::runtime_error("Unsupported persistent version of Data Collection"); diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.h index 7d448fb6de3ade2ba7bd4d5fbe1688fbe2eefc93..c2dc906df43556e240034f9eafe0ad04b848513f 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx index 81fde69fdbb17cee608216af1a526eee334b83f2..1aea2084cbc800fab1199db22a86da1c4bd251cf 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h" @@ -40,7 +40,7 @@ void SCT_ByteStreamFractionContainerCnv_p1::persToTrans(const SCT_ByteStreamFrac //================================================================ SCT_ByteStreamFractionContainer* SCT_ByteStreamFractionContainerCnv_p1::createTransient(const SCT_ByteStreamFractionContainer_p1* persObj, MsgStream& log) { - std::auto_ptr<SCT_ByteStreamFractionContainer> trans(new SCT_ByteStreamFractionContainer()); + std::unique_ptr<SCT_ByteStreamFractionContainer> trans(std::make_unique<SCT_ByteStreamFractionContainer>()); persToTrans(persObj, trans.get(), log); return(trans.release()); } diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.h index 4638154c0b8e8cb639cc49e9e594b956523d8b5c..9f06438a31099e8efe607e02fa4295d460ed96a0 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.h @@ -1,5 +1,7 @@ +// -*- C++ -*- + /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINERCNV_P1_H diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv.cxx index a6677ddc3010bdb4b239de32bfc24a52fa3f38da..4d819af74b347593802c125a3ae80982df6e5ed2 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -23,10 +23,10 @@ TRT_BSErrContainerCnv::createPersistent(TRT_BSErrContainer* transCont) { TRT_BSErrContainer* TRT_BSErrContainerCnv::createTransient() { MsgStream log(msgSvc(), "TRT_BSErrContainerCnv" ); - static pool::Guid p1_guid("D461AC01-02CA-4A9E-886B-24EC14309121"); + static const pool::Guid p1_guid("D461AC01-02CA-4A9E-886B-24EC14309121"); if( compareClassGuid(p1_guid) ) { - // using auto_ptr ensures deletion of the persistent object - std::auto_ptr< TRT_BSErrContainer_p1 > col_vect( poolReadObject< TRT_BSErrContainer_p1 >() ); + // using unique_ptr ensures deletion of the persistent object + std::unique_ptr< TRT_BSErrContainer_p1 > col_vect( poolReadObject< TRT_BSErrContainer_p1 >() ); return m_TPConverter.createTransient( col_vect.get(), log ); } throw std::runtime_error("Unsupported persistent version of Data Collection"); diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv_p1.cxx index 257ad611ce883fc011e68e81feb442ef93d3adab..3d8d7ff37879da00f1853bfee13ab6492fddf80d 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv_p1.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSErrContainerCnv_p1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "InDetByteStreamErrorsAthenaPool/TRT_BSErrContainer_p1.h" @@ -11,7 +11,7 @@ #include <iostream> -void TRT_BSErrContainerCnv_p1::transToPers(const TRT_BSErrContainer* transCont, TRT_BSErrContainer_p1* persCont, MsgStream & /* log */) +void TRT_BSErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE (const TRT_BSErrContainer* transCont, TRT_BSErrContainer_p1* persCont, MsgStream & /* log */) { TRT_BSErrContainer::const_iterator it = transCont->begin(); TRT_BSErrContainer::const_iterator itEnd = transCont->end(); @@ -42,7 +42,7 @@ void TRT_BSErrContainerCnv_p1::persToTrans(const TRT_BSErrContainer_p1* persCon //================================================================ TRT_BSErrContainer* TRT_BSErrContainerCnv_p1::createTransient(const TRT_BSErrContainer_p1* persObj, MsgStream& log) { - std::auto_ptr<TRT_BSErrContainer> trans(new TRT_BSErrContainer()); + std::unique_ptr<TRT_BSErrContainer> trans(std::make_unique<TRT_BSErrContainer>()); persToTrans(persObj, trans.get(), log); return(trans.release()); } diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv.cxx index c12a6cb1f7ac1ef314bdda290f71fb402ffe5995..481e4d5c2b431a89eca95e80252480ffd1aca1c7 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /** @@ -20,10 +20,10 @@ TRT_BSIdErrContainerCnv::createPersistent(TRT_BSIdErrContainer* transCont) { TRT_BSIdErrContainer* TRT_BSIdErrContainerCnv::createTransient() { MsgStream log(msgSvc(), "TRT_BSIdErrContainerCnv" ); - static pool::Guid p1_guid("26F44F1E-D1F5-43B3-93E9-09376AB37491"); + static const pool::Guid p1_guid("26F44F1E-D1F5-43B3-93E9-09376AB37491"); if( compareClassGuid(p1_guid) ) { - // using auto_ptr ensures deletion of the persistent object - std::auto_ptr< TRT_BSIdErrContainer_p1 > col_vect( poolReadObject< TRT_BSIdErrContainer_p1 >() ); + // using unique_ptr ensures deletion of the persistent object + std::unique_ptr< TRT_BSIdErrContainer_p1 > col_vect( poolReadObject< TRT_BSIdErrContainer_p1 >() ); return m_TPConverter.createTransient( col_vect.get(), log ); } throw std::runtime_error("Unsupported persistent version of Data Collection"); diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx index bb0cfb0b4874023edcfdafb161d6633163c52808..e34c7439f0b7827eea4059d81a9962596ff04056 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/TRT_BSIdErrContainerCnv_p1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "InDetByteStreamErrorsAthenaPool/TRT_BSIdErrContainer_p1.h" @@ -11,7 +11,7 @@ #include <iostream> -void TRT_BSIdErrContainerCnv_p1::transToPers(const TRT_BSIdErrContainer* transCont, TRT_BSIdErrContainer_p1* persCont, MsgStream & /* log */) +void TRT_BSIdErrContainerCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE (const TRT_BSIdErrContainer* transCont, TRT_BSIdErrContainer_p1* persCont, MsgStream & /* log */) { TRT_BSIdErrContainer::const_iterator it = transCont->begin(); TRT_BSIdErrContainer::const_iterator itEnd = transCont->end(); @@ -42,7 +42,7 @@ void TRT_BSIdErrContainerCnv_p1::persToTrans(const TRT_BSIdErrContainer_p1* per //================================================================ TRT_BSIdErrContainer* TRT_BSIdErrContainerCnv_p1::createTransient(const TRT_BSIdErrContainer_p1* persObj, MsgStream& log) { - std::auto_ptr<TRT_BSIdErrContainer> trans(new TRT_BSIdErrContainer()); + std::unique_ptr<TRT_BSIdErrContainer> trans(std::make_unique<TRT_BSIdErrContainer>()); persToTrans(persObj, trans.get(), log); return(trans.release()); } diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testBSError.py b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testBSError.py new file mode 100644 index 0000000000000000000000000000000000000000..dcce22f4d8b10e9fb628ed5e02761faf372e4800 --- /dev/null +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/share/testBSError.py @@ -0,0 +1,110 @@ +import AthenaCommon.AtlasUnixStandardJob + +#-------------------------------------------------------------- +# Thread-specific setup +#-------------------------------------------------------------- +from AthenaCommon.ConcurrencyFlags import jobproperties +numThreads = jobproperties.ConcurrencyFlags.NumThreads() +if numThreads > 0: + from AthenaCommon.AlgScheduler import AlgScheduler + AlgScheduler.CheckDependencies( True ) + AlgScheduler.ShowControlFlow( True ) + AlgScheduler.ShowDataDependencies( True ) + +# use auditors +from AthenaCommon.AppMgr import ServiceMgr +from GaudiSvc.GaudiSvcConf import AuditorSvc +ServiceMgr += AuditorSvc() +theAuditorSvc = ServiceMgr.AuditorSvc +theAuditorSvc.Auditors += ["ChronoAuditor"] +theAuditorSvc.Auditors += ["MemStatAuditor"] +theApp.AuditAlgorithms=True + + +#-------------------------------------------------------------- +# Load Geometry +#-------------------------------------------------------------- +from AthenaCommon.GlobalFlags import globalflags +globalflags.DetDescrVersion="ATLAS-R2-2016-01-00-01" +globalflags.DetGeo="atlas" +globalflags.InputFormat="pool" +globalflags.DataSource="data" +print globalflags + +#-------------------------------------------------------------- +# Set Detector setup +#-------------------------------------------------------------- +# --- switch on InnerDetector +from AthenaCommon.DetFlags import DetFlags +DetFlags.ID_setOff() +DetFlags.Calo_setOff() +DetFlags.Muon_setOff() +DetFlags.Truth_setOff() +DetFlags.LVL1_setOff() +DetFlags.SCT_setOn() + +# ---- switch parts of ID off/on as follows +#switch off tasks +DetFlags.pileup.all_setOff() +DetFlags.simulate.all_setOff() +DetFlags.makeRIO.all_setOff() +DetFlags.writeBS.all_setOff() +DetFlags.readRDOBS.all_setOff() +DetFlags.readRIOBS.all_setOff() +DetFlags.readRIOPool.all_setOff() +DetFlags.writeRIOPool.all_setOff() + + + +import AtlasGeoModel.SetGeometryVersion +import AtlasGeoModel.GeoModelInit + +from AthenaCommon.AlgSequence import AlgSequence + +job = AlgSequence() + +# Set up SCT cabling +from AthenaCommon.Include import include +include('InDetRecExample/InDetRecCabling.py') + +#-------------------------------------------------------------- +# Load IOVDbSvc +#-------------------------------------------------------------- + +IOVDbSvc = Service("IOVDbSvc") +from IOVDbSvc.CondDB import conddb +IOVDbSvc.GlobalTag="CONDBR2-BLKPA-2018-03" + +from SCT_ConditionsTools.SCT_ConfigurationConditionsToolSetup import SCT_ConfigurationConditionsToolSetup +sct_ConfigurationConditionsToolSetup = SCT_ConfigurationConditionsToolSetup() +sct_ConfigurationConditionsToolSetup.setup() +SCT_ConfigurationConditionsTool = sct_ConfigurationConditionsToolSetup.getTool() + +from SCT_ConditionsTools.SCT_ByteStreamErrorsToolSetup import SCT_ByteStreamErrorsToolSetup +sct_ByteStreamErrorsToolSetup = SCT_ByteStreamErrorsToolSetup() +sct_ByteStreamErrorsToolSetup.setConfigTool(SCT_ConfigurationConditionsTool) +sct_ByteStreamErrorsToolSetup.setup() +SCT_ByteStreamErrorsTool = sct_ByteStreamErrorsToolSetup.getTool() + +SCT_ByteStreamErrorsTool.OutputLevel=DEBUG + +from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_ByteStreamErrorsTestAlg +job+= SCT_ByteStreamErrorsTestAlg(ByteStreamErrorsTool=SCT_ByteStreamErrorsTool) + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +if numThreads >= 2: + from SCT_ConditionsAlgorithms.SCTCondAlgCardinality import sctCondAlgCardinality + sctCondAlgCardinality.set(numThreads) + job.SCT_ByteStreamErrorsTestAlg.Cardinality = numThreads + +import AthenaPoolCnvSvc.ReadAthenaPool +from PoolSvc.PoolSvcConf import PoolSvc +ServiceMgr += PoolSvc() + +athenaCommonFlags.FilesInput = [ "./ESD.pool.root" ] +ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput.get_Value() + +theApp.EvtMax = -1 + +ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" + diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ByteStreamErrorsTestAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ByteStreamErrorsTestAlg.cxx new file mode 100644 index 0000000000000000000000000000000000000000..81caf08fbc3ffab8d815076ab0e64086c014ef4f --- /dev/null +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ByteStreamErrorsTestAlg.cxx @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file SCT_ByteStreamErrorsTestAlg.cxx + * + * @brief Class to test SCT_ByteStreamErrorsTool (implementation) + * + * @author Susumu.Oda@cern.ch + **/ + +#include "SCT_ByteStreamErrorsTestAlg.h" + +SCT_ByteStreamErrorsTestAlg::SCT_ByteStreamErrorsTestAlg(const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator) { +} + +//Initialize +StatusCode SCT_ByteStreamErrorsTestAlg::initialize() { + ATH_MSG_INFO("Calling initialize"); + + // Retrieve bytestream error tool + ATH_CHECK(m_bsErrTool.retrieve()); + + return StatusCode::SUCCESS; +} + +//Execute +StatusCode SCT_ByteStreamErrorsTestAlg::execute(const EventContext& ctx) const { + ATH_MSG_INFO("Calling execute"); + + const std::array<std::set<IdentifierHash>, SCT_ByteStreamErrors::NUM_ERROR_TYPES>* errorSets{m_bsErrTool->getErrorSets(ctx)}; + ATH_MSG_ALWAYS("------------------------------------------------------------"); + for (unsigned int iErr{0}; iErr<SCT_ByteStreamErrors::NUM_ERROR_TYPES; iErr++) { + ATH_MSG_ALWAYS("BS Error index: " << iErr << " type " << SCT_ByteStreamErrors::errorTypesDescription[iErr].c_str()); + const std::set<IdentifierHash>& errorSet{(*errorSets)[iErr]}; + for (const IdentifierHash& hash: errorSet) { + ATH_MSG_ALWAYS(" Wafer hash : " << hash); + } + ATH_MSG_ALWAYS("------------------------------------------------------------"); + } + + return StatusCode::SUCCESS; +} + +//Finalize +StatusCode SCT_ByteStreamErrorsTestAlg::finalize() { + ATH_MSG_INFO("Calling finalize"); + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ByteStreamErrorsTestAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ByteStreamErrorsTestAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..b5a454c754d36a14ab24f90f5e3aa48dde087e32 --- /dev/null +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/SCT_ByteStreamErrorsTestAlg.h @@ -0,0 +1,41 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file SCT_ByteStreamErrorsTestAlg.h + * + * @brief Class to test SCT_ByteStreamErrorsTool (header) + * + * @author Susumu.Oda@cern.ch + **/ + +#ifndef SCT_ByteStreamErrorsTestAlg_H +#define SCT_ByteStreamErrorsTestAlg_H + +//Athena +#include "AthenaBaseComps/AthReentrantAlgorithm.h" + +#include "SCT_ConditionsTools/ISCT_ByteStreamErrorsTool.h" + +//Gaudi +#include "GaudiKernel/ToolHandle.h" + +class SCT_ByteStreamErrorsTestAlg : public AthReentrantAlgorithm { + public: + SCT_ByteStreamErrorsTestAlg(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~SCT_ByteStreamErrorsTestAlg() = default; + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + virtual StatusCode finalize() override; + /** Make this algorithm clonable. */ + virtual bool isClonable() const override { return true; }; + + private: + ToolHandle<ISCT_ByteStreamErrorsTool> m_bsErrTool{this, "ByteStreamErrorsTool", "SCT_ByteStreamErrorsTool", "Tool to retrieve SCT bytestream errors"}; +}; + +#endif // SCT_ByteStreamErrorsTestAlg_H diff --git a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx index ec0fbc62f1f067c0b7a83be817df8c941ab3f4eb..58928ac93b78130ff8c31abb90362219395ef6e7 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsAlgorithms/src/components/SCT_ConditionsAlgorithms_entries.cxx @@ -1,4 +1,5 @@ #include "../SCT_AlignCondAlg.h" +#include "../SCT_ByteStreamErrorsTestAlg.h" #include "../SCT_ConditionsParameterCondAlg.h" #include "../SCT_ConditionsParameterTestAlg.h" #include "../SCT_ConditionsSummaryTestAlg.h" @@ -35,6 +36,7 @@ #include "../SCT_TdaqEnabledTestAlg.h" DECLARE_COMPONENT( SCT_AlignCondAlg ) +DECLARE_COMPONENT( SCT_ByteStreamErrorsTestAlg ) DECLARE_COMPONENT( SCT_ConditionsParameterCondAlg ) DECLARE_COMPONENT( SCT_ConditionsParameterTestAlg ) DECLARE_COMPONENT( SCT_ConditionsSummaryTestAlg ) diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx index 93d53e37eaaeaa10958d6ddc67e9ff9ea49a5285..3c60d4b5c67a7c872d3820fa904d3d3e7e086160 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_ByteStreamErrorsTool.cxx @@ -396,12 +396,12 @@ SCT_ByteStreamErrorsTool::fillData(const EventContext& ctx) const { /// However, ABCDError_Chip0-ABCDError_Chip5 and TempMaskedChip0-TempMaskedChip5 are not common for two links. if (side==0) { IdentifierHash otherSide{IdentifierHash(elt->first + 1)}; - addError(otherSide,elt->second, ctx); - ATH_MSG_DEBUG("Adding error to side 1 for module with RX redundancy" << otherSide); + addError(otherSide, elt->second, ctx); + ATH_MSG_DEBUG("Adding error to side 1 for module with RX redundancy " << otherSide); } else if (side==1) { IdentifierHash otherSide{IdentifierHash(elt->first - 1)}; - addError(otherSide,elt->second, ctx); - ATH_MSG_DEBUG("Adding error to side 0 for module with RX redundancy" << otherSide); + addError(otherSide, elt->second, ctx); + ATH_MSG_DEBUG("Adding error to side 0 for module with RX redundancy " << otherSide); } } }