Skip to content

Commit 80518bf

Browse files
committed
[ALICE3] TRK: allow ACTS clustering
1 parent e608207 commit 80518bf

File tree

5 files changed

+79
-23
lines changed

5 files changed

+79
-23
lines changed

Detectors/Upgrades/ALICE3/TRK/reconstruction/CMakeLists.txt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12+
if(Acts_FOUND)
13+
set(actsTarget Acts::Core)
14+
endif()
15+
1216
o2_add_library(TRKReconstruction
1317
TARGETVARNAME targetName
1418
SOURCES src/TimeFrame.cxx
1519
src/Clusterer.cxx
20+
$<$<BOOL:${Acts_FOUND}>:src/ClustererACTS.cxx>
21+
$<$<BOOL:${Acts_FOUND}>:src/TrackerACTS.cxx>
1622
PUBLIC_LINK_LIBRARIES
1723
O2::ITStracking
1824
O2::GPUCommon
@@ -27,11 +33,23 @@ o2_add_library(TRKReconstruction
2733
O2::DataFormatsITS
2834
O2::TRKSimulation
2935
nlohmann_json::nlohmann_json
36+
${actsTarget}
3037
PRIVATE_LINK_LIBRARIES
3138
O2::Steer
3239
TBB::tbb)
3340

41+
if(Acts_FOUND)
42+
target_compile_definitions(${targetName} PUBLIC O2_WITH_ACTS)
43+
endif()
44+
45+
set(dictHeaders include/TRKReconstruction/TimeFrame.h
46+
include/TRKReconstruction/Clusterer.h)
47+
48+
if(Acts_FOUND)
49+
list(APPEND dictHeaders include/TRKReconstruction/ClustererACTS.h
50+
include/TRKReconstruction/TrackerACTS.h)
51+
endif()
52+
3453
o2_target_root_dictionary(TRKReconstruction
35-
HEADERS include/TRKReconstruction/TimeFrame.h
36-
include/TRKReconstruction/Clusterer.h
54+
HEADERS ${dictHeaders}
3755
LINKDEF src/TRKReconstructionLinkDef.h)

Detectors/Upgrades/ALICE3/TRK/reconstruction/include/TRKReconstruction/Clusterer.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,17 @@ class Clusterer
161161
};
162162
//----------------------------------------------
163163

164-
void process(gsl::span<const Digit> digits,
165-
gsl::span<const DigROFRecord> digitROFs,
166-
std::vector<o2::trk::Cluster>& clusters,
167-
std::vector<unsigned char>& patterns,
168-
std::vector<o2::trk::ROFRecord>& clusterROFs,
169-
const ConstDigitTruth* digitLabels = nullptr,
170-
ClusterTruth* clusterLabels = nullptr,
171-
gsl::span<const DigMC2ROFRecord> digMC2ROFs = {},
172-
std::vector<o2::trk::MC2ROFRecord>* clusterMC2ROFs = nullptr);
173-
174-
private:
164+
virtual void process(gsl::span<const Digit> digits,
165+
gsl::span<const DigROFRecord> digitROFs,
166+
std::vector<o2::trk::Cluster>& clusters,
167+
std::vector<unsigned char>& patterns,
168+
std::vector<o2::trk::ROFRecord>& clusterROFs,
169+
const ConstDigitTruth* digitLabels = nullptr,
170+
ClusterTruth* clusterLabels = nullptr,
171+
gsl::span<const DigMC2ROFRecord> digMC2ROFs = {},
172+
std::vector<o2::trk::MC2ROFRecord>* clusterMC2ROFs = nullptr);
173+
174+
protected:
175175
int mNHugeClus = 0;
176176
std::unique_ptr<ClustererThread> mThread;
177177
std::vector<int> mSortIdx; ///< reusable per-ROF sort buffer

Detectors/Upgrades/ALICE3/TRK/reconstruction/src/TRKReconstructionLinkDef.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@
1717

1818
#pragma link C++ class o2::trk::TimeFrame < 11> + ;
1919
#pragma link C++ class o2::trk::Clusterer + ;
20+
#ifdef O2_WITH_ACTS
21+
#pragma link C++ class o2::trk::ClustererACTS + ;
22+
23+
#endif
2024

2125
#endif

Detectors/Upgrades/ALICE3/TRK/workflow/include/TRKWorkflow/ClustererSpec.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include "Framework/DataProcessorSpec.h"
1616
#include "Framework/Task.h"
1717
#include "TRKReconstruction/Clusterer.h"
18+
#ifdef O2_WITH_ACTS
19+
#include "TRKReconstruction/ClustererACTS.h"
20+
#endif
1821

1922
namespace o2::trk
2023
{
@@ -29,7 +32,13 @@ class ClustererDPL : public o2::framework::Task
2932
private:
3033
bool mUseMC = true;
3134
int mNThreads = 1;
35+
#ifdef O2_WITH_ACTS
36+
bool mUseACTS = false;
37+
#endif
3238
o2::trk::Clusterer mClusterer;
39+
#ifdef O2_WITH_ACTS
40+
o2::trk::ClustererACTS mClustererACTS;
41+
#endif
3342
};
3443

3544
o2::framework::DataProcessorSpec getClustererSpec(bool useMC);

Detectors/Upgrades/ALICE3/TRK/workflow/src/ClustererSpec.cxx

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ namespace o2::trk
2323
void ClustererDPL::init(o2::framework::InitContext& ic)
2424
{
2525
mNThreads = std::max(1, ic.options().get<int>("nthreads"));
26+
#ifdef O2_WITH_ACTS
27+
mUseACTS = ic.options().get<bool>("useACTS");
28+
#endif
2629
}
2730

2831
void ClustererDPL::run(o2::framework::ProcessingContext& pc)
@@ -48,15 +51,32 @@ void ClustererDPL::run(o2::framework::ProcessingContext& pc)
4851
}
4952
o2::base::GeometryManager::loadGeometry("o2sim_geometry.root", false, true);
5053

51-
mClusterer.process(digits,
52-
rofs,
53-
clusters,
54-
patterns,
55-
clusterROFs,
56-
mUseMC ? &labels : nullptr,
57-
clusterLabels.get(),
58-
mc2rofs,
59-
mUseMC ? &clusterMC2ROFs : nullptr);
54+
#ifdef O2_WITH_ACTS
55+
if (mUseACTS) {
56+
LOG(info) << "Running TRKClusterer with ACTS";
57+
mClustererACTS.process(digits,
58+
rofs,
59+
clusters,
60+
patterns,
61+
clusterROFs,
62+
mUseMC ? &labels : nullptr,
63+
clusterLabels.get(),
64+
mc2rofs,
65+
mUseMC ? &clusterMC2ROFs : nullptr);
66+
} else
67+
#endif
68+
{
69+
LOG(info) << "Running TRKClusterer";
70+
mClusterer.process(digits,
71+
rofs,
72+
clusters,
73+
patterns,
74+
clusterROFs,
75+
mUseMC ? &labels : nullptr,
76+
clusterLabels.get(),
77+
mc2rofs,
78+
mUseMC ? &clusterMC2ROFs : nullptr);
79+
}
6080

6181
pc.outputs().snapshot(o2::framework::Output{"TRK", "COMPCLUSTERS", 0}, clusters);
6282
pc.outputs().snapshot(o2::framework::Output{"TRK", "PATTERNS", 0}, patterns);
@@ -93,7 +113,12 @@ o2::framework::DataProcessorSpec getClustererSpec(bool useMC)
93113
inputs,
94114
outputs,
95115
o2::framework::AlgorithmSpec{o2::framework::adaptFromTask<o2::trk::ClustererDPL>(useMC)},
96-
o2::framework::Options{{"nthreads", o2::framework::VariantType::Int, 1, {"Number of clustering threads"}}}};
116+
o2::framework::Options{{"nthreads", o2::framework::VariantType::Int, 1, {"Number of clustering threads"}}
117+
#ifdef O2_WITH_ACTS
118+
,
119+
{"useACTS", o2::framework::VariantType::Bool, false, {"Use ACTS for clustering"}}
120+
#endif
121+
}};
97122
}
98123

99124
} // namespace o2::trk

0 commit comments

Comments
 (0)