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 "R3BLogger.h"
16#include "R3BNeulandHit.h"
17#include <FairTask.h>
18#include <Rtypes.h>
19#include <RtypesCore.h>
20#include <cstdlib>
21#include <fmt/core.h>
22#include <string_view>
23#include <utility>
24#include <vector>
25
27 const double dist_y,
28 const double dist_z,
29 const double dist_t,
30 const std::string_view input,
31 const std::string_view output)
32 : FairTask("R3BNeulandClusterFinder")
33 , fDigis(input)
34 , fClusters(output)
35{
36 fClusteringEngine.SetClusteringCondition(
37 [=](const R3BNeulandHit& one, const R3BNeulandHit& other)
38 {
39 return std::abs(one.GetPosition().X() - other.GetPosition().X()) < dist_x &&
40 std::abs(one.GetPosition().Y() - other.GetPosition().Y()) < dist_y &&
41 std::abs(one.GetPosition().Z() - other.GetPosition().Z()) < dist_z &&
42 std::abs(one.GetT() - other.GetT()) < dist_t;
43 });
44}
45
47{
48 fDigis.init();
49 fClusters.init();
50 return kSUCCESS;
51}
52
53void R3BNeulandClusterFinder::Exec(Option_t* /*option*/)
54{
55 fClusters.clear();
58
60 const auto nDigis = neuland_hits_buffer_.size();
61
62 // Group them using the clustering condition set above: vector of digis -> vector of vector of digis
64 const auto nClusters = clustered_hits_buffer_.size();
65
66 R3BLOG(debug, fmt::format("R3BNeulandClusterFinder - nDigis nCluster: {} {}", nDigis, nClusters));
67
68 for (auto& cluster : clustered_hits_buffer_)
69 {
70 fClusters.get().emplace_back(std::move(cluster));
71 }
72}
73
#define R3BLOG(severity, x)
Definition R3BLogger.h:32
ClassImp(R3BNeulandClusterFinder)
std::vector< R3BNeulandHit > neuland_hits_buffer_
R3B::OutputVectorConnector< R3BNeulandCluster > fClusters
R3B::InputVectorConnector< R3BNeulandHit > fDigis
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")
std::vector< std::vector< R3BNeulandHit > > clustered_hits_buffer_
Neuland::ClusteringEngine< R3BNeulandHit > fClusteringEngine
auto Init() -> InitStatus override
auto GetT() const -> double
auto GetPosition() const -> TVector3