ATLAS Offline Software
AFP_RawDataProvider.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 // AFP includes
6 
7 // AFP_ByteStream2RawCnv includes
9 
11 
12 
14  ISvcLocator *pSvcLocator)
15  : AthReentrantAlgorithm(name, pSvcLocator),
16  m_robDataProvider("ROBDataProviderSvc", name)
17 {
18 }
19 
21 
23  ATH_MSG_DEBUG("AFP_RawDataProvider::initialize");
24 
25  if (m_robDataProvider.retrieve().isFailure()) {
26  ATH_MSG_WARNING("Failed to retrieve service " << m_robDataProvider);
27  return StatusCode::SUCCESS;
28  } else
29  ATH_MSG_DEBUG("Retrieved service " << m_robDataProvider);
30 
31  if (m_rawDataTool.retrieve().isFailure()) {
32  ATH_MSG_WARNING("Failed to retrieve service " << m_rawDataTool);
33  return StatusCode::SUCCESS;
34  } else {
35  ATH_MSG_DEBUG("Retrieved service " << m_rawDataTool);
36  }
37 
39 
40  return StatusCode::SUCCESS;
41 }
42 
43 StatusCode AFP_RawDataProvider::execute(const EventContext &ctx) const {
44  ATH_MSG_DEBUG("AFP_RawDataProvider::EXECUTE");
45  auto container = std::make_unique<AFP_RawContainer>();
46  ATH_MSG_DEBUG("Created AFP RDO Container");
47 
48  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *> listOfRobf;
49 
50  m_robDataProvider->getROBData(ctx, m_robIDs, listOfRobf);
51  ATH_MSG_DEBUG(" ROB ID " << std::hex << m_robIDs<<std::dec);
52  ATH_MSG_DEBUG(" Number of ROB fragments is " << listOfRobf.size());
53 
54  if (m_rawDataTool->convert(listOfRobf, container.get()).isFailure()) {
55  ATH_MSG_ERROR("Bytestream conversion into raw failed");
56  return StatusCode::FAILURE;
57  } else {
58  ATH_MSG_DEBUG(" Number of time-of-flight collections in container is "
59  << container->collectionsToF().size());
60  ATH_MSG_DEBUG(" Number of silicon collections in container is "
61  << container->collectionsSi().size());
62  }
63 
65  StatusCode recordSC = writeHandle.record(std::move(container));
66  if (recordSC.isFailure()) {
67  ATH_MSG_WARNING("Unable to record AFP RDO Container");
68  return StatusCode::SUCCESS;
69  } else {
70  ATH_MSG_DEBUG("AFP RDO Container recorded");
71  }
72 
73  return StatusCode::SUCCESS;
74 }
AFP_RawDataProvider::m_AFP_RawContainerKey
SG::WriteHandleKey< AFP_RawContainer > m_AFP_RawContainerKey
name used to store AFP_RawContainer in StoreGate
Definition: AFP_RawDataProvider.h:47
AFP_RawContainer.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
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
AFP_RawDataProvider::initialize
virtual StatusCode initialize()
Initialise tool and service.
Definition: AFP_RawDataProvider.cxx:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AFP_RawDataProvider::execute
virtual StatusCode execute(const EventContext &ctx) const
Creates raw objects from bytestream.
Definition: AFP_RawDataProvider.cxx:43
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AFP_RawDataProvider::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: AFP_RawDataProvider.h:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
AFP_RawDataProvider::m_rawDataTool
ToolHandle< AFP_RawDataProviderTool > m_rawDataTool
Definition: AFP_RawDataProvider.h:44
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AFP_RawDataProvider.h
AFP_RawDataProvider::~AFP_RawDataProvider
virtual ~AFP_RawDataProvider()
Does nothing.
Definition: AFP_RawDataProvider.cxx:20
AFP_RawDataProvider::m_robIDs
const std::vector< unsigned int > m_robIDs
vector of robIDs from which data should be processed
Definition: AFP_RawDataProvider.h:51
AFP_RawDataProvider::AFP_RawDataProvider
AFP_RawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AFP_RawDataProvider.cxx:13