ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetEventCnv
ITkPixelByteStreamCnv
src
ITkPixEncoder.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/*EXTERNAL CODE PORTED FROM YARR MINIMALLY ADAPTED FOR ATHENA*/
6
7
/*
8
* Author: Ondra Kovanda, ondrej.kovanda at cern.ch
9
* Date: 03/2024
10
* Description: ITkPix* encoding base class
11
*/
12
13
#ifndef ITKPIXENCODER_H
14
#define ITKPIXENCODER_H
15
16
17
#include "
ITkPixLayout.h
"
18
#include "
CxxUtils/checker_macros.h
"
19
#include <vector>
20
#include <cstdint>
21
#include <mutex>
22
23
class
ITkPixEncoder
{
24
public
:
25
typedef
ITkPixLayout<uint16_t>
HitMap
;
26
27
ITkPixEncoder
(
const
bool
enableChipID =
true
,
const
unsigned
nCol = 400,
const
unsigned
nRow = 384,
28
const
unsigned
nColInCCol = 8,
const
unsigned
nRowInQRow = 2,
29
const
unsigned
nEventsPerStream = 16,
const
bool
plainHitMap =
false
,
30
const
bool
dropToT =
false
);
31
32
std::vector<uint32_t>&
getWords
(){
return
m_words;}
33
34
void
addBits64
(
const
uint64_t value,
const
uint8_t
length
)
const
;
35
36
void
setHitMap
(
const
HitMap
& hitMap)
const
{m_hitMap = hitMap;}
37
38
void
setEventsPerStream
(
const
unsigned
nEventsPerStream = 16){
m_nEventsPerStream
= nEventsPerStream;}
39
40
void
setChipID
(
const
uint8_t& chipID);
41
42
void
clear
()
const
;
43
44
protected
:
45
46
void
pushWords32
()
const
;
47
48
void
encodeQCore
(
const
unsigned
nCCol,
const
unsigned
nQRow)
const
;
49
50
void
encodeEvent
()
const
;
51
52
void
streamTag
(
const
uint8_t nStream)
const
;
53
54
void
intTag
(
const
uint16_t nEvt)
const
;
55
56
void
scanHitMap
()
const
;
57
58
bool
hitInQCore
(
const
unsigned
CCol,
const
unsigned
QRow)
const
;
59
60
//Access to all mutables is always mutex-protected
61
// Chip geometry
62
unsigned
m_nCol
{400},
m_nRow
{384},
m_nCCol
{50},
m_nQRow
{192},
m_nColInCCol
{8},
m_nRowInQRow
{2};
63
64
// Output
65
mutable
std::vector<uint32_t> m_words
ATLAS_THREAD_SAFE
;
//only accessed in mutex-protected function
66
unsigned
m_nEventsPerStream
;
67
mutable
unsigned
m_currCCol
ATLAS_THREAD_SAFE
{}, m_currQRow
ATLAS_THREAD_SAFE
{}, m_currEvent
ATLAS_THREAD_SAFE
{};
//
68
mutable
uint8_t m_currStream
ATLAS_THREAD_SAFE
{};
69
70
// Encoding machinery
71
mutable
uint64_t m_currBlock
ATLAS_THREAD_SAFE
{};
72
mutable
uint8_t m_currBit
ATLAS_THREAD_SAFE
{};
73
mutable
std::vector<std::vector<bool>> m_hitQCores
ATLAS_THREAD_SAFE
;
//only accessed in mutex-protected function
74
mutable
std::vector<unsigned> m_lastQRow
ATLAS_THREAD_SAFE
;
//only accessed in mutex-protected function
75
76
//Globals - could be replace with compile-time conditioning instead of run-time if performance is critical
77
bool
m_enableChipID
{},
m_plainHitMap
{},
m_dropToT
{};
78
size_t
m_bitsPerWord
;
79
uint8_t
m_chipID
= 0b00;
80
81
// Input
82
mutable
HitMap
m_hitMap
ATLAS_THREAD_SAFE
;
//only accessed in mutex-protected function
83
84
mutable
std::mutex
m_mutex
;
85
86
87
};
88
89
90
#endif
length
double length(const pvec &v)
Definition
FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
ITkPixLayout.h
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
ITkPixEncoder::pushWords32
void pushWords32() const
Definition
ITkPixEncoder.cxx:75
ITkPixEncoder::m_dropToT
bool m_dropToT
Definition
ITkPixEncoder.h:77
ITkPixEncoder::m_nCol
unsigned m_nCol
Definition
ITkPixEncoder.h:62
ITkPixEncoder::m_bitsPerWord
size_t m_bitsPerWord
Definition
ITkPixEncoder.h:78
ITkPixEncoder::encodeQCore
void encodeQCore(const unsigned nCCol, const unsigned nQRow) const
Definition
ITkPixEncoder.cxx:92
ITkPixEncoder::m_nRowInQRow
unsigned m_nRowInQRow
Definition
ITkPixEncoder.h:62
ITkPixEncoder::setEventsPerStream
void setEventsPerStream(const unsigned nEventsPerStream=16)
Definition
ITkPixEncoder.h:38
ITkPixEncoder::m_chipID
uint8_t m_chipID
Definition
ITkPixEncoder.h:79
ITkPixEncoder::ATLAS_THREAD_SAFE
std::vector< uint32_t > m_words ATLAS_THREAD_SAFE
Definition
ITkPixEncoder.h:65
ITkPixEncoder::m_plainHitMap
bool m_plainHitMap
Definition
ITkPixEncoder.h:77
ITkPixEncoder::scanHitMap
void scanHitMap() const
Definition
ITkPixEncoder.cxx:147
ITkPixEncoder::encodeEvent
void encodeEvent() const
Definition
ITkPixEncoder.cxx:170
ITkPixEncoder::hitInQCore
bool hitInQCore(const unsigned CCol, const unsigned QRow) const
Definition
ITkPixEncoder.cxx:132
ITkPixEncoder::m_nQRow
unsigned m_nQRow
Definition
ITkPixEncoder.h:62
ITkPixEncoder::m_nCCol
unsigned m_nCCol
Definition
ITkPixEncoder.h:62
ITkPixEncoder::addBits64
void addBits64(const uint64_t value, const uint8_t length) const
Definition
ITkPixEncoder.cxx:29
ITkPixEncoder::m_mutex
std::mutex m_mutex
Definition
ITkPixEncoder.h:84
ITkPixEncoder::m_nColInCCol
unsigned m_nColInCCol
Definition
ITkPixEncoder.h:62
ITkPixEncoder::streamTag
void streamTag(const uint8_t nStream) const
Definition
ITkPixEncoder.cxx:209
ITkPixEncoder::m_nEventsPerStream
unsigned m_nEventsPerStream
Definition
ITkPixEncoder.h:66
ITkPixEncoder::HitMap
ITkPixLayout< uint16_t > HitMap
Definition
ITkPixEncoder.h:25
ITkPixEncoder::setChipID
void setChipID(const uint8_t &chipID)
Definition
ITkPixEncoder.cxx:227
ITkPixEncoder::clear
void clear() const
Definition
ITkPixEncoder.cxx:231
ITkPixEncoder::m_nRow
unsigned m_nRow
Definition
ITkPixEncoder.h:62
ITkPixEncoder::ITkPixEncoder
ITkPixEncoder(const bool enableChipID=true, const unsigned nCol=400, const unsigned nRow=384, const unsigned nColInCCol=8, const unsigned nRowInQRow=2, const unsigned nEventsPerStream=16, const bool plainHitMap=false, const bool dropToT=false)
Definition
ITkPixEncoder.cxx:20
ITkPixEncoder::getWords
std::vector< uint32_t > & getWords()
Definition
ITkPixEncoder.h:32
ITkPixEncoder::m_enableChipID
bool m_enableChipID
Definition
ITkPixEncoder.h:77
ITkPixEncoder::setHitMap
void setHitMap(const HitMap &hitMap) const
Definition
ITkPixEncoder.h:36
ITkPixEncoder::intTag
void intTag(const uint16_t nEvt) const
Definition
ITkPixEncoder.cxx:217
ITkPixLayout
Definition
ITkPixLayout.h:18
Generated on
for ATLAS Offline Software by
1.17.0