ATLAS Offline Software
Loading...
Searching...
No Matches
CmxCpHitsByteStreamxAODCnv.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 <stdint.h>
7
10
13
15#include "GaudiKernel/DataObject.h"
16#include "GaudiKernel/IOpaqueAddress.h"
17#include "GaudiKernel/IRegistry.h"
18#include "GaudiKernel/ISvcLocator.h"
19#include "GaudiKernel/StatusCode.h"
20
24
28
30
31namespace LVL1BS {
32
34 Converter(storageType(), classID(), svcloc),
35 AthMessaging(svcloc != 0 ? msgSvc() : 0, "CmxCpHitsByteStreamxAODCnv"),
36 m_name("CmxCpHitsByteStreamxAODCnv")
37{
38
39}
40
41// CLID
42
46
51
52// Init method gets all necessary services etc.
53
54
56 ATH_MSG_DEBUG("Initializing " << m_name);
57
58 CHECK(Converter::initialize());
59 return StatusCode::SUCCESS;
60}
61
62// createObj should create the RDO from bytestream.
63
64StatusCode CmxCpHitsByteStreamxAODCnv::createObj(IOpaqueAddress* pAddr,
65 DataObject*& pObj) {
66 ATH_MSG_DEBUG("createObj() called");
67 // -------------------------------------------------------------------------
68 ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
69 CHECK(pBS_Addr != nullptr);
70 // -------------------------------------------------------------------------
71 const std::string nm = *(pBS_Addr->par());
72 const std::string nmAux = nm + "Aux.";
73 ATH_MSG_DEBUG("Creating xAOD::CMXCPHits interface objects '" << nm << "'");
74
75 xAOD::CMXCPHitsContainer* const cphitsCollection =
77
78 // Create link with AUX container
80 ATH_MSG_DEBUG("Creating store with data link to '" << nmAux);
81
82 for(size_t i=0; i < link->size(); ++i){
83 cphitsCollection->push_back(new xAOD::CMXCPHits());
84 }
85 // ==========================================================================
86 cphitsCollection->setStore(link);
87 pObj = SG::asStorable(cphitsCollection);
88 ATH_MSG_DEBUG("Number of xAOD::CMXCPHits created: " << cphitsCollection->size());
89
90 return StatusCode::SUCCESS;
91}
92
93// createRep should create the bytestream from RDOs.
94
95StatusCode CmxCpHitsByteStreamxAODCnv::createRep(DataObject* /*pObj*/,
96 IOpaqueAddress*& /*pAddr*/) {
97 return StatusCode::FAILURE;
98}
99
100} // end namespace
#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.
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()
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
CMXCPHitsContainer_v1 CMXCPHitsContainer
Define the latest version of the CMXCPHits class.
CMXCPHits_v1 CMXCPHits
Define the latest version of the CMMCPHits class.