14#ifndef ALICEO2_ITS_CLUSTERER_H 
   15#define ALICEO2_ITS_CLUSTERER_H 
   17#define _PERFORM_TIMING_ 
   21#define _ALLOW_DIAGONAL_ALPIDE_CLUSTERS_ 
   38#ifdef _PERFORM_TIMING_ 
   39#include <TStopwatch.h> 
   50class ConstMCTruthContainerView;
 
  135    std::vector<std::pair<int, uint32_t>> 
pixels;
 
  150    void resetColumn(
int* buff)
 const { std::memset(buff, -1, 
sizeof(
int) * (
size - 2)); }
 
  159      pixels.emplace_back(firstIndex, ip);
 
  160      firstIndex = 
pixels.size() - 1;
 
  169      pixels.emplace_back(-1, ip);
 
 
  208  template <
typename VCLUS, 
typename VPAT>
 
  210                            VCLUS* compClusPtr, VPAT* patternsPtr, 
MCTruth* labelsClusPtr, 
int nlab, 
bool isIB, 
bool isHuge = 
false);
 
  233    LOGP(info, 
"Setting TopologyDictionary with IB size={} & OB size={}", dict->
getSize(
true), dict->
getSize(
false));
 
 
  248  void flushClusters(
CompClusCont* compClus, MCTruth* labels);
 
  251  bool mContinuousReadout = 
true; 
 
  255  int mMaxRowColDiffToMask = 0; 
 
  259  int mSquashingDepth = 0; 
 
  262  std::vector<std::unique_ptr<ClustererThread>> mThreads; 
 
  263  std::vector<ChipPixelData> mChips;                      
 
  264  std::vector<ChipPixelData> mChipsOld;                   
 
  265  std::vector<ChipPixelData*> mFiredChipsPtr;             
 
  269#ifdef _PERFORM_TIMING_ 
  271  TStopwatch mTimerMerge;
 
  275template <
typename VCLUS, 
typename VPAT>
 
  277                              VCLUS* compClusPtr, VPAT* patternsPtr, 
MCTruth* labelsClusPtr, 
int nlab, 
bool isIB, 
bool isHuge)
 
  279  if (labelsClusPtr && lblBuff) { 
 
  280    auto cnt = compClusPtr->
size();
 
  281    for (
int i = nlab; 
i--;) {
 
  285  auto colSpanW = 
bbox.colSpan();
 
  286  auto rowSpanW = 
bbox.rowSpan();
 
  288  std::array<unsigned char, itsmft::ClusterPattern::MaxPatternBytes> patt{};
 
  289  for (
const auto& pix : pixbuf) {
 
  290    uint32_t 
ir = pix.getRowDirect() - 
bbox.rowMin, ic = pix.getCol() - 
bbox.colMin;
 
  291    int nbits = 
ir * colSpanW + ic;
 
  292    patt[nbits >> 3] |= (0x1 << (7 - (nbits % 8)));
 
  296  LOGP(
debug, 
"PattID: findGroupID({},{},{})={}", 
row, 
col, patt[0], pattID);
 
  300      float xCOG = 0., zCOG = 0.;
 
  306      patternsPtr->emplace_back((
unsigned char)rowSpanW);
 
  307      patternsPtr->emplace_back((
unsigned char)colSpanW);
 
  308      int nBytes = rowSpanW * colSpanW / 8;
 
  309      if (((rowSpanW * colSpanW) % 8) != 0) {
 
  312      patternsPtr->insert(patternsPtr->end(), std::begin(patt), std::begin(patt) + nBytes);
 
  315  compClusPtr->emplace_back(
row, 
col, pattID, 
bbox.chipID);
 
 
 
 
 
 
Definition of the ITSMFT compact cluster.
 
Header to collect LHC related constants.
 
Transient data classes for single pixel and set of pixels from current chip.
 
Abstract class for Alpide data reader class.
 
Definition of the SegmentationAlpide class.
 
Definition of the LookUp class for its3.
 
void setDictionary(const its3::TopologyDictionary *dict)
 
void setContinuousReadOut(bool v)
 
static constexpr int MaxLabels
 
int getMaxBCSeparationToMask() const
 
int getMaxRowColDiffToMask() const
 
TStopwatch & getTimerMerge()
 
int getMaxROFDepthToSquash() const
 
Clusterer & operator=(Clusterer &&)=delete
 
void setMaxBCSeparationToMask(int n)
 
bool isContinuousReadOut() const
 
Clusterer(Clusterer &&)=delete
 
void clear()
load the dictionary of cluster topologies
 
static void streamCluster(const std::vector< PixelData > &pixbuf, const std::array< Label, MaxLabels > *lblBuff, const BBox &bbox, const its3::LookUp &pattIdConverter, VCLUS *compClusPtr, VPAT *patternsPtr, MCTruth *labelsClusPtr, int nlab, bool isIB, bool isHuge=false)
 
Clusterer & operator=(const Clusterer &)=delete
 
int getMaxBCSeparationToSquash() const
 
void setMaxRowColDiffToMask(int v)
 
Clusterer(const Clusterer &)=delete
 
void setMaxBCSeparationToSquash(int n)
 
static constexpr int MaxHugeClusWarn
 
void setMaxROFDepthToSquash(int v)
 
void setDictionary(const TopologyDictionary *dict)
 
int getSize(bool IB) const
Returns the number of elements in the dicionary;.
 
static int getCOG(int rowSpan, int colSpan, const unsigned char patt[MaxPatternBytes], float &xCOG, float &zCOG)
Static: Compute pattern's COG position. Returns the number of fired pixels.
 
static constexpr uint8_t MaxRowSpan
 
static constexpr uint8_t MaxColSpan
 
static constexpr unsigned short InvalidPatternID
 
< single pixel datum, with possibility to set a flag of pixel being masked out
 
PixelReader class for the ITSMFT.
 
static constexpr int NRows
 
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
 
constexpr double LHCBunchSpacingNS
 
std::vector< unsigned char > PatternCont
 
std::vector< itsmft::CompClusterExt > CompClusCont
 
std::vector< itsmft::ROFRecord > ROFRecCont
 
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
 
bool isInside(uint16_t row, uint16_t col) const
 
bool isAcceptableSize() const
 
void adjust(uint16_t row, uint16_t col)
 
ClustererThread & operator=(ClustererThread &&)=delete
 
std::vector< PixelData > pixArrBuff
temporary buffer for building cluster labels
 
void addNewPrecluster(uint32_t ip, uint16_t row)
 
std::vector< ThreadStat > stats
 
void finishChipSingleHitFast(uint32_t hit, ChipPixelData *curChipData, CompClusCont *compClusPtr, PatternCont *patternsPtr, const ConstMCTruth *labelsDigPtr, MCTruth *labelsClusPTr)
 
std::array< Label, MaxLabels > labelsBuff
 
std::vector< int > preClusterIndices
 
void updateChip(const ChipPixelData *curChipData, uint32_t ip)
 
void expandPreCluster(uint32_t ip, uint16_t row, int preClusIndex)
add new precluster at given row of current column for the fired pixel with index ip in the ChipPixelD...
 
ClustererThread(const ClustererThread &)=delete
 
void fetchMCLabels(int digID, const ConstMCTruth *labelsDig, int &nfilled)
 
std::vector< std::pair< int, uint32_t > > pixels
 
ClustererThread(ClustererThread &&)=delete
 
bool noLeftCol
flag that there is no column on the left to check
 
ClustererThread & operator=(const ClustererThread &)=delete
 
ClustererThread(Clusterer *par=nullptr, int _id=-1)
 
std::vector< int > preClusterHeads
 
CompClusCont compClusters
temporary buffer for pattern calc.
 
void initChip(const ChipPixelData *curChipData, uint32_t first)
 
void resetColumn(int *buff) const
reset column buffer, for the performance reasons we use memset
 
void finishChip(ChipPixelData *curChipData, CompClusCont *compClus, PatternCont *patterns, const ConstMCTruth *labelsDig, MCTruth *labelsClus)
 
void swapColumnBuffers()
add cluster at row (entry ip in the ChipPixeData) to the precluster with given index
 
uint16_t currCol
Column being processed.
 
methods and transient data used within a thread
 
o2::InteractionRecord ir(0, 0)