ATLAS Offline Software
CmxRoIByteStreamAuxCnv.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 // ============================================================================
20 
22 #include "ByteStreamData/ROBData.h"
23 
25 #include "GaudiKernel/DataObject.h"
26 #include "GaudiKernel/IOpaqueAddress.h"
27 #include "GaudiKernel/IRegistry.h"
28 #include "GaudiKernel/ISvcLocator.h"
29 #include "GaudiKernel/StatusCode.h"
30 
33 #include "StoreGate/StoreGateSvc.h"
34 
35 // ============================================================================
36 // TrigT1
37 // ============================================================================
38 #include "TrigT1CaloEvent/CMXRoI.h"
39 // ============================================================================
40 // xAOD
41 // ============================================================================
42 #include "xAODTrigL1Calo/CMXRoI.h"
45 // ============================================================================
46 // Local
47 // ============================================================================
48 #include "CmxRoIByteStreamAuxCnv.h"
49 #include "../JepRoiByteStreamV2Tool.h"
50 #include "../ToString.h"
51 // ============================================================================
52 
53 namespace LVL1BS {
55  Converter(storageType(), classID(), svcloc),
56  AthMessaging(svcloc != 0 ? msgSvc() : 0, "CmxRoIByteStreamAuxCnv"),
57  m_name("CmxRoIByteStreamAuxCnv"),
58  m_readTool("LVL1BS::JepRoiByteStreamV2Tool/JepRoiByteStreamV2Tool")
59 {
60 }
61 
64 }
65 
67 {
69 }
70 
71 // Init method gets all necessary services etc.
72 
74  ATH_MSG_DEBUG("Initializing " << m_name);
75 
77  CHECK(m_readTool.retrieve());
78 
79  return StatusCode::SUCCESS;
80 }
81 
82 // createObj should create the RDO from bytestream.
84  DataObject*& pObj) {
85  ATH_MSG_DEBUG("createObj() called");
86  // -------------------------------------------------------------------------
87  ByteStreamAddress *pBS_Addr = dynamic_cast<ByteStreamAddress *>(pAddr);
88  CHECK(pBS_Addr != nullptr);
89  // -------------------------------------------------------------------------
90  const std::string nm = *(pBS_Addr->par());
91  ATH_MSG_DEBUG("Creating Objects " << nm);
92 
93  auto aux = new xAOD::CMXRoIAuxContainer;
94  xAOD::CMXRoIContainer container;
95  container.setStore(aux);
96  // -------------------------------------------------------------------------
97  LVL1::CMXRoI source;
98  StatusCode sc = m_readTool->convert(nm, &source);
99  if (sc.isFailure()) {
100  ATH_MSG_ERROR("Failed to create objects");
101  delete aux;
102  return sc;
103  }
104 
105  xAOD::CMXRoI* item = new xAOD::CMXRoI();
106  container.push_back(item);
107 
108  item->initialize(source.ex(), source.ey(), source.et(),
109  source.exError(), source.eyError(), source.etError(),
110  //source.sumEtHits(), source.missingEtHits(),
111  // amazurov: values for EtHits and missingEtHits are swaped in source
112  source.missingEtHits(), source.sumEtHits(),
113  source.missingEtSigHits(),
120  // source.sumEtHits(LVL1::CMXRoI::SumType::MASKED), source.missingEtHits(LVL1::CMXRoI::SumType::MASKED)
121  // amazurov: values for EtHits and missingEtHits are swaped in source
123  );
124 
125  // -------------------------------------------------------------------------
126  //ATH_MSG_VERBOSE(ToString(container));
127  ATH_MSG_DEBUG("Number of readed CMXRoI: " << aux->size());
128  // -------------------------------------------------------------------------
129  pObj = SG::asStorable(aux);
130  return StatusCode::SUCCESS;
131 }
132 
133 // createRep should create the bytestream from RDOs.
135  IOpaqueAddress*& /*pAddr*/) {
136  return StatusCode::FAILURE;
137 }
138 
139 } // end namespace
LVL1BS::CmxRoIByteStreamAuxCnv::classID
static const CLID & classID()
Definition: CmxRoIByteStreamAuxCnv.cxx:62
CMXRoIAuxContainer.h
LVL1::CMXRoI::missingEtHits
unsigned int missingEtHits(SumType type=NORMAL) const
Return Missing-ET hits.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:139
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...
CmxRoIByteStreamAuxCnv.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
LVL1::CMXRoI
CMX RoI data.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:22
LVL1BS::CmxRoIByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition: CmxRoIByteStreamAuxCnv.cxx:134
LVL1::CMXRoI::eyError
int eyError(SumType type=NORMAL) const
Return Ey error flags (bit 0 Overflow)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:124
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
IByteStreamEventAccess.h
CMXRoIContainer.h
LVL1::CMXRoI::etError
int etError(SumType type=NORMAL) const
Return Et error flags (bit 0 Overflow)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:129
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LVL1BS::CmxRoIByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition: CmxRoIByteStreamAuxCnv.cxx:83
LVL1BS::CmxRoIByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition: CmxRoIByteStreamAuxCnv.h:57
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
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
xAOD::CMXRoI
CMXRoI_v1 CMXRoI
Define the latest version of the CMXRoI class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CMXRoI.h:14
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
LVL1::CMXRoI::ex
unsigned int ex(SumType type=NORMAL) const
Return Ex.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:104
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
LVL1BS::CmxRoIByteStreamAuxCnv::initialize
virtual StatusCode initialize()
Definition: CmxRoIByteStreamAuxCnv.cxx:73
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
LVL1BS::CmxRoIByteStreamAuxCnv::m_readTool
ToolHandle< JepRoiByteStreamV2Tool > m_readTool
Do the main job - retrieve objects from robs.
Definition: CmxRoIByteStreamAuxCnv.h:60
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ByteStreamAddress.h
LVL1::CMXRoI::ey
unsigned int ey(SumType type=NORMAL) const
Return Ey.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:109
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
LVL1::CMXRoI::exError
int exError(SumType type=NORMAL) const
Return Ex error flags (bit 0 Overflow)
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:119
CMXRoI.h
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
Converter
Definition: Converter.h:27
LArProv::MASKED
@ MASKED
Definition: LArProvenance.h:31
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
item
Definition: ItemListSvc.h:43
LVL1::CMXRoI::sumEtHits
unsigned int sumEtHits(SumType type=NORMAL) const
Return Sum-ET hits.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:134
LVL1BS::CmxRoIByteStreamAuxCnv::CmxRoIByteStreamAuxCnv
CmxRoIByteStreamAuxCnv(ISvcLocator *svcloc)
Definition: CmxRoIByteStreamAuxCnv.cxx:54
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
CMXRoI.h
StoreGateSvc.h
xAOD::CMXRoI_v1
Description of CMXRoI_v1.
Definition: CMXRoI_v1.h:27
LVL1BS::CmxRoIByteStreamAuxCnv::storageType
static long storageType()
Definition: CmxRoIByteStreamAuxCnv.cxx:66
LVL1::CMXRoI::et
unsigned int et(SumType type=NORMAL) const
Return Et.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:114
IROBDataProviderSvc.h
xAOD::CMXRoIAuxContainer
CMXRoIAuxContainer_v1 CMXRoIAuxContainer
Define the latest version of the CMXRoI auxiliary info.
Definition: CMXRoIAuxContainer.h:13
LVL1::CMXRoI::missingEtSigHits
unsigned int missingEtSigHits() const
Return Missing-ET-Sig hits.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CMXRoI.h:144