ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_StripVetoTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
10
11#include "SCT_StripVetoTool.h"
12
13// STL includes
14#include <vector>
15
16// Athena include
19
20// Constructor
21SCT_StripVetoTool::SCT_StripVetoTool(const std::string& type, const std::string& name, const IInterface* parent) :
22 base_class(type, name, parent) {
23}
24
25//Initialize
26StatusCode
28 if (fillData().isFailure()) {
29 ATH_MSG_ERROR("Failed to fill data");
30 return StatusCode::FAILURE;
31 }
32
33 ATH_MSG_INFO("Initialized SCT_StripVetoTool with " << m_badElements.value().size() << " elements declared bad.");
34
35 if (detStore()->retrieve(m_pHelper, "SCT_ID").isFailure()) {
36 ATH_MSG_ERROR("SCT helper failed to retrieve");
37 return StatusCode::FAILURE;
38 }
39
40 return StatusCode::SUCCESS;
41}
42
43//Finalize
44StatusCode
46 return StatusCode::SUCCESS;
47}
48
49bool
51 return (h==InDetConditions::SCT_STRIP); //default case is the side, which we cant report on
52}
53
54bool
56 if (not canReportAbout(h)) return true;
57 return (m_badIds.find(elementId) == m_badIds.end());
58}
59
60bool
61SCT_StripVetoTool::isGood(const Identifier& elementId, const EventContext& /*ctx*/, InDetConditions::Hierarchy h) const {
62 return isGood(elementId, h);
63}
64
65bool
66SCT_StripVetoTool::isGood(const IdentifierHash& /*hashId*/) const { //comment out unused parameter to prevent compiler warning
67 return true; //cant answer questions about the module side
68}
69
70bool
71SCT_StripVetoTool::isGood(const IdentifierHash& hashId, const EventContext& /*ctx*/) const {
72 return isGood(hashId);
73}
74
75// @TODO consider vetoed strips below.
76void
77SCT_StripVetoTool::getDetectorElementStatus([[maybe_unused]] const EventContext& ctx, [[maybe_unused]] InDet::SiDetectorElementStatus &element_status, [[maybe_unused]] SG::WriteCondHandle<InDet::SiDetectorElementStatus>* whandle) const { }
78
79
80
81StatusCode
83 if (m_badElements.value().empty()) ATH_MSG_INFO("No bad strips.");
84 std::vector<std::string>::const_iterator pId{m_badElements.value().begin()};
85 std::vector<std::string>::const_iterator last{m_badElements.value().end()};
86 bool success{true};
87 for(; pId not_eq last; ++pId) {
88 success &= m_badIds.insert(Identifier(static_cast<Identifier::value_type>(atoll(pId->c_str())))).second;
89 }
90 return (success ? StatusCode::SUCCESS : StatusCode::FAILURE);
91}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
This is an Identifier helper class for the SCT subdetector.
header file for tool allowing one to declare strips as bad
Header file for AthHistogramAlgorithm.
This is a "hash" representation of an Identifier.
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (chip, module...)
StringArrayProperty m_badElements
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::SCT_STRIP) const override
Is the detector element good?
const SCT_ID * m_pHelper
virtual StatusCode initialize() override
std::set< Identifier > m_badIds
SCT_StripVetoTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual void getDetectorElementStatus(const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
virtual StatusCode finalize() override