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
28#include <gsl/span>
29#include <vector>
30#include <array>
31#include <memory>
32#include <cstring>
33#include <utility>
34
35namespace o2::iotof
36{
37
38class GeometryTGeo;
39
41{
42 public:
43 static constexpr int MaxLabels = 10;
44
51
52 //----------------------------------------------
54 Clusterer* mParent = nullptr;
55 // Column buffers data members in TRK, for now not needed in TF3
56
57 // Further struct members in TRK, for now not needed in TF3
58
59 std::array<Label, MaxLabels> mLabelsBuff;
60
61 // per-thread output (accumulated, then merged back by caller)
62 std::vector<Cluster> mClusters;
63 std::vector<uint16_t> mPatterns;
65
66 // Further reset column buffer in TRK, not included for now in TF3
68
69 void fetchMCLabels(uint32_t digID, const ConstDigitTruth* labelsDig, int& nFilled);
70 void findClustersSingleHit(gsl::span<const Digit> digits, uint32_t digitIdx,
71 const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
72 void findClustersMultipleHits(gsl::span<const Digit> digits, gsl::span<const uint32_t> digitIdxs,
73 const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
74 std::vector<std::vector<uint32_t>> buildPreclusters(gsl::span<const Digit> digits,
75 gsl::span<const uint32_t> digitIdxs,
76 int maxTimeDiffNSigma,
77 float timeResolution);
78 void processChip(gsl::span<const Digit> digits, int chipFirst, int chipN,
79 std::vector<Cluster>* clustersOut, std::vector<unsigned char>* patternsOut,
80 const ConstDigitTruth* labelsDigPtr, ClusterTruth* labelsClusPtr);
81 void writeTopologiesToFile(const char* filename);
82
83 explicit ClustererThread(Clusterer* par = nullptr) : mParent(par) {}
86 };
87 //----------------------------------------------
88
89 virtual void process(gsl::span<const Digit> digits,
90 gsl::span<const DigROFRecord> digitROFs,
91 std::vector<o2::iotof::Cluster>& clusters,
92 std::vector<unsigned char>& patterns,
93 std::vector<o2::itsmft::ROFRecord>& clusterROFs,
94 const ConstDigitTruth* digitLabels = nullptr,
95 ClusterTruth* clusterLabels = nullptr,
96 gsl::span<const DigMC2ROFRecord> digMC2ROFs = {},
97 std::vector<o2::itsmft::MC2ROFRecord>* clusterMC2ROFs = nullptr);
98
99 // ///< load the dictionary of cluster topologies
100 // void loadDictionary(const std::string& fileName) { mPattIdConverter.loadDictionary(fileName); }
101 // void setDictionary(const TopologyDictionary* dict) { mPattIdConverter.setDictionary(dict); }
102 // const TopologyDictionary& getDictionary() const { return mPattIdConverter.getDictionary(); }
103 // auto& getPattIdConverter() const { return mPattIdConverter; }
104
105 protected:
106 std::unique_ptr<ClustererThread> mThread;
107 std::vector<int> mSortIdx;
108};
109
110} // namespace o2::iotof
111
112#endif
A const (ready only) version of MCTruthContainer.
Definition of the IOTOF cluster.
Definition of IOTOF digit class.
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
Definition of the ITSMFT ROFrame (trigger) record.
Header to collect LHC related constants.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the TopologyClassifier class.
Definition of the IOTOF clusterer settings.
static constexpr int MaxLabels
Definition Clusterer.h:43
std::vector< int > mSortIdx
reusable per-ROF sort buffer
Definition Clusterer.h:107
std::unique_ptr< ClustererThread > mThread
Definition Clusterer.h:106
std::string filename()
ClustererThread & operator=(const ClustererThread &)=delete
std::array< Label, MaxLabels > mLabelsBuff
MC label buffer for one cluster.
Definition Clusterer.h:59
TopologyClassifier mClsTopoClassifier
Definition Clusterer.h:67
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:62
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:63
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:83
ClustererThread(const ClustererThread &)=delete
std::vector< Cluster > clusters
std::vector< Digit > digits