ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsAlgorithms
src
SCT_RODVetoCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
13
14
#include "
SCT_RODVetoCondAlg.h
"
15
16
#include "
InDetIdentifier/SCT_ID.h
"
17
#include "
StoreGate/WriteCondHandle.h
"
18
#include "
AthenaKernel/IOVInfiniteRange.h
"
19
20
#include <algorithm>
21
#include <ios>
22
23
SCT_RODVetoCondAlg::SCT_RODVetoCondAlg
(
const
std::string& name,
24
ISvcLocator* pSvcLocator) :
25
AthCondAlgorithm
(name, pSvcLocator)
26
{
27
}
28
29
StatusCode
SCT_RODVetoCondAlg::initialize
() {
30
ATH_CHECK
(
m_cabling
.retrieve());
31
ATH_CHECK
(
detStore
()->retrieve(
m_pHelper
,
"SCT_ID"
));
32
ATH_CHECK
(
m_badIds
.initialize());
33
34
return
StatusCode::SUCCESS;
35
}
36
37
StatusCode
SCT_RODVetoCondAlg::execute
(
const
EventContext& ctx)
const
{
38
ATH_MSG_INFO
(
m_badRODElementsInput
.value().size() <<
" RODs were declared bad"
);
39
40
std::vector<unsigned int> allRods;
41
m_cabling
->getAllRods(allRods, ctx);
42
43
SG::WriteCondHandle<IdentifierSet>
badIds{
m_badIds
, ctx};
44
if
(badIds.
isValid
()) {
45
return
StatusCode::SUCCESS;
46
}
47
48
std::unique_ptr<IdentifierSet> bad_id_set = std::make_unique<IdentifierSet>();
49
50
for
(
unsigned
int
thisRod:
m_badRODElementsInput
.value()) {
51
ATH_MSG_DEBUG
(
"This rod is "
<< std::hex <<
"0x"
<< thisRod << std::dec);
52
53
//check whether rod exists
54
if
(std::find(allRods.begin(), allRods.end(), thisRod)==allRods.end()) {
55
ATH_MSG_WARNING
(
"Your vetoed selection "
<< std::hex <<
"0x"
<< thisRod <<
" does not exist."
<< std::dec);
56
continue
;
57
}
58
59
std::vector<IdentifierHash> listOfHashes;
60
m_cabling
->getHashesForRod(listOfHashes, thisRod, ctx);
61
// Two consecutive hashes may produce the same module id, since they will be two sides
62
// of the same module. We avoid invalid inserts by guarding against this.
63
Identifier
previousId;
//constructor produces an invalid one
64
for
(
const
IdentifierHash
& thisHash: listOfHashes) {
65
Identifier
wafId{
m_pHelper
->wafer_id(thisHash)};
66
Identifier
modId{
m_pHelper
->module_id(wafId)};
67
const
bool
alreadyInserted{modId==previousId};
68
previousId = modId;
69
if
(alreadyInserted)
continue
;
70
ATH_MSG_VERBOSE
(
"This module Id is "
<< modId);
71
const
bool
thisInsertionOk{bad_id_set->insert(modId).second};
72
if
(not thisInsertionOk) {
73
ATH_MSG_WARNING
(
"Insertion failed for rod "
<< std::hex <<
"0x"
<< thisRod << std::dec <<
" and module (hash,id): "
<< thisHash <<
", "
<< modId);
74
}
75
}
76
}
77
ATH_CHECK
(badIds.
record
(
IOVInfiniteRange::infiniteRunLB
(),std::move(bad_id_set)) );
78
79
return
StatusCode::SUCCESS;
80
}
81
82
StatusCode
SCT_RODVetoCondAlg::finalize
() {
83
return
StatusCode::SUCCESS;
84
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IOVInfiniteRange.h
SCT_ID.h
This is an Identifier helper class for the SCT subdetector.
SCT_RODVetoCondAlg.h
Header file for the SCT_RODVetoCondAlg class in package SCT_ConditionsAlgorithms.
WriteCondHandle.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
IOVInfiniteRange::infiniteRunLB
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
Definition
IOVInfiniteRange.h:39
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SCT_RODVetoCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
SCT_RODVetoCondAlg.cxx:37
SCT_RODVetoCondAlg::finalize
virtual StatusCode finalize() override final
Definition
SCT_RODVetoCondAlg.cxx:82
SCT_RODVetoCondAlg::m_badRODElementsInput
UnsignedIntegerArrayProperty m_badRODElementsInput
Definition
SCT_RODVetoCondAlg.h:47
SCT_RODVetoCondAlg::initialize
virtual StatusCode initialize() override final
Definition
SCT_RODVetoCondAlg.cxx:29
SCT_RODVetoCondAlg::m_cabling
ToolHandle< ISCT_CablingTool > m_cabling
Definition
SCT_RODVetoCondAlg.h:44
SCT_RODVetoCondAlg::SCT_RODVetoCondAlg
SCT_RODVetoCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCT_RODVetoCondAlg.cxx:23
SCT_RODVetoCondAlg::m_badIds
SG::WriteCondHandleKey< IdentifierSet > m_badIds
Definition
SCT_RODVetoCondAlg.h:46
SCT_RODVetoCondAlg::m_pHelper
const SCT_ID * m_pHelper
Definition
SCT_RODVetoCondAlg.h:45
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0