Project
Loading...
Searching...
No Matches
Clusterer.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef ALICEO2_IOTOF_CLUSTERER_H
16#define ALICEO2_IOTOF_CLUSTERER_H
17
27#include <gsl/span>
28#include <vector>
29#include <array>
30#include <memory>
31#include <cstring>
32#include <utility>
33
34namespace o2::iotof
35{
36
37class GeometryTGeo;
38
40{
41 public:
42 static constexpr int MaxLabels = 10;
43
50
51 //----------------------------------------------
53 Clusterer* mParent = nullptr;
54 // Column buffers data members in TRK, for now not needed in TF3
55
56 // Further struct members in TRK, for now not needed in TF3
57
58 std::array<Label, MaxLabels> mLabelsBuff;
59
60 // per-thread output (accumulated, then merged back by caller)
61 std::vector<Cluster> mClusters;
62 std::vector<uint16_t> mPatterns;
64
65 // Further reset column buffer in TRK, not included for now in TF3
67
68 void fetchMCLabels(uint32_t digID, const ConstDigitTruth* labelsDig, int& nFilled);
69 void findClustersSingleHit(gsl::span<const Digit> digits, uint32_t digitIdx,
70 const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
71 void findClustersMultipleHits(gsl::span<const Digit> digits, gsl::span<const uint32_t> digitIdxs,
72 const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
73 std::vector<std::vector<uint32_t>> buildPreclusters(gsl::span<const Digit> digits,
74 gsl::span<const uint32_t> digitIdxs,
75 int maxTimeDiffNSigma,
76 float timeResolution);
77 void processChip(gsl::span<const Digit> digits, int chipFirst, int chipN,
78 std::vector<Cluster>* clustersOut, std::vector<unsigned char>* patternsOut,
79 const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
80 void writeTopologiesToFile(const char* filename);
81
82 explicit ClustererThread(Clusterer* par = nullptr) : mParent(par) {}
85 };
86 //----------------------------------------------
87
88 virtual void process(gsl::span<const Digit> digits,
89 gsl::span<const DigROFRecord> digitROFs,
90 std::vector<o2::iotof::Cluster>& clusters,
91 std::vector<unsigned char>& patterns,
92 std::vector<o2::itsmft::ROFRecord>& clusterROFs,
93 const ConstDigitTruth* digitLabels = nullptr,
94 ClusterTruth* clusterLabels = nullptr,
95 gsl::span<const DigMC2ROFRecord> digMC2ROFs = {},
96 std::vector<o2::itsmft::MC2ROFRecord>* clusterMC2ROFs = nullptr);
97
98 // ///< load the dictionary of cluster topologies
99 // void loadDictionary(const std::string& fileName) { mPattIdConverter.loadDictionary(fileName); }
100 // void setDictionary(const TopologyDictionary* dict) { mPattIdConverter.setDictionary(dict); }
101 // const TopologyDictionary& getDictionary() const { return mPattIdConverter.getDictionary(); }
102 // auto& getPattIdConverter() const { return mPattIdConverter; }
103
104 protected:
105 std::unique_ptr<ClustererThread> mThread;
106 std::vector<int> mSortIdx;
107};
108
109} // namespace o2::iotof
110
111#endif
A const (ready only) version of MCTruthContainer.
Definition of the IOTOF cluster.
Definition of IOTOF digit class.
Definition of the ITSMFT ROFrame (trigger) record.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the TopologyClassifier class.
Definition of the IOTOF clusterer settings.
virtual void process(gsl::span< const Digit > digits, gsl::span< const DigROFRecord > digitROFs, std::vector< o2::iotof::Cluster > &clusters, std::vector< unsigned char > &patterns, std::vector< o2::itsmft::ROFRecord > &clusterROFs, const ConstDigitTruth *digitLabels=nullptr, ClusterTruth *clusterLabels=nullptr, gsl::span< const DigMC2ROFRecord > digMC2ROFs={}, std::vector< o2::itsmft::MC2ROFRecord > *clusterMC2ROFs=nullptr)
Definition Clusterer.cxx:26
static constexpr int MaxLabels
Definition Clusterer.h:42
std::vector< int > mSortIdx
reusable per-ROF sort buffer
Definition Clusterer.h:106
std::unique_ptr< ClustererThread > mThread
Definition Clusterer.h:105
std::string filename()
ClustererThread & operator=(const ClustererThread &)=delete
std::array< Label, MaxLabels > mLabelsBuff
MC label buffer for one cluster.
Definition Clusterer.h:58
TopologyClassifier mClsTopoClassifier
Definition Clusterer.h:66
void processChip(gsl::span< const Digit > digits, int chipFirst, int chipN, std::vector< Cluster > *clustersOut, std::vector< unsigned char > *patternsOut, const ConstDigitTruth *labelsDigPtr, ClusterTruth *labelsClusPtr)
std::vector< std::vector< uint32_t > > buildPreclusters(gsl::span< const Digit > digits, gsl::span< const uint32_t > digitIdxs, int maxTimeDiffNSigma, float timeResolution)
std::vector< Cluster > mClusters
Definition Clusterer.h:61
void writeTopologiesToFile(const char *filename)
void findClustersMultipleHits(gsl::span< const Digit > digits, gsl::span< const uint32_t > digitIdxs, const ConstDigitTruth *labelsDigPtr, ClusterTruth *labelsClusPtr)
std::vector< uint16_t > mPatterns
Definition Clusterer.h:62
void fetchMCLabels(uint32_t digID, const ConstDigitTruth *labelsDig, int &nFilled)
Convert the cluster topology to the corresponding entry in the dictionary.
void findClustersSingleHit(gsl::span< const Digit > digits, uint32_t digitIdx, const ConstDigitTruth *labelsDigPtr, ClusterTruth *labelsClusPtr)
ClustererThread(Clusterer *par=nullptr)
Definition Clusterer.h:82
ClustererThread(const ClustererThread &)=delete
std::vector< Cluster > clusters
std::vector< Digit > digits