ATLAS Offline Software
RecCTPByteStreamCnv.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 // Gaudi/Athena include(s):
7 #include "GaudiKernel/MsgStream.h"
10 #include "ByteStreamData/ROBData.h"
11 
13 
14 // Trigger include(s):
15 #include "TrigT1Result/CTP_RIO.h"
16 
17 // Local include(s):
18 #include "RecCTPByteStreamCnv.h"
19 
25  : Converter( storageType(), classID(), svcloc ),
26  m_tool( "RecCTPByteStreamTool" ),
27  m_robDataProvider( "ROBDataProviderSvc", "RecCTPByteStreamCnv" ) {
28 
29 }
30 
36 
38 
39 }
40 
43 }
44 
49 
50  //
51  // Initialise the base class:
52  //
54 
55  MsgStream log( msgSvc(), "RecCTPByteStreamCnv" );
56  log << MSG::DEBUG << "RecCTPByteStreamCnv in initialize()" << endmsg;
57 
58  //
59  // Get RecCTPByteStreamTool:
60  //
61  ATH_CHECK( m_tool.retrieve() );
62  log << MSG::DEBUG << "Connected to RecCTPByteStreamTool" << endmsg;
63 
64  //
65  // Get ROBDataProvider:
66  //
67  ATH_CHECK( m_robDataProvider.retrieve() );
68  log << MSG::DEBUG << "Connected to ROBDataProviderSvc" << endmsg;
69 
70  return StatusCode::SUCCESS;
71 }
72 
78 StatusCode RecCTPByteStreamCnv::createObj( IOpaqueAddress* pAddr, DataObject*& pObj ) {
79 
80  MsgStream log( msgSvc(), "RecCTPByteStreamCnv" );
81  log << MSG::DEBUG << "RecCTPByteStreamCnv::createObj() called" << endmsg;
82 
83  ByteStreamAddress *pBS_Addr;
84  pBS_Addr = dynamic_cast< ByteStreamAddress* >( pAddr );
85  if( !pBS_Addr ) {
86  log << MSG::ERROR << " Can not cast to ByteStreamAddress " << endmsg ;
87  return StatusCode::FAILURE;
88  }
89 
90  log << MSG::DEBUG << " Creating Objects: " << *( pBS_Addr->par() ) << endmsg;
91 
92  //
93  // Get SourceID:
94  //
95  const uint32_t robId = m_srcIdMap.getRobID( m_srcIdMap.getRodID() );
96 
97  log << MSG::DEBUG << "expected ROB sub-detector ID: " << std::hex
98  << robId << std::dec << endmsg;
99 
100  std::vector< uint32_t > vID;
101  vID.push_back( robId );
102 
103  // get ROB fragment
105  m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags );
106 
107  // size check
108  if ( robFrags.size() != 1 ) {
109  log << MSG::WARNING << " Number of ROB fragments for source ID 0x" << MSG::hex << robId
110  << " is " << robFrags.size() << endmsg;
111 
112  CTP_RIO* result = new CTP_RIO;
113  pObj = SG::asStorable( result ) ;
114  return StatusCode::SUCCESS;
115  }
116 
117  IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
118  CTP_RIO * result = 0;
119 
120  ATH_CHECK( m_tool->convert( ROBData( *it ).getROBFragment(), result ) );
121  pObj = SG::asStorable( result );
122 
123  return StatusCode::SUCCESS;
124 }
CTP_RIO
Definition: CTP_RIO.h:22
get_generator_info.result
result
Definition: get_generator_info.py:21
ROBData_T::getROBFragment
const ROBFragment * getROBFragment() const
Return the ROBFragment.
Definition: ROBData.h:184
RecCTPByteStreamCnv::m_tool
ToolHandle< RecCTPByteStreamTool > m_tool
Tool doing the actual conversion.
Definition: RecCTPByteStreamCnv.h:55
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
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
ROBData_T
templete data class to wrap ROB fragment for accessing ROD data
Definition: ROBData.h:46
skel.it
it
Definition: skel.GENtoEVGEN.py:396
RecCTPByteStreamCnv::storageType
static long storageType()
Function needed by the framework.
Definition: RecCTPByteStreamCnv.cxx:41
RecCTPByteStreamCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Function creating the CTP_RIO object from a CTP ROB fragment.
Definition: RecCTPByteStreamCnv.cxx:78
RecCTPByteStreamCnv.h
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
RecCTPByteStreamCnv::classID
static const CLID & classID()
Function needed by the framework.
Definition: RecCTPByteStreamCnv.cxx:35
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
RawEvent.h
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
RecCTPByteStreamCnv::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service used when reading the BS data.
Definition: RecCTPByteStreamCnv.h:61
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition: IROBDataProviderSvc.h:27
ByteStreamAddress.h
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
RecCTPByteStreamCnv::initialize
virtual StatusCode initialize() override
Function connecting to all the needed services/tools.
Definition: RecCTPByteStreamCnv.cxx:48
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
Converter
Definition: Converter.h:27
RecCTPByteStreamCnv::RecCTPByteStreamCnv
RecCTPByteStreamCnv(ISvcLocator *svcloc)
Standard constructor.
Definition: RecCTPByteStreamCnv.cxx:24
CTP_RIO.h
RecCTPByteStreamCnv::m_srcIdMap
CTPSrcIdMap m_srcIdMap
Object storing the various IDs of the CTP fragment.
Definition: RecCTPByteStreamCnv.h:58
CTPSrcIdMap::getRodID
uint32_t getRodID() const
get a ROD Source ID
Definition: CTPSrcIdMap.cxx:13
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
CTPSrcIdMap::getRobID
uint32_t getRobID(uint32_t rod_id) const
Make a ROB Source ID from a ROD source ID.
Definition: CTPSrcIdMap.cxx:18