ATLAS Offline Software
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 
12 
14 #include "ByteStreamData/ROBData.h"
15 
17 #include "GaudiKernel/DataObject.h"
18 #include "GaudiKernel/IOpaqueAddress.h"
19 #include "GaudiKernel/IRegistry.h"
20 #include "GaudiKernel/ISvcLocator.h"
21 #include "GaudiKernel/StatusCode.h"
22 
25 #include "StoreGate/StoreGateSvc.h"
26 
30 
32 
33 #include "PpmByteStreamAuxCnv.h"
34 #include "../ToString.h"
36 
37 namespace LVL1BS {
39  Converter(storageType(), classID(), svcloc),
40  AthMessaging(svcloc != 0 ? msgSvc() : 0, "PpmByteStreamAuxCnv"),
41  m_name("PpmByteStreamAuxCnv"),
42  m_readTool("LVL1BS::PpmByteStreamReadV1V2Tool/PpmByteStreamReadV1V2Tool"),
43  m_zdcTool("ZdcByteStreamReadV1V2Tool/ZdcByteStreamReadV1V2Tool") {
44 
45 }
46 
49 }
50 
52 {
54 }
55 
56 // Init method gets all necessary services etc.
57 
59  ATH_MSG_DEBUG("Initializing " << m_name);
60 
62  CHECK(m_readTool.retrieve());
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 // createObj should create the RDO from bytestream.
69  DataObject*& pObj) {
70  ATH_MSG_DEBUG("createObj() called");
71  // -------------------------------------------------------------------------
72  ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
73  CHECK(pBS_Addr != nullptr);
74  // -------------------------------------------------------------------------
75  const std::string nm = *(pBS_Addr->par());
76  ATH_MSG_DEBUG("Creating Objects " << nm);
77 
78  auto aux = new xAOD::TriggerTowerAuxContainer;
79  xAOD::TriggerTowerContainer ttCollection;
80  ttCollection.setStore(aux);
81  // -------------------------------------------------------------------------
82  StatusCode sc;
83  if (nm.substr(0,3) != "Zdc")
84  {
85  ATH_MSG_DEBUG("converting for L1Calo: " << nm );
86  sc = m_readTool->convert(nm, &ttCollection);
87  }
88  else
89  {
90  ATH_MSG_DEBUG("converting for ZDC: " << nm );
91  sc = m_zdcTool->convert(nm, &ttCollection);
92  }
93  if (sc.isFailure()) {
94  ATH_MSG_ERROR("Failed to create Objects" << nm);
95  delete aux;
96  return sc;
97  }
98  // -------------------------------------------------------------------------
99  ATH_MSG_VERBOSE(ToString(ttCollection));
100  ATH_MSG_DEBUG("Number of readed objects: " << aux->size());
101  // -------------------------------------------------------------------------
102  pObj = SG::asStorable(aux);
103  return StatusCode::SUCCESS;
104 }
105 
106 // createRep should create the bytestream from RDOs.
108  IOpaqueAddress*& /*pAddr*/) {
109  return StatusCode::FAILURE;
110 }
111 
112 } // end namespace
LVL1BS::ToString
std::string ToString(const xAOD::TriggerTower &tt)
Definition: ToString.cxx:23
LVL1BS::PpmByteStreamAuxCnv::classID
static const CLID & classID()
Definition: PpmByteStreamAuxCnv.cxx:47
LVL1BS::PpmByteStreamAuxCnv::m_zdcTool
ToolHandle< ZdcByteStreamReadV1V2Tool > m_zdcTool
Definition: PpmByteStreamAuxCnv.h:64
PpmByteStreamAuxCnv.h
StorableConversions.h
convert to and from a SG storable
xAOD::TriggerTowerAuxContainer
TriggerTowerAuxContainer_v2 TriggerTowerAuxContainer
Define the latest version of the TriggerTower auxiliary container.
Definition: TriggerTowerAuxContainer.h:14
ROBData.h
Defines the ROB data entity. The ROB data is an abstract entity that is used to discase the raw event...
initialize
void initialize()
Definition: run_EoverP.cxx:894
LVL1BS::PpmByteStreamAuxCnv::m_readTool
ToolHandle< PpmByteStreamReadV1V2Tool > m_readTool
Do the main job - retrieve xAOD TriggerTowers from robs.
Definition: PpmByteStreamAuxCnv.h:63
TriggerTowerContainer.h
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
IByteStreamEventAccess.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LVL1BS::PpmByteStreamAuxCnv::PpmByteStreamAuxCnv
PpmByteStreamAuxCnv(ISvcLocator *svcloc)
Definition: PpmByteStreamAuxCnv.cxx:38
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
LVL1BS::PpmByteStreamAuxCnv::initialize
virtual StatusCode initialize()
Definition: PpmByteStreamAuxCnv.cxx:58
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
RawEvent.h
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
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ByteStreamAddress.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
PpmByteStreamReadV1V2Tool.h
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
Converter
Definition: Converter.h:27
errorcheck.h
Helpers for checking error return status codes and reporting errors.
LVL1BS::PpmByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition: PpmByteStreamAuxCnv.cxx:107
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
ZdcByteStreamReadV1V2Tool.h
TriggerTower.h
LVL1BS::PpmByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition: PpmByteStreamAuxCnv.h:60
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
StoreGateSvc.h
LVL1BS::PpmByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: PpmByteStreamAuxCnv.cxx:68
IROBDataProviderSvc.h
LVL1BS::PpmByteStreamAuxCnv::storageType
static long storageType()
Definition: PpmByteStreamAuxCnv.cxx:51
TriggerTowerAuxContainer.h