Skip to content

Commit 0b310e7

Browse files
committed
TPC Workflow: simplify stupid complicated way to pass parameters
1 parent aadd336 commit 0b310e7

File tree

2 files changed

+15
-102
lines changed

2 files changed

+15
-102
lines changed

Detectors/TPC/workflow/include/TPCWorkflow/CATrackerSpec.h

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -29,92 +29,7 @@ namespace tpc
2929

3030
namespace ca
3131
{
32-
// The CA tracker is now a wrapper to not only the actual tracking on GPU but
33-
// also the decoding of the zero-suppressed raw format and the clusterer.
34-
enum struct Operation {
35-
DecompressTPC, // run cluster decompressor
36-
DecompressTPCFromROOT, // the cluster decompressor input is a root object not flat
37-
CAClusterer, // run the CA clusterer
38-
ZSDecoder, // run the ZS raw data decoder
39-
ZSOnTheFly, // use zs on the fly
40-
OutputTracks, // publish tracks
41-
OutputCAClusters, // publish the clusters produced by CA clusterer
42-
OutputCompClusters, // publish CompClusters container
43-
OutputCompClustersFlat, // publish CompClusters container
44-
OutputQA, // Ship QA histograms to QC
45-
OutputSharedClusterMap, // Ship optional shared cluster map
46-
ProcessMC, // process MC labels
47-
SendClustersPerSector, // Send clusters and clusters mc labels per sector
48-
Noop, // skip argument on the constructor
49-
};
50-
51-
/// Helper struct to pass the individual ca::Operation flags to
52-
/// the processor spec. The struct is initialized by a variable list of
53-
/// constructor arguments.
5432
struct Config {
55-
Config(const Config&) = default;
56-
template <typename... Args>
57-
Config(Args&&... args)
58-
{
59-
init(std::forward<Args>(args)...);
60-
}
61-
62-
template <typename... Args>
63-
void init(Operation const& op, Args&&... args)
64-
{
65-
switch (op) {
66-
case Operation::DecompressTPC:
67-
decompressTPC = true;
68-
break;
69-
case Operation::DecompressTPCFromROOT:
70-
decompressTPCFromROOT = true;
71-
break;
72-
case Operation::CAClusterer:
73-
caClusterer = true;
74-
break;
75-
case Operation::ZSDecoder:
76-
zsDecoder = true;
77-
break;
78-
case Operation::ZSOnTheFly:
79-
zsOnTheFly = true;
80-
break;
81-
case Operation::OutputTracks:
82-
outputTracks = true;
83-
break;
84-
case Operation::OutputCompClusters:
85-
outputCompClusters = true;
86-
break;
87-
case Operation::OutputCompClustersFlat:
88-
outputCompClustersFlat = true;
89-
break;
90-
case Operation::OutputCAClusters:
91-
outputCAClusters = true;
92-
break;
93-
case Operation::OutputQA:
94-
outputQA = true;
95-
break;
96-
case Operation::OutputSharedClusterMap:
97-
outputSharedClusterMap = true;
98-
break;
99-
case Operation::ProcessMC:
100-
processMC = true;
101-
break;
102-
case Operation::SendClustersPerSector:
103-
sendClustersPerSector = true;
104-
break;
105-
case Operation::Noop:
106-
break;
107-
default:
108-
throw std::runtime_error("invalid CATracker operation");
109-
}
110-
if constexpr (sizeof...(args) > 0) {
111-
init(std::forward<Args>(args)...);
112-
}
113-
}
114-
115-
// Cannot specialize constructor to create proper copy constructor directly --> must overload init
116-
void init(const Config& x) { *this = x; }
117-
11833
bool decompressTPC = false;
11934
bool decompressTPCFromROOT = false;
12035
bool caClusterer = false;
@@ -129,7 +44,6 @@ struct Config {
12944
bool processMC = false;
13045
bool sendClustersPerSector = false;
13146
};
132-
13347
} // namespace ca
13448

13549
/// create a processor spec for the CATracker

Detectors/TPC/workflow/src/RecoWorkflow.cxx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -421,22 +421,21 @@ framework::WorkflowSpec getWorkflow(CompletionPolicyData* policyData, std::vecto
421421
//
422422
// selected by output type 'tracks'
423423
if (runTracker) {
424-
specs.emplace_back(o2::tpc::getCATrackerSpec(policyData, ca::Config{
425-
propagateMC ? ca::Operation::ProcessMC : ca::Operation::Noop,
426-
decompressTPC ? ca::Operation::DecompressTPC : ca::Operation::Noop,
427-
decompressTPC && inputType == InputType::CompClusters ? ca::Operation::DecompressTPCFromROOT : ca::Operation::Noop,
428-
caClusterer ? ca::Operation::CAClusterer : ca::Operation::Noop,
429-
zsDecoder ? ca::Operation::ZSDecoder : ca::Operation::Noop,
430-
zsOnTheFly ? ca::Operation::ZSOnTheFly : ca::Operation::Noop,
431-
produceTracks ? ca::Operation::OutputTracks : ca::Operation::Noop,
432-
produceCompClusters ? ca::Operation::OutputCompClusters : ca::Operation::Noop,
433-
runClusterEncoder ? ca::Operation::OutputCompClustersFlat : ca::Operation::Noop,
434-
isEnabled(OutputType::SendClustersPerSector) ? ca::Operation::SendClustersPerSector : ca::Operation::Noop,
435-
isEnabled(OutputType::QA) ? ca::Operation::OutputQA : ca::Operation::Noop,
436-
isEnabled(OutputType::Clusters) && (caClusterer || decompressTPC) ? ca::Operation::OutputCAClusters : ca::Operation::Noop,
437-
isEnabled(OutputType::Clusters) && isEnabled(OutputType::Tracks) && !isEnabled(OutputType::NoSharedClusterMap) ? ca::Operation::OutputSharedClusterMap : ca::Operation::Noop,
438-
},
439-
tpcSectors));
424+
ca::Config cfg;
425+
cfg.decompressTPC = decompressTPC;
426+
cfg.decompressTPCFromROOT = decompressTPC && inputType == InputType::CompClusters;
427+
cfg.caClusterer = caClusterer;
428+
cfg.zsDecoder = zsDecoder;
429+
cfg.zsOnTheFly = zsOnTheFly;
430+
cfg.outputTracks = produceTracks;
431+
cfg.outputCompClusters = produceCompClusters;
432+
cfg.outputCompClustersFlat = runClusterEncoder;
433+
cfg.outputCAClusters = isEnabled(OutputType::Clusters) && (caClusterer || decompressTPC);
434+
cfg.outputQA = isEnabled(OutputType::QA);
435+
cfg.outputSharedClusterMap = isEnabled(OutputType::Clusters) && isEnabled(OutputType::Tracks) && !isEnabled(OutputType::NoSharedClusterMap);
436+
cfg.processMC = propagateMC;
437+
cfg.sendClustersPerSector = isEnabled(OutputType::SendClustersPerSector);
438+
specs.emplace_back(o2::tpc::getCATrackerSpec(policyData, cfg, tpcSectors));
440439
}
441440

442441
//////////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)