5#ifndef CBM_ALGO_STS_HITFINDER_H
6#define CBM_ALGO_STS_HITFINDER_H
17#include <xpu/device.h>
64 using sort_t = xpu::block_sort<u64, CbmStsDigi, kSortDigisBlockSize, kSortDigisItemsPerThread>;
67 using context = xpu::kernel_context<shared_memory, constants>;
72 using block_size = xpu::block_size<kFindClusterBlockSize>;
74 using context = xpu::kernel_context<shared_memory, constants>;
79 using block_size = xpu::block_size<kFindClusterBlockSize>;
81 using context = xpu::kernel_context<shared_memory, constants>;
86 using block_size = xpu::block_size<kFindClusterBlockSize>;
88 using context = xpu::kernel_context<shared_memory, constants>;
93 using block_size = xpu::block_size<kFindClusterBlockSize>;
95 using context = xpu::kernel_context<shared_memory, constants>;
101 using sort_t = xpu::block_sort<u32, ClusterIdx, kSortClustersBlockSize, kSortClustersItemsPerThread>;
104 using context = xpu::kernel_context<shared_memory, constants>;
111 using context = xpu::kernel_context<shared_memory, constants>;
112 using openmp = xpu::openmp_settings<xpu::schedule_static, 1>;
162 XPU_D
unsigned int UnpackNext(
unsigned int val)
const {
return val & ~(1u << 31); }
170 unsigned int hasPreviousI = ((
unsigned int) hasPrevious) << 31;
171 unsigned int assumed;
176 }
while (old != assumed);
184 unsigned int assumed;
186 next = xpu::min((1u << 31) - 1,
next);
191 }
while (old != assumed);
314 unsigned int nDigis)
const;
318 unsigned int nDigis)
const;
321 unsigned int const nDigis)
const;
325 int const digiIndex)
const;
327 int const digiIndex)
const;
337 XPU_D
bool IsActive(
int* channelStatus,
int channel)
const
340 if (channel < 0 || channel >=
nChannels) {
343 return channelStatus[channel] > -1;
346 XPU_D
int ChanLeft(
int channel)
const {
return channel - 1; }
348 XPU_D
int ChanRight(
int channel)
const {
return channel + 1; }
365 xpu::atomic_add(&
monitor->nClusterBucketOverflow, 1);
370 tgtIdx[idx.fIdx] = idx;
371 tgtData[idx.fIdx] = cls;
378 XPU_D
void ToGlobal(
int iModule,
float lx,
float ly,
float lz,
float& gx,
float& gy,
float& gz)
const;
384 float& varX,
float& varY,
float& varXY)
const;
386 XPU_D
void CreateHit(
int iBlocks,
float xLocal,
float yLocal,
float varX,
float varY,
float varXY,
388 float du,
float dv)
const;
396 if (old >= errorValue) {
399 }
while (!xpu::atomic_cas_block(maxError, *maxError, xpu::max(errorValue, *maxError)));
This file contains the definition of the PaddedValue class.
Data class for a single-channel message in the STS.
XPU_D unsigned int UnpackNext(unsigned int val) const
XPU_D void SetNext(unsigned int next)
XPU_D void SetHasPrevious(bool hasPrevious)
XPU_D bool HasNext() const
XPU_D bool HasPrevious() const
unsigned int hasPreviousAndNext
XPU_D unsigned int next() const
XPU_D void SaveMaxError(float errorValue, int iModule) const
XPU_D bool IsActive(int *channelStatus, int channel) const
xpu::buffer< PaddedToCacheLine< int > > nHitsPerModule
XPU_D void CreateClusterFromConnectors1(int const iModule, const CbmStsDigi *digis, int const digiIndex) const
xpu::buffer< DigiConnector > digiConnectorsPerModule
XPU_D void AddCluster(int iModule, uint32_t time, const sts::Cluster &cls) const
XPU_D void CalculateChannelOffsets(FindClusters::context &ctx, CbmStsDigi *digis, unsigned int *channelOffsets, unsigned int nDigis) const
xpu::buffer< PaddedToCacheLine< int > > nClustersPerModule
XPU_D void SortClusters(SortClusters::context &) const
XPU_D void CalculateOffsetsParallel(FindClusters::context &) const
size_t hitsAllocatedPerModule
XPU_D int ChanRight(int channel) const
XPU_D int ChanLeft(int channel) const
xpu::buffer< HitfinderMonDevice > monitor
xpu::buffer< float > landauTable
xpu::buffer< unsigned int > channelOffsetPerModule
xpu::buffer< ClusterIdx > clusterIdxPerModule
xpu::buffer< float > localToGlobalTranslationByModule
XPU_D bool Intersect(const HitfinderCache &pars, float xF, float exF, float xB, float exB, float &x, float &y, float &varX, float &varY, float &varXY) const
xpu::buffer< SensorPar > sensorPars
size_t maxClustersPerModule
xpu::buffer< sts::Hit > hitsFlat
xpu::buffer< CbmStsDigi > digisPerModuleTmp
XPU_D float GetTimeResolution(int, int) const
XPU_D void FindClustersSingleStep(FindClusters::context &) const
xpu::buffer< float > localToGlobalRotationByModule
xpu::buffer< size_t > digiOffsetPerModule
xpu::buffer< sts::Hit > hitsPerModule
XPU_D bool IsInside(const HitfinderCache &pars, float x, float y) const
XPU_D float LandauWidth(float charge) const
XPU_D void CreateClusterFromConnectorsN(int const iModule, const CbmStsDigi *digis, DigiConnector *digiConnector, int const digiIndex) const
XPU_D void CalculateClustersDigiWise(FindClusters::context &ctx, CbmStsDigi *digis, DigiConnector *digiConnector, unsigned int const nDigis) const
xpu::buffer< sts::Cluster > clusterDataPerModule
xpu::buffer< ClusterIdx * > clusterIdxSortedPerModule
XPU_D void IntersectClusters(int iBlock, const HitfinderCache &pars, const ClusterIdx &idxF, const sts::Cluster &clsF, const ClusterIdx &idxB, const sts::Cluster &clsB) const
XPU_D bool IsBackside(int iModule) const
sts::HitfinderPars::Asic asic
xpu::buffer< ClusterIdx > clusterIdxPerModuleTmp
xpu::buffer< CbmStsDigi > digisPerModule
XPU_D void SortDigisInSpaceAndTime(SortDigis::context &) const
XPU_D void CalculateClustersParallel(FindClusters::context &) const
XPU_D void CreateClusterFromConnectors2(int const iModule, const CbmStsDigi *digis, DigiConnector *digiConnector, int const digiIndex) const
XPU_D void ToGlobal(int iModule, float lx, float ly, float lz, float &gx, float &gy, float &gz) const
XPU_D int ChanDist(int c1, int c2) const
XPU_D void CreateHit(int iBlocks, float xLocal, float yLocal, float varX, float varY, float varXY, const ClusterIdx &idxF, const Cluster &clsF, const ClusterIdx &idxB, const sts::Cluster &clsB, float du, float dv) const
XPU_D void FindHits(FindHits::context &) const
XPU_D unsigned int GetNDigis(int iModule) const
XPU_D void FindClustersParallel(FindClusters::context &) const
XPU_D void FindClusterConnectionsDigiWise(FindClusters::context &ctx, CbmStsDigi *digis, DigiConnector *digiConnector, unsigned int *channelOffsets, unsigned int nDigis) const
xpu::buffer< PaddedToCacheLine< float > > maxClusterTimeErrorByModuleSide
XPU_D float GetClusterPosition(const HitfinderCache &pars, float centre, bool isFront) const
@ kSortClustersItemsPerThread
@ kSortDigisItemsPerThread
@ kFindHitsChunksPerModule
XPU_D void operator()(context &)
xpu::block_size< kFindClusterBlockSize > block_size
xpu::kernel_context< shared_memory, constants > context
u32 fTime
Cluster time (average of digi times) [ns].
xpu::kernel_context< shared_memory, constants > context
XPU_D void operator()(context &)
xpu::block_size< kFindClusterBlockSize > block_size
xpu::block_size< kFindClusterBlockSize > block_size
XPU_D void operator()(context &)
xpu::kernel_context< shared_memory, constants > context
xpu::kernel_context< shared_memory, constants > context
XPU_D void operator()(context &)
xpu::block_size< kFindClusterBlockSize > block_size
xpu::openmp_settings< xpu::schedule_static, 1 > openmp
XPU_D void operator()(context &)
xpu::block_size< kFindHitsBlockSize > block_size
xpu::kernel_context< shared_memory, constants > context
i32 nClusterBucketOverflow
xpu::block_size< kSortClustersBlockSize > block_size
XPU_D void operator()(context &)
sort_t::storage_t shared_memory
xpu::block_sort< u32, ClusterIdx, kSortClustersBlockSize, kSortClustersItemsPerThread > sort_t
xpu::kernel_context< shared_memory, constants > context
XPU_D void operator()(context &)
sort_t::storage_t shared_memory
xpu::block_size< kSortDigisBlockSize > block_size
xpu::block_sort< u64, CbmStsDigi, kSortDigisBlockSize, kSortDigisItemsPerThread > sort_t
xpu::kernel_context< shared_memory, constants > context