R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandClusterFinder.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
15#include <vector>
16
18 const double dist_y,
19 const double dist_z,
20 const double dist_t,
21 const std::string_view input,
22 const std::string_view output)
23 : FairTask("R3BNeulandClusterFinder")
24 , fDigis(input)
25 , fClusters(output)
26{
27 fClusteringEngine.SetClusteringCondition(
28 [=](const R3BNeulandHit& one, const R3BNeulandHit& other)
29 {
30 return std::abs(one.GetPosition().X() - other.GetPosition().X()) < dist_x &&
31 std::abs(one.GetPosition().Y() - other.GetPosition().Y()) < dist_y &&
32 std::abs(one.GetPosition().Z() - other.GetPosition().Z()) < dist_z &&
33 std::abs(one.GetT() - other.GetT()) < dist_t;
34 });
35}
36
38{
39 fDigis.init();
40 fClusters.init();
41 return kSUCCESS;
42}
43
44void R3BNeulandClusterFinder::Exec(Option_t* /*option*/)
45{
46 fClusters.clear();
47 neuland_hits_buffer_.clear();
48 clustered_hits_buffer_.clear();
49
50 neuland_hits_buffer_ = fDigis.get();
51 const auto nDigis = neuland_hits_buffer_.size();
52
53 // Group them using the clustering condition set above: vector of digis -> vector of vector of digis
54 clustered_hits_buffer_ = fClusteringEngine.Clusterize(neuland_hits_buffer_);
55 const auto nClusters = clustered_hits_buffer_.size();
56
57 R3BLOG(debug, fmt::format("R3BNeulandClusterFinder - nDigis nCluster: {} {}", nDigis, nClusters));
58
59 for (auto& cluster : clustered_hits_buffer_)
60 {
61 fClusters.get().emplace_back(std::move(cluster));
62 }
63}
64
#define R3BLOG(severity, x)
Definition R3BLogger.h:35
ClassImp(R3BNeulandClusterFinder)
void Exec(Option_t *) override
R3BNeulandClusterFinder(double dist_x=1. *CLUSTER_FINDER_DISTANCE, double dist_y=1. *CLUSTER_FINDER_DISTANCE, double dist_z=2. *CLUSTER_FINDER_DISTANCE, double dist_t=1., std::string_view input="NeulandHits", std::string_view output="NeulandClusters")
auto Init() -> InitStatus override
auto GetT() const -> double
auto GetPosition() const -> TVector3