ATLAS Offline Software
TileMuRcvContByteStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //****************************************************************************
6 // Filename : TileMuRcvContByteStreamTool.cxx
7 // Author : Joao Gentil Saraiva (jmendes@cern.ch)
8 // Created : February 2015
9 //
10 // DESCRIPTION
11 // AlgTool used in the TileMuRcv to BS conversion
12 //
13 // BUGS:
14 //
15 // History:
16 //
17 //****************************************************************************
18 
19 // Gaudi includes
20 
21 // Atlas includes
24 
25 // Tile includes
32 
33 #include "AthenaKernel/CLASS_DEF.h"
34 
35 #include <map>
36 #include <stdint.h>
37 
38 static const InterfaceID IID_ITileMuRcvContByteStreamTool("TileMuRcvContByteStreamTool", 1, 0);
39 
41  return IID_ITileMuRcvContByteStreamTool;
42 }
43 
44 // default constructor
45 
47  const IInterface* parent)
49  , m_tileHWID(0)
50  , m_runPeriod(0)
51 {
52  declareInterface<TileMuRcvContByteStreamTool>(this);
53 }
54 
55 // destructor
56 
58 }
59 
61 
62  ATH_MSG_INFO ("Initializing TileMuRcvContByteStreamTool");
63 
64  ATH_CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
65 
66  ToolHandle<TileROD_Decoder> dec("TileROD_Decoder");
67  ATH_CHECK( dec.retrieve() );
68 
70 
72  m_runPeriod = cabling->runPeriod();
73 
74  return StatusCode::SUCCESS;
75 }
76 
78  ATH_MSG_INFO ("Finalizing TileMuRcvContByteStreamTool successfuly");
79  return StatusCode::SUCCESS;
80 }
81 
83 {
84  ATH_MSG_INFO ("Executing TileMuRcvContByteStreamTool::convert method");
85 
87 
88  int n = 0;
89  uint32_t frag_id = 0x0;
90  uint32_t reid = 0x0;
91 
94 
95  // skip thresholds stored at first position of the container
96  //
97  ++it_cont;
98 
99  std::map<uint32_t, TileROD_Encoder> mapEncoder;
100 
101  for (; it_cont != end_cont; ++it_cont)
102  {
103  n++;
104  frag_id = (*it_cont)->identify();
105  reid = hid2re->getRodTileMuRcvID(frag_id);
106  mapEncoder[reid].setTileHWID(m_tileHWID,m_runPeriod);
107  const TileMuonReceiverObj* tileMuRcv = *it_cont;
108  mapEncoder[reid].addTileMuRcvObj(tileMuRcv);
109  }
110 
111  ATH_MSG_DEBUG( " Number of TileMuonReceiverObj objects counted " << n << " out of the possible " << cont->size()-1 );
112 
113  // fill ROD
114  //
115  std::map<uint32_t, TileROD_Encoder>::iterator map_it = mapEncoder.begin();
116  std::map<uint32_t, TileROD_Encoder>::iterator map_end = mapEncoder.end();
117 
119 
120  TileROD_Encoder* theEncoder;
121 
122  for (; map_it != map_end; ++map_it)
123  {
124  theROD = fea->getRodData( (*map_it).first );
125  theEncoder = &( (*map_it).second );
126  theEncoder -> fillRODTileMuRcvObj( *theROD );
127  ATH_MSG_DEBUG( " Number of words in ROD " <<MSG::hex<< (*map_it).first <<MSG::dec<< ": " << theROD->size() );// DEBUG
128  ATH_MSG_DEBUG( " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ " );// DEBUG
129  }
130 
131  return StatusCode::SUCCESS;
132 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TileMuRcvContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition: TileMuRcvContByteStreamTool.cxx:77
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
TileCablingService::getInstance
static const TileCablingService * getInstance()
get pointer to service instance
Definition: TileCablingService.cxx:24
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileMuRcvContByteStreamTool::m_runPeriod
int m_runPeriod
Definition: TileMuRcvContByteStreamTool.h:69
TileMuRcvContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: TileMuRcvContByteStreamTool.cxx:60
TileROD_Encoder
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...
Definition: TileROD_Encoder.h:46
TileMuRcvContByteStreamTool::TileMuRcvContByteStreamTool
TileMuRcvContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: TileMuRcvContByteStreamTool.cxx:46
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
TileMuRcvContByteStreamTool::m_hid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
Definition: TileMuRcvContByteStreamTool.h:64
ReadCondHandle.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
TileHWID.h
TileROD_Decoder.h
beamspotman.n
n
Definition: beamspotman.py:731
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
TileMuRcvContByteStreamTool::convert
StatusCode convert(TileMuonReceiverContainer *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileMuRcvContainer to bytestream.
Definition: TileMuRcvContByteStreamTool.cxx:82
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileCablingService
Definition: TileCablingService.h:23
TileMuRcvContByteStreamTool::m_initializeForWriting
Gaudi::Property< bool > m_initializeForWriting
Definition: TileMuRcvContByteStreamTool.h:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TileROD_Encoder.h
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TileMuonReceiverObj
Definition: TileMuonReceiverObj.h:28
TileMuRcvContByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: TileMuRcvContByteStreamTool.cxx:40
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileMuRcvContByteStreamTool::~TileMuRcvContByteStreamTool
virtual ~TileMuRcvContByteStreamTool()
Destructor.
Definition: TileMuRcvContByteStreamTool.cxx:57
TileMuRcvContByteStreamTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileMuRcvContByteStreamTool.h:67
TileMuonReceiverObj.h
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition: FullEventAssembler.h:54
AthAlgTool
Definition: AthAlgTool.h:26
TileContainer.h
TileMuRcvContByteStreamTool.h
TileContainer
Definition: TileContainer.h:38
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
CLASS_DEF.h
macros to associate a CLID to a type
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.