ATLAS Offline Software
Loading...
Searching...
No Matches
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
24
25// Tile includes
30#include "TileEvent/TileL2.h"
32
33
34
36
37#include <map>
38#include <stdint.h>
39
40static const InterfaceID IID_ITileL2ContByteStreamTool("TileL2ContByteStreamTool", 1, 0);
41
45
46// default contructor
47
48TileL2ContByteStreamTool::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
61
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
72
73 return StatusCode::SUCCESS;
74}
75
77
78 return StatusCode::SUCCESS;
79}
80
83
84 //fea->clear();
85
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}
#define endmsg
#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< TileL2 > TileL2Container
static const InterfaceID IID_ITileL2ContByteStreamTool("TileL2ContByteStreamTool", 1, 0)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
const_iterator begin() 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
virtual StatusCode initialize() override
Gaudi::Property< bool > m_initializeForWriting
virtual ~TileL2ContByteStreamTool()
Destructor.
Gaudi::Property< bool > m_doFragTypeMu
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
virtual StatusCode finalize() override
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
StatusCode convert(TileL2Container *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileL2Container to BS.
TileL2ContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Gaudi::Property< bool > m_doFragTypeEt
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
Definition TileL2.h:33
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...
void fillRODL2(std::vector< uint32_t > &v)
void fillROD12(std::vector< uint32_t > &v)