diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt b/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt index 87bb0f6216293b2c1f21b6577cfb9398a00626c9..0ca3528b0c0a26f5cc030b19770c82ca6b1a2cee 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt +++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/CMakeLists.txt @@ -7,11 +7,15 @@ atlas_subdir( InDetByteStreamErrors ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC + Control/AthenaKernel Control/CLIDSvc Control/DataModel Control/SGTools DetectorDescription/Identifier ) +# External dependencies: +find_package( Boost COMPONENTS filesystem thread system ) + # this line failed automatic conversion in cmt2cmake : # use AtlasReflex AtlasReflex-* External - no_auto_imports @@ -21,6 +25,12 @@ atlas_add_dictionary( InDetByteStreamErrorsDict InDetByteStreamErrors/selection.xml LINK_LIBRARIES DataModel SGTools Identifier ) +atlas_add_library( InDetByteStreamErrors + src/*.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} + PUBLIC_HEADERS InDetByteStreamErrors + LINK_LIBRARIES AthenaKernel ) + # Install files from the package: atlas_install_headers( InDetByteStreamErrors ) diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/InDetByteStreamErrorsDict.h b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/InDetByteStreamErrorsDict.h index 4deecbd903c5296aaad134c19f5c9adb92628870..3f0fc6e7266c870b2f3d1607bea424c5a8d85f97 100755 --- a/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/InDetByteStreamErrorsDict.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/InDetByteStreamErrorsDict.h @@ -8,6 +8,7 @@ #include "InDetByteStreamErrors/InDetBSErrContainer.h" #include "InDetByteStreamErrors/TRT_BSErrContainer.h" #include "InDetByteStreamErrors/TRT_BSIdErrContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" namespace { // Need this to create the dict entries diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamFraction.h b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/SCT_ByteStreamFraction.h similarity index 69% rename from InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamFraction.h rename to InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/SCT_ByteStreamFraction.h index d265827a914857e48bbb1af223e586f0c557bdb9..c95aaf3f2c1fa0651ba8641e08dde295bd64eeaf 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamFraction.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/SCT_ByteStreamFraction.h @@ -35,10 +35,25 @@ public: // Get majority bool majority() const; + // Get entries + unsigned int entries() const; + + // Get true set + std::set<uint32_t> getTrueSet() const; + + // Get false set + std::set<uint32_t> getFalseSet() const; + + // Set true set + void setTrueSet(const std::set<uint32_t>& trueSet); + + // Set false set + void setFalseSet(const std::set<uint32_t>& falseSet); + private: // Store RODIDs with true and false separately - std::set<uint32_t> m_trueSets; - std::set<uint32_t> m_falseSets; + std::set<uint32_t> m_trueSet; + std::set<uint32_t> m_falseSet; }; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamFractionContainer.h b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h similarity index 77% rename from InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamFractionContainer.h rename to InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h index 6efb876d75901d546c7e20fe11016b9846195c56..b8f2e01aadcd562c92413fedc789aeaa384db9f7 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ByteStreamFractionContainer.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h @@ -11,7 +11,7 @@ #ifndef SCT_ByteStreamFractionContainer_h #define SCT_ByteStreamFractionContainer_h -#include "SCT_ConditionsData/SCT_ByteStreamFraction.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFraction.h" // Include Athena stuff #include "AthenaKernel/CLASS_DEF.h" @@ -36,6 +36,15 @@ public: // Get majority bool majority(const Type type) const; + // Set true set + void setTrueSet(const Type type, const std::set<uint32_t> trueSet); + + // Set false set + void setFalseSet(const Type type, const std::set<uint32_t> falseSet); + + // Get fraction + SCT_ByteStreamFraction getFraction(const Type type) const; + private: // Store RODIDs with true and false separately SCT_ByteStreamFraction m_fraction[NumberOfTypes]; diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrors/src/SCT_ByteStreamFraction.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrors/src/SCT_ByteStreamFraction.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8f78de7397d7110a8a6d13bae25717ef12335d8c --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/src/SCT_ByteStreamFraction.cxx @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +//---------------------------------------------------------------------- +// Implementation file for a data object class for SCT_ByteStreamErrorSvc +//---------------------------------------------------------------------- + +#include "InDetByteStreamErrors/SCT_ByteStreamFraction.h" + +//---------------------------------------------------------------------- +// Constructor +SCT_ByteStreamFraction::SCT_ByteStreamFraction() +{ + clear(); +} + +//---------------------------------------------------------------------- +// a new rodId with a bool value +void SCT_ByteStreamFraction::insert(const uint32_t rodId, const bool value) +{ + if (value) m_trueSet.insert(rodId); + else m_falseSet.insert(rodId); +} + +//---------------------------------------------------------------------- +// Clear m_trueSet and m_falseSet +void SCT_ByteStreamFraction::clear() +{ + m_trueSet.clear(); + m_falseSet.clear(); +} + +//---------------------------------------------------------------------- +// Get majority +bool SCT_ByteStreamFraction::majority() const +{ + return (m_trueSet.size() >= m_falseSet.size()); +} + +//---------------------------------------------------------------------- +// Get entries +unsigned int SCT_ByteStreamFraction::entries() const +{ + return (m_trueSet.size() + m_falseSet.size()); +} + +//---------------------------------------------------------------------- +// Get true set +std::set<uint32_t> SCT_ByteStreamFraction::getTrueSet() const +{ + return m_trueSet; +} + +//---------------------------------------------------------------------- +// Get false set +std::set<uint32_t> SCT_ByteStreamFraction::getFalseSet() const +{ + return m_falseSet; +} + +//---------------------------------------------------------------------- +// Set true set +void SCT_ByteStreamFraction::setTrueSet(const std::set<uint32_t>& trueSet) +{ + m_trueSet = trueSet; +} + +//---------------------------------------------------------------------- +// Set false set +void SCT_ByteStreamFraction::setFalseSet(const std::set<uint32_t>& falseSet) +{ + m_falseSet = falseSet; +} diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrors/src/SCT_ByteStreamFractionContainer.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrors/src/SCT_ByteStreamFractionContainer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e520fbab59776642854f8ed8f49be786ef9688f5 --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrors/src/SCT_ByteStreamFractionContainer.cxx @@ -0,0 +1,71 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +//---------------------------------------------------------------------- +// Implementation file for a data object class for SCT_ByteStreamErrorSvc +//---------------------------------------------------------------------- + +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" + +//---------------------------------------------------------------------- +// Constructor +SCT_ByteStreamFractionContainer::SCT_ByteStreamFractionContainer() +{ + clear(); +} + +//---------------------------------------------------------------------- +// a new rodId with a bool value +void SCT_ByteStreamFractionContainer::insert(const Type type, const uint32_t rodId, const bool value) +{ + if (type>=FirstIndex and type<NumberOfTypes) { + m_fraction[type].insert(rodId, value); + } +} + +//---------------------------------------------------------------------- +// Clear m_trueSets and m_falseSets +void SCT_ByteStreamFractionContainer::clear() +{ + for (unsigned int type{static_cast<unsigned int>(FirstIndex)}; type<NumberOfTypes; type++) { + m_fraction[type].clear(); + } +} + +//---------------------------------------------------------------------- +// Get majority +bool SCT_ByteStreamFractionContainer::majority(const Type type) const +{ + // Check invalid type + if (not (type>=FirstIndex and type<NumberOfTypes)) return false; + + // Default value without entries is different + if (type==SimulatedData and m_fraction[type].entries()==0) return false; + if (type==CondensedMode and m_fraction[type].entries()==0) return true; + if (type==HVOn and m_fraction[type].entries()==0) return false; + + return m_fraction[type].majority(); +} + +//---------------------------------------------------------------------- +// Set true set +void SCT_ByteStreamFractionContainer::setTrueSet(const Type type, const std::set<uint32_t> trueSet) +{ + if (type>=FirstIndex and type<NumberOfTypes) m_fraction[type].setTrueSet(trueSet); +} + +//---------------------------------------------------------------------- +// Set false set +void SCT_ByteStreamFractionContainer::setFalseSet(const Type type, const std::set<uint32_t> falseSet) +{ + if (type>=FirstIndex and type<NumberOfTypes) m_fraction[type].setFalseSet(falseSet); +} + +//---------------------------------------------------------------------- +// Get fraction +SCT_ByteStreamFraction SCT_ByteStreamFractionContainer::getFraction(const Type type) const +{ + if (type>=FirstIndex and type<NumberOfTypes) return m_fraction[type]; + return SCT_ByteStreamFraction{}; +} diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt index 639b719dfbfeb2a109d2f20d12adb25d1c3b7139..bb69c1c4a10c3332086c25721144a7d10e3e9221 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/CMakeLists.txt @@ -22,7 +22,8 @@ atlas_add_poolcnv_library( InDetByteStreamErrorsAthenaPoolPoolCnv src/*.cxx FILES InDetByteStreamErrors/InDetBSErrContainer.h InDetByteStreamErrors/TRT_BSIdErrContainer.h InDetByteStreamErrors/TRT_BSErrContainer.h - LINK_LIBRARIES AthenaPoolUtilities Identifier TestTools AthAllocators + InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h + LINK_LIBRARIES AthenaPoolUtilities Identifier InDetByteStreamErrors TestTools AthAllocators AthenaPoolCnvSvcLib ) atlas_add_dictionary( InDetByteStreamErrorsAthenaPoolCnvDict diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h index 445a1faf6c4fe0535e3c92d9f4fcd70f1d734002..7646e6ce64fc60aface5358900eb495ebc59e5e7 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPoolCnvDict.h @@ -7,4 +7,5 @@ #include "InDetByteStreamErrorsAthenaPool/InDetBSErrContainer_p1.h" #include "InDetByteStreamErrorsAthenaPool/TRT_BSErrContainer_p1.h" #include "InDetByteStreamErrorsAthenaPool/TRT_BSIdErrContainer_p1.h" +#include "InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h" #endif diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h new file mode 100644 index 0000000000000000000000000000000000000000..b7c3fe1bade3ddc749466698a23e5c81533649c6 --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINER_P1_H +#define INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINER_P1_H + +#include <vector> +#include <cstdint> +#include <set> + +class SCT_ByteStreamFractionContainer_p1 +{ + public: + /// Default constructor + SCT_ByteStreamFractionContainer_p1(); + friend class SCT_ByteStreamFractionContainerCnv_p1; + private: + std::vector<std::set<uint32_t> > m_trueSets; + std::vector<std::set<uint32_t> > m_falseSets; +}; + +inline +SCT_ByteStreamFractionContainer_p1::SCT_ByteStreamFractionContainer_p1() {} + +#endif // INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINER_P1_H diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml index 4eb591742f02f12415b7efb8f7df2b1f373206ad..c554a2c40f15a95d7472f60208ac31f6d911615b 100644 --- a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/InDetByteStreamErrorsAthenaPool/selection.xml @@ -2,4 +2,5 @@ <class name="InDetBSErrContainer_p1" id="FA64DC17-D07E-4305-9B21-18C64F1B4C47" /> <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" /> </lcgdict> diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..309644374436d0b2fc339b63b01fd54207c7a967 --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file SCT_ByteStreamFractionContainerCnv.cxx + * @brief Generated implementation file which includes header files needed by SCT_ByteStreamFractionContainerCnv + * @author Susumu Oda <Susumu.Oda@cern.ch> + */ + +#include "SCT_ByteStreamFractionContainerCnv.h" + +SCT_ByteStreamFractionContainer_PERS* +SCT_ByteStreamFractionContainerCnv::createPersistent(SCT_ByteStreamFractionContainer* transCont) { + MsgStream log(msgSvc(), "SCT_ByteStreamFractionContainerCnv"); + SCT_ByteStreamFractionContainer_PERS *persObj = m_TPConverter.createPersistent(transCont, log); + return persObj; +} + +SCT_ByteStreamFractionContainer* +SCT_ByteStreamFractionContainerCnv::createTransient() { + MsgStream log(msgSvc(), "SCT_ByteStreamFractionContainerCnv" ); + static 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 >() ); + 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 new file mode 100644 index 0000000000000000000000000000000000000000..96eb3dc62c1c5d5e94b03dd026ccc3039cd1ee82 --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file SCT_ByteStreamFractionContainerCnv.h + * @brief Generated header file which defines a typedef for templated converter class + * @author Susumu Oda <Susumu.Oda@cern.ch> + */ + +#ifndef INDETBYTESTREAMERRORSATHENAPOOL_SCT_ByteStreamFractionContainerCnv_H +#define INDETBYTESTREAMERRORSATHENAPOOL_SCT_ByteStreamFractionContainerCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h" +#include "SCT_ByteStreamFractionContainerCnv_p1.h" + +/** the latest persistent representation type of DataCollection: */ +typedef SCT_ByteStreamFractionContainer_p1 SCT_ByteStreamFractionContainer_PERS; +typedef T_AthenaPoolCustomCnv<SCT_ByteStreamFractionContainer, SCT_ByteStreamFractionContainer_PERS> SCT_ByteStreamFractionContainerCnvBase; + +class SCT_ByteStreamFractionContainerCnv : public SCT_ByteStreamFractionContainerCnvBase { +friend class CnvFactory<SCT_ByteStreamFractionContainerCnv>; +protected: + SCT_ByteStreamFractionContainerCnv (ISvcLocator* svcloc) : SCT_ByteStreamFractionContainerCnvBase(svcloc) {} + virtual SCT_ByteStreamFractionContainer_PERS*createPersistent(SCT_ByteStreamFractionContainer* transCont); + virtual SCT_ByteStreamFractionContainer* createTransient(); + + SCT_ByteStreamFractionContainerCnv_p1 m_TPConverter; +}; + +#endif // INDETBYTESTREAMERRORSATHENAPOOL_SCT_ByteStreamFractionContainerCnv_H diff --git a/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..81fde69fdbb17cee608216af1a526eee334b83f2 --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.cxx @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" +#include "SCT_ByteStreamFractionContainerCnv_p1.h" + +#include "AthAllocators/DataPool.h" + +void SCT_ByteStreamFractionContainerCnv_p1::transToPers(const SCT_ByteStreamFractionContainer* transCont, SCT_ByteStreamFractionContainer_p1* persCont, MsgStream & /*log */) +{ + (persCont->m_trueSets).reserve(SCT_ByteStreamFractionContainer::NumberOfTypes); + (persCont->m_falseSets).reserve(SCT_ByteStreamFractionContainer::NumberOfTypes); + + for (unsigned int i=SCT_ByteStreamFractionContainer::FirstIndex; i<SCT_ByteStreamFractionContainer::NumberOfTypes; i++) { + SCT_ByteStreamFractionContainer::Type type = static_cast<SCT_ByteStreamFractionContainer::Type>(i); + (persCont->m_trueSets).push_back(transCont->getFraction(type).getTrueSet()); + (persCont->m_falseSets).push_back(transCont->getFraction(type).getFalseSet()); + } + return; +} + +void SCT_ByteStreamFractionContainerCnv_p1::persToTrans(const SCT_ByteStreamFractionContainer_p1* persCont, SCT_ByteStreamFractionContainer* transCont, MsgStream & /*log */) +{ + std::vector<std::set<uint32_t> >::const_iterator it = (persCont->m_trueSets).begin(); + std::vector<std::set<uint32_t> >::const_iterator itEnd = (persCont->m_trueSets).end(); + for (unsigned int i=SCT_ByteStreamFractionContainer::FirstIndex; i<SCT_ByteStreamFractionContainer::NumberOfTypes and it!=itEnd; i++, it++) { + SCT_ByteStreamFractionContainer::Type type = static_cast<SCT_ByteStreamFractionContainer::Type>(i); + transCont->setTrueSet(type, *it); + } + std::vector<std::set<uint32_t> >::const_iterator jt = (persCont->m_falseSets).begin(); + std::vector<std::set<uint32_t> >::const_iterator jtEnd = (persCont->m_falseSets).end(); + for (unsigned int j=SCT_ByteStreamFractionContainer::FirstIndex; j<SCT_ByteStreamFractionContainer::NumberOfTypes and jt!=jtEnd; j++, jt++) { + SCT_ByteStreamFractionContainer::Type type = static_cast<SCT_ByteStreamFractionContainer::Type>(j); + transCont->setFalseSet(type, *jt); + } + return; +} + +//================================================================ +SCT_ByteStreamFractionContainer* SCT_ByteStreamFractionContainerCnv_p1::createTransient(const SCT_ByteStreamFractionContainer_p1* persObj, MsgStream& log) { + std::auto_ptr<SCT_ByteStreamFractionContainer> trans(new 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 new file mode 100644 index 0000000000000000000000000000000000000000..4638154c0b8e8cb639cc49e9e594b956523d8b5c --- /dev/null +++ b/InnerDetector/InDetConditions/InDetByteStreamErrorsAthenaPool/src/SCT_ByteStreamFractionContainerCnv_p1.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINERCNV_P1_H +#define INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINERCNV_P1_H + +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "InDetByteStreamErrorsAthenaPool/SCT_ByteStreamFractionContainer_p1.h" + + +class SCT_ByteStreamFractionContainerCnv_p1 : public T_AthenaPoolTPCnvBase<SCT_ByteStreamFractionContainer, SCT_ByteStreamFractionContainer_p1> +{ + public: + SCT_ByteStreamFractionContainerCnv_p1(){}; + + virtual void persToTrans(const SCT_ByteStreamFractionContainer_p1* persCont, + SCT_ByteStreamFractionContainer* transCont, + MsgStream &log) ; + virtual void transToPers(const SCT_ByteStreamFractionContainer* transCont, + SCT_ByteStreamFractionContainer_p1* persCont, + MsgStream &log) ; + virtual SCT_ByteStreamFractionContainer* createTransient(const SCT_ByteStreamFractionContainer_p1* persObj, MsgStream& log) ; + +}; + +#endif // INDETBYTESTREAMERRORSATHENAPOOL_SCT_BYTESTREAMFRACTIONCONTAINERCNV_P1_H diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ByteStreamFraction.cxx b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ByteStreamFraction.cxx deleted file mode 100644 index e578ec5d89105356940e34c184b918187459e556..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ByteStreamFraction.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -//---------------------------------------------------------------------- -// Implementation file for a data object class for SCT_ByteStreamErrorSvc -//---------------------------------------------------------------------- - -#include "SCT_ConditionsData/SCT_ByteStreamFraction.h" - -//---------------------------------------------------------------------- -// Constructor -SCT_ByteStreamFraction::SCT_ByteStreamFraction() -{ - clear(); -} - -//---------------------------------------------------------------------- -// a new rodId with a bool value -void SCT_ByteStreamFraction::insert(const uint32_t rodId, const bool value) -{ - if (value) m_trueSets.insert(rodId); - else m_falseSets.insert(rodId); -} - -//---------------------------------------------------------------------- -// Clear m_trueSets and m_falseSets -void SCT_ByteStreamFraction::clear() -{ - m_trueSets.clear(); - m_falseSets.clear(); -} - -//---------------------------------------------------------------------- -// Get majority -bool SCT_ByteStreamFraction::majority() const -{ - return (m_trueSets.size() >= m_falseSets.size()); -} diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ByteStreamFractionContainer.cxx b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ByteStreamFractionContainer.cxx deleted file mode 100644 index 97194df399af92705aaa4c736f63ef38a6dd9c62..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_ByteStreamFractionContainer.cxx +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -//---------------------------------------------------------------------- -// Implementation file for a data object class for SCT_ByteStreamErrorSvc -//---------------------------------------------------------------------- - -#include "SCT_ConditionsData/SCT_ByteStreamFractionContainer.h" - -//---------------------------------------------------------------------- -// Constructor -SCT_ByteStreamFractionContainer::SCT_ByteStreamFractionContainer() -{ - clear(); -} - -//---------------------------------------------------------------------- -// a new rodId with a bool value -void SCT_ByteStreamFractionContainer::insert(const Type type, const uint32_t rodId, const bool value) -{ - if (type>=FirstIndex and type<NumberOfTypes) { - m_fraction[type].insert(rodId, value); - } -} - -//---------------------------------------------------------------------- -// Clear m_trueSets and m_falseSets -void SCT_ByteStreamFractionContainer::clear() -{ - for (unsigned int type{static_cast<unsigned int>(FirstIndex)}; type<NumberOfTypes; type++) { - m_fraction[type].clear(); - } -} - -//---------------------------------------------------------------------- -// Get majority -bool SCT_ByteStreamFractionContainer::majority(const Type type) const -{ - if (type>=FirstIndex and type<NumberOfTypes) { - return m_fraction[type].majority(); - } - return false; -} diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/CMakeLists.txt b/InnerDetector/InDetConditions/SCT_ConditionsServices/CMakeLists.txt index 2d9354066cdbbdf44390ea44fa5614e9b0c52999..8a6088484c03ca4bb427faedf007c5bd24140f9c 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsServices/CMakeLists.txt +++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/CMakeLists.txt @@ -41,13 +41,13 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( SCT_ConditionsServices src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel Identifier GaudiKernel SCT_ConditionsData AthenaBaseComps StoreGateLib SGtests AthenaPoolUtilities GeoModelUtilities EventInfo xAODEventInfo SiPropertiesSvcLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib PathResolver SCT_ConditionsServicesLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel Identifier GaudiKernel InDetByteStreamErrors SCT_ConditionsData AthenaBaseComps StoreGateLib SGtests AthenaPoolUtilities GeoModelUtilities EventInfo xAODEventInfo SiPropertiesSvcLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib PathResolver SCT_ConditionsServicesLib ) atlas_add_library ( SCT_ConditionsServicesLib src/*.cxx PUBLIC_HEADERS SCT_ConditionsServices INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${COOL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel Identifier GaudiKernel SCT_ConditionsData AthenaBaseComps StoreGateLib SGtests AthenaPoolUtilities GeoModelUtilities EventInfo xAODEventInfo SiPropertiesSvcLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib PathResolver) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel Identifier GaudiKernel InDetByteStreamErrors SCT_ConditionsData AthenaBaseComps StoreGateLib SGtests AthenaPoolUtilities GeoModelUtilities EventInfo xAODEventInfo SiPropertiesSvcLib InDetIdentifier InDetReadoutGeometry SCT_CablingLib PathResolver) # Install files from the package: atlas_install_headers( SCT_ConditionsServices ) diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h b/InnerDetector/InDetConditions/SCT_ConditionsServices/SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h index 150f411dcc92e9577d0453adb5e3ccb24ef50d52..99b69e76e0c721eb8e87d9a4c818c94d39d5e862 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsServices/SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h @@ -39,35 +39,15 @@ class ISCT_ByteStreamErrorsSvc: virtual public ISCT_ConditionsSvc { virtual const std::set<IdentifierHash>* getErrorSet(int errorType)=0; - virtual void setRODSimulatedData()=0; + virtual bool isRODSimulatedData() const =0; - virtual bool isRODSimulatedData()=0; + virtual bool isCondensedReadout() const =0; + virtual bool HVisOn() const =0; - virtual void addError(IdentifierHash id, int errorType)=0; - virtual void addErrorCount(int errorType)=0; - - virtual void resetSets()=0; - virtual void resetCounts()=0; /** for the counts used by HLT */ - virtual int getNumberOfErrors(int errorType)=0; /** for HLT */ - - virtual void addRODHVCounter(bool HVisOn)=0; - - virtual bool isCondensedReadout()=0; - - virtual void setCondensedReadout(bool isCondensed)=0; - - virtual bool HVisOn()=0; - - /** Set first temporarily masked chip information from byte stream trailer */ - virtual void setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip)=0; - /** Get first temporarily masked chip information */ - virtual unsigned int getFirstTempMaskedChip(const IdentifierHash& hashId) const =0; - /** Map of temporary chip status for all modules with at least one bad chip (packed as 1st 12 bits of unsigned int) */ - virtual const std::map<Identifier, unsigned int>* tempMaskedChips() const =0; /** Temporary status of chips for a particular module (packed as 1st 12 bits of unsigned int) */ - virtual unsigned int tempMaskedChips(const Identifier& moduleId) const =0; + virtual unsigned int tempMaskedChips(const Identifier& moduleId)=0; /** Status ABCD errors of chips for a particular module (packed as 1st 12 bits of unsigned int) */ - virtual unsigned int abcdErrorChips(const Identifier& moduleId) const =0; + virtual unsigned int abcdErrorChips(const Identifier& moduleId)=0; private: diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.cxx index 9a916b85cb8212c87a6fbe6202eca8879b452286..ee1f257c8bb5af04a47538bab7e1bbc4751e8d15 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.cxx @@ -11,9 +11,6 @@ /// header file for this class. #include "SCT_ByteStreamErrorsSvc.h" -///Gaudi includes -#include "GaudiKernel/IIncidentSvc.h" - ///Athena includes #include "InDetIdentifier/SCT_ID.h" @@ -28,32 +25,19 @@ /** Constructor */ SCT_ByteStreamErrorsSvc::SCT_ByteStreamErrorsSvc( const std::string& name, ISvcLocator* pSvcLocator ) : AthService(name, pSvcLocator), - m_evtStore{"StoreGateSvc", name}, m_detStore{"DetectorStore", name}, - m_cabling{"SCT_CablingSvc", name}, m_config{"InDetSCT_ConfigurationConditionsSvc", name}, m_sct_id{nullptr}, m_pManager{nullptr}, - m_filled{false}, - m_lookForSGErrContainer{true}, - m_firstTempMaskedChips{}, m_tempMaskedChips{}, - m_isRODSimulatedData{false}, - m_numRODsHVon{0}, - m_numRODsTotal{0}, - m_condensedMode{true} + m_abcdErrorChips{}, + m_mutex{}, + m_cache{} { - declareProperty("EventStore", m_evtStore); declareProperty("DetectorStore", m_detStore); declareProperty("ContainerName", m_bsErrContainerName=std::string{"SCT_ByteStreamErrs"}); - declareProperty("CablingService", m_cabling); + declareProperty("FracContainerName", m_bsFracContainerName=std::string{"SCT_ByteStreamFrac"}); declareProperty("ConfigService", m_config); - declareProperty("UseRXRedundancyInfo", m_useRXredundancy=true); - - for (int errorType{0}; errorType<SCT_ByteStreamErrors::NUM_ERROR_TYPES; errorType++) { - m_bsErrors[errorType].clear(); - m_numBsErrors[errorType] = 0; - } } /** Initialize */ @@ -65,23 +49,6 @@ SCT_ByteStreamErrorsSvc::initialize() { m_bsErrors[errorType].clear(); } - m_isRODSimulatedData=false; - - IIncidentSvc* incsvc{nullptr}; - sc = service("IncidentSvc", incsvc); - int priority{100}; - if (sc.isSuccess()) { - incsvc->addListener( this, "BeginEvent", priority); - } - - /** Get a StoreGateSvc */ - if (m_evtStore.retrieve().isFailure()) { - ATH_MSG_FATAL( "Failed to retrieve service " << m_evtStore); - return StatusCode::FAILURE; - } - else { - ATH_MSG_INFO("Retrieved service " << m_evtStore); - } /** Get a detector store */ if (m_detStore.retrieve().isFailure()) { ATH_MSG_FATAL("Failed to retrieve service " << m_detStore); @@ -104,20 +71,12 @@ SCT_ByteStreamErrorsSvc::initialize() { return StatusCode::FAILURE; } - if (m_useRXredundancy) { - sc = m_cabling.retrieve() ; - if (sc.isFailure()) { - ATH_MSG_FATAL("Cannot retrieve cabling!"); - return StatusCode::FAILURE; - } - } - ATH_CHECK(m_detStore->retrieve(m_pManager, "SCT")); // Read Handle Key ATH_CHECK(m_bsErrContainerName.initialize()); + ATH_CHECK(m_bsFracContainerName.initialize()); - resetCounts(); return sc; } @@ -127,27 +86,6 @@ SCT_ByteStreamErrorsSvc::finalize() { return StatusCode::SUCCESS; } -////////////////////////////////////////////////////////////////////////////////// - -/** Clear the sets of IDHashes at the start of every event. - * and set the flag to not filled, so that first time the svc - * is asked for its data, it will fill itself with fillData() - */ - -void -SCT_ByteStreamErrorsSvc::handle(const Incident& inc) { - if (inc.type() == "BeginEvent") { - this->resetSets(); - this->resetCounts(); - m_filled = false; - m_numRODsHVon=0; - m_numRODsTotal=0; - m_firstTempMaskedChips.clear(); - m_tempMaskedChips.clear(); - } - return; -} - //////////////////////////////////////////////////////////////////////////////////// /** allow the Service to be retrieved via a ServiceHandle. */ @@ -168,32 +106,19 @@ SCT_ByteStreamErrorsSvc::queryInterface(const InterfaceID& riid, void** ppvInter } bool -SCT_ByteStreamErrorsSvc::isCondensedReadout() { - return m_condensedMode; -} - -void -SCT_ByteStreamErrorsSvc::setCondensedReadout(bool isCondensed) { - m_condensedMode = isCondensed; +SCT_ByteStreamErrorsSvc::isCondensedReadout() const { + const SCT_ByteStreamFractionContainer* fracData{getFracData()}; + if (fracData==nullptr) return false; + return fracData->majority(SCT_ByteStreamFractionContainer::CondensedMode); } bool -SCT_ByteStreamErrorsSvc::HVisOn() { - if ((m_numRODsTotal > 0) and ( ((float)m_numRODsHVon / (float)m_numRODsTotal) > 0.5 ) ) - return true; - else - return false; -} - - -void -SCT_ByteStreamErrorsSvc::addRODHVCounter(bool HVisOn) { - m_numRODsTotal++; - if (HVisOn) m_numRODsHVon++; - return; +SCT_ByteStreamErrorsSvc::HVisOn() const { + const SCT_ByteStreamFractionContainer* fracData{getFracData()}; + if (fracData==nullptr) return true; + return fracData->majority(SCT_ByteStreamFractionContainer::HVOn); } - ///////////////////////////////////////////////////////////////////////////// /** Used by ConditionsSummaySvc to decide whether to call isGood() for a particular @@ -218,64 +143,39 @@ SCT_ByteStreamErrorsSvc::canReportAbout(InDetConditions::Hierarchy h) { bool SCT_ByteStreamErrorsSvc::isGood(const IdentifierHash& elementIdHash) { + const EventContext& ctx{Gaudi::Hive::currentContext()}; - if (!m_filled) { - StatusCode sc{fillData()}; - if (sc.isFailure()) { - ATH_MSG_ERROR("Failed to read BS errors from SG container " << m_bsErrContainerName.key()); - return true; - } - } - - if (m_isRODSimulatedData) return false; + if (isRODSimulatedData()) return false; bool result{true}; - - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::TimeOutError].begin(), - m_bsErrors[SCT_ByteStreamErrors::TimeOutError].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::TimeOutError].end()); - if (!result) return result; - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::BCIDError].begin(), - m_bsErrors[SCT_ByteStreamErrors::BCIDError].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::BCIDError].end()); - if (!result) return result; - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::LVL1IDError].begin(), - m_bsErrors[SCT_ByteStreamErrors::LVL1IDError].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::LVL1IDError].end()); - if (!result) return result; - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::MaskedLink].begin(), - m_bsErrors[SCT_ByteStreamErrors::MaskedLink].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::MaskedLink].end()); - if (!result) return result; - - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::ROBFragmentError].begin(), - m_bsErrors[SCT_ByteStreamErrors::ROBFragmentError].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::ROBFragmentError].end()); - if (!result) return result; - - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::MissingLinkHeaderError].begin(), - m_bsErrors[SCT_ByteStreamErrors::MissingLinkHeaderError].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::MissingLinkHeaderError].end()); - if (!result) return result; - - result = (std::find(m_bsErrors[SCT_ByteStreamErrors::MaskedROD].begin(), - m_bsErrors[SCT_ByteStreamErrors::MaskedROD].end(), - elementIdHash) == m_bsErrors[SCT_ByteStreamErrors::MaskedROD].end()); - if (!result) return result; + const std::vector<SCT_ByteStreamErrors::errorTypes> errorsToBeChecked{ + SCT_ByteStreamErrors::TimeOutError, + SCT_ByteStreamErrors::BCIDError, + SCT_ByteStreamErrors::LVL1IDError, + SCT_ByteStreamErrors::MaskedLink, + SCT_ByteStreamErrors::ROBFragmentError, + SCT_ByteStreamErrors::MissingLinkHeaderError, + SCT_ByteStreamErrors::MaskedROD}; + for (unsigned int i{0}; i<errorsToBeChecked.size(); i++) { + const std::set<IdentifierHash>& errorSet{getErrorSet(errorsToBeChecked[i], ctx)}; + result = (std::find(errorSet.begin(), errorSet.end(), elementIdHash) == errorSet.end()); + if (not result) return result; + } + // If all 6 chips of a link issue ABCD errors or are bad chips or temporarily masked chips, the link is treated as bad one. const Identifier wafer_id{m_sct_id->wafer_id(elementIdHash)}; const Identifier module_id{m_sct_id->module_id(wafer_id)}; unsigned int badChips{m_config->badChips(module_id)}; + unsigned int abcdErrorChips2{abcdErrorChips(module_id)}; unsigned int tempMaskedChips2{tempMaskedChips(module_id)}; const int side{m_sct_id->side(wafer_id)}; - short id{static_cast<short>(side==0 ? 0 : 6)}; bool allChipsBad{true}; - for (int errType{SCT_ByteStreamErrors::ABCDError_Chip0}; (errType<=SCT_ByteStreamErrors::ABCDError_Chip5) and allChipsBad; errType++) { - bool issueABCDError{(std::find(m_bsErrors[errType].begin(), m_bsErrors[errType].end(), elementIdHash)!=m_bsErrors[errType].end())}; - bool isBadChip = ((badChips >> (id)) & 0x1) != 0; - bool isTempMaskedChip = ((tempMaskedChips2 >> (id)) & 0x1) != 0; - id++; + const int idMax{static_cast<short>(side==0 ? 6 : 12)}; + for (int id{idMax-6}; id<idMax; id++) { + bool issueABCDError{((abcdErrorChips2 >> id) & 0x1) != 0}; + bool isBadChip{((badChips >> id) & 0x1) != 0}; + bool isTempMaskedChip{((tempMaskedChips2 >> id) & 0x1) != 0}; allChipsBad = (issueABCDError or isBadChip or isTempMaskedChip); if (not allChipsBad) break; } @@ -288,7 +188,7 @@ bool SCT_ByteStreamErrorsSvc::isGood(const Identifier& elementId, InDetConditions::Hierarchy h) { if (not canReportAbout(h)) return true; - if (m_isRODSimulatedData) return false; + if (isRODSimulatedData()) return false; if (h==InDetConditions::SCT_SIDE) { const IdentifierHash elementIdHash{m_sct_id->wafer_hash(elementId)}; @@ -302,7 +202,7 @@ SCT_ByteStreamErrorsSvc::isGood(const Identifier& elementId, InDetConditions::Hi } bool -SCT_ByteStreamErrorsSvc::isGoodChip(const Identifier& stripId) const { +SCT_ByteStreamErrorsSvc::isGoodChip(const Identifier& stripId) { // This check assumes present SCT. // Get module number const Identifier moduleId{m_sct_id->module_id(stripId)}; @@ -348,7 +248,7 @@ SCT_ByteStreamErrorsSvc::isGoodChip(const Identifier& stripId) const { int SCT_ByteStreamErrorsSvc::getChip(const Identifier& stripId) const { const InDetDD::SiDetectorElement* siElement{m_pManager->getDetectorElement(stripId)}; - if (!siElement) { + if (siElement==nullptr) { ATH_MSG_DEBUG ("InDetDD::SiDetectorElement is not obtained from stripId " << stripId); return -1; } @@ -388,10 +288,10 @@ SCT_ByteStreamErrorsSvc::getChip(const Identifier& stripId) const { /** reset everything at the start of every event. */ void -SCT_ByteStreamErrorsSvc::resetSets() { +SCT_ByteStreamErrorsSvc::resetSets(const EventContext& ctx) { for (int errType{0}; errType<SCT_ByteStreamErrors::NUM_ERROR_TYPES; errType++) { - m_bsErrors[errType].clear(); + m_bsErrors[errType][ctx.slot()].clear(); } return; @@ -406,15 +306,9 @@ SCT_ByteStreamErrorsSvc::resetSets() { const std::set<IdentifierHash>* SCT_ByteStreamErrorsSvc::getErrorSet(int errorType) { - - if (!m_filled) { - StatusCode sc{fillData()}; - if (sc.isFailure()) { - ATH_MSG_ERROR("Failed to fill from SG container " << m_bsErrContainerName.key()); - } - } + const EventContext& ctx{Gaudi::Hive::currentContext()}; if (errorType>=0 and errorType<SCT_ByteStreamErrors::NUM_ERROR_TYPES) { - return &(m_bsErrors[errorType]); + return &getErrorSet(static_cast<SCT_ByteStreamErrors::errorTypes>(errorType), ctx); } return 0; } @@ -428,71 +322,85 @@ SCT_ByteStreamErrorsSvc::getErrorSet(int errorType) { StatusCode SCT_ByteStreamErrorsSvc::fillData() { + ATH_MSG_ERROR("fillData() is obsolete"); + return StatusCode::FAILURE; +} - if (m_lookForSGErrContainer) { - SG::ReadHandle<InDetBSErrContainer> errCont{m_bsErrContainerName}; - - /** When running over ESD files without BSErr container stored, don't - * want to flood the user with error messages. Should just have a bunch - * of empty sets, and keep quiet. - */ - if (not errCont.isValid()) { - ATH_MSG_INFO("Failed to retrieve BS error container " - << m_bsErrContainerName.key() - << " from StoreGate. " - << "This is expected if you are reading an ESD file " - << "which doesn't have the ByteStreamErrors container stored, " - << "such as an MC ESD file, or a real data ESD file produced " - << "with a release older than 14.5.0. " - << "Otherwise, you might have a problem. " - << "This message won't be printed again."); - - m_lookForSGErrContainer = false; - m_filled = true; - return StatusCode::SUCCESS; +StatusCode +SCT_ByteStreamErrorsSvc::fillData(const EventContext& ctx) { + EventContext::ContextID_t slot{ctx.slot()}; + EventContext::ContextEvt_t evt{ctx.evt()}; + + if (slot<m_cache.size() and m_cache[slot]==evt) { + // Cache isvalid + return StatusCode::SUCCESS; + } + + std::lock_guard<std::mutex> lock{m_mutex}; + + static const EventContext::ContextEvt_t invalidValue{EventContext::INVALID_CONTEXT_EVT}; + if (slot>=m_cache.size()) { + m_cache.resize(slot+1, invalidValue); // Store invalid values in order to go to the next IF statement. + for (int errType{0}; errType<SCT_ByteStreamErrors::NUM_ERROR_TYPES; errType++) { + m_bsErrors[errType].resize(slot+1); } + m_tempMaskedChips.resize(slot+1); + m_abcdErrorChips.resize(slot+1); + } + resetSets(ctx); + m_tempMaskedChips[slot].clear(); + m_abcdErrorChips[slot].clear(); + + SG::ReadHandle<InDetBSErrContainer> errCont{m_bsErrContainerName}; + + /** When running over ESD files without BSErr container stored, don't + * want to flood the user with error messages. Should just have a bunch + * of empty sets, and keep quiet. + */ + if (not errCont.isValid()) { + ATH_MSG_INFO("Failed to retrieve BS error container " + << m_bsErrContainerName.key() + << " from StoreGate. "); + return StatusCode::SUCCESS; + } - /** OK, so we found the StoreGate container, now lets iterate - * over it to populate the sets of errors owned by this Svc. - */ - ATH_MSG_DEBUG("size of error container is " << errCont->size()); - for (const auto* elt : *errCont) { - addError(elt->first,elt->second); - if (m_useRXredundancy) { - Identifier wafer_id{m_sct_id->wafer_id(elt->first)}; - Identifier module_id{m_sct_id->module_id(wafer_id)}; - std::pair<bool, bool> badLinks{m_config->badLinks(module_id)}; - int side{m_sct_id->side(m_sct_id->wafer_id(elt->first))}; - bool result{(side==0 ? badLinks.first : badLinks.second) and (badLinks.first xor badLinks.second)}; - if (result) { - /// error in a module using RX redundancy - add an error for the other link as well!! - if (side==0) { - IdentifierHash otherSide{IdentifierHash(elt->first + 1)}; - addError(otherSide,elt->second); - 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); - ATH_MSG_DEBUG("Adding error to side 0 for module with RX redundancy" << otherSide); - } + /** OK, so we found the StoreGate container, now lets iterate + * over it to populate the sets of errors owned by this Svc. + */ + ATH_MSG_DEBUG("size of error container is " << errCont->size()); + for (const auto* elt : *errCont) { + addError(elt->first,elt->second, ctx); + Identifier wafer_id{m_sct_id->wafer_id(elt->first)}; + Identifier module_id{m_sct_id->module_id(wafer_id)}; + int side{m_sct_id->side(m_sct_id->wafer_id(elt->first))}; + if ((elt->second>=SCT_ByteStreamErrors::ABCDError_Chip0 and elt->second<=SCT_ByteStreamErrors::ABCDError_Chip5)) { + m_abcdErrorChips[slot][module_id] |= (1 << (elt->second-SCT_ByteStreamErrors::ABCDError_Chip0 + side*6)); + } else if (elt->second>=SCT_ByteStreamErrors::TempMaskedChip0 and elt->second<=SCT_ByteStreamErrors::TempMaskedChip5) { + m_tempMaskedChips[slot][module_id] |= (1 << (elt->second-SCT_ByteStreamErrors::TempMaskedChip0 + side*6)); + } else { + std::pair<bool, bool> badLinks{m_config->badLinks(module_id)}; + bool result{(side==0 ? badLinks.first : badLinks.second) and (badLinks.first xor badLinks.second)}; + if (result) { + /// error in a module using RX redundancy - add an error for the other link as well!! + /// 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); + } 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); } } } - m_filled=true; - return StatusCode::SUCCESS; - } else { - /** We presumably tried looking for the container before and failed, - * so lets just return happily to avoid spamming the user with error - * messages. - */ - m_filled=true; - return StatusCode::SUCCESS; } + return StatusCode::SUCCESS; } bool SCT_ByteStreamErrorsSvc::filled() const{ - return m_filled; + return true; } /** The following method is used to populate @@ -502,299 +410,73 @@ SCT_ByteStreamErrorsSvc::filled() const{ */ void -SCT_ByteStreamErrorsSvc::addError(IdentifierHash id, int errorType) { - if (errorType>=0 and errorType<SCT_ByteStreamErrors::NUM_ERROR_TYPES) { - m_bsErrors[errorType].insert(id); - } -} - -/** The HLT also wants to know how many errors there - * were in a given RoI.. unfortunately this means we - * can't use the same model as for offline where the - * RodDecoder writes to a StoreGate container which is - * read in once per event by this Svc.. instead, have - * the RodDecoder call the following method as it goes - * along. The counts can be reset by any client using - * the resetCounts() method. - */ - -void -SCT_ByteStreamErrorsSvc::addErrorCount(int errorType) { +SCT_ByteStreamErrorsSvc::addError(IdentifierHash id, int errorType, const EventContext& ctx) { if (errorType>=0 and errorType<SCT_ByteStreamErrors::NUM_ERROR_TYPES) { - m_numBsErrors[errorType]++; + m_bsErrors[errorType][ctx.slot()].insert(id); } } - /////////////////////////////////////////////////////////////////////////////// -/** A bit is set in a particular word in the ByteStream if the data +/** A bit from a particular word in the ByteStream if the data * is coming from the ROD simulator rather than real modules. */ -void -SCT_ByteStreamErrorsSvc::setRODSimulatedData() { - m_isRODSimulatedData=true; -} bool -SCT_ByteStreamErrorsSvc::isRODSimulatedData() { - return m_isRODSimulatedData; +SCT_ByteStreamErrorsSvc::isRODSimulatedData() const { + const SCT_ByteStreamFractionContainer* fracData{getFracData()}; + if (fracData==nullptr) return false; + return fracData->majority(SCT_ByteStreamFractionContainer::SimulatedData); } /////////////////////////////////////////////////////////////////////////////// -/** The following methods are for HLT, to get the numbers of errors - * per RoI, so won't necessarily match up with the sizes of the sets. - */ - -void -SCT_ByteStreamErrorsSvc::resetCounts() { - for (int errorType{0}; errorType<SCT_ByteStreamErrors::NUM_ERROR_TYPES; errorType++) { - m_numBsErrors[errorType] = 0; - } +unsigned int SCT_ByteStreamErrorsSvc::tempMaskedChips(const Identifier& moduleId) { + const EventContext& ctx{Gaudi::Hive::currentContext()}; + const std::map<Identifier, unsigned int>& v_tempMaskedChips{getTempMaskedChips(ctx)}; + std::map<Identifier, unsigned int>::const_iterator it{v_tempMaskedChips.find(moduleId)}; + if (it!=v_tempMaskedChips.end()) return it->second; + return 0; } -int -SCT_ByteStreamErrorsSvc::getNumberOfErrors(int errorType) { - if (errorType>=0 and errorType<SCT_ByteStreamErrors::NUM_ERROR_TYPES) { - return m_numBsErrors[errorType]; - } +unsigned int SCT_ByteStreamErrorsSvc::abcdErrorChips(const Identifier& moduleId) { + const EventContext& ctx{Gaudi::Hive::currentContext()}; + const std::map<Identifier, unsigned int>& v_abcdErrorChips{getAbcdErrorChips(ctx)}; + std::map<Identifier, unsigned int>::const_iterator it{v_abcdErrorChips.find(moduleId)}; + if (it!=v_abcdErrorChips.end()) return it->second; return 0; } -void SCT_ByteStreamErrorsSvc::setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip) { - if (not hashId.is_valid()) { - ATH_MSG_INFO("setFirstTempMaskedChip hashId " << hashId << " is invalid."); - return; - } - if (firstTempMaskedChip==0) { - ATH_MSG_WARNING("setFirstTempMaskedChip: firstTempMaskedChip should be greater than 0. firstTempMaskedChip is " << firstTempMaskedChip); - return; - } - - //// 1. set m_firstTempMaskedChips for this wafer - std::pair<std::map<IdentifierHash, unsigned int>::const_iterator, bool> - ret{m_firstTempMaskedChips.insert(std::make_pair(hashId, firstTempMaskedChip))}; - if (not ret.second) { - ATH_MSG_WARNING("setFirstTempMaskedChip: already set for hashId " << hashId << - " firstTempMaskedChip is " << ret.first->second << - " and you are trying to put " << firstTempMaskedChip); - return; - } - - //// 2. set m_tempMaskedChips for this module - - // wafer hash -> wafer id -> module id -> wafer hash on side-0, wafer hash on side-1 - const Identifier wafId{m_sct_id->wafer_id(hashId)}; - const Identifier moduleId{m_sct_id->module_id(wafId)}; - - // Side 0 - IdentifierHash hash_side0; - m_sct_id->get_hash(moduleId, hash_side0, &m_cntx_sct); - unsigned int firstTempMaskedChip_side0{getFirstTempMaskedChip(hash_side0)}; - - // Side 1 - IdentifierHash hash_side1; - m_sct_id->get_other_side(hash_side0, hash_side1); - unsigned int firstTempMaskedChip_side1{getFirstTempMaskedChip(hash_side1)}; - - // There should be at least one masked chip - if (firstTempMaskedChip_side0==0 and firstTempMaskedChip_side1==0) { - ATH_MSG_WARNING("setFirstTempMaskedChip: There should be at least one masked chip. Something is wrong."); - return; - } - - int type{0}; - // Check if Rx redundancy is used or not in this module - std::pair<bool, bool> badLinks{m_config->badLinks(moduleId)}; - if (badLinks.first xor badLinks.second) { - // Rx redundancy is used in this module. - if (badLinks.first and not badLinks.second) { - // link-1 is broken - type = 1; - } else if (badLinks.second and not badLinks.first) { - // link-0 is broken - type = 2; - } else if (badLinks.first and badLinks.second) { - // both link-0 and link-1 are working - ATH_MSG_WARNING("setFirstTempMaskedChip: Both link-0 and link-1 are working. But Rx redundancy is used... Why?"); - return; - } else { - // both link-0 and link-1 are broken - ATH_MSG_WARNING("setFirstTempMaskedChip: Both link-0 and link-1 are broken. But data are coming... Why?"); - return; - } - } - - if (type==1 or type==2) { - if (firstTempMaskedChip_side0>0 and - firstTempMaskedChip_side1>0 and - firstTempMaskedChip_side0!=firstTempMaskedChip_side1) { - ATH_MSG_WARNING("setFirstTempMaskedChip: Rx redundancy is used. " << - "But, side 0 and side 1 have inconsistent first masked chip information. " << - " firstTempMaskedChip_side0 " << firstTempMaskedChip_side0 << - " firstTempMaskedChip_side1 " << firstTempMaskedChip_side1 << - " firstTempMaskedChip " << firstTempMaskedChip); - } +const SCT_ByteStreamFractionContainer* SCT_ByteStreamErrorsSvc::getFracData() const { + SG::ReadHandle<SCT_ByteStreamFractionContainer> fracCont{m_bsFracContainerName}; + if (not fracCont.isValid()) { + ATH_MSG_INFO(m_bsFracContainerName.key() << " cannot be retrieved"); + return nullptr; } + return fracCont.ptr(); +} - // "Modified" module (using Rx redundancy) case - // Information of modified modules are found in - // modified0 and modified1 functions of SCT_ReadoutTool.cxx and - // Table 3.8 of CERN-THESIS-2008-001 https://cds.cern.ch/record/1078223 - // However, there are two exceptions of the exceptions. - unsigned long long fullSerialNumber{m_cabling->getSerialNumberFromHash(hashId).to_ulonglong()}; - if (// Readout through link-0 - fullSerialNumber==20220170200183 or // hash=4662 bec=0 layer=2 eta= 6 phi=39 - fullSerialNumber==20220330200606 or // hash=5032 bec=0 layer=3 eta=-2 phi= 7 - fullSerialNumber==20220330200693 // hash=5554 bec=0 layer=3 eta=-5 phi=29 - ) { - if (type!=1) ATH_MSG_WARNING("Link-0 is broken but modified module readingout link-0, inconsistent"); - type = 3; - - // An exception: - // fullSerialNumber=20220170200941, hash=3560 bec=0 layer=1 eta=-6 phi=34 - // This module is a modified one. However, it is not using modified configuration. - // Readout sequence is 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11. - } - if (// Readout through link-1 - fullSerialNumber==20220170200653 or // hash=2786 bec=0 layer=1 eta= 4 phi= 1 - fullSerialNumber==20220330200117 or // hash=5516 bec=0 layer=3 eta= 1 phi=27 - fullSerialNumber==20220330200209 or // hash=5062 bec=0 layer=3 eta= 2 phi= 8 - fullSerialNumber==20220330200505 or // hash=5260 bec=0 layer=3 eta= 5 phi=16 - fullSerialNumber==20220330200637 or // hash=4184 bec=0 layer=2 eta=-6 phi=20 - fullSerialNumber==20220330200701 // hash=4136 bec=0 layer=2 eta=-6 phi=18 - ) { - if (type!=2) ATH_MSG_WARNING("Link-1 is broken but modified module readingout link-1, inconsistent"); - type = 4; - - // Another exception: - // fullSerialNumber=20220170200113, hash=3428 bec=0 layer=1 eta= 1 phi=28 - // This module is a modified one. However, it is not using modified configuration. - // Readout sequence is 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5. +const std::set<IdentifierHash>& SCT_ByteStreamErrorsSvc::getErrorSet(SCT_ByteStreamErrors::errorTypes errorType, const EventContext& ctx) { + StatusCode sc{fillData(ctx)}; + if (sc.isFailure()) { + ATH_MSG_ERROR("fillData in getErrorSet fails"); } - static const int chipOrder[5][12]{ - // type=0 not prepared for both link-0 and link-1 are working - {}, - // type=1 link-1 is broken: chip 0 1 2 3 4 5 6 7 8 9 10 11 - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, - // type=2 link-0 is broken: chip 6 7 8 9 10 11 0 1 2 3 4 5 - {6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5}, - // type=3 "modified" modules and link-1 is broken: chip 0 1 2 3 4 5 7 8 9 10 11 6 - {0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 6}, - // type=4 "modified" modules and link-0 is broken: chip 6 7 8 9 10 11 1 2 3 4 5 0 - {6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 0} - }; - - unsigned int tempMaskedChips2{0}; - if (type==0) { - // both link-0 and link-1 are working - - // Chips 0-5 are on side 0 and chips 6-11 are on side 1. - // Normally, modules send hits on side 0 via link-0 and side 1 via link-1. - // The first temporally masked chip value is the id of the chip that is - // first masked in the readout chain "plus one". - // If the value is in between 1 to 6, it indicates side 0. - // If the value is in between 7 to 12, it indicates side 1. - // However, some special modules send hits on side 0 via link-1 and hits on - // side 1 via link-0. If the first masked chip value on side 1 (0) is - // between 1 to 6 (7 to 12), it indicates the module is a special one. - // In that case, information is swapped. - if ((6<firstTempMaskedChip_side0 and firstTempMaskedChip_side0<=12) or - (0<firstTempMaskedChip_side1 and firstTempMaskedChip_side1<= 6)) { - unsigned int swapFirstTempMaskedChip_side0{firstTempMaskedChip_side0}; - firstTempMaskedChip_side0 = firstTempMaskedChip_side1; - firstTempMaskedChip_side1 = swapFirstTempMaskedChip_side0; - } - - if (firstTempMaskedChip_side0>0) { - for (unsigned int iChip{firstTempMaskedChip_side0-1}; iChip<6; iChip++) { - tempMaskedChips2 |= (1<<iChip); - addError(hash_side0, SCT_ByteStreamErrors::TempMaskedChip0+iChip); - } - } - if (firstTempMaskedChip_side1>6) { - for (unsigned int iChip{firstTempMaskedChip_side1-1}; iChip<12; iChip++) { - tempMaskedChips2 |= (1<<iChip); - addError(hash_side1, SCT_ByteStreamErrors::TempMaskedChip0+iChip-6); - } - } - } else { - // type=1, 2, 3, 4: cases using Rx redundancy - if (firstTempMaskedChip>0) { - bool toBeMasked{false}; - for (int iChip{0}; iChip<12; iChip++) { - int jChip{chipOrder[type][iChip]}; - if (jChip==static_cast<int>(firstTempMaskedChip-1)) toBeMasked = true; - if (toBeMasked) { - tempMaskedChips2 |= (1<<jChip); - if (jChip<6) addError(hash_side0, SCT_ByteStreamErrors::TempMaskedChip0+jChip); - else addError(hash_side1, SCT_ByteStreamErrors::TempMaskedChip0+jChip-6); - } - } - } - } - - ATH_MSG_VERBOSE("setFirstTempMaskedChip Hash " << hashId - << " SerialNumber " << m_cabling->getSerialNumberFromHash(hashId).str() - << " moduleId " << moduleId - << " barrel_ec " << m_sct_id->barrel_ec(wafId) - << " layer_disk " << m_sct_id->layer_disk(wafId) - << " eta_module " << m_sct_id->eta_module(wafId) - << " phi_module " << m_sct_id->phi_module(wafId) - << " side " << m_sct_id->side(wafId) - << " firstTempMaskedChip " << firstTempMaskedChip - << " tempMaskedChips2 " << tempMaskedChips2); - - m_tempMaskedChips[moduleId] = tempMaskedChips2; + return m_bsErrors[errorType][ctx.slot()]; } -unsigned int SCT_ByteStreamErrorsSvc::getFirstTempMaskedChip(const IdentifierHash& hashId) const { - std::map<IdentifierHash, unsigned int>::const_iterator it{m_firstTempMaskedChips.find(hashId)}; - if (it!=m_firstTempMaskedChips.end()) return it->second; - return 0; -} +const std::map<Identifier, unsigned int>& SCT_ByteStreamErrorsSvc::getTempMaskedChips(const EventContext& ctx) { + StatusCode sc{fillData(ctx)}; + if (sc.isFailure()) { + ATH_MSG_ERROR("fillData in getTempMaskedChips fails"); + } -unsigned int SCT_ByteStreamErrorsSvc::tempMaskedChips(const Identifier& moduleId) const { - std::map<Identifier, unsigned int>::const_iterator it{m_tempMaskedChips.find(moduleId)}; - if (it!=m_tempMaskedChips.end()) return it->second; - return 0; + return m_tempMaskedChips[ctx.slot()]; } -unsigned int SCT_ByteStreamErrorsSvc::abcdErrorChips(const Identifier& moduleId) const { - unsigned int abcdErrorChips2{0}; - int chip{0}; - - // Side 0 - IdentifierHash hash_side0; - m_sct_id->get_hash(moduleId, hash_side0, &m_cntx_sct); - if (std::find(m_bsErrors[SCT_ByteStreamErrors::ABCDError].begin(), - m_bsErrors[SCT_ByteStreamErrors::ABCDError].end(), - hash_side0) - !=m_bsErrors[SCT_ByteStreamErrors::ABCDError].end()) { - for (int errType{SCT_ByteStreamErrors::ABCDError_Chip0}; errType<=SCT_ByteStreamErrors::ABCDError_Chip5; errType++) { - if (std::find(m_bsErrors[errType].begin(), m_bsErrors[errType].end(), hash_side0)!=m_bsErrors[errType].end()) { - abcdErrorChips2 |= (1 << chip); - } - chip++; - } - } else { - chip = 6; - } - - // Side 1 - IdentifierHash hash_side1; - m_sct_id->get_other_side(hash_side0, hash_side1); - if (std::find(m_bsErrors[SCT_ByteStreamErrors::ABCDError].begin(), - m_bsErrors[SCT_ByteStreamErrors::ABCDError].end(), - hash_side1) - !=m_bsErrors[SCT_ByteStreamErrors::ABCDError].end()) { - for (int errType{SCT_ByteStreamErrors::ABCDError_Chip0}; errType<=SCT_ByteStreamErrors::ABCDError_Chip5; errType++) { - if (std::find(m_bsErrors[errType].begin(), m_bsErrors[errType].end(), hash_side1)!=m_bsErrors[errType].end()) { - abcdErrorChips2 |= (1 << chip); - } - chip++; - } +const std::map<Identifier, unsigned int>& SCT_ByteStreamErrorsSvc::getAbcdErrorChips(const EventContext& ctx) { + StatusCode sc{fillData(ctx)}; + if (sc.isFailure()) { + ATH_MSG_ERROR("fillData in getAbcdErrorChips fails"); } - return abcdErrorChips2; + return m_abcdErrorChips[ctx.slot()]; } diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.h b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.h index 3b9a7ce7e05f8ddafcb5bafa55c547d1832d43cc..210faa209bc3488825585fe19140e6399f382a55 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ByteStreamErrorsSvc.h @@ -10,21 +10,23 @@ #ifndef SCT_ByteStreamErrorsSvc_h #define SCT_ByteStreamErrorsSvc_h -///STL includes +///STL includes #include <set> #include <map> #include <list> +#include <mutex> ///Gaudi includes -#include "GaudiKernel/IIncidentListener.h" #include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/EventContext.h" + ///Athena includes #include "AthenaBaseComps/AthService.h" #include "InDetConditionsSummaryService/InDetHierarchy.h" -#include "SCT_Cabling/ISCT_CablingSvc.h" #include "SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" /** needs to be included here for gcc 4.3 compatibility */ #include "StoreGate/StoreGateSvc.h" @@ -50,7 +52,7 @@ namespace InDetDD { * Service that keeps track of modules that give rise to errors in the bytestram. **/ -class SCT_ByteStreamErrorsSvc: virtual public ISCT_ByteStreamErrorsSvc, virtual public IIncidentListener, virtual public AthService { +class SCT_ByteStreamErrorsSvc: virtual public ISCT_ByteStreamErrorsSvc, virtual public AthService { friend class SvcFactory<SCT_ByteStreamErrorsSvc>; public: //@name Service methods @@ -60,8 +62,6 @@ public: virtual StatusCode initialize() override; virtual StatusCode finalize() override; virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); - - virtual void handle(const Incident& inc) override; //@} virtual bool canReportAbout(InDetConditions::Hierarchy h) override; @@ -80,66 +80,48 @@ public: virtual bool canFillDuringInitialize() override { return false; } const std::set<IdentifierHash>* getErrorSet(int errorType) override; // Used by SCTRawDataProviderTool and others - void addError(IdentifierHash id, int errorType) override; // Used by SCT_RodDecoder - virtual void resetSets() override; // Internally used - virtual int getNumberOfErrors(int errorType) override; /** for HLT */ // Used by SCT_TrgClusterization and SCT_ClusterCacheTool - void addErrorCount(int errorType) override; // Used by SCT_RodDecoder - virtual void resetCounts() override; /** for the counts used by HLT */ // Used internally and by SCT_ClusterCacheTool - - virtual void setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip) override; // Used by SCT_RodDecoder - virtual unsigned int getFirstTempMaskedChip(const IdentifierHash& hashId) const override; // Internally used - virtual const std::map<Identifier, unsigned int>* tempMaskedChips() const override {return &m_tempMaskedChips;} // Internally used - virtual unsigned int tempMaskedChips(const Identifier & moduleId) const override; // Internally used - - virtual unsigned int abcdErrorChips(const Identifier & moduleId) const override; // Internally used - void setRODSimulatedData() override; // Used by SCT_RodDecoder - bool isRODSimulatedData() override; // Internally used - - virtual void addRODHVCounter(bool HVisOn) override; // Used by SCT_RodDecoder - virtual bool HVisOn() override; // Internally used - - virtual bool isCondensedReadout() override; // Not used - virtual void setCondensedReadout(bool isCondensed) override; // Used by SCT_RodDecoder + virtual unsigned int tempMaskedChips(const Identifier& moduleId) override; // Internally used + virtual unsigned int abcdErrorChips(const Identifier& moduleId) override; // Internally used + virtual bool isRODSimulatedData() const override; // Internally used + virtual bool HVisOn() const override; // Internally used + virtual bool isCondensedReadout() const override; // Not used private: - ServiceHandle<StoreGateSvc> m_evtStore; ServiceHandle<StoreGateSvc> m_detStore; - ServiceHandle<ISCT_CablingSvc> m_cabling; ServiceHandle<ISCT_ConfigurationConditionsSvc> m_config; const SCT_ID* m_sct_id; IdContext m_cntx_sct; const InDetDD::SCT_DetectorManager* m_pManager; //!< SCT detector manager - bool m_filled; - - bool m_useRXredundancy; - - bool m_lookForSGErrContainer; SG::ReadHandleKey<InDetBSErrContainer> m_bsErrContainerName; + SG::ReadHandleKey<SCT_ByteStreamFractionContainer> m_bsFracContainerName; - // Used by getErrorSet, addError, resetSets - std::set<IdentifierHash> m_bsErrors[SCT_ByteStreamErrors::NUM_ERROR_TYPES]; - // Used by getNumberOfErrors, addErrorCount, resetCounts - int m_numBsErrors[SCT_ByteStreamErrors::NUM_ERROR_TYPES]; + std::vector<std::set<IdentifierHash> > m_bsErrors[SCT_ByteStreamErrors::NUM_ERROR_TYPES]; // Used by getErrorSet, addError, resetSets - // Used by setFirstTempMaskedChip, getFirstTempMaskedChip, tempMaskedChips - std::map<IdentifierHash, unsigned int> m_firstTempMaskedChips; - std::map<Identifier, unsigned int> m_tempMaskedChips; + std::vector<std::map<Identifier, unsigned int> > m_tempMaskedChips; + std::vector<std::map<Identifier, unsigned int> > m_abcdErrorChips; - // Used by setRODSimulatedData and isRODSimulatedData - bool m_isRODSimulatedData; // This can be ROD dependent. + // Mutex to protect the contents. + mutable std::mutex m_mutex; + // Cache to store events for slots + mutable std::vector<EventContext::ContextEvt_t> m_cache; - // Used by addRODHVCounter and HVisOn - int m_numRODsHVon; - int m_numRODsTotal; + StatusCode fillData(const EventContext& ctx); - // Used by isCondensedReadout and setCondensedReadout - bool m_condensedMode; // This can be ROD dependent. + void addError(IdentifierHash id, int errorType, const EventContext& ctx); + void resetSets(const EventContext& ctx); - bool isGoodChip(const Identifier& stripId) const; + bool isGoodChip(const Identifier& stripId); int getChip(const Identifier& stripId) const; + + // For isRODSimulatedData, HVisOn and isCondensedReadout + const SCT_ByteStreamFractionContainer* getFracData() const; + + const std::set<IdentifierHash>& getErrorSet(SCT_ByteStreamErrors::errorTypes errorType, const EventContext& ctx); + const std::map<Identifier, unsigned int>& getTempMaskedChips(const EventContext& ctx); + const std::map<Identifier, unsigned int>& getAbcdErrorChips(const EventContext& ctx); }; #endif // SCT_ByteStreamErrorsSvc_h diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt index 91b26d1f870bcd23dfe0f6772530b3716b97db85..19db0f76b3f63e6145ee230dd46bc48ff7c6ff26 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/CMakeLists.txt @@ -12,7 +12,6 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetConditions/InDetByteStreamErrors - InnerDetector/InDetConditions/SCT_ConditionsData PRIVATE Control/AthenaBaseComps Control/StoreGate @@ -33,7 +32,7 @@ atlas_add_component( SCT_RawDataByteStreamCnv src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel InDetRawData SCT_ConditionsData AthenaBaseComps StoreGateLib SGtests Identifier EventInfo xAODEventInfo InDetIdentifier InDetReadoutGeometry SCT_CablingLib TrigSteeringEvent) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel InDetRawData InDetByteStreamErrors AthenaBaseComps StoreGateLib SGtests Identifier EventInfo xAODEventInfo InDetIdentifier InDetReadoutGeometry SCT_CablingLib TrigSteeringEvent) # Install files from the package: atlas_install_headers( SCT_RawDataByteStreamCnv ) diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCTRawDataProviderTool.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCTRawDataProviderTool.h index 438b64cdf1bb235d9084f52418791e1ac03ff9ec..402279f0515e08273c27fd504a8c331c650f5f7b 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCTRawDataProviderTool.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCTRawDataProviderTool.h @@ -10,7 +10,7 @@ #include "InDetRawData/SCT_RDO_Container.h" #include "InDetRawData/InDetTimeCollection.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" -#include "SCT_ConditionsData/SCT_ByteStreamFractionContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" #include <set> #include <string> diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h index 4075ee1710498a754a46d9d173e1cc8836618855..77777b77745409bd3d7e933c9c11c696762ca5b9 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/SCT_RawDataByteStreamCnv/ISCT_RodDecoder.h @@ -21,7 +21,7 @@ //Cannot fwd declare RawEvent, due to typedef in the .h. Needed for OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment #include "ByteStreamData/RawEvent.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" -#include "SCT_ConditionsData/SCT_ByteStreamFractionContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" class IInterface; class InterfaceID; diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx index a745be934e259c631515ca5248aa989cbd7eaf30..175222f87b90b413e97bb37cbb16eb742a1fcc73 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.cxx @@ -35,7 +35,7 @@ SCTRawDataProvider::SCTRawDataProvider(const std::string& name, declareProperty("LVL1IDKey", m_lvl1CollectionKey = std::string{"SCT_LVL1ID"}); declareProperty("BCIDKey", m_bcidCollectionKey = std::string{"SCT_BCID"}); declareProperty("ByteStreamErrContainer", m_bsErrContainerKey = std::string{"SCT_ByteStreamErrs"}); - declareProperty("ByteStreamFracContainer", m_bsFracContainerKey = std::string{"SCT_ByteStreamFractionContainer"}); + declareProperty("ByteStreamFracContainer", m_bsFracContainerKey = std::string{"SCT_ByteStreamFrac"}); declareProperty("CablingSvc", m_cabling); declareProperty("RDOCacheKey", m_rdoContainerCacheKey); } diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h index 3cdbb7ae1fb298316b409bf1f7f41a2001fdf2d2..a8d371ed71b789fd433038fe4f7067712bf878ef 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCTRawDataProvider.h @@ -27,7 +27,7 @@ #include "InDetRawData/InDetTimeCollection.h" #include "InDetRawData/SCT_RDO_Container.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" -#include "SCT_ConditionsData/SCT_ByteStreamFractionContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx index a2b568c4c37eefcf01662bfd5e5ca596d013895b..46c99a4d473c482f1f3d7e14ed77b759f6c9c528 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx @@ -16,6 +16,7 @@ //Inner detector #include "SCT_Cabling/ISCT_CablingSvc.h" #include "SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h" +#include "SCT_ConditionsServices/ISCT_ConfigurationConditionsSvc.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" @@ -33,6 +34,7 @@ SCT_RodDecoder::SCT_RodDecoder m_indet_mgr{nullptr}, m_cabling{"SCT_CablingSvc", name}, m_byteStreamErrSvc{"SCT_ByteStreamErrorsSvc", name}, + m_configSvc{"InDetSCT_ConfigurationConditionsSvc", name}, m_condensedMode{false}, m_superCondensedMode{false}, m_singleCondHitNumber{0}, @@ -68,6 +70,7 @@ SCT_RodDecoder::SCT_RodDecoder { declareProperty("CablingSvc", m_cabling); declareProperty("ErrorsSvc", m_byteStreamErrSvc); + declareProperty("ConfigSvc", m_configSvc); declareProperty("TriggerMode", m_triggerMode=true); declareInterface<ISCT_RodDecoder>(this); } @@ -88,8 +91,10 @@ StatusCode SCT_RodDecoder::initialize() { ATH_CHECK(detStore()->retrieve(m_indet_mgr,"SCT")); ATH_CHECK(detStore()->retrieve(m_sct_id,"SCT_ID")); + m_cntx_sct = m_sct_id->wafer_context(); ATH_CHECK(m_byteStreamErrSvc.retrieve()); + ATH_CHECK(m_configSvc.retrieve()); return StatusCode::SUCCESS; } @@ -151,8 +156,6 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r /**determine whether this data was generated using the ROD simulator */ uint32_t rod_datatype{robFrag.rod_detev_type()}; const bool rodSimulatedData{static_cast<bool>((rod_datatype >> 20) & 1)}; - - if (rodSimulatedData) m_byteStreamErrSvc->setRODSimulatedData(); if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::SimulatedData, robid, rodSimulatedData); /** look for the bit that denotes "Super-condensed" mode.*/ @@ -238,7 +241,6 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r /** look at bits 20-23 for DCS HV */ int hvBits{static_cast<int>((statusWord >> 20) & 0xf)}; const bool hvOn{hvBits==0xf}; - m_byteStreamErrSvc->addRODHVCounter(hvOn); if (bsFracCont) bsFracCont->insert(SCT_ByteStreamFractionContainer::HVOn, robid, hvOn); } } @@ -655,14 +657,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r sc=StatusCode::RECOVERABLE; } - bool condensedMode{false}; - if (d[n]&0x100) condensedMode = true; - - if (condensedMode != m_condensedMode) { - m_condensedMode = condensedMode; - // This does not appear to be used. Can it be removed??? - m_byteStreamErrSvc->setCondensedReadout(m_condensedMode); - } + m_condensedMode = static_cast<bool>(d[n]&0x100); continue; @@ -721,7 +716,7 @@ SCT_RodDecoder::fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& r // 6 means chip 5 is temporarily masked. // 7 means chips 6-11, 0-5 are temporarily masked. // 12 means chips 11, 0-5 are temporarily masked. - m_byteStreamErrSvc->setFirstTempMaskedChip(currentLinkIdHash, (d[n] & 0xF)); + setFirstTempMaskedChip(currentLinkIdHash, (d[n] & 0xF), errs); } continue; } @@ -951,15 +946,161 @@ SCT_RodDecoder::addSingleError(const IdentifierHash idHash, const int bsErrorType, InDetBSErrContainer* errs) { - bool ok{true}; - if (m_triggerMode) { - m_byteStreamErrSvc->addErrorCount(bsErrorType); + bool ok{idHash.is_valid() and errs!=nullptr}; + if (ok) { + errs->push_back(std::make_unique<std::pair<IdentifierHash, int> >(idHash, bsErrorType)); + } + return ok; +} + +void +SCT_RodDecoder::setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip, InDetBSErrContainer* errs) { + if (not hashId.is_valid()) { + ATH_MSG_INFO("setFirstTempMaskedChip hashId " << hashId << " is invalid."); + return; + } + if (firstTempMaskedChip==0) { + ATH_MSG_WARNING("setFirstTempMaskedChip: firstTempMaskedChip should be greater than 0. firstTempMaskedChip is " << firstTempMaskedChip); + return; + } + + // wafer hash -> wafer id -> module id -> wafer hash on side-0, wafer hash on side-1 + const Identifier wafId{m_sct_id->wafer_id(hashId)}; + const Identifier moduleId{m_sct_id->module_id(wafId)}; + + // Side 0 + IdentifierHash hash_side0; + m_sct_id->get_hash(moduleId, hash_side0, &m_cntx_sct); + unsigned int firstTempMaskedChip_side0{0}; + if (hashId==hash_side0) firstTempMaskedChip_side0 = firstTempMaskedChip; + + // Side 1 + IdentifierHash hash_side1; + m_sct_id->get_other_side(hash_side0, hash_side1); + unsigned int firstTempMaskedChip_side1{0}; + if (hashId==hash_side1) firstTempMaskedChip_side1 = firstTempMaskedChip; + + int type{0}; + // Check if Rx redundancy is used or not in this module + std::pair<bool, bool> badLinks{m_configSvc->badLinks(moduleId)}; + if (badLinks.first xor badLinks.second) { + // Rx redundancy is used in this module. + if (badLinks.first and not badLinks.second) { + // link-1 is broken + type = 1; + } else if (badLinks.second and not badLinks.first) { + // link-0 is broken + type = 2; + } else if (badLinks.first and badLinks.second) { + // both link-0 and link-1 are working + ATH_MSG_WARNING("setFirstTempMaskedChip: Both link-0 and link-1 are working. But Rx redundancy is used... Why?"); + return; + } else { + // both link-0 and link-1 are broken + ATH_MSG_WARNING("setFirstTempMaskedChip: Both link-0 and link-1 are broken. But data are coming... Why?"); + return; + } + } + + // "Modified" module (using Rx redundancy) case + // Information of modified modules are found in + // modified0 and modified1 functions of SCT_ReadoutTool.cxx and + // Table 3.8 of CERN-THESIS-2008-001 https://cds.cern.ch/record/1078223 + // However, there are two exceptions of the exceptions. + unsigned long long fullSerialNumber{m_cabling->getSerialNumberFromHash(hashId).to_ulonglong()}; + if (// Readout through link-0 + fullSerialNumber==20220170200183 or // hash=4662 bec=0 layer=2 eta= 6 phi=39 + fullSerialNumber==20220330200606 or // hash=5032 bec=0 layer=3 eta=-2 phi= 7 + fullSerialNumber==20220330200693 // hash=5554 bec=0 layer=3 eta=-5 phi=29 + ) { + if (type!=1) ATH_MSG_WARNING("Link-0 is broken but modified module readingout link-0, inconsistent"); + type = 3; + + // An exception: + // fullSerialNumber=20220170200941, hash=3560 bec=0 layer=1 eta=-6 phi=34 + // This module is a modified one. However, it is not using modified configuration. + // Readout sequence is 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11. + } + if (// Readout through link-1 + fullSerialNumber==20220170200653 or // hash=2786 bec=0 layer=1 eta= 4 phi= 1 + fullSerialNumber==20220330200117 or // hash=5516 bec=0 layer=3 eta= 1 phi=27 + fullSerialNumber==20220330200209 or // hash=5062 bec=0 layer=3 eta= 2 phi= 8 + fullSerialNumber==20220330200505 or // hash=5260 bec=0 layer=3 eta= 5 phi=16 + fullSerialNumber==20220330200637 or // hash=4184 bec=0 layer=2 eta=-6 phi=20 + fullSerialNumber==20220330200701 // hash=4136 bec=0 layer=2 eta=-6 phi=18 + ) { + if (type!=2) ATH_MSG_WARNING("Link-1 is broken but modified module readingout link-1, inconsistent"); + type = 4; + + // Another exception: + // fullSerialNumber=20220170200113, hash=3428 bec=0 layer=1 eta= 1 phi=28 + // This module is a modified one. However, it is not using modified configuration. + // Readout sequence is 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5. + } + + static const int chipOrder[5][12]{ + // type=0 not prepared for both link-0 and link-1 are working + {}, + // type=1 link-1 is broken: chip 0 1 2 3 4 5 6 7 8 9 10 11 + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, + // type=2 link-0 is broken: chip 6 7 8 9 10 11 0 1 2 3 4 5 + {6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5}, + // type=3 "modified" modules and link-1 is broken: chip 0 1 2 3 4 5 7 8 9 10 11 6 + {0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 6}, + // type=4 "modified" modules and link-0 is broken: chip 6 7 8 9 10 11 1 2 3 4 5 0 + {6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 0} + }; + + if (type==0) { + // both link-0 and link-1 are working + + // Chips 0-5 are on side 0 and chips 6-11 are on side 1. + // Normally, modules send hits on side 0 via link-0 and side 1 via link-1. + // The first temporally masked chip value is the id of the chip that is + // first masked in the readout chain "plus one". + // If the value is in between 1 to 6, it indicates side 0. + // If the value is in between 7 to 12, it indicates side 1. + // However, some special modules send hits on side 0 via link-1 and hits on + // side 1 via link-0. If the first masked chip value on side 1 (0) is + // between 1 to 6 (7 to 12), it indicates the module is a special one. + // In that case, information is swapped. + if ((6<firstTempMaskedChip_side0 and firstTempMaskedChip_side0<=12) or + (0<firstTempMaskedChip_side1 and firstTempMaskedChip_side1<= 6)) { + unsigned int swapFirstTempMaskedChip_side0{firstTempMaskedChip_side0}; + firstTempMaskedChip_side0 = firstTempMaskedChip_side1; + firstTempMaskedChip_side1 = swapFirstTempMaskedChip_side0; + } + + if (firstTempMaskedChip_side0>0) { + for (unsigned int iChip{firstTempMaskedChip_side0-1}; iChip<6; iChip++) { + addSingleError(hash_side0, SCT_ByteStreamErrors::TempMaskedChip0+iChip, errs); + } + } + if (firstTempMaskedChip_side1>6) { + for (unsigned int iChip{firstTempMaskedChip_side1-1}; iChip<12; iChip++) { + addSingleError(hash_side1, SCT_ByteStreamErrors::TempMaskedChip0+iChip-6, errs); + } + } } else { - ok=idHash.is_valid(); - if (ok) { - errs->push_back(std::make_unique<std::pair<IdentifierHash, int> > - (idHash, bsErrorType)); + // type=1, 2, 3, 4: cases using Rx redundancy + bool toBeMasked{false}; + for (int iChip{0}; iChip<12; iChip++) { + int jChip{chipOrder[type][iChip]}; + if (jChip==static_cast<int>(firstTempMaskedChip-1)) toBeMasked = true; + if (toBeMasked) { + if (jChip<6) addSingleError(hash_side0, SCT_ByteStreamErrors::TempMaskedChip0+jChip, errs); + else addSingleError(hash_side1, SCT_ByteStreamErrors::TempMaskedChip0+jChip-6, errs); + } } } - return ok; + + ATH_MSG_VERBOSE("setFirstTempMaskedChip Hash " << hashId + << " SerialNumber " << m_cabling->getSerialNumberFromHash(hashId).str() + << " moduleId " << moduleId + << " barrel_ec " << m_sct_id->barrel_ec(wafId) + << " layer_disk " << m_sct_id->layer_disk(wafId) + << " eta_module " << m_sct_id->eta_module(wafId) + << " phi_module " << m_sct_id->phi_module(wafId) + << " side " << m_sct_id->side(wafId) + << " firstTempMaskedChip " << firstTempMaskedChip); } diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h index b20423509b8e0e0053e6b5ac367c070f003af1a0..461e18f8a6f7203fdff3e0ee66d8c0bd1b24cba0 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.h @@ -20,9 +20,11 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" +#include "Identifier/IdContext.h" class ISCT_CablingSvc; class ISCT_ByteStreamErrorsSvc; +class ISCT_ConfigurationConditionsSvc; class SCT_ID; namespace InDetDD{ @@ -82,10 +84,14 @@ class SCT_RodDecoder : public AthAlgTool, public ISCT_RodDecoder bool addSingleError(const IdentifierHash idHash, const int bsErrorType, InDetBSErrContainer* errs); + /** Set first temporarily masked chip information from byte stream trailer */ + void setFirstTempMaskedChip(const IdentifierHash& hashId, const unsigned int firstTempMaskedChip, InDetBSErrContainer* errs); const SCT_ID* m_sct_id; + IdContext m_cntx_sct; const InDetDD::SCT_DetectorManager *m_indet_mgr; ServiceHandle<ISCT_CablingSvc> m_cabling; ServiceHandle<ISCT_ByteStreamErrorsSvc> m_byteStreamErrSvc; + ServiceHandle<ISCT_ConfigurationConditionsSvc> m_configSvc; bool m_condensedMode ; bool m_superCondensedMode ; /** Summary of the decoding process */ diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx index dbbf4de5f040f0712033eccf64bf7f12e90c0b7b..f8456d38fad80ce0531720629fb06b7729c94648 100644 --- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx +++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodEncoder.cxx @@ -93,7 +93,7 @@ void SCT_RodEncoder::fillROD(std::vector<uint32_t>& v32rod, uint32_t robid, vRDOs_t& rdoVec) { /** retrieve errors from SCT_ByteStreamErrorsSvc */ - + const std::set<IdentifierHash>* timeOutErrors{m_bsErrs->getErrorSet(SCT_ByteStreamErrors::TimeOutError)}; const std::set<IdentifierHash>* l1idErrors{m_bsErrs->getErrorSet(SCT_ByteStreamErrors::LVL1IDError)}; const std::set<IdentifierHash>* bcidErrors{m_bsErrs->getErrorSet(SCT_ByteStreamErrors::BCIDError)}; diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py index 5e0181eda2fb859b57fca1ee481f60e5803132d6..f486cc2c2b53f0e2bd0022eef7f04698e3de9b0d 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetKeys.py @@ -148,6 +148,12 @@ class SCT_ByteStreamErrs(JobProperty): allowedTypes = ['str'] StoredValue = 'SCT_ByteStreamErrs' +class SCT_ByteStreamFrac(JobProperty): + """StoreGate key for SCT BS fractions""" + statusOn = True + allowedTypes = ['str'] + StoredValue = 'SCT_ByteStreamFrac' + class TRT_ByteStreamErrs(JobProperty): """StoreGate key for TRT BS errors""" statusOn = True @@ -1097,6 +1103,7 @@ jobproperties.InDetContainerKeys.add_JobProperty(BCM_RDOs) jobproperties.InDetContainerKeys.add_JobProperty(BCM_CompactDOs) jobproperties.InDetContainerKeys.add_JobProperty(PixelByteStreamErrs) jobproperties.InDetContainerKeys.add_JobProperty(SCT_ByteStreamErrs) +jobproperties.InDetContainerKeys.add_JobProperty(SCT_ByteStreamFrac) jobproperties.InDetContainerKeys.add_JobProperty(TRT_ByteStreamErrs) jobproperties.InDetContainerKeys.add_JobProperty(TRT_ByteStreamIdErrs) jobproperties.InDetContainerKeys.add_JobProperty(GangedPixelMap) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py index f96291619fed2ae1b01da7868c7b2f29c485933a..8d9e46b2e04069970e2271c514a01041d2d64b0c 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/WriteInDetESD.py @@ -129,6 +129,7 @@ if globalflags.InputFormat()=='bytestream': InDetESDList+=['InDetBSErrContainer#'+InDetKeys.SCT_ByteStreamErrs()] InDetESDList+=['TRT_BSErrContainer#'+InDetKeys.TRT_ByteStreamErrs()] InDetESDList+=['TRT_BSIdErrContainer#'+InDetKeys.TRT_ByteStreamIdErrs()] + InDetESDList+=['SCT_ByteStreamFractionContainer#'+InDetKeys.SCT_ByteStreamFrac()] if InDetFlags.doxAOD(): excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation." diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py index 5edf3a66da82968848253dbf1d56a834cfadb0f6..1ae25ff27522995ea8295358f0c89ebd5fb58d1b 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecPreProcessing.py @@ -161,7 +161,6 @@ class SCTClustering_EF( InDet__SCT_TrgClusterization ): self.clusteringTool = InDetTrigSCT_ClusteringTool self.SCT_RDOContainerName=EF_SCTRDOKey self.conditionsSummarySvc="SCT_ConditionsSummarySvc/"+SCT_ConditionsSetup.instanceName("InDetSCT_ConditionsSummarySvcWithoutFlagged") - self.bytestreamErrorSvc=InDetTrigBSErrorSvc from InDetTrigRecExample.InDetTrigSliceSettings import InDetTrigSliceSettings self.EtaHalfWidth = InDetTrigSliceSettings[('etaHalfWidth',type)] diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/InDetTrigPrepRawDataFormat/SCT_TrgClusterization.h b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/InDetTrigPrepRawDataFormat/SCT_TrgClusterization.h index 219b5cf9ab4f4a6c2bd96d1058cc4194f95c80d2..a4d415a909df43853639106c676d9c02e87ea248 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/InDetTrigPrepRawDataFormat/SCT_TrgClusterization.h +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/InDetTrigPrepRawDataFormat/SCT_TrgClusterization.h @@ -124,7 +124,6 @@ namespace InDet { double m_etaHalfWidth; //!< ROI half-width in eta. double m_phiHalfWidth; //!< ROI half-width in phi. std::string m_sctRDOContainerName; - ServiceHandle<ISCT_ByteStreamErrorsSvc> m_bsErrorSvc; ServiceHandle<IROBDataProviderSvc> m_robDataProvider; //!< ROB Data Provide Service //conditions diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx index d00ab93cffc873b12bf14442ac99a55d7549a102..b4cd107e35a6e7f0044e7c537d0dd62a83919dc8 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx @@ -31,7 +31,6 @@ #include "AthenaKernel/Timeout.h" #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" -#include "SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h" //Trigger #include "TrigSteeringEvent/TrigRoiDescriptor.h" @@ -65,7 +64,6 @@ namespace InDet{ m_etaHalfWidth(0.1), m_phiHalfWidth(0.1), m_sctRDOContainerName("SCT_RDOs"), - m_bsErrorSvc("SCT_ByteStreamErrorsSvc",name), m_robDataProvider("ROBDataProviderSvc", name), m_pSummarySvc("SCT_ConditionsSummarySvc", name), m_checkBadModules(true), @@ -90,7 +88,6 @@ namespace InDet{ declareProperty("RawDataProvider", m_rawDataProvider); declareProperty("conditionsSummarySvc", m_pSummarySvc); - declareProperty("bytestreamErrorSvc", m_bsErrorSvc); declareProperty("checkBadModules", m_checkBadModules); declareProperty("maxRDOs", m_maxRDOs); declareProperty("doTimeOutChecks", m_doTimeOutChecks); @@ -231,13 +228,6 @@ namespace InDet{ } - //BS Error Svc - if (m_bsErrorSvc.retrieve().isFailure()){ - ATH_MSG_FATAL( "Could not retrieve " << m_bsErrorSvc ); - return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP); - } else { - ATH_MSG_INFO ("Retrieved service " << m_bsErrorSvc); - } if (m_checkBadModules){ if (m_pSummarySvc.retrieve().isFailure()){ @@ -391,30 +381,6 @@ namespace InDet{ if (scdec.isSuccess()){ //check for recoverable errors - int n_err_total = 0; - - int bsErrors[SCT_ByteStreamErrors::NUM_ERROR_TYPES]; - - for (size_t idx = 0; idx<size_t(SCT_ByteStreamErrors::NUM_ERROR_TYPES); idx++){ - int n_errors = m_bsErrorSvc->getNumberOfErrors(idx); - n_err_total += n_errors; - bsErrors[idx] = n_errors; - } - - - ATH_MSG_DEBUG( "decoding errors: " << n_err_total ); - - if (n_err_total){ - for (size_t idx = 0; idx<size_t(SCT_ByteStreamErrors::NUM_ERROR_TYPES); idx++){ - m_SctBSErr.push_back(bsErrors[idx]); - if (bsErrors[idx]){ - ATH_MSG_DEBUG(" " << idx << ":" << bsErrors[idx]); - } - } - ATH_MSG_DEBUG( "" ); - } - - } else { ATH_MSG_DEBUG( " m_rawDataProvider->decode failed" ); } diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/CMakeLists.txt b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/CMakeLists.txt index a9a77eb16c7b54b74553b951d002a93c7702d5f7..22290d0d118fa49e0c3219064b05d9646ee75d73 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/CMakeLists.txt +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/CMakeLists.txt @@ -17,7 +17,6 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/IRegionSelector Event/ByteStreamCnvSvcBase InnerDetector/InDetConditions/InDetByteStreamErrors - InnerDetector/InDetConditions/SCT_ConditionsData InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDetDescr/SCT_Cabling @@ -31,7 +30,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( InDetTrigRawDataProvider src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRawData AthenaKernel StoreGateLib SGtests IRegionSelector ByteStreamCnvSvcBaseLib SCT_ConditionsData InDetIdentifier SCT_CablingLib TrigSteeringEvent PixelCablingLib ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRawData AthenaKernel StoreGateLib SGtests IRegionSelector ByteStreamCnvSvcBaseLib InDetByteStreamErrors InDetIdentifier SCT_CablingLib TrigSteeringEvent PixelCablingLib ) # Install files from the package: atlas_install_headers( InDetTrigRawDataProvider ) diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx index 2a0e1b6d6a82d4c00aa76d34982722b447c7aa92..272bfdb1874df746ddf6a384bd55f26a8701be77 100644 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigRawDataProvider/src/TrigSCTRawDataProvider.cxx @@ -15,7 +15,7 @@ #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "IRegionSelector/IRegSelSvc.h" #include "InDetByteStreamErrors/InDetBSErrContainer.h" -#include "SCT_ConditionsData/SCT_ByteStreamFractionContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" using OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment; @@ -43,8 +43,8 @@ namespace InDet { { declareInterface<InDet::ITrigRawDataProviderTool>(this); declareProperty("RDOKey", m_RDO_Key = "SCT_RDOs_EFID"); - declareProperty("ByteStreamErrContainer", m_bsErrCont_Key = "SCT_ByteStreamErrs_EFID"); - declareProperty("ByteStreamFracContainer", m_bsFracCont_Key = "SCT_ByteStreamFractionContainer_EFID"); + declareProperty("ByteStreamErrContainer", m_bsErrCont_Key = "SCT_ByteStreamErrs"); + declareProperty("ByteStreamFracContainer", m_bsFracCont_Key = "SCT_ByteStreamFrac"); declareProperty("RawDataTool", m_rawDataTool); } @@ -157,7 +157,7 @@ namespace InDet { m_bsFracCont = nullptr; if (!m_storeGate->transientContains<SCT_ByteStreamFractionContainer>(m_bsFracCont_Key)) { m_bsFracCont = new SCT_ByteStreamFractionContainer(); - if (m_storeGate->record(m_bsFracCont, m_bsFracCont_Key).isFailure()) { + if (m_storeGate->record(m_bsFracCont, m_bsFracCont_Key, true, true).isFailure()) { ATH_MSG_FATAL("Unable to record " << m_bsFracCont_Key); return StatusCode::FAILURE; } @@ -173,7 +173,7 @@ namespace InDet { m_bsErrCont = nullptr; if (!m_storeGate->transientContains<InDetBSErrContainer>(m_bsErrCont_Key)) { m_bsErrCont = new InDetBSErrContainer(); - if (m_storeGate->record(m_bsErrCont, m_bsErrCont_Key).isFailure()) { + if (m_storeGate->record(m_bsErrCont, m_bsErrCont_Key, true, true).isFailure()) { ATH_MSG_FATAL("Unable to record " << m_bsErrCont_Key); return StatusCode::FAILURE; } diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt b/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt index f7acd33e59fd17eae66bbcdee9e1f9c9f250b070..ecc045420d0a9e2767e4c1869a0bb12dae0ed908 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt @@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/IRegionSelector DetectorDescription/Identifier Event/ByteStreamData + InnerDetector/InDetConditions/InDetByteStreamErrors InnerDetector/InDetConditions/PixelConditionsServices InnerDetector/InDetConditions/SCT_ConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier @@ -30,7 +31,6 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/AtlasDetDescr Event/ByteStreamCnvSvcBase InnerDetector/InDetConditions/InDetBeamSpotService - InnerDetector/InDetConditions/SCT_ConditionsData InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv Tracking/TrkEvent/TrkSpacePoint Trigger/TrigTools/TrigInDetToolInterfaces @@ -44,7 +44,7 @@ atlas_add_component( TrigOnlineSpacePointTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps IRegionSelector Identifier ByteStreamData ByteStreamData_test GaudiKernel InDetIdentifier InDetReadoutGeometry SCT_CablingLib InDetRawData InDetPrepRawData SiClusterizationToolLib TrkPrepRawData TrigInDetEvent TrigSteeringEvent AtlasDetDescr ByteStreamCnvSvcBaseLib SCT_ConditionsData TrkSpacePoint TrigTimeAlgsLib PixelCablingLib ) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps IRegionSelector InDetByteStreamErrors ByteStreamData ByteStreamData_test GaudiKernel InDetByteStreamErrors InDetIdentifier InDetReadoutGeometry SCT_CablingLib InDetRawData InDetPrepRawData SiClusterizationToolLib TrkPrepRawData TrigInDetEvent TrigSteeringEvent AtlasDetDescr ByteStreamCnvSvcBaseLib SCT_ConditionsData TrkSpacePoint TrigTimeAlgsLib PixelCablingLib ) # Install files from the package: atlas_install_headers( TrigOnlineSpacePointTool ) diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/SCT_ClusterCacheTool.h b/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/SCT_ClusterCacheTool.h index 08f49217da3439a68cedb1e57af9f4e922d598cd..8fa8acac620660658263dcfa6eb71224af130a8a 100755 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/SCT_ClusterCacheTool.h +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/TrigOnlineSpacePointTool/SCT_ClusterCacheTool.h @@ -14,7 +14,6 @@ #include "InDetRawData/SCT_RDO_Container.h" #include "SiClusterizationTool/ISCT_ClusteringTool.h" -#include "SCT_ConditionsServices/ISCT_ByteStreamErrorsSvc.h" #include "TrigOnlineSpacePointTool/FastSCT_RodDecoder.h" #include "Identifier/IdContext.h" #include "InDetReadoutGeometry/SiDetectorManager.h" @@ -61,7 +60,6 @@ private: ToolHandle<ISCT_RodDecoder> m_offlineDecoder; bool m_useOfflineDecoder; bool m_useOfflineClustering; - ServiceHandle<ISCT_ByteStreamErrorsSvc> m_byteStreamErrSvc; ToolHandle<InDet::ISCT_ClusteringTool> m_clusteringTool; SCT_RDO_Container* m_rdoContainer; std::string m_rdoContainerName; diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py index c7d19f9c80038aeadf5696af9ba06868c9cde261..58e9649e1e82d0cce450d8dcfdd15b544db4b6cb 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/python/TrigOnlineSpacePointTool_Config.py @@ -52,7 +52,6 @@ class ConfiguredOnlineSpacePointProviderTool(OnlineSpacePointProviderTool) : ConfiguredPixelClusterCacheTool = PixelClusterCacheTool(PixelClusteringTool=InDetL2TrigMergedPixelsTool) ConfiguredSCT_ClusterCacheTool = SCT_ClusterCacheTool(SCT_ClusteringTool = InDetL2TrigSCT_ClusteringTool, - SCT_ByteStreamErrorsSvc= SCT_ConditionsSetup.instanceName("InDetSCT_ByteStreamErrorsSvc"), ) if not self.DoBS_Conversion : diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/SCT_ClusterCacheTool.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/SCT_ClusterCacheTool.cxx index c2f23ed668c1cc54e87dbeadee850fc67f92f2d2..02ef64a169517f14d15f32f076e65d7a97554be6 100755 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/SCT_ClusterCacheTool.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/SCT_ClusterCacheTool.cxx @@ -25,7 +25,8 @@ using eformat::helper::SourceIdentifier; #include "TrigTimeAlgs/TrigTimerSvc.h" -#include "SCT_ConditionsData/SCT_ByteStreamFractionContainer.h" +#include "InDetByteStreamErrors/InDetBSErrContainer.h" +#include "InDetByteStreamErrors/SCT_ByteStreamFractionContainer.h" using OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment; @@ -34,7 +35,6 @@ SCT_ClusterCacheTool::SCT_ClusterCacheTool( const std::string& type, const IInterface* parent ) : AthAlgTool(type, name, parent), m_offlineDecoder("SCT_RodDecoder",this), - m_byteStreamErrSvc("SCT_ByteStreamErrorsSvc",name), m_clusteringTool("InDet::SCT_ClusteringTool/InDetTrigSCT_ClusteringTool") { declareInterface< ISCT_ClusterCacheTool>( this ); @@ -42,10 +42,9 @@ SCT_ClusterCacheTool::SCT_ClusterCacheTool( const std::string& type, declareProperty( "SCT_ROD_Decoder", m_offlineDecoder,"SCT_RodDecoder"); declareProperty( "UseOfflineDecoder", m_useOfflineDecoder = true); declareProperty( "RDO_ContainerName", m_rdoContainerName = "SCT_RDO_Cache"); - declareProperty( "ByteStreamErrContainer", m_bsErrContainerName = "SCT_ByteStreamErrs_Cache"); - declareProperty( "ByteStreamFracContainer", m_bsFracContainerName = "SCT_ByteStreamFractionContainer_Cache"); + declareProperty( "ByteStreamErrContainer", m_bsErrContainerName = "SCT_ByteStreamErrs"); + declareProperty( "ByteStreamFracContainer", m_bsFracContainerName = "SCT_ByteStreamFracr"); declareProperty( "UseOfflineClustering", m_useOfflineClustering = true); - declareProperty( "SCT_ByteStreamErrorsSvc",m_byteStreamErrSvc ); declareProperty( "SCT_ClusteringTool", m_clusteringTool,"InDet::SCT_ClusteringTool/InDetTrigSCT_ClusteringTool"); declareProperty( "DoBS_Conversion", m_doBS = true); } @@ -133,10 +132,6 @@ StatusCode SCT_ClusterCacheTool::initialize() { return StatusCode::FAILURE; } - if (m_byteStreamErrSvc.retrieve().isFailure()) { - ATH_MSG_ERROR("initialize(): Can't get "<<m_byteStreamErrSvc); - return StatusCode::FAILURE; - } } else { m_offlineDecoder.disable(); } @@ -186,7 +181,7 @@ StatusCode SCT_ClusterCacheTool::finalize() StatusCode SCT_ClusterCacheTool::convertBStoClusters(std::vector<const ROBF*>& robFrags, const std::vector<IdentifierHash>& listOfSCTIds, - std::vector<int>& errorVect, bool isFullScan) + std::vector<int>& /*errorVect*/, bool isFullScan) { if(m_timers) { @@ -235,7 +230,7 @@ StatusCode SCT_ClusterCacheTool::convertBStoClusters(std::vector<const ROBF*>& r if (m_useOfflineDecoder) { if (!evtStore()->transientContains<InDetBSErrContainer>(m_bsErrContainerName)) { bsErrCont = new InDetBSErrContainer(); - if (evtStore()->record(bsErrCont, m_bsErrContainerName).isFailure()) { + if (evtStore()->record(bsErrCont, m_bsErrContainerName, true, true).isFailure()) { ATH_MSG_FATAL("Unable to record " << m_bsErrContainerName); return StatusCode::FAILURE; } @@ -249,7 +244,7 @@ StatusCode SCT_ClusterCacheTool::convertBStoClusters(std::vector<const ROBF*>& r } if (!evtStore()->transientContains<SCT_ByteStreamFractionContainer>(m_bsFracContainerName)) { bsFracCont = new SCT_ByteStreamFractionContainer(); - if (evtStore()->record(bsFracCont, m_bsFracContainerName).isFailure()) { + if (evtStore()->record(bsFracCont, m_bsFracContainerName, true, true).isFailure()) { ATH_MSG_FATAL("Unable to record " << m_bsFracContainerName); return StatusCode::FAILURE; } @@ -362,7 +357,6 @@ StatusCode SCT_ClusterCacheTool::convertBStoClusters(std::vector<const ROBF*>& r else { if(m_timers) m_timer[1]->resume(); - m_byteStreamErrSvc->resetCounts(); StatusCode scRod = StatusCode::SUCCESS; if(!isFullScan) { @@ -374,13 +368,6 @@ StatusCode SCT_ClusterCacheTool::convertBStoClusters(std::vector<const ROBF*>& r if(scRod.isRecoverable()) { n_recov_errors++; - for(int idx=0;idx<SCT_ByteStreamErrors::NUM_ERROR_TYPES;idx++) - { - int n_error = m_byteStreamErrSvc->getNumberOfErrors(idx); - for(int ierror = 0;ierror<n_error;ierror++) - errorVect.push_back(idx); - } - } else if(scRod.isFailure()) {