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

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

#include <CTPByteStreamTool.h>

Inheritance diagram for CTPByteStreamTool:
Collaboration diagram for CTPByteStreamTool:

Public Member Functions

 CTPByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor.
StatusCode convert (const ROBF *rob, CTP_RDO *&result)
 Convert ROBFragment to CTP_RDO.
StatusCode convert (const CTP_RDO *result, RawEventWrite *re)
 convert CTP_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

CTPSrcIdMap m_srcIdMap
 Object storing the various IDs of the CTP fragment.
FullEventAssembler< CTPSrcIdMapm_fea
 Object used in creating the CTP 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 CTP_RDO <-> ByteStream conversion.

   The actual work of translating the information in a CTP_RDO object
   into a CTP ROB fragment and vice-versa is done with this tool.
See also
CTPByteStreamCnv
Author
David Berge
Date
Date
2007-12-14 15:33:07

Definition at line 33 of file CTPByteStreamTool.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

◆ CTPByteStreamTool()

CTPByteStreamTool::CTPByteStreamTool ( 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 31 of file CTPByteStreamTool.cxx.

33 : AthAlgTool( type, name, parent ) {
34
35 declareInterface< CTPByteStreamTool >( this );
36}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ convert() [1/2]

StatusCode CTPByteStreamTool::convert ( const CTP_RDO * result,
RawEventWrite * re )

convert CTP_RDO to ByteStream

Conversion from RDO to eformat::ROBFragment.

This is called from the CTPByteStreamCnv::createRep method.

Definition at line 43 of file CTPByteStreamTool.cxx.

43 {
44
45 MsgStream log( msgSvc(), name() );
46 ATH_MSG_DEBUG("executing convert() from RDO to ROBFragment");
47
48 //get CTP version
49 unsigned int ctpVersionNumber = result->getCTPVersionNumber();
50 CTPdataformatVersion ctpVersion(ctpVersionNumber);
51
52 // Clear Event Assembler
53 m_fea.clear();
54
55 // Reset lumi-block number to 1
56 m_fea.setDetEvtType( 1 );
57 // Set L1Apos to center of readout window
58 uint16_t minorVersion = ( result->getNumberOfBunches() - 1u ) / 2u;
59 minorVersion &= ctpVersion.getL1APositionMask();
60 minorVersion <<= ctpVersion.getL1APositionShift();
61 m_fea.setRodMinorVersion( minorVersion );
62
64
65 // Source ID of CTP
66 const uint32_t rodId = m_srcIdMap.getRodID();
67
68 ATH_MSG_DEBUG(" ROD ID:" << MSG::hex << rodId);
69
70 // get the ROD data container to be filled
71 theROD = m_fea.getRodData( rodId );
72
73 ATH_MSG_VERBOSE(" Dumping CTP words:");
74
75 // fill Data Words
76 const std::vector< uint32_t >& vDataWords = result->getDataWords();
77 std::vector< uint32_t >::const_iterator it = vDataWords.begin();
78 std::vector< uint32_t >::const_iterator end = vDataWords.end();
79 for( ; it != end; ++it ) {
80 theROD->push_back( *it );
81 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setw( 8 ) << ( *it ));
82 }
83
84 // Now fill full event
85 ATH_MSG_DEBUG("Now filling the event with the CTP fragment");
86 m_fea.fill( re, log );
87
88 return StatusCode::SUCCESS;
89}
const boost::regex re(r_e)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
CTPSrcIdMap m_srcIdMap
Object storing the various IDs of the CTP fragment.
FullEventAssembler< CTPSrcIdMap > m_fea
Object used in creating the CTP ROB fragment.
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
msgSvc
Provide convenience handles for various services.
Definition StdJOSetup.py:36
setWord1 uint16_t
setEventNumber uint32_t

◆ convert() [2/2]

StatusCode CTPByteStreamTool::convert ( const ROBF * rob,
CTP_RDO *& result )

Convert ROBFragment to CTP_RDO.

Conversion from eformat::ROBFragment to RDO.

This is called from the CTPByteStreamCnv::createObj method.

Definition at line 96 of file CTPByteStreamTool.cxx.

96 {
97
98 MsgStream log( msgSvc(), name() );
99 ATH_MSG_DEBUG("executing convert() from ROBFragment to RDO");
100
101 const uint32_t ctpRodId = m_srcIdMap.getRodID();
102 const uint32_t rodId = rob->rod_source_id();
103
104 ATH_MSG_DEBUG(" expected ROD sub-detector ID: " << std::hex << ctpRodId
105 << " ID found: " << std::hex << rodId << std::dec);
106
107 if ( rodId == ctpRodId ) {
108
109 ATH_MSG_VERBOSE(" Dumping CTP words:");
110
111 // For generality let's declare the data pointer like this. Altough it's
112 // unlikely to ever change from being a pointer to uint32_t-s.
114 rob->rod_data( it_data );
115 const uint32_t ndata = rob->rod_ndata();
116
117 // data words
118 std::vector<uint32_t> vDataWords;
119 for ( uint32_t i = 0; i < ndata; ++i, ++it_data ) {
120 vDataWords.push_back( static_cast<uint32_t>( *it_data ) );
121 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setw( 8 ) << *it_data);
122 }
123
124 // create CTP RDO
125 uint32_t nExtraWords=0;
126 nExtraWords=CTPfragment::numberExtraPayloadWords(rob);
127 unsigned int ctpVersionNumber = CTPfragment::ctpFormatVersion(rob);
128 result = new CTP_RDO(ctpVersionNumber, std::move(vDataWords) , nExtraWords);
129
130 uint8_t l1apos = CTPfragment::lvl1AcceptBunch(rob);
131 result->setL1AcceptBunchPosition(l1apos);
132
133 uint32_t tc = CTPfragment::turnCounter(rob);
134 result->setTurnCounter(tc);
135
136 return StatusCode::SUCCESS;
137 }
138
139 ATH_MSG_ERROR("Wrong ROD ID found in the CTP ROB fragment!");
140 return StatusCode::FAILURE;
141}
#define ATH_MSG_ERROR(x)
static Double_t tc
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 & CTPByteStreamTool::interfaceID ( )
static

AlgTool InterfaceID.

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

Definition at line 23 of file CTPByteStreamTool.cxx.

23 {
25}
static const InterfaceID IID_ICTPByteStreamTool("CTPByteStreamTool", 1, 0)
Unique interface ID of the tool that identifies it to the framweork.

◆ 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< CTPSrcIdMap > CTPByteStreamTool::m_fea
private

Object used in creating the CTP ROB fragment.

Definition at line 55 of file CTPByteStreamTool.h.

◆ m_srcIdMap

CTPSrcIdMap CTPByteStreamTool::m_srcIdMap
private

Object storing the various IDs of the CTP fragment.

Definition at line 53 of file CTPByteStreamTool.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: