ATLAS Offline Software
Loading...
Searching...
No Matches
PpmByteStreamAuxCnv.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 <vector>
6#include <cstdint>
7#include <memory>
8
11
14
16#include "GaudiKernel/DataObject.h"
17#include "GaudiKernel/IOpaqueAddress.h"
18#include "GaudiKernel/IRegistry.h"
19#include "GaudiKernel/ISvcLocator.h"
20#include "GaudiKernel/StatusCode.h"
21
25
29
31
32#include "PpmByteStreamAuxCnv.h"
33#include "../ToString.h"
35
36namespace LVL1BS {
38 Converter(storageType(), classID(), svcloc),
39 AthMessaging(svcloc != 0 ? msgSvc() : 0, "PpmByteStreamAuxCnv"),
40 m_name("PpmByteStreamAuxCnv"),
41 m_readTool("LVL1BS::PpmByteStreamReadV1V2Tool/PpmByteStreamReadV1V2Tool"),
42 m_zdcTool("ZdcByteStreamReadV1V2Tool/ZdcByteStreamReadV1V2Tool") {
43
44}
45
49
54
55// Init method gets all necessary services etc.
56
58 ATH_MSG_DEBUG("Initializing " << m_name);
59
60 CHECK(Converter::initialize());
61 CHECK(m_readTool.retrieve());
62
63 return StatusCode::SUCCESS;
64}
65
66// createObj should create the RDO from bytestream.
67StatusCode PpmByteStreamAuxCnv::createObj(IOpaqueAddress* pAddr,
68 DataObject*& pObj) {
69 ATH_MSG_DEBUG("createObj() called");
70 // -------------------------------------------------------------------------
71 ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
72 CHECK(pBS_Addr != nullptr);
73 // -------------------------------------------------------------------------
74 const std::string nm = *(pBS_Addr->par());
75 ATH_MSG_DEBUG("Creating Objects " << nm);
76
78 xAOD::TriggerTowerContainer ttCollection;
79 ttCollection.setStore(aux);
80 // -------------------------------------------------------------------------
81 StatusCode sc;
82 if (nm.substr(0,3) != "Zdc")
83 {
84 ATH_MSG_DEBUG("converting for L1Calo: " << nm );
85 sc = m_readTool->convert(nm, &ttCollection);
86 }
87 else
88 {
89 ATH_MSG_DEBUG("converting for ZDC: " << nm );
90 sc = m_zdcTool->convert(nm, &ttCollection);
91 }
92 if (sc.isFailure()) {
93 ATH_MSG_ERROR("Failed to create Objects" << nm);
94 delete aux;
95 return sc;
96 }
97 // -------------------------------------------------------------------------
98 ATH_MSG_VERBOSE(ToString(ttCollection));
99 ATH_MSG_DEBUG("Number of readed objects: " << aux->size());
100 // -------------------------------------------------------------------------
101 pObj = SG::asStorable(aux);
102 return StatusCode::SUCCESS;
103}
104
105// createRep should create the bytestream from RDOs.
106StatusCode PpmByteStreamAuxCnv::createRep(DataObject* /*pObj*/,
107 IOpaqueAddress*& /*pAddr*/) {
108 return StatusCode::FAILURE;
109}
110
111} // end namespace
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
uint32_t CLID
The Class ID type.
static Double_t sc
Defines the ROB data entity. The ROB data is an abstract entity that is used to decouple the raw even...
convert to and from a SG storable
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
static constexpr long storageType()
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
ToolHandle< ZdcByteStreamReadV1V2Tool > m_zdcTool
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
std::string m_name
Converter name.
ToolHandle< PpmByteStreamReadV1V2Tool > m_readTool
Do the main job - retrieve xAOD TriggerTowers from robs.
PpmByteStreamAuxCnv(ISvcLocator *svcloc)
std::string ToString(const xAOD::TriggerTower &tt)
Definition ToString.cxx:23
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
TriggerTowerAuxContainer_v2 TriggerTowerAuxContainer
Define the latest version of the TriggerTower auxiliary container.