ATLAS Offline Software
CmxJetHitsByteStreamAuxCnv.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 // ============================================================================
6 // Includes
7 // ============================================================================
8 // STD
9 // ============================================================================
10 #include <vector>
11 #include <cstdint>
12 #include <memory>
13 #include <algorithm>
14 // ============================================================================
15 // Athena
16 // ============================================================================
19 
21 #include "ByteStreamData/ROBData.h"
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 
32 #include "StoreGate/StoreGateSvc.h"
33 
34 // ============================================================================
35 // TrigT1
36 // ============================================================================
38 // ============================================================================
39 // xAOD
40 // ============================================================================
44 // ============================================================================
45 // Local
46 // ============================================================================
48 #include "../JepByteStreamV2Tool.h"
49 #include "../ToString.h"
50 // ============================================================================
51 
52 namespace LVL1BS {
54  Converter(storageType(), classID(), svcloc),
55  AthMessaging(svcloc != 0 ? msgSvc() : 0, "CmxJetHitsByteStreamAuxCnv"),
56  m_name("CmxJetHitsByteStreamAuxCnv"),
57  m_readTool("LVL1BS::JepByteStreamV2Tool/JepByteStreamV2Tool")
58 {
59 }
60 
63 }
64 
66 {
68 }
69 
70 // Init method gets all necessary services etc.
71 
73  ATH_MSG_DEBUG("Initializing " << m_name);
74 
76  CHECK(m_readTool.retrieve());
77 
78  return StatusCode::SUCCESS;
79 }
80 
81 // createObj should create the RDO from bytestream.
83  DataObject*& pObj) {
84  ATH_MSG_DEBUG("createObj() called");
85  // -------------------------------------------------------------------------
86  ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
87  CHECK(pBS_Addr != nullptr);
88  // -------------------------------------------------------------------------
89  const std::string nm = *(pBS_Addr->par());
90  ATH_MSG_DEBUG("Creating Objects " << nm);
91 
92  auto aux = new xAOD::CMXJetHitsAuxContainer;
94  jetCollection.setStore(aux);
95  // -------------------------------------------------------------------------
96  DataVector<LVL1::CMXJetHits> cmxJetHitsVector;
97  StatusCode sc = m_readTool->convert(nm, &cmxJetHitsVector);
98  if (sc.isFailure()) {
99  ATH_MSG_ERROR("Failed to create objects");
100  delete aux;
101  return sc;
102  }
103 
104  for (auto jet : cmxJetHitsVector) {
106  jetCollection.push_back(item);
107 
108  std::vector<uint32_t> hitsVec0(jet->hitsVec0().begin(), jet->hitsVec0().end());
109  std::vector<uint32_t> hitsVec1(jet->hitsVec1().begin(), jet->hitsVec1().end());
110  std::vector<uint32_t> errorVec0(jet->errorVec0().begin(), jet->errorVec0().end());
111  std::vector<uint32_t> errorVec1(jet->errorVec1().begin(), jet->errorVec1().end());
112 
113  item->initialize(jet->crate(), jet->source(),
114  hitsVec0, hitsVec1, errorVec0, errorVec1, jet->peak());
115  }
116 
117  // -------------------------------------------------------------------------
118  //ATH_MSG_VERBOSE(ToString(jetCollection));
119  ATH_MSG_DEBUG("Number of readed CMXJetHits: " << aux->size());
120  // -------------------------------------------------------------------------
121  pObj = SG::asStorable(aux);
122  return StatusCode::SUCCESS;
123 }
124 
125 // createRep should create the bytestream from RDOs.
127  IOpaqueAddress*& /*pAddr*/) {
128  return StatusCode::FAILURE;
129 }
130 
131 } // end namespace
xAOD::CMXJetHits_v1
Description of CMXJetHits_v1.
Definition: CMXJetHits_v1.h:30
CMXJetHits.h
StorableConversions.h
convert to and from a SG storable
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::CmxJetHitsByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: CmxJetHitsByteStreamAuxCnv.cxx:82
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
CmxJetHitsByteStreamAuxCnv.h
LVL1BS::CmxJetHitsByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition: CmxJetHitsByteStreamAuxCnv.h:56
CMXJetHitsContainer.h
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
LVL1BS::CmxJetHitsByteStreamAuxCnv::initialize
virtual StatusCode initialize()
Definition: CmxJetHitsByteStreamAuxCnv.cxx:72
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
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
CMXJetHits.h
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
LVL1BS::CmxJetHitsByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition: CmxJetHitsByteStreamAuxCnv.cxx:126
xAOD::CMXJetHitsAuxContainer
CMXJetHitsAuxContainer_v1 CMXJetHitsAuxContainer
Define the latest version of the CMXJetHits class.
Definition: CMXJetHitsAuxContainer.h:17
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
LVL1BS::CmxJetHitsByteStreamAuxCnv::classID
static const CLID & classID()
Definition: CmxJetHitsByteStreamAuxCnv.cxx:61
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
LVL1BS::CmxJetHitsByteStreamAuxCnv::CmxJetHitsByteStreamAuxCnv
CmxJetHitsByteStreamAuxCnv(ISvcLocator *svcloc)
Definition: CmxJetHitsByteStreamAuxCnv.cxx:53
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.
item
Definition: ItemListSvc.h:43
LVL1BS::CmxJetHitsByteStreamAuxCnv::storageType
static long storageType()
Definition: CmxJetHitsByteStreamAuxCnv.cxx:65
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
LVL1BS::CmxJetHitsByteStreamAuxCnv::m_readTool
ToolHandle< JepByteStreamV2Tool > m_readTool
Do the main job - retrieve objects.
Definition: CmxJetHitsByteStreamAuxCnv.h:59
CMXJetHitsAuxContainer.h
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
StoreGateSvc.h
runIDPVM.jetCollection
jetCollection
Definition: runIDPVM.py:112
IROBDataProviderSvc.h
xAOD::CMXJetHits
CMXJetHits_v1 CMXJetHits
Define the latest version of the CMXJetHits class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CMXJetHits.h:20