ATLAS Offline Software
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 
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 
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)
51  , m_tileHWID(0)
52  , m_verbose(false)
53 {
54  declareInterface<TileL2ContByteStreamTool>(this);
55 }
56 
57 // destructor
58 
60 }
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 
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileL2ContByteStreamTool::~TileL2ContByteStreamTool
virtual ~TileL2ContByteStreamTool()
Destructor.
Definition: TileL2ContByteStreamTool.cxx:59
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TileL2ContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: TileL2ContByteStreamTool.cxx:62
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileL2ContByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: TileL2ContByteStreamTool.cxx:42
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileROD_Encoder
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...
Definition: TileROD_Encoder.h:46
skel.it
it
Definition: skel.GENtoEVGEN.py:423
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TileL2ContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition: TileL2ContByteStreamTool.cxx:76
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
TileL2ContByteStreamTool::m_doFragTypeMu
Gaudi::Property< bool > m_doFragTypeMu
Definition: TileL2ContByteStreamTool.h:67
TileL2ContByteStreamTool::convert
StatusCode convert(TileL2Container *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileL2Container to BS.
Definition: TileL2ContByteStreamTool.cxx:81
TileL2ContByteStreamTool::m_verbose
bool m_verbose
Definition: TileL2ContByteStreamTool.h:75
skel.l2
l2
Definition: skel.GENtoEVGEN.py:426
TileHWID.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
TileROD_Decoder.h
TileL2ContByteStreamTool::m_hid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
Definition: TileL2ContByteStreamTool.h:71
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
TileL2.h
TileL2ContByteStreamTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileL2ContByteStreamTool.h:74
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileL2ContByteStreamTool.h
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.
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
TileL2ContByteStreamTool::m_initializeForWriting
Gaudi::Property< bool > m_initializeForWriting
Definition: TileL2ContByteStreamTool.h:69
TileROD_Encoder::fillRODL2
void fillRODL2(std::vector< uint32_t > &v)
Definition: TileROD_Encoder.cxx:432
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
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
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition: FullEventAssembler.h:54
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
AthAlgTool
Definition: AthAlgTool.h:26
TileContainer.h
TileContainer
Definition: TileContainer.h:38
CLASS_DEF.h
macros to associate a CLID to a type
TileL2
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
Definition: TileL2.h:33
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data
TileROD_Encoder::fillROD12
void fillROD12(std::vector< uint32_t > &v)
Definition: TileROD_Encoder.cxx:209
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.