ATLAS Offline Software
Loading...
Searching...
No Matches
CondWriterExtAlg.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 "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
27{
28 const EventContext& context = getContext();
29 ATH_MSG_INFO ("Event " << context.eventID().event_number() <<
30 " LBN " << context.eventID().lumi_block());
31
32 // Check if we need to execute a command
33 auto it = m_cmd.find(context.eventID().lumi_block());
34 if (it != m_cmd.end()) {
35 ATH_MSG_INFO("Executing: " << it->second);
36 if ( system(it->second.c_str()) != 0 ) {
37 ATH_MSG_ERROR("Error executing command");
38 return StatusCode::FAILURE;
39 }
40 // Remove this command
41 m_cmd.erase(it);
42
43 ATH_MSG_INFO("Resetting and dropping payload of folder " << m_attrListKey.value());
44
45 ATH_CHECK( m_iovSvc->dropObjectFromDB(detStore()->clid(m_attrListKey), m_attrListKey, "StoreGateSvc") );
46 }
47
48 return StatusCode::SUCCESS;
49}
50
51} // 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
CondWriterExtAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute() override
Gaudi::Property< std::string > m_attrListKey
ServiceHandle< IIOVSvc > m_iovSvc
Gaudi::Property< std::map< int, std::string > > m_cmd
Definition B.h:23