ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileSvc
TileByteStream
src
TileL2ContByteStreamTool.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 : TileL2ContByteStreamTool.cxx
7
// Author : Aranzazu Ruiz
8
// Created : March 2007
9
//
10
// DESCRIPTION
11
// AlgTool used in the TileL2 to BS conversion
12
//
13
// BUGS:
14
//
15
// History:
16
//
17
//****************************************************************************
18
19
// Gaudi includes
20
21
// Atlas includes
22
#include "
AthenaKernel/errorcheck.h
"
23
#include "
StoreGate/ReadCondHandle.h
"
24
25
// Tile includes
26
#include "
TileByteStream/TileL2ContByteStreamTool.h
"
27
#include "
TileByteStream/TileROD_Decoder.h
"
28
#include "
TileByteStream/TileROD_Encoder.h
"
29
#include "
TileEvent/TileContainer.h
"
30
#include "
TileEvent/TileL2.h
"
31
#include "
TileIdentifier/TileHWID.h
"
32
33
34
35
#include "
AthenaKernel/CLASS_DEF.h
"
36
37
#include <map>
38
#include <stdint.h>
39
40
static
const
InterfaceID
IID_ITileL2ContByteStreamTool
(
"TileL2ContByteStreamTool"
, 1, 0);
41
42
const
InterfaceID&
TileL2ContByteStreamTool::interfaceID
() {
43
return
IID_ITileL2ContByteStreamTool
;
44
}
45
46
// default contructor
47
48
TileL2ContByteStreamTool::TileL2ContByteStreamTool
(
const
std::string&
type
,
const
std::string& name,
49
const
IInterface* parent)
50
:
AthAlgTool
(
type
, name, parent)
51
,
m_tileHWID
(0)
52
,
m_verbose
(false)
53
{
54
declareInterface<TileL2ContByteStreamTool>(
this
);
55
}
56
57
// destructor
58
59
TileL2ContByteStreamTool::~TileL2ContByteStreamTool
() {
60
}
61
62
StatusCode
TileL2ContByteStreamTool::initialize
() {
63
64
ATH_MSG_INFO
(
"Initializing TileL2ContByteStreamTool"
);
65
66
ATH_CHECK
(
detStore
()->retrieve(
m_tileHWID
,
"TileHWID"
) );
67
68
ToolHandle<TileROD_Decoder> dec(
"TileROD_Decoder"
);
69
ATH_CHECK
( dec.retrieve() );
70
71
ATH_CHECK
(
m_hid2RESrcIDKey
.initialize(
m_initializeForWriting
) );
72
73
return
StatusCode::SUCCESS;
74
}
75
76
StatusCode
TileL2ContByteStreamTool::finalize
() {
77
78
return
StatusCode::SUCCESS;
79
}
80
81
StatusCode
TileL2ContByteStreamTool::convert
(
TileL2Container
* cont,
82
FullEventAssembler<TileHid2RESrcID>
*fea)
const
{
83
84
//fea->clear();
85
86
FullEventAssembler<TileHid2RESrcID>::RODDATA
* theROD;
87
SG::ReadCondHandle<TileHid2RESrcID>
hid2re{
m_hid2RESrcIDKey
};
88
89
TileL2Container::const_iterator
it_cont = cont->
begin
();
90
TileL2Container::const_iterator
it_cont_end = cont->
end
();
91
92
std::map<uint32_t, TileROD_Encoder> mapEncoder;
93
94
int
n = 0;
95
int
nm = 0;
96
97
for
(; it_cont != it_cont_end; ++it_cont) {
98
99
int
frag_id = (*it_cont)->identify();
100
101
uint32_t reid = hid2re->getRodID(frag_id);
102
mapEncoder[reid].setTileHWID(
m_tileHWID
,
m_verbose
, 0x12);
103
104
const
TileL2
* l2 = *it_cont;
105
mapEncoder[reid].addL2(l2);
106
++n;
107
nm += l2->NMuons();
108
109
if
(
msgLvl
(MSG::VERBOSE)) {
110
unsigned
int
ndata = l2->Ndata();
111
unsigned
int
j = 0;
112
for
(
unsigned
int
i = 0; i < (l2->NMuons()); ++i, j += 2) {
113
msg
(MSG::VERBOSE) <<
"Muon found:"
<< MSG::hex
114
<<
" frag ID = 0x"
<< (l2->identify())
115
<<
" word1 = 0x"
<< ((j < ndata) ? l2->val(j) : 0)
116
<<
" word2 = 0x"
<< ((j + 1 < ndata) ? l2->val(j + 1) : 0) << MSG::dec
117
<<
" eta = "
<< (l2->eta(i))
118
<<
" phi = "
<< (l2->phi(i)) <<
endmsg
;
119
}
120
for
(; j < ndata; ++j) {
121
msg
(MSG::VERBOSE) <<
"extra word = 0x"
<< MSG::hex << l2->val(j) << MSG::dec <<
endmsg
;
122
}
123
}
124
}
125
126
ATH_MSG_DEBUG
(
" Number of TileL2 objects "
<< n
127
<<
" Number of muons "
<< nm );
128
129
std::map<uint32_t, TileROD_Encoder>::iterator it = mapEncoder.begin();
130
std::map<uint32_t, TileROD_Encoder>::iterator it_end = mapEncoder.end();
131
132
TileROD_Encoder
* theEncoder;
133
134
// TileROD_Encoder has collected all the TileL2s, now can fill the ROD block data
135
136
for
(; it != it_end; ++it) {
137
theROD = fea->
getRodData
((*it).first);
138
theEncoder = &((*it).second);
139
if
(
m_doFragTypeMu
) theEncoder->
fillROD12
(*theROD);
140
if
(
m_doFragTypeEt
) theEncoder->
fillRODL2
(*theROD);
141
}
142
143
return
StatusCode::SUCCESS;
144
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CLASS_DEF.h
macros to associate a CLID to a type
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ReadCondHandle.h
TileContainer.h
TileL2Container
TileContainer< TileL2 > TileL2Container
Definition
TileContainer.h:67
TileHWID.h
IID_ITileL2ContByteStreamTool
static const InterfaceID IID_ITileL2ContByteStreamTool("TileL2ContByteStreamTool", 1, 0)
TileL2ContByteStreamTool.h
TileL2.h
TileROD_Decoder.h
TileROD_Encoder.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition
AthCommonMsg.h:30
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
TileContainer< TileL2 >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector< TELEMENT >::end
const_iterator end() const noexcept
DataVector< TELEMENT >::begin
const_iterator begin() const noexcept
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition
FullEventAssembler.h:38
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition
FullEventAssembler.h:52
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
TileL2ContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition
TileL2ContByteStreamTool.cxx:62
TileL2ContByteStreamTool::m_initializeForWriting
Gaudi::Property< bool > m_initializeForWriting
Definition
TileL2ContByteStreamTool.h:69
TileL2ContByteStreamTool::~TileL2ContByteStreamTool
virtual ~TileL2ContByteStreamTool()
Destructor.
Definition
TileL2ContByteStreamTool.cxx:59
TileL2ContByteStreamTool::m_tileHWID
const TileHWID * m_tileHWID
Definition
TileL2ContByteStreamTool.h:74
TileL2ContByteStreamTool::m_doFragTypeMu
Gaudi::Property< bool > m_doFragTypeMu
Definition
TileL2ContByteStreamTool.h:67
TileL2ContByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition
TileL2ContByteStreamTool.cxx:42
TileL2ContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition
TileL2ContByteStreamTool.cxx:76
TileL2ContByteStreamTool::m_hid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
Definition
TileL2ContByteStreamTool.h:71
TileL2ContByteStreamTool::m_verbose
bool m_verbose
Definition
TileL2ContByteStreamTool.h:75
TileL2ContByteStreamTool::convert
StatusCode convert(TileL2Container *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileL2Container to BS.
Definition
TileL2ContByteStreamTool.cxx:81
TileL2ContByteStreamTool::TileL2ContByteStreamTool
TileL2ContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition
TileL2ContByteStreamTool.cxx:48
TileL2ContByteStreamTool::m_doFragTypeEt
Gaudi::Property< bool > m_doFragTypeEt
Definition
TileL2ContByteStreamTool.h:68
TileL2
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
Definition
TileL2.h:33
TileROD_Encoder
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...
Definition
TileROD_Encoder.h:46
TileROD_Encoder::fillRODL2
void fillRODL2(std::vector< uint32_t > &v)
Definition
TileROD_Encoder.cxx:455
TileROD_Encoder::fillROD12
void fillROD12(std::vector< uint32_t > &v)
Definition
TileROD_Encoder.cxx:238
type
Generated on
for ATLAS Offline Software by
1.17.0