ATLAS Offline Software
Loading...
Searching...
No Matches
JetElementByteStreamAuxCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// ============================================================================
6// Includes
7// ============================================================================
8// STD
9// ============================================================================
10#include <vector>
11#include <cstdint>
12#include <memory>
13#include <algorithm>
14// ============================================================================
15// Athena
16// ============================================================================
19
22
24#include "GaudiKernel/DataObject.h"
25#include "GaudiKernel/IOpaqueAddress.h"
26#include "GaudiKernel/IRegistry.h"
27#include "GaudiKernel/ISvcLocator.h"
28#include "GaudiKernel/StatusCode.h"
29
33
34// ============================================================================
35// TrigT1
36// ============================================================================
38// ============================================================================
39// xAOD
40// ============================================================================
44// ============================================================================
45// Local
46// ============================================================================
49#include "../ToString.h"
50// ============================================================================
51
52namespace LVL1BS {
54 Converter(storageType(), classID(), svcloc),
55 AthMessaging(svcloc != 0 ? msgSvc() : 0, "JetElementByteStreamAuxCnv"),
56 m_name("JetElementByteStreamAuxCnv"),
57 m_readTool("LVL1BS::JepByteStreamV2Tool/JepByteStreamV2Tool")
58{
59}
60
64
69
70// Init method gets all necessary services etc.
71
73 ATH_MSG_DEBUG("Initializing " << m_name);
74
75 CHECK(Converter::initialize());
76 CHECK(m_readTool.retrieve());
77
78 return StatusCode::SUCCESS;
79}
80
81// createObj should create the RDO from bytestream.
82StatusCode JetElementByteStreamAuxCnv::createObj(IOpaqueAddress* pAddr,
83 DataObject*& pObj) {
84 ATH_MSG_DEBUG("createObj() called");
85 // -------------------------------------------------------------------------
86 ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
87 if (not pBS_Addr) return StatusCode::FAILURE;
88 // -------------------------------------------------------------------------
89 const EventContext& ctx = pBS_Addr->getEventContext();
90 const std::string nm = *(pBS_Addr->par());
91 ATH_MSG_DEBUG("Creating Objects " << nm);
92
93 auto aux = new xAOD::JetElementAuxContainer;
95 container.setStore(aux);
96 // -------------------------------------------------------------------------
98 StatusCode sc = m_readTool->convert(ctx, nm, &vec);
99 if (sc.isFailure()) {
100 ATH_MSG_ERROR("Failed to create objects");
101 delete aux;
102 return sc;
103 }
104
105 for (auto source : vec) {
107 container.push_back(item);
108
109 std::vector<uint16_t> emJetElementETVec(
110 source->emEnergyVec().begin(),
111 source->emEnergyVec().end()
112 );
113
114 std::vector<uint16_t> hadJetElementETVec(
115 source->hadEnergyVec().begin(),
116 source->hadEnergyVec().end()
117 );
118
119 std::vector<uint32_t> emJetElementError(
120 source->emErrorVec().begin(),
121 source->emErrorVec().end()
122 );
123
124 std::vector<uint32_t> hadJetElementError(
125 source->hadErrorVec().begin(),
126 source->hadErrorVec().end()
127 );
128
129 std::vector<uint32_t> linkErrorVec(
130 source->linkErrorVec().begin(),
131 source->linkErrorVec().end()
132 );
133
134 item->initialize(
135 source->eta(),
136 source->phi(),
137 source->key(),
138 emJetElementETVec,
139 hadJetElementETVec,
140 emJetElementError,
141 hadJetElementError,
142 linkErrorVec,
143 source->peak()
144 );
145 }
146
147 // -------------------------------------------------------------------------
148 //ATH_MSG_VERBOSE(ToString(container));
149 ATH_MSG_DEBUG("Number of readed JetElement: " << aux->size());
150 // -------------------------------------------------------------------------
151 pObj = SG::asStorable(aux);
152 return StatusCode::SUCCESS;
153}
154
155// createRep should create the bytestream from RDOs.
156StatusCode JetElementByteStreamAuxCnv::createRep(DataObject* /*pObj*/,
157 IOpaqueAddress*& /*pAddr*/) {
158 return StatusCode::FAILURE;
159}
160
161} // end namespace
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
std::vector< size_t > vec
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.
const EventContext & getEventContext() const
static constexpr long storageType()
Derived DataVector<T>.
Definition DataVector.h:795
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
ToolHandle< JepByteStreamV2Tool > m_readTool
Do the main job - retrieve objects from robs.
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
void setStore(SG::IAuxStore *store)
Set the store associated with this object.
virtual void initialize(const float eta, const float phi, const unsigned int key)
initialize
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
JetElementContainer_v2 JetElementContainer
Define the latest version of the JetElement container.
JetElement_v2 JetElement
Define the latest version of the JetElement class.
JetElementAuxContainer_v2 JetElementAuxContainer
Define the latest version of the JetElement auxiliary container.