CbmRoot
Loading...
Searching...
No Matches
CbmCluster.h
Go to the documentation of this file.
1/* Copyright (C) 2012-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer], Andrey Lebedev */
4
12#ifndef CBMCLUSTER_H_
13#define CBMCLUSTER_H_
14
15#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
16#include <TObject.h> // for TObject
17
18#include <cstdint>
19#include <string> // for string
20#include <vector> // for vector
21
22class CbmMatch;
23
30class CbmCluster : public TObject {
31public:
35 CbmCluster();
36 CbmCluster(const std::vector<int32_t>& indices, int32_t address);
37 CbmCluster(const CbmCluster&);
38 CbmCluster(CbmCluster&& other) noexcept;
40 CbmCluster& operator=(CbmCluster&&) noexcept;
41
45 virtual ~CbmCluster();
46
51 void AddDigi(int32_t index) { fDigis.push_back(index); }
52
57 void AddDigis(const std::vector<int32_t>& indices) { fDigis.insert(fDigis.end(), indices.begin(), indices.end()); }
58
63 void SetDigis(const std::vector<int32_t>& indices) { fDigis.assign(indices.begin(), indices.end()); }
64
69 int32_t GetNofDigis() const { return fDigis.size(); }
70
76 int32_t GetDigi(int32_t index) const { return fDigis[index]; }
77
82 const std::vector<int32_t>& GetDigis() const { return fDigis; }
83
87 void ClearDigis() { fDigis.clear(); }
88
90 int32_t GetAddress() const { return fAddress; }
91 CbmMatch* GetMatch() const { return fMatch; }
92
94 void SetAddress(int32_t address) { fAddress = address; }
95 void SetMatch(CbmMatch* match);
96
101 virtual std::string ToString() const;
102
103private:
104 std::vector<int32_t> fDigis;
105 int32_t fAddress;
107
109};
110
111#endif /* CBMCLUSTER_H_ */
Base class for cluster objects.
Definition CbmCluster.h:30
void SetDigis(const std::vector< int32_t > &indices)
Set array of digi to cluster. Overwrites existing array.
Definition CbmCluster.h:63
ClassDef(CbmCluster, 2)
void AddDigi(int32_t index)
Add digi to cluster.
Definition CbmCluster.h:51
CbmMatch * fMatch
link to Monte-Carlo information
Definition CbmCluster.h:106
CbmMatch * GetMatch() const
Definition CbmCluster.h:91
const std::vector< int32_t > & GetDigis() const
Get array of digi indices.
Definition CbmCluster.h:82
std::vector< int32_t > fDigis
Array of digi indices.
Definition CbmCluster.h:104
int32_t fAddress
Unique detector ID.
Definition CbmCluster.h:105
void SetMatch(CbmMatch *match)
int32_t GetAddress() const
Definition CbmCluster.h:90
void SetAddress(int32_t address)
Definition CbmCluster.h:94
int32_t GetDigi(int32_t index) const
Get digi at position index.
Definition CbmCluster.h:76
virtual std::string ToString() const
Return string representation of the object.
virtual ~CbmCluster()
Destructor.
CbmCluster()
Constructor.
CbmCluster & operator=(const CbmCluster &)
void AddDigis(const std::vector< int32_t > &indices)
Add array of digi to cluster.
Definition CbmCluster.h:57
void ClearDigis()
Remove all digis.
Definition CbmCluster.h:87
int32_t GetNofDigis() const
Number of digis in cluster.
Definition CbmCluster.h:69