ATLAS Offline Software
Loading...
Searching...
No Matches
MuCTPIByteStreamTool Class Reference

Tool doing the MuCTPI_RDO <-> ByteStream conversion. More...

#include <MuCTPIByteStreamTool.h>

Inheritance diagram for MuCTPIByteStreamTool:
Collaboration diagram for MuCTPIByteStreamTool:

Public Member Functions

 MuCTPIByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor.
StatusCode convert (const ROBF *rob, MuCTPI_RDO *&result)
 Convert ROBFragment to MuCTPI_RDO.
StatusCode convert (const MuCTPI_RDO *result, RawEventWrite *re)
 convert MuCTPI_RDO to ByteStream
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool InterfaceID.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

MuCTPISrcIdMap m_srcIdMap
 Object storing the various IDs of the MuCTPI fragment.
FullEventAssembler< MuCTPISrcIdMapm_fea
 Object used in creating the MuCTPI ROB fragment.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Tool doing the MuCTPI_RDO <-> ByteStream conversion.

   The actual work of translating the information in a MuCTPI_RDO object
   into a MuCTPI ROB fragment and vice-versa is done with this tool.
See also
MuCTPIByteStreamCnv
Author
Tadashi Maeno
Attila Krasznahorkay

Definition at line 32 of file MuCTPIByteStreamTool.h.

Member Typedef Documentation

◆ ROBF

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuCTPIByteStreamTool()

MuCTPIByteStreamTool::MuCTPIByteStreamTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Default constructor.

The constructor takes care of correctly constructing the base class and declaring the tool's interface to the framework.

Definition at line 25 of file MuCTPIByteStreamTool.cxx.

27 : AthAlgTool( type, name, parent ) {
28
29 declareInterface<MuCTPIByteStreamTool>( this );
30}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ convert() [1/2]

StatusCode MuCTPIByteStreamTool::convert ( const MuCTPI_RDO * result,
RawEventWrite * re )

convert MuCTPI_RDO to ByteStream

Conversion from RDO to eformat::ROBFragment.

This is called from the MuCTPIByteStreamCnv::createRep method.

Definition at line 36 of file MuCTPIByteStreamTool.cxx.

36 {
37
38 ATH_MSG_DEBUG("executing convert() from RDO to ROBFragment");
39
40 // Clear Event Assembler
41 m_fea.clear();
42
43 // MIROD
45
46 // Source ID of MIROD
47 const uint32_t rodId = m_srcIdMap.getRodID();
48
49 // get the ROD data container to be filled
50 theROD = m_fea.getRodData( rodId );
51
52 ATH_MSG_VERBOSE(" Dumping MuCTPI words:");
53
54 // fill Candidate Multiplicity
55 const std::vector< uint32_t >& multiWord = result->getAllCandidateMultiplicities();
56 std::vector< uint32_t >::const_iterator it = multiWord.begin();
57 std::vector< uint32_t >::const_iterator it_e = multiWord.end();
58 for( ; it != it_e; ++it ) {
59 theROD->push_back( *it );
60 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setfill( '0' )
61 << std::setw( 8 ) << ( *it ) << " (candidate multiplicity)");
62 }
63
64 // fill Data Words
65 const std::vector< uint32_t >& dataWord = result->dataWord();
66 it = dataWord.begin();
67 it_e = dataWord.end();
68 for( ; it != it_e; ++it ) {
69 theROD->push_back( *it );
70 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setfill( '0' )
71 << std::setw( 8 ) << ( *it ) << " (candidate word)");
72 }
73
74 // Now fill full event
75 ATH_MSG_DEBUG("Now filling the event with the MuCTPI fragment");
76 m_fea.fill( re, msg() );
77
78 return StatusCode::SUCCESS;
79}
const boost::regex re(r_e)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
MsgStream & msg() const
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
FullEventAssembler< MuCTPISrcIdMap > m_fea
Object used in creating the MuCTPI ROB fragment.
MuCTPISrcIdMap m_srcIdMap
Object storing the various IDs of the MuCTPI fragment.
setEventNumber uint32_t

◆ convert() [2/2]

StatusCode MuCTPIByteStreamTool::convert ( const ROBF * rob,
MuCTPI_RDO *& result )

Convert ROBFragment to MuCTPI_RDO.

Conversion from eformat::ROBFragment to RDO.

This is called from the MuCTPIByteStreamCnv::createObj method.

Definition at line 85 of file MuCTPIByteStreamTool.cxx.

85 {
86
87 ATH_MSG_DEBUG("executing convert() from ROBFragment to RDO");
88
89 // Source ID of MIROD
90 const uint32_t miRodId = m_srcIdMap.getRodID();
91
92 // check ROD source ID
93 const uint32_t rodId = rob->rod_source_id();
94
95 // check BC ID
96 const uint32_t bcId = rob->rod_bc_id();
97
98 ATH_MSG_DEBUG(" expected ROD sub-detector ID: " << std::hex << miRodId
99 << " ID found: " << std::hex << rodId << std::dec);
100
101 if( rodId == miRodId || rodId == 0x7501 ) {
102
103 ATH_MSG_VERBOSE(" ROD Header BCID " << bcId << ", dumping MuCTPI words:");
104 if( rodId == 0x7501 ) {
105 ATH_MSG_DEBUG(" Deprecated ROD source id found: "
106 << std::hex << rodId << std::dec);
107 }
108
109 // For generality let's declare the data pointer like this. Altough it's
110 // unlikely to ever change from being a pointer to uint32_t-s.
112 rob->rod_data( it_data );
113 const uint32_t ndata = rob->rod_ndata();
114 ATH_MSG_VERBOSE(" number of data words: " << ndata);
115
116 // candidate multiplicity
117 std::vector< uint32_t > candidateMultiplicity;
118 // data words
119 std::vector< uint32_t > dataWord;
120 for( uint32_t i = 0; i < ndata; ++i, ++it_data ) {
122 candidateMultiplicity.push_back( static_cast< uint32_t >( *it_data ) );
123 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' )
124 << ( *it_data ) << " (candidate multiplicity)");
125 } else {
126 dataWord.push_back( static_cast< uint32_t >( *it_data ) );
127 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' )
128 << ( *it_data ) << " (candidate word)");
129 }
130 }
131
132 // create MuCTPI RDO
133 result = new MuCTPI_RDO( std::move(candidateMultiplicity), std::move(dataWord) );
134 return StatusCode::SUCCESS;
135
136 }
137
138 ATH_MSG_ERROR("Wrong ROD ID found in the MuCTPI ROB fragment!");
139 return StatusCode::FAILURE;
140}
#define ATH_MSG_ERROR(x)
uint16_t bcId(uint32_t data)
static constexpr uint32_t MULT_WORD_FLAG_SHIFT
Position of the bit turned on for the multiplicity words that distinguishes them from the data words.
const DataType * PointerType
Definition RawEvent.h:25

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & MuCTPIByteStreamTool::interfaceID ( )
static

AlgTool InterfaceID.

This function is needed by the framework to know what kind of tool this is.

Definition at line 17 of file MuCTPIByteStreamTool.cxx.

17 {
19}
static const InterfaceID IID_IMuCTPIByteStreamTool("MuCTPIByteStreamTool", 1, 1)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fea

FullEventAssembler< MuCTPISrcIdMap > MuCTPIByteStreamTool::m_fea
private

Object used in creating the MuCTPI ROB fragment.

Definition at line 54 of file MuCTPIByteStreamTool.h.

◆ m_srcIdMap

MuCTPISrcIdMap MuCTPIByteStreamTool::m_srcIdMap
private

Object storing the various IDs of the MuCTPI fragment.

Definition at line 52 of file MuCTPIByteStreamTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: