ATLAS Offline Software
Loading...
Searching...
No Matches
TrigExISPublishing.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "hltinterface/ContainerFactory.h"
6#include "hltinterface/IInfoRegister.h"
7
9
10#include <vector>
11
12TrigExISPublishing::TrigExISPublishing(const std::string& name, ISvcLocator* svcLoc) :
13 AthReentrantAlgorithm(name, svcLoc)
14{}
15
17{
18 // construct the LAr noise burst container and register it
19 auto cfact = hltinterface::ContainerFactory::getInstance();
20 if (cfact) {
21 try {
22 const std::string ISname = "LArISInfo_NoiseBurstAlg";
23 const std::string IStype = "LArNoiseBurstCandidates";
24 m_IsObject = cfact->constructContainer(ISname, IStype);
25 m_evntPos = cfact->addIntVector(m_IsObject, "Flag",
26 hltinterface::GenericHLTContainer::LASTVALUE);
27 m_timeTagPos = cfact->addIntVector(m_IsObject, "TimeStamp",
28 hltinterface::GenericHLTContainer::LASTVALUE);
29 ATH_MSG_DEBUG("Registering container in IS with name /HLTObjects/" << ISname);
30 hltinterface::IInfoRegister::instance()->registerObject("/HLTObjects/", m_IsObject);
31 }
32 catch (std::exception& ex) {
33 ATH_MSG_ERROR("Cannot publish to IS: " << ex.what());
34 }
35 }
36 else {
37 ATH_MSG_INFO("IS publishing not available");
38 }
39
40 return StatusCode::SUCCESS;
41}
42
43StatusCode TrigExISPublishing::execute(const EventContext& ctx) const
44{
45 if (m_IsObject) {
46 boost::property_tree::ptree event_tree;
47 event_tree.put("eventNumber", ctx.eventID().event_number());
48 event_tree.put("LBNumber", ctx.eventID().lumi_block());
49 try {
50 hltinterface::IInfoRegister::instance()->beginEvent(event_tree);
51
52 m_IsObject->appendField(m_evntPos, std::vector<long>{0});
53 m_IsObject->appendField(m_timeTagPos, std::vector<long>{(long int)ctx.eventID().time_stamp()});
54
55 hltinterface::IInfoRegister::instance()->endEvent(event_tree);
56 }
57 catch (const std::exception& ex) {
58 ATH_MSG_INFO("Caught exception during IS publication: " << ex.what());
59 }
60 }
61
62 return StatusCode::SUCCESS;
63}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
An algorithm that can be simultaneously executed in multiple threads.
std::shared_ptr< hltinterface::GenericHLTContainer > m_IsObject
virtual StatusCode execute(const EventContext &ctx) const override
TrigExISPublishing(const std::string &name, ISvcLocator *svcLoc)
virtual StatusCode initialize() override