ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
SCT_ConditionsAlgorithms
src
SCT_ModuleVetoCondAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
SCT_ModuleVetoCondAlg.h
"
6
7
#include <memory>
8
9
namespace
{
10
template
<
class
T>
11
std::vector<T>
12
string2Vector(
const
std::string& s) {
13
std::vector<T>
v
;
14
std::istringstream inputStream{
s
};
15
std::istream_iterator<T> vecRead{inputStream};
16
std::istream_iterator<T> endOfString;
//relies on default constructor to produce eof
17
std::copy(vecRead,endOfString, std::back_inserter(v));
// DOESN'T ALLOW NON-WHITESPACE DELIMITER !
18
return
v
;
19
}
20
}
21
22
SCT_ModuleVetoCondAlg::SCT_ModuleVetoCondAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
23
: ::
AthCondAlgorithm
(name, pSvcLocator)
24
{
25
}
26
27
StatusCode
SCT_ModuleVetoCondAlg::initialize
() {
28
ATH_MSG_DEBUG
(
"initialize "
<< name());
29
30
// Read Cond Handle
31
ATH_CHECK
(
m_readKey
.initialize());
32
// Write Cond Handles
33
ATH_CHECK
(
m_writeKey
.initialize());
34
35
return
StatusCode::SUCCESS;
36
}
37
38
StatusCode
SCT_ModuleVetoCondAlg::execute
(
const
EventContext& ctx)
const
{
39
ATH_MSG_DEBUG
(
"execute "
<< name());
40
41
// Write Cond Handle
42
SG::WriteCondHandle<SCT_ModuleVetoCondData>
writeHandle{
m_writeKey
, ctx};
43
// Do we have a valid Write Cond Handle for current time?
44
if
(writeHandle.
isValid
()) {
45
ATH_MSG_DEBUG
(
"CondHandle "
<< writeHandle.
fullKey
() <<
" is already valid."
46
<<
". In theory this should not be called, but may happen"
47
<<
" if multiple concurrent events are being processed out of order."
);
48
return
StatusCode::SUCCESS;
49
}
50
51
// Read Cond Handle
52
SG::ReadCondHandle<AthenaAttributeList>
readHandle{
m_readKey
, ctx};
53
const
AthenaAttributeList
* readCdo{*readHandle};
54
if
(readCdo==
nullptr
) {
55
ATH_MSG_FATAL
(
"Null pointer to the read conditions object"
);
56
return
StatusCode::FAILURE;
57
}
58
// Add dependency
59
writeHandle.
addDependency
(readHandle);
60
ATH_MSG_INFO
(
"Size of AthenaAttributeList "
<< readHandle.
fullKey
() <<
" readCdo->size()= "
<< readCdo->size());
61
ATH_MSG_INFO
(
"Range of input is "
<< readHandle.
getRange
());
62
63
// Construct the output Cond Object and fill it in
64
std::unique_ptr<SCT_ModuleVetoCondData> writeCdo{std::make_unique<SCT_ModuleVetoCondData>()};
65
66
// Read bad wafer info
67
const
std::string &badModuleString{(*readCdo)[
"ModuleList"
].data<std::string>()};
68
std::vector<unsigned long long> v{string2Vector<unsigned long long>(badModuleString)};
69
unsigned
long
long
numberInDb{
static_cast<
unsigned
long
long
>
(v.size())};
70
ATH_MSG_INFO
(numberInDb <<
" elements were declared bad in the database."
);
71
for
(
const
unsigned
long
long
badWaferId: v) {
72
writeCdo->setBadWaferId(
Identifier
{badWaferId});
73
}
74
75
// Record the output cond object
76
if
(writeHandle.
record
(std::move(writeCdo)).isFailure()) {
77
ATH_MSG_FATAL
(
"Could not record SCT_ModuleVetoCondData "
<< writeHandle.
key
()
78
<<
" with EventRange "
<< writeHandle.
getRange
()
79
<<
" into Conditions Store"
);
80
return
StatusCode::FAILURE;
81
}
82
ATH_MSG_INFO
(
"recorded new CDO "
<< writeHandle.
key
() <<
" with range "
<< writeHandle.
getRange
() <<
" into Conditions Store"
);
83
84
return
StatusCode::SUCCESS;
85
}
86
87
StatusCode
SCT_ModuleVetoCondAlg::finalize
() {
88
ATH_MSG_DEBUG
(
"finalize "
<< name());
89
return
StatusCode::SUCCESS;
90
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
SCT_ModuleVetoCondAlg.h
AthCondAlgorithm
Base class for conditions algorithms.
Definition
AthCondAlgorithm.h:22
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
SCT_ModuleVetoCondAlg::SCT_ModuleVetoCondAlg
SCT_ModuleVetoCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
SCT_ModuleVetoCondAlg.cxx:22
SCT_ModuleVetoCondAlg::initialize
virtual StatusCode initialize() override final
Definition
SCT_ModuleVetoCondAlg.cxx:27
SCT_ModuleVetoCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
SCT_ModuleVetoCondAlg.cxx:38
SCT_ModuleVetoCondAlg::m_writeKey
SG::WriteCondHandleKey< SCT_ModuleVetoCondData > m_writeKey
Definition
SCT_ModuleVetoCondAlg.h:30
SCT_ModuleVetoCondAlg::m_readKey
SG::ReadCondHandleKey< AthenaAttributeList > m_readKey
Definition
SCT_ModuleVetoCondAlg.h:29
SCT_ModuleVetoCondAlg::finalize
virtual StatusCode finalize() override final
Definition
SCT_ModuleVetoCondAlg.cxx:87
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::fullKey
const DataObjID & fullKey() const
Definition
ReadCondHandle.h:60
SG::ReadCondHandle::getRange
const EventIDRange & getRange()
Definition
ReadCondHandle.h:241
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
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
SG::WriteCondHandle::fullKey
const DataObjID & fullKey() const
Definition
WriteCondHandle.h:45
Identifier
Definition
IdentifierFieldParser.cxx:14
python.PyAthena.v
v
Definition
PyAthena.py:153
python.SystemOfUnits.s
float s
Definition
SystemOfUnits.py:147
Generated on
for ATLAS Offline Software by
1.17.0