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

This tool orchestrates the individual steps in the BS conversion - sorting the hits into individual FEs, encoding the data streams and formatting them into eformat fragments. More...

#include <ITkPixelCnvTool.h>

Inheritance diagram for ITkPixelCnvTool:
Collaboration diagram for ITkPixelCnvTool:

Public Member Functions

 ITkPixelCnvTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize () override
 Retrieve helper tools.
template<class ContainerType>
StatusCode convertToByteStream (const ContainerType *cont) const
 Take ITkPixelRDO_Container or PixelRDO_Container and translate it 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

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 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

ToolHandle< ITkPixelHitSortingToolm_hitSortingTool {this, "HitSortingTool", ""}
ToolHandle< ITkPixelEncodingToolm_encodingTool {this, "EncodingTool", "", "The encoding tool"}
ServiceHandle< IByteStreamCnvSvcm_byteStreamCnvSvc {this, "ByteStreamConvertionService", "ByteStreamCnvSvc", "The Byte stream coversion service"}
SG::ReadCondHandleKey< ITkPixelCablingDatam_pixelCablingKey {this, "PixelCablingKey", "", "Cond Key of Pixel Cabling"}
ToolHandle< ITkPixelDataRateMonToolm_dataRateMonTool {this, "DataRateMonitoringTool", "", "Monitoring tool for data rate evaluation"}
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

This tool orchestrates the individual steps in the BS conversion - sorting the hits into individual FEs, encoding the data streams and formatting them into eformat fragments.

Definition at line 32 of file ITkPixelCnvTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ITkPixelCnvTool()

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

Definition at line 19 of file ITkPixelCnvTool.cxx.

20 : AthAlgTool(type, name, parent)
21{}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ convertToByteStream()

template<class ContainerType>
template StatusCode ITkPixelCnvTool::convertToByteStream< PixelRDO_Container > ( const ContainerType * cont) const

Take ITkPixelRDO_Container or PixelRDO_Container and translate it to bytestream.

Definition at line 47 of file ITkPixelCnvTool.cxx.

47 {
48
49 //Get the cabling
50 SG::ReadCondHandle<ITkPixelCablingData> cablingData(m_pixelCablingKey);
51 const ITkPixelCablingData* cabling = *cablingData;
52
53 //Get the full event assembler from ByteStreamCnvSvcBase
54 //SrcIdMap translates lower lvl IDs into higher lvl, e. g. ROD -> ROB, ROB -> ROS, ROS -> Det
55 FullEventAssembler<SrcIdMap>* fea = 0;
56 ATH_CHECK(m_byteStreamCnvSvc->getFullEventAssembler(fea, "ITkPixelRawCont"));
57
58 fea->setDetEvtType(0x0);
59 fea->setLvl1TriggerType(0x0);
60
61 //Expose the buffer to be filled with the encoded data
62 //Other BS converters use FullEventAssembler<SrcIdMap>::RODDATA,
63 //which is just a typedef for std::vector<uint32_t>. Why the extra
64 //layer of renaming?
65 std::vector<uint32_t>* rod;
66
67 //sort the RDO hits based on the FE
68 const std::map<ITkPixelOnlineId, ITkPixLayout<uint16_t>> EventHitMaps = m_hitSortingTool->sortRDOHits(cont, cabling);
69
70 for (const auto& [onlineID, hitMap] : EventHitMaps){
71
72 //make a copy of the onlineID
73 uint64_t onID = (uint64_t)onlineID;
74
75 //Encode the FE hits
76 std::vector<uint32_t> encodedStream = m_encodingTool->encodeFE(hitMap, onID & 0x3000000000000000);
77
78 //Build the ROD payload header. First word is size of the packet in 32bit words
79 //including the header (16b), felix status (8b), swrod status (8b),
80 //second is the DetectorResourceID
81 uint32_t chipPayloadHeader_1 = (static_cast<uint16_t>(encodedStream.size()) + 2) << 16;
82 uint32_t chipPayloadHeader_2 = onlineID.detectorResourceID();
83
84 // passing information to the monitoring tool if initialised
85 if (not m_dataRateMonTool.empty()) {
86 m_dataRateMonTool->fill(onlineID.offlineModuleID(), encodedStream, hitMap);
87 }
88
89 //The ROD identifier, the sourceID, is defined in the cabling
90 //and passed here from the ITkPixelHitSortingTool as part of
91 //the online ID
92
93 //Create ROD and insert the payload
94 rod = fea->getRodData(onlineID.sourceID());
95 rod->insert(rod->end(), {chipPayloadHeader_1, chipPayloadHeader_2});
96 rod->insert(rod->end(), encodedStream.begin(), encodedStream.end());
97
98 }
99
100 return StatusCode::SUCCESS;
101}
#define ATH_CHECK
Evaluate an expression and check for errors.
void setLvl1TriggerType(uint8_t m)
change LVL1 Trigger Type
void setDetEvtType(uint32_t m)
change Detector Event Type
RODDATA * getRodData(uint32_t id)
get a block of ROD data
SG::ReadCondHandleKey< ITkPixelCablingData > m_pixelCablingKey
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
ToolHandle< ITkPixelEncodingTool > m_encodingTool
ToolHandle< ITkPixelHitSortingTool > m_hitSortingTool
ToolHandle< ITkPixelDataRateMonTool > m_dataRateMonTool
setWord1 uint16_t
setEventNumber uint32_t

◆ 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

◆ initialize()

StatusCode ITkPixelCnvTool::initialize ( )
overridevirtual

Retrieve helper tools.

Definition at line 26 of file ITkPixelCnvTool.cxx.

26 {
27
28 //Initialize the sub-tools
29 ATH_CHECK(m_hitSortingTool.retrieve());
30
31 ATH_CHECK(m_encodingTool.retrieve());
32
33 ATH_CHECK(m_pixelCablingKey.initialize());
34
35 if (not m_dataRateMonTool.empty())
36 ATH_CHECK(m_dataRateMonTool.retrieve());
37
38 return StatusCode::SUCCESS;
39
40}

◆ 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.

◆ 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 >, and AthCheckedComponent<::AthAlgTool >.

◆ 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_byteStreamCnvSvc

ServiceHandle<IByteStreamCnvSvc> ITkPixelCnvTool::m_byteStreamCnvSvc {this, "ByteStreamConvertionService", "ByteStreamCnvSvc", "The Byte stream coversion service"}
private

Definition at line 49 of file ITkPixelCnvTool.h.

49{this, "ByteStreamConvertionService", "ByteStreamCnvSvc", "The Byte stream coversion service"};

◆ m_dataRateMonTool

ToolHandle<ITkPixelDataRateMonTool> ITkPixelCnvTool::m_dataRateMonTool {this, "DataRateMonitoringTool", "", "Monitoring tool for data rate evaluation"}
private

Definition at line 53 of file ITkPixelCnvTool.h.

53{this, "DataRateMonitoringTool", "", "Monitoring tool for data rate evaluation"};

◆ 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_encodingTool

ToolHandle<ITkPixelEncodingTool> ITkPixelCnvTool::m_encodingTool {this, "EncodingTool", "", "The encoding tool"}
private

Definition at line 47 of file ITkPixelCnvTool.h.

47{this, "EncodingTool", "", "The encoding tool"};

◆ 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_hitSortingTool

ToolHandle<ITkPixelHitSortingTool> ITkPixelCnvTool::m_hitSortingTool {this, "HitSortingTool", ""}
private

Definition at line 45 of file ITkPixelCnvTool.h.

45{this, "HitSortingTool", ""};

◆ m_pixelCablingKey

SG::ReadCondHandleKey<ITkPixelCablingData> ITkPixelCnvTool::m_pixelCablingKey {this, "PixelCablingKey", "", "Cond Key of Pixel Cabling"}
private

Definition at line 51 of file ITkPixelCnvTool.h.

51{this, "PixelCablingKey", "", "Cond Key of Pixel Cabling"};

◆ 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: