CbmRoot
Loading...
Searching...
No Matches
detectors/trd/Cluster.h
Go to the documentation of this file.
1/* Copyright (C) 2024 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Dominik Smith [committer], Alexandru Bercuci */
4
5#pragma once
6
7#include <cstddef>
8#include <cstdint>
9#include <vector>
10
11class CbmTrdDigi;
12
13namespace cbm::algo::trd
14{
20 class Cluster {
21
22 public:
26 Cluster() = delete;
27 Cluster(const std::vector<int32_t>& indices, const std::vector<const CbmTrdDigi*>& digis, int32_t address,
28 uint16_t ncols, uint16_t nrows);
29
33 virtual ~Cluster(){};
34
39 size_t GetNofDigis() const { return fDigiInd.size(); }
40
46 int32_t GetDigi(int32_t index) const { return fDigiInd[index]; }
47
52 const std::vector<const CbmTrdDigi*>& GetDigis() const { return fDigis; }
53
58 const std::vector<int32_t>& GetDigiIndices() const { return fDigiInd; }
59
61 int32_t GetAddress() const { return fAddress; }
62 uint16_t GetStartCh() const { return fStartCh; }
63 uint16_t GetNCols() const { return fNCols; }
64 uint16_t GetNRows() const { return fNRows & 0x1f; }
65 uint16_t GetNRowsRaw() const { return fNRows; }
66 uint32_t GetStartTime() const { return fStartTime; }
67 bool HasFaspDigis() const { return false; }
68
69 private:
70 std::vector<int32_t> fDigiInd;
71 std::vector<const CbmTrdDigi*> fDigis;
72
73 int32_t fAddress = 0;
74 uint8_t fNCols = 0; //< number of columns with charge above threshold
75 uint8_t fNRows = 0x1f; //< cluster row info plus extra meta data. Use dedicated getters for the correct value
76 uint16_t fStartCh = 0xffff; //< channel address of first channel
77 uint32_t fStartTime = 0xffffffff;
78
79 void SetNRows(uint16_t nrows)
80 {
81 fNRows &= (7 << 5);
82 fNRows |= (nrows & 0x1f);
83 }
84 };
85} // namespace cbm::algo::trd
Data container for TRD clusters.
Cluster()=delete
Default constructor.
std::vector< int32_t > fDigiInd
Array of digi indices.
const std::vector< const CbmTrdDigi * > & GetDigis() const
Get array of digi pointers.
size_t GetNofDigis() const
Number of digis in cluster.
virtual ~Cluster()
Destructor.
int32_t GetDigi(int32_t index) const
Get digi at position index.
void SetNRows(uint16_t nrows)
start time of cluster in clk units wrt buffer start
std::vector< const CbmTrdDigi * > fDigis
Array of digi pointers.
const std::vector< int32_t > & GetDigiIndices() const
Get array of digi indices.
int32_t fAddress
Unique detector ID.