ATLAS Offline Software
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
17 #include "TileEvent/TileDigits.h"
19 
20 #include "AthenaKernel/CLASS_DEF.h"
21 
22 #include <map>
23 #include <stdint.h>
24 
25 
26 static const InterfaceID IID_ITileDigitsContByteStreamTool
27  ("TileDigitsContByteStreamTool", 1, 0);
28 
30 { return IID_ITileDigitsContByteStreamTool; }
31 
32 // default constructor
33 
35  , const std::string& name,const IInterface* 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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileDigitsContByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: TileDigitsContByteStreamTool.cxx:48
TileDigitsContByteStreamTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileDigitsContByteStreamTool.h:63
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
TileDigitsCollection.h
TileDigitsCollection::ID
MyBase::ID ID
Definition: TileDigitsCollection.h:23
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
TileCablingService::getInstance
static const TileCablingService * getInstance()
get pointer to service instance
Definition: TileCablingService.cxx:24
TileDigitsContByteStreamTool::m_initializeForWriting
Gaudi::Property< bool > m_initializeForWriting
Definition: TileDigitsContByteStreamTool.h:58
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileDigitsContByteStreamTool.h
TileDigitsContByteStreamTool::m_runPeriod
int m_runPeriod
Definition: TileDigitsContByteStreamTool.h:66
TileROD_Encoder
Provides conversion from TileRawChannel, TileL2 and TMDB (digits,MF raw channel,decision) to ROD form...
Definition: TileROD_Encoder.h:46
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:206
TileROD_Encoder::fillROD1
void fillROD1(std::vector< uint32_t > &v)
convert all TileDigits in the current list to a vector of 32bit words
Definition: TileROD_Encoder.cxx:471
TileDigitsContByteStreamTool::m_doFragType1
Gaudi::Property< bool > m_doFragType1
Definition: TileDigitsContByteStreamTool.h:56
TileDigitsContainer
Definition: TileDigitsContainer.h:13
TileDigitsContByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: TileDigitsContByteStreamTool.cxx:29
ReadCondHandle.h
TileDigitsContByteStreamTool::finalize
virtual StatusCode finalize() override
Definition: TileDigitsContByteStreamTool.cxx:65
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TileHWID.h
TileROD_Decoder.h
TileDigitsContainer.h
beamspotman.n
n
Definition: beamspotman.py:731
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileDigitsContByteStreamTool::m_verbose
bool m_verbose
Definition: TileDigitsContByteStreamTool.h:65
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileDigitsContByteStreamTool::convert
StatusCode convert(DIGITS *cont, FullEventAssembler< TileHid2RESrcID > *fea) const
Provides conversion from TileDigitsContainer to BS.
Definition: TileDigitsContByteStreamTool.cxx:70
TileCablingService
Definition: TileCablingService.h:23
TileDigitsCollection
Definition: TileDigitsCollection.h:18
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileDigits
Definition: TileDigits.h:30
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileROD_Encoder::fillRODTileMuRcvDigi
void fillRODTileMuRcvDigi(std::vector< uint32_t > &v)
convert the TMDB objects into a vector of 32bit words: 8bit words/digit, 16bit words/RC,...
Definition: TileROD_Encoder.cxx:510
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TileROD_Encoder.h
TileDigitsContByteStreamTool::TileDigitsContByteStreamTool
TileDigitsContByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: TileDigitsContByteStreamTool.cxx:34
TileDigitsContByteStreamTool::m_doFragType5
Gaudi::Property< bool > m_doFragType5
Definition: TileDigitsContByteStreamTool.h:57
TileDigitsContByteStreamTool::~TileDigitsContByteStreamTool
virtual ~TileDigitsContByteStreamTool()
destructor
Definition: TileDigitsContByteStreamTool.cxx:46
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileDigitsContByteStreamTool::m_hid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_hid2RESrcIDKey
Definition: TileDigitsContByteStreamTool.h:60
FullEventAssembler::RODDATA
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
Definition: FullEventAssembler.h:54
AthAlgTool
Definition: AthAlgTool.h:26
TileDigits.h
TileROD_Encoder::fillROD5D
void fillROD5D(std::vector< uint32_t > &v)
Definition: TileROD_Encoder.cxx:502
CLASS_DEF.h
macros to associate a CLID to a type
FullEventAssembler::getRodData
RODDATA * getRodData(uint32_t id)
get a block of ROD data