diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/FaserSCT_ConditionsTools/ISCT_ConditionsSummaryTool.h b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/FaserSCT_ConditionsTools/ISCT_ConditionsSummaryTool.h new file mode 100644 index 0000000000000000000000000000000000000000..8fdc8ebc3ce9214db846e19651041909b6439dbf --- /dev/null +++ b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/FaserSCT_ConditionsTools/ISCT_ConditionsSummaryTool.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ISCT_CONDITIONSSUMMARYTOOL_H +#define ISCT_CONDITIONSSUMMARYTOOL_H + +#include "GaudiKernel/IInterface.h" +#include "Identifier/IdContext.h" + +#include "InDetConditionsSummaryService/InDetHierarchy.h" + +class Identifier; +class IdentifierHash; + +/** + * @class ISCT_ConditionsSummaryTool + * Interface class for service providing summary of status of a detector element +**/ + +class ISCT_ConditionsSummaryTool: virtual public IInterface, virtual public IAlgTool { +public: + virtual ~ISCT_ConditionsSummaryTool() = default; + /// Creates the InterfaceID and interfaceID() method + DeclareInterfaceID(ISCT_ConditionsSummaryTool, 1, 0); + + virtual bool isGood(const Identifier& elementId, const InDetConditions::Hierarchy h) const =0; + virtual bool isGood(const Identifier& elementId, const EventContext& ctx, const InDetConditions::Hierarchy h) const =0; + virtual bool isGood(const IdentifierHash& elementHash) const =0; + virtual bool isGood(const IdentifierHash& elementHash, const EventContext& ctx) const =0; +}; + +#endif //ISCT_CONDITIONSSUMMARYTOOL_H diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConditionsSummaryTool.cxx b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConditionsSummaryTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..afa408534cb14480c4664d5f3055af1b94e1126a --- /dev/null +++ b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConditionsSummaryTool.cxx @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + + +#include "FaserSCT_ConditionsSummaryTool.h" +#include "FaserSCT_ConditionsTools/ISCT_ConditionsTool.h" + + +FaserSCT_ConditionsSummaryTool::FaserSCT_ConditionsSummaryTool(const std::string& type, const std::string& name, const IInterface* parent) : + base_class(type, name, parent), m_toolHandles{this} { + declareProperty("ConditionsTools", m_toolHandles); +} + +StatusCode FaserSCT_ConditionsSummaryTool::initialize() { + ATH_CHECK(m_toolHandles.retrieve()); + m_noReports = m_toolHandles.empty(); + return StatusCode::SUCCESS; +} + +bool FaserSCT_ConditionsSummaryTool::isGood(const Identifier& elementId, const EventContext& ctx, const InDetConditions::Hierarchy h) const { + if (not m_noReports) { + for (const ToolHandle<ISCT_ConditionsTool>& tool: m_toolHandles) { + if (tool->canReportAbout(h) and (not tool->isGood(elementId, ctx, h))) return false; + } + } + return true; +} + +bool FaserSCT_ConditionsSummaryTool::isGood(const Identifier& elementId, const InDetConditions::Hierarchy h) const { + return isGood(elementId, Gaudi::Hive::currentContext(), h); +} + +bool FaserSCT_ConditionsSummaryTool::isGood(const IdentifierHash& elementHash, const EventContext& ctx) const { + if (not m_noReports) { + for (const ToolHandle<ISCT_ConditionsTool>& tool: m_toolHandles) { + if ((tool->canReportAbout(InDetConditions::SCT_SIDE) or + tool->canReportAbout(InDetConditions::SCT_MODULE)) and + (not tool->isGood(elementHash, ctx))) { + return false; + } + } + } + return true; +} + +bool FaserSCT_ConditionsSummaryTool::isGood(const IdentifierHash& elementHash) const { + return isGood(elementHash, Gaudi::Hive::currentContext()); +} diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConditionsSummaryTool.h b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConditionsSummaryTool.h new file mode 100644 index 0000000000000000000000000000000000000000..681ac2be455a5ab243f61165c99022a169f8ee3e --- /dev/null +++ b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/FaserSCT_ConditionsSummaryTool.h @@ -0,0 +1,38 @@ +#ifndef FASERSCT_CONDITIONSSUMMARYTOOL_H +#define FASERSCT_CONDITIONSSUMMARYTOOL_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "InDetConditionsSummaryService/InDetHierarchy.h" +#include "FaserSCT_ConditionsTools/ISCT_ConditionsSummaryTool.h" + +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/EventContext.h" + +#include <string> +#include <vector> + +class ISCT_ConditionsTool; + +/** + * @class FaserSCT_ConditionsSummaryTool + * Interface class for tool providing summary of status of an SCT detector element +**/ +class FaserSCT_ConditionsSummaryTool: public extends<AthAlgTool, ISCT_ConditionsSummaryTool> { +public: + FaserSCT_ConditionsSummaryTool(const std::string& type, const std::string& name, const IInterface* parent); //!< Tool constructor + virtual ~FaserSCT_ConditionsSummaryTool() = default; + virtual StatusCode initialize() override; + + virtual bool isGood(const Identifier& elementId, const InDetConditions::Hierarchy h) const override; + virtual bool isGood(const Identifier& elementId, const EventContext& ctx, const InDetConditions::Hierarchy h) const override; + virtual bool isGood(const IdentifierHash& elementHash) const override; + virtual bool isGood(const IdentifierHash& elementHash, const EventContext& ctx) const override; + +private: + StringArrayProperty m_reportingTools; //!< list of tools to be used + ToolHandleArray<ISCT_ConditionsTool> m_toolHandles; + bool m_noReports{true}; +}; + + +#endif // FASERSCT_CONDITIONSSUMMARYTOOL_H diff --git a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/components/FaserSCT_ConditionsTools_entries.cxx b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/components/FaserSCT_ConditionsTools_entries.cxx index adad7ee37337a3d347bedc9c1f5b28cf731fb837..2d1e511188e5b1c136d04c62943b56cb271dc900 100644 --- a/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/components/FaserSCT_ConditionsTools_entries.cxx +++ b/Tracker/TrackerConditions/FaserSCT_ConditionsTools/src/components/FaserSCT_ConditionsTools_entries.cxx @@ -21,6 +21,7 @@ // #include "../SCT_TdaqEnabledTool.h" #include "../FaserSCT_CableMappingTool.h" #include "../FaserSCT_NoisyStripTool.h" +#include "../FaserSCT_ConditionsSummaryTool.h" // DECLARE_COMPONENT( SCT_ByteStreamErrorsTool ) // DECLARE_COMPONENT( SCT_ChargeTrappingTool ) @@ -45,3 +46,4 @@ DECLARE_COMPONENT( FaserSCT_SiliconConditionsTool ) // DECLARE_COMPONENT( SCT_TdaqEnabledTool ) DECLARE_COMPONENT( FaserSCT_CableMappingTool ) DECLARE_COMPONENT( FaserSCT_NoisyStripTool ) +DECLARE_COMPONENT( FaserSCT_ConditionsSummaryTool )