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 
11 
13 #include "ByteStreamData/ROBData.h"
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 
24 #include "StoreGate/StoreGateSvc.h"
25 
29 
31 
32 #include "PpmByteStreamAuxCnv.h"
33 #include "../ToString.h"
35 
36 namespace 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 
48 }
49 
51 {
53 }
54 
55 // Init method gets all necessary services etc.
56 
58  ATH_MSG_DEBUG("Initializing " << m_name);
59 
61  CHECK(m_readTool.retrieve());
62 
63  return StatusCode::SUCCESS;
64 }
65 
66 // createObj should create the RDO from bytestream.
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 
77  auto aux = new xAOD::TriggerTowerAuxContainer;
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.
107  IOpaqueAddress*& /*pAddr*/) {
108  return StatusCode::FAILURE;
109 }
110 
111 } // 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:46
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
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:37
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition: DataObjectSharedPtr.h:65
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:57
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:794
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:106
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: ZdcModifySlices.h:10
StoreGateSvc.h
LVL1BS::PpmByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: PpmByteStreamAuxCnv.cxx:67
IROBDataProviderSvc.h
LVL1BS::PpmByteStreamAuxCnv::storageType
static long storageType()
Definition: PpmByteStreamAuxCnv.cxx:50
TriggerTowerAuxContainer.h