ATLAS Offline Software
Loading...
Searching...
No Matches
TileDigitsContByteStreamTool.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// Gaudi includes
6
7// Atlas includes
10
11// Tile includes
19
21
22#include <map>
23#include <stdint.h>
24
25
26static const InterfaceID IID_ITileDigitsContByteStreamTool
27 ("TileDigitsContByteStreamTool", 1, 0);
28
31
32// default constructor
33
35 , const std::string& name,const IInterface* parent )
36 : AthAlgTool(type, name, parent)
37 , m_tileHWID(0)
38 , m_verbose(false)
39 , m_runPeriod(0)
40{
41 declareInterface< TileDigitsContByteStreamTool >( this );
42}
43
44// destructor
45
47
49
50 ATH_MSG_INFO ("Initializing TileDigitsContByteStreamTool");
51
52 ATH_CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
53
54 ToolHandle<TileROD_Decoder> dec("TileROD_Decoder");
55 ATH_CHECK( dec.retrieve() );
56
58
60 m_runPeriod = cabling->runPeriod();
61
62 return StatusCode::SUCCESS;
63}
64
66 ATH_MSG_INFO ("Finalizing TileDigitsContByteStreamTool successfuly");
67 return StatusCode::SUCCESS;
68}
69
71{
73
75
76 std::map<uint32_t, TileROD_Encoder> mapEncoder;
77
78 ATH_MSG_DEBUG( " number of digits collections " << digitsContainer->size() << " " << evtStore()->proxy(digitsContainer)->name() );
79
80 int m = 0;
81 int n = 0;
82 uint32_t reid = 0x0;
83
84 bool isTMDB = evtStore()->proxy(digitsContainer)->name() == "MuRcvDigitsCnt";
85
86 for (const TileDigitsCollection* digitsCollection : *digitsContainer) {
87
88 TileDigitsCollection::ID frag_id = digitsCollection->identify();
89
90 if (isTMDB){
91 reid = hid2re->getRodTileMuRcvID(frag_id);
92 mapEncoder[reid].setTileHWID(m_tileHWID,m_runPeriod);
93 } else {
94 reid = hid2re->getRodID(frag_id);
95 mapEncoder[reid].setTileHWID(m_tileHWID, m_verbose, 1);
96 }
97
98 for (const TileDigits* digits : *digitsCollection) {
99 mapEncoder[reid].addDigi(digits);
100 ++n;
101 }
102 ++m;
103
104 ATH_MSG_DEBUG( " Collection " << m << ": " << MSG::hex << "0x" << frag_id
105 << " ROD " << "0x" << reid
106 << " number of channels " << MSG::dec << n );
107 }
108
109 // TileROD_Encoder has collected all the channels, now can fill the ROD block data.
110
111 for (std::pair<const uint32_t, TileROD_Encoder>& reidAndEncoder: mapEncoder) {
112
113 theROD = fea->getRodData(reidAndEncoder.first);
114 TileROD_Encoder& theEncoder = reidAndEncoder.second;
115
116 // RODId is already defined so use it for the exception
117
118 if ((reidAndEncoder.first & 0xf00)) {
119 theEncoder.fillRODTileMuRcvDigi(*theROD);
120 } else {
121 if (m_doFragType1) theEncoder.fillROD1(*theROD);
122 if (m_doFragType5) theEncoder.fillROD5D(*theROD);
123 }
124
125 ATH_MSG_DEBUG( " Number words in ROD " << MSG::hex <<" 0x"<< reidAndEncoder.first << MSG::dec << " : " << theROD->size() );
126 }
127
128 return StatusCode::SUCCESS;
129}
#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.
static const InterfaceID IID_ITileDigitsContByteStreamTool("TileDigitsContByteStreamTool", 1, 0)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
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
size_t size() const
Duplicate of fullSize for backwards compatability.
static const TileCablingService * getInstance()
get pointer to service instance
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
TileDigitsContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
StatusCode convert(DIGITS *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileDigitsContainer to BS.
virtual StatusCode finalize() override
virtual StatusCode initialize() override
Gaudi::Property< bool > m_initializeForWriting
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...
void fillROD5D(std::vector< uint32_t > &v)
void fillROD1(std::vector< uint32_t > &v)
convert all TileDigits in the current list to a vector of 32bit words
void fillRODTileMuRcvDigi(std::vector< uint32_t > &v)
convert the TMDB objects into a vector of 32bit words: 8bit words/digit, 16bit words/RC,...