ATLAS Offline Software
Loading...
Searching...
No Matches
PhaseIIStripRawDataContainer.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
4#ifndef PHASEII_STRIPRAWDATACONTAINER_H
5#define PHASEII_STRIPRAWDATACONTAINER_H
6
10
11#include <cassert>
12#include <cstdint>
13
14namespace PhaseII {
15
19 protected:
20 // helper constants to unpack the bit packed information from the data word.
21 // To extract the data the bits are shifted first and then the mask is applied
22 static constexpr std::uint32_t MASK_GROUPSIZE = 0x7FF;
23 static constexpr unsigned int SHIFT_GROUPSIZE = 0;
24 static constexpr std::uint32_t MASK_TIMEBIN = 0x7;
25 static constexpr unsigned int SHIFT_TIMEBIN = 22;
26 static constexpr std::uint32_t MASK_ERRORS = 0x7;
27 static constexpr unsigned int SHIFT_ERRORS = 25;
28 // alternative interpretation for the upper most bits
29 static constexpr std::uint32_t MASK_ONTIME = 0x1;
30 static constexpr unsigned int SHIFT_ONTIME = 23;
31 static constexpr std::uint32_t MASK_FIRSTHITERROR = 0x1;
32 static constexpr unsigned int SHIFT_FIRSTHITERROR = 29;
33 static constexpr std::uint32_t MASK_SECONDHITERROR = 0x1;
34 static constexpr unsigned int SHIFT_SECONDHITERROR = 30;
35 public:
37 static int getGroupSize(std::uint32_t dataWord) { return unpack(MASK_GROUPSIZE, SHIFT_GROUPSIZE, dataWord); }
39 static int getTimeBin(std::uint32_t dataWord) { return unpack(MASK_TIMEBIN, SHIFT_TIMEBIN, dataWord); }
41 static int getErrors(std::uint32_t dataWord) { return unpack(MASK_ERRORS, SHIFT_ERRORS, dataWord); }
42 // alternatives
43 // @TODO not full clear when the alternative interpretation of the upper-bits is to be used and when not.
44 static bool OnTime(std::uint32_t dataWord) { return unpack(MASK_ONTIME, SHIFT_ONTIME, dataWord); };
47
49 static std::uint32_t makeWord(unsigned int group_size, unsigned int time_bin, unsigned int errors ) {
50 return pack(MASK_GROUPSIZE, SHIFT_GROUPSIZE, group_size)
51 | pack(MASK_TIMEBIN, SHIFT_TIMEBIN, time_bin)
52 | pack(MASK_ERRORS, SHIFT_ERRORS, errors);
53 }
54
56 // @TODO for which data periods was/is SCT1/SCT3 being used?
57 enum ERawDataType { SCT1 = 1, SCT3 =3, UNKNOWN=0};
59 ERawDataType dataType() const { return m_dataType; }
62 protected:
64 };
65
67 template <AccessPolicy accessPolicy=AccessPolicy::ReadOnly>
68 class StripRawDataProxy : public RawDataProxyBase<PhaseII::StripRawDataContainer, accessPolicy >
69 {
70 public:
72 using BASE::BASE;
73
78 // alterntives
79 bool OnTime() const {return StripRawDataContainer::OnTime(this->dataWord());}
82 StripRawDataContainer::ERawDataType dataType() const {return this->container().dataType(); }
83
84 };
85
86 // provide means to RawDataCollectionProxies to discover the RDO proxy type to be used for a certain i.e. strip RDO container.
87 namespace RawData {
88 namespace details {
89 template <>
91 template <AccessPolicy accessPolicy>
93 };
94 }
95 }
96
97 // Define all the proxies for read only access of the strip raw data
98 template <AccessPolicy accessPolicy=AccessPolicy::ReadOnly>
100}
101
102// Pool converter do not like namespaces
104
106#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
declare to which family the container belongs as far as its indexing policy is concerned
PhaseII::StripRawDataContainerCollectionTypes<>::ContainerCollection PhaseIIStripRawDataContainer
Base raw data container which provides coordinates of a certain dimension and a data word per RDO (ra...
static constexpr int unpack(std::uint32_t mask, unsigned int shift, unsigned int word)
static constexpr std::uint32_t pack(std::uint32_t mask, unsigned int shift, int input)
const std::uint32_t & dataWord(unsigned int index) const
typename ContainerProxyBase< PhaseII::StripRawDataContainer, unsigned int, accessPolicy >::template ElementProxyBase< accessPolicy > BASE
The container for strip RDOs The base class is the InDetRawDataContainer with a coordinate dimension ...
static constexpr std::uint32_t MASK_TIMEBIN
static constexpr unsigned int SHIFT_FIRSTHITERROR
static constexpr std::uint32_t MASK_FIRSTHITERROR
static constexpr std::uint32_t MASK_ONTIME
static constexpr std::uint32_t MASK_ERRORS
static int getGroupSize(std::uint32_t dataWord)
Extract the number of consecutive strip hits starting from the coordinates of the corresponding RDO f...
static std::uint32_t makeWord(unsigned int group_size, unsigned int time_bin, unsigned int errors)
Create a bit-packed data word.
static int getErrors(std::uint32_t dataWord)
Extract error information from the data word.
ERawDataType
The data format of the RAW data.
static constexpr unsigned int SHIFT_ERRORS
void setDataType(ERawDataType type)
Set the RAW data type of this container.
static constexpr std::uint32_t MASK_GROUPSIZE
static bool FirstHitError(std::uint32_t dataWord)
static constexpr unsigned int SHIFT_SECONDHITERROR
static constexpr std::uint32_t MASK_SECONDHITERROR
static constexpr unsigned int SHIFT_GROUPSIZE
static bool SecondHitError(std::uint32_t dataWord)
static int getTimeBin(std::uint32_t dataWord)
Extract the time bin from the data word.
static constexpr unsigned int SHIFT_TIMEBIN
static constexpr unsigned int SHIFT_ONTIME
ERawDataType dataType() const
Return the type of the original RAW data the RDO container is based on.
static bool OnTime(std::uint32_t dataWord)
A proxy for a strip RDO which adds convenience methods to interpret the data word to the base proxy.
StripRawDataContainer::ERawDataType dataType() const
StripRawDataProxy< AccessPolicy::ReadOnly > ReadOnlyProxy
RawDataProxyBase< PhaseII::StripRawDataContainer, accessPolicy > BASE
RawDataCollectionTypes< StripRawDataContainer, accessPolicy > StripRawDataContainerCollectionTypes
helper class to define all the proxies for a RDO container.
PhaseII::IndexedRanges< StripRawDataContainer, std::atomic< PhaseII::DataRange > > ContainerCollection