ATLAS Offline Software
Loading...
Searching...
No Matches
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
34
35#include <map>
36#include <stdint.h>
37
38static const InterfaceID IID_ITileMuRcvContByteStreamTool("TileMuRcvContByteStreamTool", 1, 0);
39
43
44// default constructor
45
46TileMuRcvContByteStreamTool::TileMuRcvContByteStreamTool(const std::string& type, const std::string& name,
47 const IInterface* parent)
48 : AthAlgTool(type, name, parent)
49 , m_tileHWID(0)
50 , m_runPeriod(0)
51{
52 declareInterface<TileMuRcvContByteStreamTool>(this);
53}
54
55// destructor
56
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
macros to associate a CLID to a type
Helpers for checking error return status codes and reporting errors.
TileContainer< TileMuonReceiverObj > TileMuonReceiverContainer
static const InterfaceID IID_ITileMuRcvContByteStreamTool("TileMuRcvContByteStreamTool", 1, 0)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() const noexcept
size_type size() const noexcept
Template class for assembling a full atlas raw event from subfragments.
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
static const TileCablingService * getInstance()
get pointer to service instance
virtual StatusCode finalize() override
Gaudi::Property< bool > m_initializeForWriting
TileMuRcvContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
StatusCode convert(TileMuonReceiverContainer *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileMuRcvContainer to bytestream.
virtual StatusCode initialize() override
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...