ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
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 More...
 
virtual ~TRTRawContByteStreamTool ()
 destructor More...
 
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) More...
 

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

Definition at line 38 of file TRTRawContByteStreamTool.h.

◆ TRTRawCollection

Definition at line 41 of file TRTRawContByteStreamTool.h.

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 }

◆ ~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
90  TRT_RDO_Container::const_iterator it_coll = cont->begin();
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);
138  theEncoder.set_trt_cabling (m_trt_CablingSvc);
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 }

◆ finalize()

StatusCode TRTRawContByteStreamTool::finalize ( )
overridevirtual

Definition at line 60 of file TRTRawContByteStreamTool.cxx.

61 {
63  return StatusCode::SUCCESS;
64 }

◆ initialize()

StatusCode TRTRawContByteStreamTool::initialize ( )
overridevirtual

Definition at line 42 of file TRTRawContByteStreamTool.cxx.

43 {
45 
46  ATH_CHECK( m_trt_CablingSvc.retrieve() );
47  ATH_MSG_INFO( "Retrieved tool " << m_trt_CablingSvc );
48 
49  ATH_CHECK( detStore()->retrieve(m_trt_idHelper, "TRT_ID") );
50 
51  ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
52 
53  return StatusCode::SUCCESS;
54 }

Member Data Documentation

◆ m_byteStreamCnvSvc

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

Definition at line 58 of file TRTRawContByteStreamTool.h.

◆ 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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
TRTRawContByteStreamTool::m_trt_idHelper
const TRT_ID * m_trt_idHelper
Definition: TRTRawContByteStreamTool.h:63
TRTRawContByteStreamTool::RDO
TRT_RDORawData RDO
Definition: TRTRawContByteStreamTool.h:38
TRT_RodEncoder::set_trt_cabling
void set_trt_cabling(ServiceHandle< ITRT_CablingSvc > trt_CablingSvc)
setCablingSvc
Definition: TRT_RodEncoder.h:42
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FullEventAssembler< SrcIdMap >
DataVector< RawDataT >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition: DataVector.h:837
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
initialize
void initialize()
Definition: run_EoverP.cxx:894
TRT_RodEncoder
This class provides conversion from TRT RDO to ROD format.
Definition: TRT_RodEncoder.h:24
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:209
TRT_RodEncoder::fillROD
StatusCode fillROD(std::vector< uint32_t > &v)
conversion of ROD into ROD fragment
Definition: TRT_RodEncoder.cxx:36
TRT_RodEncoder::setRodMinorVersion
void setRodMinorVersion(unsigned short RodBlockVersion)
setRodMinorVersion
Definition: TRT_RodEncoder.h:48
TRT_RodEncoder::set_trt_IdHelper
void set_trt_IdHelper(const TRT_ID *trt_id)
setId Helper
Definition: TRT_RodEncoder.h:39
TRTRawContByteStreamTool::m_trt_CablingSvc
ServiceHandle< ITRT_CablingSvc > m_trt_CablingSvc
Definition: TRTRawContByteStreamTool.h:61
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TRT_RodEncoder::fillROD3
StatusCode fillROD3(std::vector< uint32_t > &v)
conversion of ROD into compressed ROD fragment
Definition: TRT_RodEncoder.cxx:77
FullEventAssembler::setRodMinorVersion
void setRodMinorVersion(uint16_t m)
change the ROD minor version
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRTRawContByteStreamTool::TRTRawCollection
InDetRawDataCollection< RDO > TRTRawCollection
Definition: TRTRawContByteStreamTool.h:41
TRTRawContByteStreamTool::m_RodBlockVersion
unsigned short m_RodBlockVersion
Definition: TRTRawContByteStreamTool.h:64
TRTRawContByteStreamTool::m_byteStreamCnvSvc
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
Definition: TRTRawContByteStreamTool.h:59
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
Identifier
Definition: IdentifierFieldParser.cxx:14