ATLAS Offline Software
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 
8 #include "TrigExISPublishing.h"
9 
10 #include <vector>
11 
12 TrigExISPublishing::TrigExISPublishing(const std::string& name, ISvcLocator* 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 
43 StatusCode 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 }
TrigExISPublishing::m_IsObject
std::shared_ptr< hltinterface::GenericHLTContainer > m_IsObject
Definition: TrigExISPublishing.h:27
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
TrigExISPublishing::m_evntPos
size_t m_evntPos
Definition: TrigExISPublishing.h:29
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
calibdata.exception
exception
Definition: calibdata.py:495
TrigExISPublishing::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrigExISPublishing.cxx:43
ptree
boost::property_tree::ptree ptree
Definition: JsonFileLoader.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TrigExISPublishing::initialize
virtual StatusCode initialize() override
Definition: TrigExISPublishing.cxx:16
TrigExISPublishing::m_timeTagPos
size_t m_timeTagPos
Definition: TrigExISPublishing.h:30
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
TrigExISPublishing.h
TrigExISPublishing::TrigExISPublishing
TrigExISPublishing(const std::string &name, ISvcLocator *svcLoc)
Definition: TrigExISPublishing.cxx:12