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

An AlgTool class to provide conversion from TRT RDO container to ByteStream, and fill it in RawEvent created: Oct 25, 2002, by Hong Ma requirements: typedef for CONTAINER class method StatusCode convert(CONTAINER* cont, RawEvent* re, MsgStream& log );. More...

#include <TRTRawContByteStreamTool.h>

Inheritance diagram for TRTRawContByteStreamTool:
Collaboration diagram for TRTRawContByteStreamTool:

Public Types

typedef TRT_RDORawData RDO
typedef InDetRawDataCollection< RDOTRTRawCollection

Public Member Functions

 TRTRawContByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 constructor
virtual ~TRTRawContByteStreamTool ()
 destructor
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual StatusCode convert (TRT_RDO_Container *cont) const override
 New convert method which makes use of the encoder class (as done for other detectors)

Private Attributes

ServiceHandle< IByteStreamCnvSvcm_byteStreamCnvSvc { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }
ServiceHandle< ITRT_CablingSvcm_trt_CablingSvc
const TRT_IDm_trt_idHelper
unsigned short m_RodBlockVersion

Detailed Description

An AlgTool class to provide conversion from TRT RDO container to ByteStream, and fill it in RawEvent created: Oct 25, 2002, by Hong Ma requirements: typedef for CONTAINER class method StatusCode convert(CONTAINER* cont, RawEvent* re, MsgStream& log );.

Definition at line 33 of file TRTRawContByteStreamTool.h.

Member Typedef Documentation

◆ RDO

◆ TRTRawCollection

Constructor & Destructor Documentation

◆ TRTRawContByteStreamTool()

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

constructor

Definition at line 22 of file TRTRawContByteStreamTool.cxx.

24 : base_class(type,name,parent),
25 m_trt_CablingSvc ("TRT_CablingSvc", name ),
26 m_trt_idHelper(nullptr)
27{
28 declareInterface< ITRTRawContByteStreamTool >( this );
29 declareProperty("RodBlockVersion",m_RodBlockVersion=3);
30}
ServiceHandle< ITRT_CablingSvc > m_trt_CablingSvc

◆ ~TRTRawContByteStreamTool()

TRTRawContByteStreamTool::~TRTRawContByteStreamTool ( )
virtualdefault

destructor

Member Function Documentation

◆ convert()

StatusCode TRTRawContByteStreamTool::convert ( TRT_RDO_Container * cont) const
overridevirtual

New convert method which makes use of the encoder class (as done for other detectors)

Definition at line 71 of file TRTRawContByteStreamTool.cxx.

72{
73 StatusCode sc(StatusCode::SUCCESS);
74
75 FullEventAssembler<SrcIdMap>* fea = nullptr;
76 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
77 "TRTRawCont") );
79
80 // set ROD Minor version
82 ATH_MSG_DEBUG( " Setting Minor Version Number to "<<m_RodBlockVersion );
83
84 // a map for ROD ID onto Encoder
85 std::map<uint32_t, TRT_RodEncoder> mapEncoder;
86
87 ATH_MSG_DEBUG( " number of collections "<< cont->size() );
88
89 //loop over the collections in the TRT RDO container
91 TRT_RDO_Container::const_iterator it_coll_end = cont->end();
92
93 for( ; it_coll!=it_coll_end;++it_coll)
94 {
95 const TRTRawCollection* coll = (*it_coll) ;
96
97 if ( nullptr != coll )
98 {
99 // Collection Id
100 Identifier id = coll->identify() ;
101
102 // Layer Id associated to the collection Id (Mapping)
103 Identifier IdLayer = m_trt_idHelper->layer_id(id);
104
105 std::vector<uint32_t> robids = m_trt_CablingSvc->getRobID(IdLayer);
106
107 eformat::helper::SourceIdentifier sid_rob(robids[0]);
108
109 // Building the rod ID
110 eformat::helper::SourceIdentifier sid_rod( sid_rob.subdetector_id(),
111 sid_rob.module_id() );
112 uint32_t rodId = sid_rod.code();
113
114 // loop over RDOs in the collection;
115 TRTRawCollection::const_iterator it_b = coll->begin();
116 TRTRawCollection::const_iterator it_e = coll->end();
117
118 for(; it_b!=it_e; ++it_b) // loop over RDOs in the collection;
119 {
120 const RDO* theRdo = *it_b; // fill rdo vector VRDO in
121 mapEncoder[rodId].addRdo(theRdo); // RodEncoder with the collection
122 }
123 }
124
125 } // End loop over collections
126
127 // loop over Encoder map and fill all ROD Data Blocks
128 std::map<uint32_t,TRT_RodEncoder>::iterator it_map = mapEncoder.begin();
129 std::map<uint32_t,TRT_RodEncoder>::iterator it_map_end = mapEncoder.end();
130
131 for (; (it_map != it_map_end) && (sc == StatusCode::SUCCESS); ++it_map)
132 {
133
134 TRT_RodEncoder theEncoder = (*it_map).second;
135
136 // set the idhelper, mapping and minor version
137 theEncoder.set_trt_IdHelper (m_trt_idHelper);
140 // use encoder to get ROD fragment data
141 theROD = fea->getRodData((*it_map).first); // get ROD data address
142
143
144 if ( 1 == m_RodBlockVersion )
145 sc = theEncoder.fillROD( *theROD ) ; // fill ROD data
146 else if ( 3 == m_RodBlockVersion )
147 sc = theEncoder.fillROD3( *theROD ) ; // fill ROD data
148 else
149 {
150 ATH_MSG_WARNING( "Unsupported TRT Rod Block Version Number" );
151 sc = StatusCode::RECOVERABLE;
152 }
153 }
154
155 if ( sc == StatusCode::FAILURE )
156 ATH_MSG_ERROR( "TRT ROD Encoder Failed" );
157 else if ( sc == StatusCode::RECOVERABLE )
158 ATH_MSG_WARNING( "TRT ROD Encoder has RECOVERABLE error" );
159
160
161 return sc;
162}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
void setRodMinorVersion(uint16_t m)
change the ROD minor version
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
const_iterator end() const
return const_iterator for end of container
size_t size() const
Duplicate of fullSize for backwards compatability.
const_iterator begin() const
return const_iterator for first entry
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
InDetRawDataCollection< RDO > TRTRawCollection
void set_trt_IdHelper(const TRT_ID *trt_id)
setId Helper
void setRodMinorVersion(unsigned short RodBlockVersion)
setRodMinorVersion
void set_trt_cabling(const ServiceHandle< ITRT_CablingSvc > &trt_CablingSvc)
setCablingSvc
StatusCode fillROD3(std::vector< uint32_t > &v)
conversion of ROD into compressed ROD fragment
StatusCode fillROD(std::vector< uint32_t > &v)
conversion of ROD into ROD fragment
::StatusCode StatusCode
StatusCode definition for legacy code.
setEventNumber uint32_t

◆ finalize()

StatusCode TRTRawContByteStreamTool::finalize ( )
overridevirtual

Definition at line 60 of file TRTRawContByteStreamTool.cxx.

61{
62 ATH_CHECK( AlgTool::finalize() );
63 return StatusCode::SUCCESS;
64}

◆ initialize()

StatusCode TRTRawContByteStreamTool::initialize ( )
overridevirtual

Definition at line 42 of file TRTRawContByteStreamTool.cxx.

43{
44 ATH_CHECK( AlgTool::initialize() );
45
46 ATH_CHECK( m_trt_CablingSvc.retrieve() );
47 ATH_MSG_INFO( "Retrieved tool " << m_trt_CablingSvc );
48
50
51 ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
52
53 return StatusCode::SUCCESS;
54}
#define ATH_MSG_INFO(x)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

Member Data Documentation

◆ m_byteStreamCnvSvc

ServiceHandle<IByteStreamCnvSvc> TRTRawContByteStreamTool::m_byteStreamCnvSvc { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }
private

Definition at line 58 of file TRTRawContByteStreamTool.h.

59{ this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" };

◆ m_RodBlockVersion

unsigned short TRTRawContByteStreamTool::m_RodBlockVersion
private

Definition at line 64 of file TRTRawContByteStreamTool.h.

◆ m_trt_CablingSvc

ServiceHandle<ITRT_CablingSvc> TRTRawContByteStreamTool::m_trt_CablingSvc
private

Definition at line 61 of file TRTRawContByteStreamTool.h.

◆ m_trt_idHelper

const TRT_ID* TRTRawContByteStreamTool::m_trt_idHelper
private

Definition at line 63 of file TRTRawContByteStreamTool.h.


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