ATLAS Offline Software
Loading...
Searching...
No Matches
AFP_RawDataProviderTool.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_ByteStream2RawCnv includes
7
8static const InterfaceID
9 IID_IAFP_RawCollByteStreamTool("AFP_RawDataProviderTool", 1, 0);
13
15 const std::string &name,
16 const IInterface *parent)
17 : AthAlgTool(type, name, parent)
18{
19 declareInterface<AFP_RawDataProviderTool>(this);
20}
21
23
25 ATH_MSG_INFO("Initializing " << name() << "...");
26
27 StatusCode sc = AthAlgTool::initialize();
28 ATH_MSG_DEBUG("INITIALIZE AFP_RawDataProviderTool");
29 if (sc.isFailure()) {
30 ATH_MSG_WARNING(" Failed to init baseclass");
31 return StatusCode::SUCCESS;
32 }
33
34 if (m_decoder.retrieve().isFailure()) {
35 ATH_MSG_WARNING("FAILED TO RETRIEVE TOOL " << m_decoder);
36 return StatusCode::SUCCESS;
37 } else {
38 ATH_MSG_DEBUG("Retrieved decoder tool " << m_decoder);
39 }
40 return StatusCode::SUCCESS;
41}
42
43StatusCode
44AFP_RawDataProviderTool::convert(std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *> &vecRobs,
45 AFP_RawContainer *rawContainer) const
46{
47 std::set<uint32_t> robIdSet;
48
49 if (!rawContainer) {
50 ATH_MSG_WARNING("NULL pointer passed in rawContainer.");
51 return StatusCode::SUCCESS;
52 }
53
54 if (vecRobs.empty()) {
55 ATH_MSG_DEBUG("vecRobs.size() == 0");
56 return StatusCode::SUCCESS;
57 }
58
59 // Loop over robs and fill rawContainer
60 for (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* rob : vecRobs) {
61 const uint32_t robId = rob->rod_source_id();
62
63 if (robIdSet.insert(robId).second) {
64 StatusCode sc = m_decoder->fillCollection(rob, rawContainer);
65 if (sc.isFailure()) {
66 ATH_MSG_ERROR("Failed filling collection");
67 return StatusCode::FAILURE;
68 }
69 }
70
71 } // end for loop
72
73 return StatusCode::SUCCESS;
74}
75
77 StatusCode sc = AthAlgTool::finalize();
78 ATH_MSG_DEBUG("FINALIZE AFP_RawDataProviderTool");
79 if (sc.isFailure()) {
80 ATH_MSG_WARNING("FINALIZE failed");
81 return StatusCode::SUCCESS;
82 }
83
84 return StatusCode::SUCCESS;
85}
static const InterfaceID IID_IAFP_RawCollByteStreamTool("AFP_RawDataProviderTool", 1, 0)
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
StatusCode convert(std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vecRobs, AFP_RawContainer *rawContainer) const
Fill rawContainer with collections created from provided vecRobs.
virtual ~AFP_RawDataProviderTool()
Does nothing.
static const InterfaceID & interfaceID()
ToolHandle< AFP_ByteStream2RawCnv > m_decoder
AFP_RawDataProviderTool(const std::string &type, const std::string &name, const IInterface *parent)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
eformat::ROBFragment< PointerType > ROBFragment
Definition RawEvent.h:27