CbmRoot
Loading...
Searching...
No Matches
trd/Hitfind.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] */
4
5#pragma once
6
7#include "CbmTrdDigi.h"
8#include "DigiRec.h"
9#include "PODVector.h"
10#include "PartitionedVector.h"
11#include "trd/Clusterizer.h"
12#include "trd/Clusterizer2D.h"
13#include "trd/HitFinder.h"
14#include "trd/HitFinder2D.h"
15#include "trd/HitMerger.h"
16#include "trd/HitMerger2D.h"
17#include "trd/Hitfind2DSetup.h"
18#include "trd/HitfindSetup.h"
19
20#include <gsl/span>
21#include <optional>
22#include <sstream>
23#include <vector>
24
25#include <xpu/host.h>
26
27
28namespace cbm::algo::trd
29{
30
37 xpu::timings timeHitfind;
38 xpu::timings timeClusterize;
39 xpu::timings sortTime;
40 size_t numDigis = 0;
41 size_t numHits = 0;
42
43 std::string print() const
44 {
45 std::stringstream ss;
46 ss << "Hitfind stats: num digis " << numDigis << ", num hits " << numHits << std::endl;
47 return ss.str();
48 }
49 };
50
57 class Hitfind {
58
59 public:
60 typedef std::tuple<PartitionedVector<Hit>, HitfindMonitorData> resultType;
61 typedef std::pair<Hit, std::vector<DigiRec>> hitDataType;
62
69 resultType operator()(gsl::span<CbmTrdDigi> digiIn);
70
72 resultType RunRowParallel(gsl::span<CbmTrdDigi> digiIn);
73
75 resultType RunModuleParallelMerge(gsl::span<CbmTrdDigi> digiIn);
76
79
80 private: // members
82 std::unordered_map<int, std::unique_ptr<cbm::algo::trd::Clusterizer2D>> fClusterBuild2d;
83 std::unordered_map<int, std::unique_ptr<cbm::algo::trd::Clusterizer>> fClusterBuild;
84
86 std::unordered_map<int, std::unique_ptr<cbm::algo::trd::HitFinder2D>> fHitFind2d;
87 std::unordered_map<int, std::unique_ptr<cbm::algo::trd::HitFinder>> fHitFind;
88
90 std::unordered_map<int, std::unique_ptr<cbm::algo::trd::HitMerger2D>> fHitMerge2d;
91 std::unordered_map<int, std::unique_ptr<cbm::algo::trd::HitMerger>> fHitMerge;
92
94 std::vector<std::tuple<int, bool, size_t, size_t>> fModList;
95
97 std::vector<std::tuple<int, bool, size_t>> fRowList;
98
100 std::unordered_map<int, size_t> fModId;
101 };
102} // namespace cbm::algo::trd
Algo class for hitfinding.
Definition trd/Hitfind.h:57
std::unordered_map< int, std::unique_ptr< cbm::algo::trd::HitMerger > > fHitMerge
Definition trd/Hitfind.h:91
std::unordered_map< int, std::unique_ptr< cbm::algo::trd::Clusterizer2D > > fClusterBuild2d
Cluster building algorithms per module.
Definition trd/Hitfind.h:82
std::unordered_map< int, std::unique_ptr< cbm::algo::trd::HitFinder2D > > fHitFind2d
Hit finding algorithms per module.
Definition trd/Hitfind.h:86
std::vector< std::tuple< int, bool, size_t > > fRowList
List of rows (module address, type flag (true = 2D), row in module)
Definition trd/Hitfind.h:97
std::unordered_map< int, std::unique_ptr< cbm::algo::trd::Clusterizer > > fClusterBuild
Definition trd/Hitfind.h:83
std::unordered_map< int, std::unique_ptr< cbm::algo::trd::HitFinder > > fHitFind
Definition trd/Hitfind.h:87
resultType RunRowParallel(gsl::span< CbmTrdDigi > digiIn)
Run all steps row-parallel.
std::pair< Hit, std::vector< DigiRec > > hitDataType
Definition trd/Hitfind.h:61
resultType operator()(gsl::span< CbmTrdDigi > digiIn)
Algorithm execution.
std::unordered_map< int, size_t > fModId
Map from module address to module Id (sequential number)
Hitfind(trd::HitfindSetup, trd::Hitfind2DSetup)
Constructor.
resultType RunModuleParallelMerge(gsl::span< CbmTrdDigi > digiIn)
Run merge step module-parallel all others row-parallel.
std::vector< std::tuple< int, bool, size_t, size_t > > fModList
List of modules (address, type flag (true = 2D), numRows, numCols)
Definition trd/Hitfind.h:94
std::tuple< PartitionedVector< Hit >, HitfindMonitorData > resultType
Definition trd/Hitfind.h:60
std::unordered_map< int, std::unique_ptr< cbm::algo::trd::HitMerger2D > > fHitMerge2d
Hit merging algorithms per module.
Definition trd/Hitfind.h:90
Hitfind setup / Hardware cabling for TRD2D Used to create the hardware mapping for the TRD2D hitfinde...
Monitoring data for hitfinding.
Definition trd/Hitfind.h:36
Hitfind setup / Hardware cabling for TRD Used to create the hardware mapping for the TRD hitfinder.