ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataCommon
src
CondWriterExtAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CondWriterExtAlg.h
"
6
7
#include "
StoreGate/ReadHandle.h
"
8
9
#include <stdlib.h>
10
11
namespace
DMTest
{
12
13
CondWriterExtAlg::CondWriterExtAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
14
AthAlgorithm
(name, pSvcLocator),
15
m_iovSvc
(
"IOVSvc"
, name)
16
{
17
}
18
19
StatusCode
CondWriterExtAlg::initialize
()
20
{
21
ATH_CHECK
(
m_iovSvc
.retrieve() );
22
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
CondWriterExtAlg::execute
(
const
EventContext& ctx)
27
{
28
ATH_MSG_INFO
(
"Event "
<< ctx.eventID().event_number() <<
29
" LBN "
<< ctx.eventID().lumi_block());
30
31
// Check if we need to execute a command
32
auto
it =
m_cmd
.find(ctx.eventID().lumi_block());
33
if
(it !=
m_cmd
.end()) {
34
ATH_MSG_INFO
(
"Executing: "
<< it->second);
35
if
( system(it->second.c_str()) != 0 ) {
36
ATH_MSG_ERROR
(
"Error executing command"
);
37
return
StatusCode::FAILURE;
38
}
39
// Remove this command
40
m_cmd
.erase(it);
41
42
ATH_MSG_INFO
(
"Resetting and dropping payload of folder "
<<
m_attrListKey
.value());
43
44
ATH_CHECK
(
m_iovSvc
->dropObjectFromDB(
detStore
()->clid(
m_attrListKey
),
m_attrListKey
,
"StoreGateSvc"
) );
45
}
46
47
return
StatusCode::SUCCESS;
48
}
49
50
}
// namespace DMTest
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CondWriterExtAlg.h
ReadHandle.h
Handle class for reading from StoreGate.
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
DMTest::CondWriterExtAlg::initialize
virtual StatusCode initialize() override
Definition
CondWriterExtAlg.cxx:19
DMTest::CondWriterExtAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
CondWriterExtAlg.cxx:26
DMTest::CondWriterExtAlg::CondWriterExtAlg
CondWriterExtAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CondWriterExtAlg.cxx:13
DMTest::CondWriterExtAlg::m_attrListKey
Gaudi::Property< std::string > m_attrListKey
Definition
CondWriterExtAlg.h:29
DMTest::CondWriterExtAlg::m_iovSvc
ServiceHandle< IIOVSvc > m_iovSvc
Definition
CondWriterExtAlg.h:32
DMTest::CondWriterExtAlg::m_cmd
Gaudi::Property< std::map< int, std::string > > m_cmd
Definition
CondWriterExtAlg.h:30
DMTest
Definition
B.h:23
Generated on
for ATLAS Offline Software by
1.17.0