ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9#include <stdlib.h>
10
11namespace DMTest {
12
13CondWriterExtAlg::CondWriterExtAlg(const std::string& name, ISvcLocator* pSvcLocator) :
14 AthAlgorithm(name, pSvcLocator),
15 m_iovSvc("IOVSvc", name)
16{
17}
18
20{
21 ATH_CHECK( m_iovSvc.retrieve() );
22
23 return StatusCode::SUCCESS;
24}
25
26StatusCode 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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
CondWriterExtAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< std::string > m_attrListKey
ServiceHandle< IIOVSvc > m_iovSvc
Gaudi::Property< std::map< int, std::string > > m_cmd
Definition B.h:23