Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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"
19 #include <vector>
20 #include <cstdint>
21 #include <mutex>
22 
24  public:
26 
27  ITkPixEncoder(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 clear() const;
41 
42  protected:
43 
44  void pushWords32() const;
45 
46  void encodeQCore(const unsigned nCCol, const unsigned nQRow) const;
47 
48  void encodeEvent() const;
49 
50  void streamTag(const uint8_t nStream) const;
51 
52  void intTag(const uint16_t nEvt) const;
53 
54  void scanHitMap() const;
55 
56  bool hitInQCore(const unsigned CCol, const unsigned QRow) const;
57 
58  //Access to all mutables is always mutex-protected
59  // Chip geometry
60  unsigned m_nCol{400}, m_nRow{384}, m_nCCol{50}, m_nQRow{192}, m_nColInCCol{8}, m_nRowInQRow{2};
61 
62  // Output
63  mutable std::vector<uint32_t> m_words ATLAS_THREAD_SAFE; //only accessed in mutex-protected function
65  mutable unsigned m_currCCol ATLAS_THREAD_SAFE {}, m_currQRow ATLAS_THREAD_SAFE {}, m_currEvent ATLAS_THREAD_SAFE {};//
66  mutable uint8_t m_currStream ATLAS_THREAD_SAFE {};
67 
68  // Encoding machinery
69  mutable uint64_t m_currBlock ATLAS_THREAD_SAFE {};
70  mutable uint8_t m_currBit ATLAS_THREAD_SAFE {};
71  mutable std::vector<std::vector<bool>> m_hitQCores ATLAS_THREAD_SAFE; //only accessed in mutex-protected function
72  mutable std::vector<unsigned> m_lastQRow ATLAS_THREAD_SAFE; //only accessed in mutex-protected function
73 
74  //Globals - could be replace with compile-time conditioning instead of run-time if performance is critical
76 
77  // Input
78  mutable HitMap m_hitMap ATLAS_THREAD_SAFE; //only accessed in mutex-protected function
79 
81 
82 
83 };
84 
85 
86 #endif
ITkPixEncoder::m_nRow
unsigned m_nRow
Definition: ITkPixEncoder.h:60
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
ITkPixEncoder::m_nCol
unsigned m_nCol
Definition: ITkPixEncoder.h:60
ITkPixLayout.h
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
ITkPixEncoder::getWords
std::vector< uint32_t > & getWords()
Definition: ITkPixEncoder.h:32
ITkPixEncoder::intTag
void intTag(const uint16_t nEvt) const
Definition: ITkPixEncoder.cxx:214
ITkPixEncoder::hitInQCore
bool hitInQCore(const unsigned CCol, const unsigned QRow) const
Definition: ITkPixEncoder.cxx:128
ITkPixEncoder::HitMap
ITkPixLayout< uint16_t > HitMap
Definition: ITkPixEncoder.h:25
athena.value
value
Definition: athena.py:124
ITkPixEncoder::clear
void clear() const
Definition: ITkPixEncoder.cxx:224
ITkPixEncoder::ATLAS_THREAD_SAFE
std::vector< std::vector< bool > > m_hitQCores ATLAS_THREAD_SAFE
Definition: ITkPixEncoder.h:71
ITkPixEncoder::m_dropToT
bool m_dropToT
Definition: ITkPixEncoder.h:75
ITkPixEncoder::m_nRowInQRow
unsigned m_nRowInQRow
Definition: ITkPixEncoder.h:60
ITkPixEncoder::setHitMap
void setHitMap(const HitMap &hitMap) const
Definition: ITkPixEncoder.h:36
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
ITkPixEncoder::m_nEventsPerStream
unsigned m_nEventsPerStream
Definition: ITkPixEncoder.h:64
ITkPixEncoder::m_nColInCCol
unsigned m_nColInCCol
Definition: ITkPixEncoder.h:60
ITkPixEncoder::pushWords32
void pushWords32() const
Definition: ITkPixEncoder.cxx:73
ITkPixEncoder::ATLAS_THREAD_SAFE
std::vector< uint32_t > m_words ATLAS_THREAD_SAFE
Definition: ITkPixEncoder.h:63
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ITkPixEncoder::m_plainHitMap
bool m_plainHitMap
Definition: ITkPixEncoder.h:75
ITkPixEncoder::encodeEvent
void encodeEvent() const
Definition: ITkPixEncoder.cxx:166
ITkPixEncoder::ITkPixEncoder
ITkPixEncoder(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:19
ITkPixEncoder::ATLAS_THREAD_SAFE
std::vector< unsigned > m_lastQRow ATLAS_THREAD_SAFE
Definition: ITkPixEncoder.h:72
ITkPixEncoder::m_nCCol
unsigned m_nCCol
Definition: ITkPixEncoder.h:60
ITkPixEncoder::m_mutex
std::mutex m_mutex
Definition: ITkPixEncoder.h:80
ITkPixEncoder::ATLAS_THREAD_SAFE
HitMap m_hitMap ATLAS_THREAD_SAFE
Definition: ITkPixEncoder.h:78
ITkPixEncoder
Definition: ITkPixEncoder.h:23
ITkPixEncoder::encodeQCore
void encodeQCore(const unsigned nCCol, const unsigned nQRow) const
Definition: ITkPixEncoder.cxx:88
ITkPixLayout
Definition: ITkPixLayout.h:18
ITkPixEncoder::addBits64
void addBits64(const uint64_t value, const uint8_t length) const
Definition: ITkPixEncoder.cxx:27
ITkPixEncoder::setEventsPerStream
void setEventsPerStream(const unsigned nEventsPerStream=16)
Definition: ITkPixEncoder.h:38
ITkPixEncoder::streamTag
void streamTag(const uint8_t nStream) const
Definition: ITkPixEncoder.cxx:206
ITkPixEncoder::m_nQRow
unsigned m_nQRow
Definition: ITkPixEncoder.h:60
checker_macros.h
Define macros for attributes used to control the static checker.
ITkPixEncoder::scanHitMap
void scanHitMap() const
Definition: ITkPixEncoder.cxx:143
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26