ATLAS Offline Software
ITkPixV2Encoder.cxx
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6 * Author: Ondra Kovanda, ondrej.kovanda at cern.ch
7 * Date: 02/2024
8 * Description: ITkPix* encoding
9 */
10 
11 #include "ITkPixV2Encoder.h"
12 
14  m_currBlock |= (0x1ULL << 63);
15  pushWords32();
16 }
17 
18 void ITkPixV2Encoder::addToStream(const HitMap& hitMap, bool last){
19  //This is a high-level interface function that can take care of
20  //adding an event into the current stream, this can be called
21  //easily from the outside, and automatically tags/ends streams
22  //and events based on internal vars only
23 
24  //If this is the first event, start a new stream. Otherwise, add an
25  //internal tag
26  if (m_currEvent == 0){
28  m_currStream++;
29  }
30  else {
32  }
33 
34  //Then add the actual encoded event information
35  setHitMap(hitMap);
36  encodeEvent();
37  m_currEvent++;
38 
39  //If this is the last event in the stream or if we explicitly
40  //want to end the stream (i. e. total number of generated events
41  //is not a multiple of nEventsPerStream), end the stream
42  if (m_currEvent == m_nEventsPerStream || last){
43  endStream();
44  m_currEvent = 0;
45  }
46 
47 }
ITkPixV2Encoder::addToStream
void addToStream(const HitMap &hitMap, bool last=false)
Definition: ITkPixV2Encoder.cxx:18
ITkPixEncoder::streamTag
void streamTag(const uint8_t nStream)
Definition: ITkPixEncoder.cxx:188
ITkPixEncoder::m_currStream
uint8_t m_currStream
Definition: ITkPixEncoder.h:57
ITkPixEncoder::m_nEventsPerStream
unsigned m_nEventsPerStream
Definition: ITkPixEncoder.h:56
ITkPixV2Encoder::endStream
void endStream()
Definition: ITkPixV2Encoder.cxx:13
ITkPixEncoder::intTag
void intTag(const uint16_t nEvt)
Definition: ITkPixEncoder.cxx:193
ITkPixEncoder::m_currEvent
unsigned m_currEvent
Definition: ITkPixEncoder.h:56
ITkPixEncoder::setHitMap
void setHitMap(const HitMap &hitMap)
Definition: ITkPixEncoder.h:46
ITkPixEncoder::pushWords32
void pushWords32()
Definition: ITkPixEncoder.cxx:66
ITkPixEncoder::m_currBlock
uint64_t m_currBlock
Definition: ITkPixEncoder.h:60
ITkPixV2Encoder.h
ITkPixLayout< uint16_t >
ITkPixEncoder::encodeEvent
void encodeEvent()
Definition: ITkPixEncoder.cxx:151