ATLAS Offline Software
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 
11 #include "SCT_StripVetoTool.h"
12 
13 // STL includes
14 #include <vector>
15 
16 // Athena include
18 #include "InDetIdentifier/SCT_ID.h"
19 
20 // Constructor
21 SCT_StripVetoTool::SCT_StripVetoTool(const std::string& type, const std::string& name, const IInterface* parent) :
22  base_class(type, name, parent) {
23 }
24 
25 //Initialize
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
46  return StatusCode::SUCCESS;
47 }
48 
49 bool
51  return (h==InDetConditions::SCT_STRIP); //default case is the side, which we cant report on
52 }
53 
54 bool
56  if (not canReportAbout(h)) return true;
57  return (m_badIds.find(elementId) == m_badIds.end());
58 }
59 
60 bool
61 SCT_StripVetoTool::isGood(const Identifier& elementId, const EventContext& /*ctx*/, InDetConditions::Hierarchy h) const {
62  return isGood(elementId, h);
63 }
64 
65 bool
66 SCT_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 
70 bool
71 SCT_StripVetoTool::isGood(const IdentifierHash& hashId, const EventContext& /*ctx*/) const {
72  return isGood(hashId);
73 }
74 
75 // @TODO consider vetoed strips below.
76 void
77 SCT_StripVetoTool::getDetectorElementStatus([[maybe_unused]] const EventContext& ctx, [[maybe_unused]] InDet::SiDetectorElementStatus &element_status, [[maybe_unused]] SG::WriteCondHandle<InDet::SiDetectorElementStatus>* whandle) const { }
78 
79 
80 
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SCT_StripVetoTool::SCT_StripVetoTool
SCT_StripVetoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SCT_StripVetoTool.cxx:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SCT_StripVetoTool::m_badIds
std::set< Identifier > m_badIds
Definition: SCT_StripVetoTool.h:59
SCT_StripVetoTool::fillData
StatusCode fillData()
Definition: SCT_StripVetoTool.cxx:82
SCT_StripVetoTool::canReportAbout
virtual bool canReportAbout(InDetConditions::Hierarchy h) const override
Can the service report about the given component? (chip, module...)
Definition: SCT_StripVetoTool.cxx:50
InDetConditions::Hierarchy
Hierarchy
Definition: InDetHierarchy.h:14
SCT_StripVetoTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SCT_StripVetoTool::getDetectorElementStatus
virtual void getDetectorElementStatus(const EventContext &ctx, InDet::SiDetectorElementStatus &element_status, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
Definition: SCT_StripVetoTool.cxx:77
SCT_StripVetoTool::m_badElements
StringArrayProperty m_badElements
Definition: SCT_StripVetoTool.h:58
InDet::SiDetectorElementStatus
Definition: SiDetectorElementStatus.h:62
SCT_StripVetoTool::initialize
virtual StatusCode initialize() override
Definition: SCT_StripVetoTool.cxx:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
SCT_StripVetoTool::isGood
virtual bool isGood(const Identifier &elementId, InDetConditions::Hierarchy h=InDetConditions::SCT_STRIP) const override
Is the detector element good?
Definition: SCT_StripVetoTool.cxx:55
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
IdentifierHash.h
SCT_StripVetoTool::m_pHelper
const SCT_ID * m_pHelper
Definition: SCT_StripVetoTool.h:60
SCT_StripVetoTool::finalize
virtual StatusCode finalize() override
Definition: SCT_StripVetoTool.cxx:45
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Identifier::value_type
unsigned long long value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:27
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
InDetConditions::SCT_STRIP
@ SCT_STRIP
Definition: InDetHierarchy.h:14
SG::WriteCondHandle
Definition: WriteCondHandle.h:26
Identifier
Definition: IdentifierFieldParser.cxx:14