Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DataFormats/SiStripCluster/interface/SiStripCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class SiStripCluster {
initQB();
}

SiStripCluster(uint16_t firstStrip, std::vector<uint8_t>&& data, float barycenter, float charge)
: amplitudes_(std::move(data)), firstStrip_(firstStrip), barycenter_(barycenter), charge_(charge) {}

template <typename Iter>
SiStripCluster(const uint16_t& firstStrip, Iter begin, Iter end) : amplitudes_(begin, end), firstStrip_(firstStrip) {
initQB();
Expand Down
8 changes: 8 additions & 0 deletions DataFormats/SiStripClusterSoA/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<use name="DataFormats/Common"/>
<use name="DataFormats/Portable"/>
<use name="DataFormats/SoATemplate"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags ALPAKA_BACKENDS="!serial"/>
<export>
<lib name="1"/>
</export>
26 changes: 26 additions & 0 deletions DataFormats/SiStripClusterSoA/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SiStripClusterSoA
The `SiStripClusterHost`/`SiStripClusterDevice` is a portable collection based on the `SiStripClusterSoALayout` (`DataFormats/SiStripClusterSoA/interface/SiStripClusterSoA.h`).

It is used to store the collection of SiStrip cluster candidates from the heterogeneous SiStripClusterizer module (`RecoLocalTracker/SiStripClusterizer`).

## Data members
The fields in the structure have the following meaning:

| SoA type | C-type | Name | Description |
| --- | --- | --- | --- |
| column | uint32_t | clusterIndex | Index for the first strip amplitude in this cluster candidate, to be fetched by the Digi collection |
| column | uint16_t | clusterSize | Cluster cand. strip count |
| column | uint32_t | clusterDetId | Cluster cand. detector ID |
| column | uint16_t | firstStrip | First strip ID of the cluster cand. |
| column | bool | candidateAccepted | Is the cluster candidate a good one? [^ThreeThresholdAlgorithm.cc#L103-L107] |
| column | float | barycenter | Cluster cand. barycenter [^SiStripCluster.h#L164] |
| column | float | charge | Cluster cand. charge [^SiStripCluster.h#L152-L159] |
| column | uint32_t | candidateAcceptedPrefix | Prefix sum of the candidateAccepted colum, used to index the good clusters |
| scalar | uint32_t | nClusterCandidates | Number of cluster candidates in the collection [^noteCand] |
| scalar | uint32_t | maxClusterSize | Max number of contiguous strips for clustering (setup) |

<!-- -->
[^ThreeThresholdAlgorithm.cc#L103-L107]: [RecoLocalTracker/SiStripClusterizer/src/ThreeThresholdAlgorithm.cc](https://github.com/cms-sw/cmssw/blob/CMSSW_16_0_X/RecoLocalTracker/SiStripClusterizer/src/ThreeThresholdAlgorithm.cc#L103-L107)
[^SiStripCluster.h#L164]: [DataFormats/SiStripCluster/interface/SiStripCluster.h#L164](https://github.com/cms-sw/cmssw/blob/CMSSW_16_0_X/DataFormats/SiStripCluster/interface/SiStripCluster.h#L164)
[^SiStripCluster.h#L152-L159]: [DataFormats/SiStripCluster/interface/SiStripCluster.h#L152-L159](https://github.com/cms-sw/cmssw/blob/CMSSW_16_0_X/DataFormats/SiStripCluster/interface/SiStripCluster.h#L152-L159)
[^noteCand]: this is typically lower than the collection pre-allocated size (i.e., from `collection->metadata().size()`). It indicates the number of non-contiguous strip seeds over which the clustering is perfomed. It can be used while loop over the collection to break earlier than the collection size.
12 changes: 12 additions & 0 deletions DataFormats/SiStripClusterSoA/interface/SiStripClusterHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef DataFormats_SiStripClusterSoA_interface_SiStripClusterHost_h
#define DataFormats_SiStripClusterSoA_interface_SiStripClusterHost_h

#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterSoA.h"

namespace sistrip {
// SoA with SiStripCluster fields in host memory
using SiStripClusterHost = PortableHostCollection<SiStripClusterSoA>;
} // namespace sistrip

#endif // DataFormats_SiStripClusterSoA_interface_SiStripClusterHost_h
26 changes: 26 additions & 0 deletions DataFormats/SiStripClusterSoA/interface/SiStripClusterSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

#ifndef DataFormats_SiStripClusterSoA_interface_SiStripClusterSoA_h
#define DataFormats_SiStripClusterSoA_interface_SiStripClusterSoA_h

#include "DataFormats/SoATemplate/interface/SoALayout.h"

namespace sistrip {

GENERATE_SOA_LAYOUT(SiStripClusterSoALayout,
SOA_COLUMN(uint32_t, clusterIndex),
SOA_COLUMN(uint16_t, clusterSize),
SOA_COLUMN(uint32_t, clusterDetId),
SOA_COLUMN(uint16_t, firstStrip),
SOA_COLUMN(bool, candidateAccepted),
SOA_COLUMN(float, barycenter),
SOA_COLUMN(float, charge),
SOA_COLUMN(uint32_t, candidateAcceptedPrefix),
SOA_SCALAR(uint32_t, nClusterCandidates),
SOA_SCALAR(uint32_t, maxClusterSize))

using SiStripClusterSoA = SiStripClusterSoALayout<>;
using SiStripClusterView = SiStripClusterSoA::View;
using SiStripClusterConstView = SiStripClusterSoA::ConstView;
} // namespace sistrip

#endif // DataFormats_SiStripClusterSoA_interface_SiStripClustersSoA_h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef DataFormats_SiStripClusterSoA_interface_alpaka_SiStripClustersDevice_h
#define DataFormats_SiStripClusterSoA_interface_alpaka_SiStripClustersDevice_h

#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterHost.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterSoA.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE::sistrip {
// make the names from the top-level sistrip namespace visible for unqualified lookup
// inside the ALPAKA_ACCELERATOR_NAMESPACE::sistrip namespace
using namespace ::sistrip;
using SiStripClusterDevice = PortableCollection<SiStripClusterSoA>;
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::sistrip

// check that the sistrip device collection for the host device is the same as the sistrip host collection
ASSERT_DEVICE_MATCHES_HOST_COLLECTION(sistrip::SiStripClusterDevice, sistrip::SiStripClusterHost);

#endif // DataFormats_SiStripClusterSoA_interface_alpaka_SiStripClustersDevice_h
9 changes: 9 additions & 0 deletions DataFormats/SiStripClusterSoA/src/alpaka/classes_cuda.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef DataFormats_SiStripClusterSoA_src_alpaka_classes_cuda_h
#define DataFormats_SiStripClusterSoA_src_alpaka_classes_cuda_h

#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterSoA.h"
#include "DataFormats/SiStripClusterSoA/interface/alpaka/SiStripClusterDevice.h"

#endif
5 changes: 5 additions & 0 deletions DataFormats/SiStripClusterSoA/src/alpaka/classes_cuda_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<lcgdict>
<class name="alpaka_cuda_async::sistrip::SiStripClusterDevice" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_cuda_async::sistrip::SiStripClusterDevice>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::sistrip::SiStripClusterDevice>>" persistent="false"/>
</lcgdict>
9 changes: 9 additions & 0 deletions DataFormats/SiStripClusterSoA/src/alpaka/classes_rocm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef DataFormats_SiStripClusterSoA_src_alpaka_classes_rocm_h
#define DataFormats_SiStripClusterSoA_src_alpaka_classes_rocm_h

#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterSoA.h"
#include "DataFormats/SiStripClusterSoA/interface/alpaka/SiStripClusterDevice.h"

#endif
5 changes: 5 additions & 0 deletions DataFormats/SiStripClusterSoA/src/alpaka/classes_rocm_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<lcgdict>
<class name="alpaka_rocm_async::sistrip::SiStripClusterDevice" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_rocm_async::sistrip::SiStripClusterDevice>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::sistrip::SiStripClusterDevice>>" persistent="false"/>
</lcgdict>
4 changes: 4 additions & 0 deletions DataFormats/SiStripClusterSoA/src/classes.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "DataFormats/Portable/interface/PortableHostCollectionReadRules.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterHost.h"

SET_PORTABLEHOSTCOLLECTION_READ_RULES(sistrip::SiStripClusterHost);
7 changes: 7 additions & 0 deletions DataFormats/SiStripClusterSoA/src/classes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef DataFormats_SiStripClusterSoA_src_classes_h
#define DataFormats_SiStripClusterSoA_src_classes_h

#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/SiStripClusterSoA/interface/SiStripClusterHost.h"

#endif // DataFormats_SiStripClusterSoA_src_classes_h
7 changes: 7 additions & 0 deletions DataFormats/SiStripClusterSoA/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<lcgdict>
<!-- ::Layout alias must be listed before the aliased-to type -->
<class name="sistrip::SiStripClusterHost::Layout"/>
<class name="sistrip::SiStripClusterSoALayout<128,false>"/>
<class name="sistrip::SiStripClusterHost"/>
<class name="edm::Wrapper<sistrip::SiStripClusterHost>" splitLevel="0"/>
</lcgdict>
8 changes: 8 additions & 0 deletions DataFormats/SiStripDigiSoA/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<use name="DataFormats/Common"/>
<use name="DataFormats/Portable"/>
<use name="DataFormats/SoATemplate"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags ALPAKA_BACKENDS="!serial"/>
<export>
<lib name="1"/>
</export>
12 changes: 12 additions & 0 deletions DataFormats/SiStripDigiSoA/interface/SiStripDigiHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef DataFormats_SiStripDigiSoA_interface_SiStripDigiHost_h
#define DataFormats_SiStripDigiSoA_interface_SiStripDigiHost_h

#include "DataFormats/Portable/interface/PortableHostCollection.h"
#include "DataFormats/SiStripDigiSoA/interface/SiStripDigiSoA.h"

namespace sistrip {
// SoA with SiStripClusters fields in host memory
using SiStripDigiHost = PortableHostCollection<SiStripDigiSoA>;
} // namespace sistrip

#endif
20 changes: 20 additions & 0 deletions DataFormats/SiStripDigiSoA/interface/SiStripDigiSoA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

#ifndef DataFormats_SiStripDigiSoA_interface_SiStripDigiSoA_h
#define DataFormats_SiStripDigiSoA_interface_SiStripDigiSoA_h

#include "DataFormats/SoATemplate/interface/SoALayout.h"

namespace sistrip {
GENERATE_SOA_LAYOUT(SiStripDigiSoALayout,
SOA_COLUMN(uint8_t, adc),
SOA_COLUMN(uint16_t, channel),
SOA_COLUMN(uint16_t, stripId),
SOA_SCALAR(uint32_t, nbGoodCandidates),
SOA_SCALAR(uint32_t, nbCandidates))

using SiStripDigiSoA = SiStripDigiSoALayout<>;
using SiStripDigiView = SiStripDigiSoA::View;
using SiStripDigiConstView = SiStripDigiSoA::ConstView;
} // namespace sistrip

#endif
18 changes: 18 additions & 0 deletions DataFormats/SiStripDigiSoA/interface/alpaka/SiStripDigiDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef DataFormats_SiStripDigiSoA_interface_alpaka_SiStripDigiDevice_h
#define DataFormats_SiStripDigiSoA_interface_alpaka_SiStripDigiDevice_h

#include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
#include "DataFormats/SiStripDigiSoA/interface/SiStripDigiHost.h"
#include "DataFormats/SiStripDigiSoA/interface/SiStripDigiSoA.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE::sistrip {
// make the names from the top-level sistrip namespace visible for unqualified lookup
// inside the ALPAKA_ACCELERATOR_NAMESPACE::sistrip namespace
using namespace ::sistrip;
using SiStripDigiDevice = PortableCollection<SiStripDigiSoA>;
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::sistrip

ASSERT_DEVICE_MATCHES_HOST_COLLECTION(sistrip::SiStripDigiDevice, sistrip::SiStripDigiHost);

#endif
8 changes: 8 additions & 0 deletions DataFormats/SiStripDigiSoA/src/alpaka/classes_cuda.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef DataFormats_SiStripDigiSoA_src_alpaka_classes_cuda_h
#define DataFormats_SiStripDigiSoA_src_alpaka_classes_cuda_h

#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/SiStripDigiSoA/interface/alpaka/SiStripDigiDevice.h"

#endif
5 changes: 5 additions & 0 deletions DataFormats/SiStripDigiSoA/src/alpaka/classes_cuda_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<lcgdict>
<class name="alpaka_cuda_async::sistrip::SiStripDigiDevice" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_cuda_async::sistrip::SiStripDigiDevice>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::sistrip::SiStripDigiDevice>>" persistent="false"/>
</lcgdict>
8 changes: 8 additions & 0 deletions DataFormats/SiStripDigiSoA/src/alpaka/classes_rocm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef DataFormats_SiStripDigiSoA_src_alpaka_classes_rocm_h
#define DataFormats_SiStripDigiSoA_src_alpaka_classes_rocm_h

#include "DataFormats/Common/interface/DeviceProduct.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/SiStripDigiSoA/interface/alpaka/SiStripDigiDevice.h"

#endif
5 changes: 5 additions & 0 deletions DataFormats/SiStripDigiSoA/src/alpaka/classes_rocm_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<lcgdict>
<class name="alpaka_rocm_async::sistrip::SiStripDigiDevice" persistent="false"/>
<class name="edm::DeviceProduct<alpaka_rocm_async::sistrip::SiStripDigiDevice>" persistent="false"/>
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::sistrip::SiStripDigiDevice>>" persistent="false"/>
</lcgdict>
4 changes: 4 additions & 0 deletions DataFormats/SiStripDigiSoA/src/classes.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "DataFormats/Portable/interface/PortableHostCollectionReadRules.h"
#include "DataFormats/SiStripDigiSoA/interface/SiStripDigiHost.h"

SET_PORTABLEHOSTCOLLECTION_READ_RULES(sistrip::SiStripDigiHost);
8 changes: 8 additions & 0 deletions DataFormats/SiStripDigiSoA/src/classes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef DataFormats_SiStripDigiSoA_src_classes_h
#define DataFormats_SiStripDigiSoA_src_classes_h

#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/SiStripDigiSoA/interface/SiStripDigiSoA.h"
#include "DataFormats/SiStripDigiSoA/interface/SiStripDigiHost.h"

#endif
7 changes: 7 additions & 0 deletions DataFormats/SiStripDigiSoA/src/classes_def.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<lcgdict>
<!-- ::Layout alias must be listed before the aliased-to type -->
<class name="sistrip::SiStripDigiHost::Layout"/>
<class name="sistrip::SiStripDigiSoALayout<128,false>"/>
<class name="sistrip::SiStripDigiHost"/>
<class name="edm::Wrapper<sistrip::SiStripDigiHost>" splitLevel="0"/>
</lcgdict>
6 changes: 3 additions & 3 deletions EventFilter/SiStripRawToDigi/interface/SiStripFEDBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,18 @@ namespace sistrip {
namespace detail {

template <uint8_t num_words>
uint16_t getADC_W(const uint8_t* data, uint_fast16_t offset, uint8_t bits_shift) {
constexpr uint16_t getADC_W(const uint8_t* data, uint_fast16_t offset, uint8_t bits_shift) {
// get ADC from one or two bytes (at most 10 bits), and shift if needed
return (data[offset ^ 7] + (num_words == 2 ? ((data[(offset + 1) ^ 7] & 0x03) << 8) : 0)) << bits_shift;
}

template <uint16_t mask>
uint16_t getADC_B2(const uint8_t* data, uint_fast16_t wOffset, uint_fast8_t bOffset) {
constexpr uint16_t getADC_B2(const uint8_t* data, uint_fast16_t wOffset, uint_fast8_t bOffset) {
// get ADC from two bytes, from wOffset until bOffset bits from the next byte (maximum decided by mask)
return (((data[wOffset ^ 7]) << bOffset) + (data[(wOffset + 1) ^ 7] >> (BITS_PER_BYTE - bOffset))) & mask;
}
template <uint16_t mask>
uint16_t getADC_B1(const uint8_t* data, uint_fast16_t wOffset, uint_fast8_t bOffset) {
constexpr uint16_t getADC_B1(const uint8_t* data, uint_fast16_t wOffset, uint_fast8_t bOffset) {
// get ADC from one byte, until bOffset into the byte at wOffset (maximum decided by mask)
return (data[wOffset ^ 7] >> (BITS_PER_BYTE - bOffset)) & mask;
}
Expand Down
52 changes: 38 additions & 14 deletions EventFilter/SiStripRawToDigi/interface/SiStripFEDBufferComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,28 +615,32 @@ namespace sistrip {
//holds information about position of a channel in the buffer for use by unpacker
class FEDChannel {
public:
FEDChannel(const uint8_t* const data, const uint32_t offset, const uint16_t length);
enum class ZSROMode { nonLite = 7, lite = 2 };
constexpr FEDChannel(const uint8_t* const data, const uint32_t offset, const uint16_t length);
constexpr FEDChannel(const uint8_t* const data, const uint32_t offset, const ZSROMode zsRoMode);
//gets length from first 2 bytes (assuming normal FED channel)
FEDChannel(const uint8_t* const data, const uint32_t offset);
uint16_t length() const;
const uint8_t* data() const;
uint32_t offset() const;
constexpr FEDChannel(const uint8_t* const data, const uint32_t offset);
constexpr uint16_t stripsInCh(uint8_t num_bits) const;
constexpr uint16_t length() const;
constexpr const uint8_t* data() const;
constexpr uint32_t offset() const;
/**
* Retrieve the APV CM median for a non-lite zero-suppressed channel
*
* apvIndex should be either 0 or 1 (there are, by construction, two APVs on every channel)
* No additional checks are done here, so the caller should check
* the readout mode and/or packet code.
*/
uint16_t cmMedian(const uint8_t apvIndex) const;
constexpr uint16_t cmMedian(const uint8_t apvIndex) const;
//third byte of channel data for normal FED channels
uint8_t packetCode() const;
constexpr uint8_t packetCode() const;

private:
friend class FEDBuffer;
const uint8_t* data_;
uint32_t offset_;
uint16_t length_;
uint8_t headerLen_ = 0;
};

//base class for sistrip FED buffers which have a DAQ header/trailer and tracker special header
Expand Down Expand Up @@ -1557,28 +1561,48 @@ namespace sistrip {

//FEDChannel

inline FEDChannel::FEDChannel(const uint8_t* const data, const uint32_t offset) : data_(data), offset_(offset) {
constexpr FEDChannel::FEDChannel(const uint8_t* const data, const uint32_t offset, const ZSROMode zsRoMode)
: data_(data), offset_(offset), headerLen_(zsRoMode == ZSROMode::nonLite ? 7 : 2) {
length_ = (data_[(offset_) ^ 7] + (data_[(offset_ + 1) ^ 7] << 8));
}

constexpr FEDChannel::FEDChannel(const uint8_t* const data, const uint32_t offset) : data_(data), offset_(offset) {
length_ = (data_[(offset_) ^ 7] + (data_[(offset_ + 1) ^ 7] << 8));
}

inline FEDChannel::FEDChannel(const uint8_t* const data, const uint32_t offset, const uint16_t length)
constexpr FEDChannel::FEDChannel(const uint8_t* const data, const uint32_t offset, const uint16_t length)
: data_(data), offset_(offset), length_(length) {}

inline uint16_t FEDChannel::length() const { return length_; }
constexpr uint16_t FEDChannel::stripsInCh(uint8_t num_bits) const {
const bool emptyCh = (headerLen_ + 2) >= (length_);
const uint16_t start = offset_ + headerLen_;
const uint16_t end = offset_ + length_;
uint16_t stripN = 0;
if (!emptyCh) {
for (uint16_t nStrip_wOfs = start + 1; nStrip_wOfs < end;) {
const uint8_t clustStripN = data_[(nStrip_wOfs) ^ 7];
nStrip_wOfs += ((uint32_t)clustStripN) * num_bits / 8 + 2;
stripN += clustStripN;
}
}
return stripN;
}

constexpr uint16_t FEDChannel::length() const { return length_; }

inline uint8_t FEDChannel::packetCode() const { return data_[(offset_ + 2) ^ 7]; }
constexpr uint8_t FEDChannel::packetCode() const { return data_[(offset_ + 2) ^ 7]; }

inline uint16_t FEDChannel::cmMedian(const uint8_t apvIndex) const {
constexpr uint16_t FEDChannel::cmMedian(const uint8_t apvIndex) const {
uint16_t result = 0;
//CM median is 10 bits with lowest order byte first. First APV CM median starts in 4th byte of channel data
result |= data_[(offset_ + 3 + 2 * apvIndex) ^ 7];
result |= (((data_[(offset_ + 4 + 2 * apvIndex) ^ 7]) << 8) & 0x300);
return result;
}

inline const uint8_t* FEDChannel::data() const { return data_; }
constexpr const uint8_t* FEDChannel::data() const { return data_; }

inline uint32_t FEDChannel::offset() const { return offset_; }
constexpr uint32_t FEDChannel::offset() const { return offset_; }
} // namespace sistrip

#endif //ndef EventFilter_SiStripRawToDigi_FEDBufferComponents_H
Loading