Skip to content

Commit 9e0af1b

Browse files
committed
DPL Analysis: provide dpl-metadata-tables
ArrayString of tables in the first AOD to be read.
1 parent 44f6af3 commit 9e0af1b

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

Framework/AnalysisSupport/src/Plugin.cxx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,25 @@ struct RunSummary : o2::framework::ServicePlugin {
6565
}
6666
};
6767

68+
std::vector<std::string> getListOfTables(TFile* f)
69+
{
70+
std::vector<std::string> r;
71+
TList* keyList = f->GetListOfKeys();
72+
73+
for (auto key : *keyList) {
74+
if (!std::string_view(key->GetName()).starts_with("DF_")) {
75+
continue;
76+
}
77+
auto* d = (TDirectory*)f->Get(key->GetName());
78+
TList* branchList = d->GetListOfKeys();
79+
for (auto b : *branchList) {
80+
r.emplace_back(b->GetName());
81+
}
82+
break;
83+
}
84+
return r;
85+
}
86+
6887
struct DiscoverMetadataInAOD : o2::framework::ConfigDiscoveryPlugin {
6988
ConfigDiscovery* create() override
7089
{
@@ -118,6 +137,11 @@ struct DiscoverMetadataInAOD : o2::framework::ConfigDiscoveryPlugin {
118137
char const* value = strdup(objString->String());
119138
results.push_back(ConfigParamSpec{key, VariantType::String, value, {"Metadata in AOD"}});
120139
}
140+
141+
auto tables = getListOfTables(currentFile);
142+
if (tables.empty() == false) {
143+
results.push_back(ConfigParamSpec{"aod-metadata-tables", VariantType::ArrayString, tables, {"Tables in first AOD"}});
144+
}
121145
return results;
122146
}};
123147
}

Framework/TestWorkflows/src/o2TestHistograms.cxx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,23 @@ struct EtaAndClsHistogramsFull {
4949
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
5050
{
5151
std::string runType = "3";
52+
std::vector<std::string> tables;
5253
if (cfgc.options().hasOption("aod-metadata-Run")) {
5354
runType = cfgc.options().get<std::string>("aod-metadata-Run");
5455
}
56+
if (cfgc.options().hasOption("aod-metadata-tables")) {
57+
tables = cfgc.options().get<std::vector<std::string>>("aod-metadata-tables");
58+
}
5559
LOGP(info, "Runtype is {}", runType);
60+
bool hasTrackCov = false;
61+
for (auto& table : tables) {
62+
if (table.starts_with("O2trackcov")) {
63+
hasTrackCov = true;
64+
}
65+
LOGP(info, "- {} present.", table);
66+
}
5667
// Notice it's important for the tasks to use the same name, otherwise topology generation will be confused.
57-
if (runType == "2") {
68+
if (runType == "2" || !hasTrackCov) {
5869
LOGP(info, "Using only tracks {}", runType);
5970
return WorkflowSpec{
6071
adaptAnalysisTask<EtaAndClsHistogramsSimple>(cfgc, TaskName{"simple-histos"}),

0 commit comments

Comments
 (0)