Skip to content

Commit 9a47f41

Browse files
committed
AnalysisContext -> DanglingEdgesContext
1 parent 70b1040 commit 9a47f41

File tree

8 files changed

+90
-91
lines changed

8 files changed

+90
-91
lines changed

Framework/AnalysisSupport/src/AODReaderHelpers.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "Framework/AlgorithmSpec.h"
2020
#include "Framework/DataSpecUtils.h"
2121
#include "Framework/ConfigContext.h"
22-
#include "Framework/AnalysisContext.h"
22+
#include "Framework/DanglingEdgesContext.h"
2323

2424
namespace o2::framework::readers
2525
{
@@ -81,7 +81,7 @@ struct Buildable {
8181

8282
AlgorithmSpec AODReaderHelpers::indexBuilderCallback(ConfigContext const& ctx)
8383
{
84-
auto& ac = ctx.services().get<AnalysisContext>();
84+
auto& ac = ctx.services().get<DanglingEdgesContext>();
8585
return AlgorithmSpec::InitCallback{[requested = ac.requestedIDXs](InitContext& /*ic*/) {
8686
std::vector<Buildable> buildables;
8787
for (auto& i : requested) {
@@ -183,7 +183,7 @@ struct Spawnable {
183183

184184
AlgorithmSpec AODReaderHelpers::aodSpawnerCallback(ConfigContext const& ctx)
185185
{
186-
auto& ac = ctx.services().get<AnalysisContext>();
186+
auto& ac = ctx.services().get<DanglingEdgesContext>();
187187
return AlgorithmSpec::InitCallback{[requested = ac.spawnerInputs](InitContext& /*ic*/) {
188188
std::vector<Spawnable> spawnables;
189189
for (auto& i : requested) {

Framework/AnalysisSupport/src/AODWriterHelpers.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
#include "Framework/AnalysisContext.h"
11+
#include "Framework/DanglingEdgesContext.h"
1212
#include "Framework/ConfigContext.h"
1313
#include "Framework/ControlService.h"
1414
#include "AODWriterHelpers.h"
@@ -62,7 +62,7 @@ const static std::unordered_map<OutputObjHandlingPolicy, std::string> ROOTfileNa
6262

6363
AlgorithmSpec AODWriterHelpers::getOutputTTreeWriter(ConfigContext const& ctx)
6464
{
65-
auto& ac = ctx.services().get<AnalysisContext>();
65+
auto& ac = ctx.services().get<DanglingEdgesContext>();
6666
auto dod = AnalysisSupportHelpers::getDataOutputDirector(ctx);
6767
int compressionLevel = 505;
6868
if (ctx.options().hasOption("aod-writer-compression")) {
@@ -245,7 +245,7 @@ AlgorithmSpec AODWriterHelpers::getOutputTTreeWriter(ConfigContext const& ctx)
245245
AlgorithmSpec AODWriterHelpers::getOutputObjHistWriter(ConfigContext const& ctx)
246246
{
247247
using namespace monitoring;
248-
auto& ac = ctx.services().get<AnalysisContext>();
248+
auto& ac = ctx.services().get<DanglingEdgesContext>();
249249
auto tskmap = ac.outTskMap;
250250
auto objmap = ac.outObjHistMap;
251251

Framework/CCDBSupport/src/AnalysisCCDBHelpers.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "Framework/RawDeviceService.h"
1919
#include "Framework/Output.h"
2020
#include "Framework/Signpost.h"
21-
#include "Framework/AnalysisContext.h"
21+
#include "Framework/DanglingEdgesContext.h"
2222
#include "Framework/ConfigContext.h"
2323
#include "Framework/ConfigContext.h"
2424
#include <arrow/array/builder_binary.h>
@@ -69,7 +69,7 @@ void fillValidRoutes(CCDBFetcherHelper& helper, std::vector<o2::framework::Outpu
6969

7070
AlgorithmSpec AnalysisCCDBHelpers::fetchFromCCDB(ConfigContext const& ctx)
7171
{
72-
auto& ac = ctx.services().get<AnalysisContext>();
72+
auto& ac = ctx.services().get<DanglingEdgesContext>();
7373
std::vector<std::shared_ptr<arrow::Schema>> schemas;
7474
auto schemaMetadata = std::make_shared<arrow::KeyValueMetadata>();
7575

Framework/Core/include/Framework/AnalysisSupportHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "Framework/OutputSpec.h"
1515
#include "Framework/InputSpec.h"
1616
#include "Framework/DataProcessorSpec.h"
17-
#include "Framework/AnalysisContext.h"
17+
#include "Framework/DanglingEdgesContext.h"
1818
#include "Headers/DataHeader.h"
1919
#include <array>
2020

Framework/Core/include/Framework/AnalysisContext.h renamed to Framework/Core/include/Framework/DanglingEdgesContext.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
#ifndef O2_FRAMEWORK_ANALYSISCONTEXT_H_
12-
#define O2_FRAMEWORK_ANALYSISCONTEXT_H_
11+
#ifndef O2_FRAMEWORK_DANGLINGEDGESCONTEXT_H_
12+
#define O2_FRAMEWORK_DANGLINGEDGESCONTEXT_H_
1313

1414
#include <vector>
1515
#include "Framework/InputSpec.h"
@@ -32,7 +32,7 @@ struct OutputObjectInfo {
3232
// This will keep track of the inputs which have
3333
// been requested and for which we will need to inject
3434
// some source device.
35-
struct AnalysisContext {
35+
struct DanglingEdgesContext {
3636
std::vector<InputSpec> requestedAODs;
3737
std::vector<OutputSpec> providedAODs;
3838
std::vector<InputSpec> requestedDYNs;
@@ -63,4 +63,4 @@ struct AnalysisContext {
6363
extern template class std::vector<o2::framework::OutputObjectInfo>;
6464
extern template class std::vector<o2::framework::OutputTaskInfo>;
6565

66-
#endif // O2_FRAMEWORK_ANALYSISCONTEXT_H_
66+
#endif // O2_FRAMEWORK_DANGLINGEDGESCONTEXT_H_

Framework/Core/src/AnalysisSupportHelpers.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace o2::framework
2525
std::shared_ptr<DataOutputDirector> AnalysisSupportHelpers::getDataOutputDirector(ConfigContext const& ctx)
2626
{
2727
auto const& options = ctx.options();
28-
auto const& OutputsInputs = ctx.services().get<AnalysisContext>().outputsInputs;
29-
auto const& isDangling = ctx.services().get<AnalysisContext>().isDangling;
28+
auto const& OutputsInputs = ctx.services().get<DanglingEdgesContext>().outputsInputs;
29+
auto const& isDangling = ctx.services().get<DanglingEdgesContext>().isDangling;
3030

3131
std::shared_ptr<DataOutputDirector> dod = std::make_shared<DataOutputDirector>();
3232

@@ -200,7 +200,7 @@ DataProcessorSpec AnalysisSupportHelpers::getOutputObjHistSink(ConfigContext con
200200
DataProcessorSpec
201201
AnalysisSupportHelpers::getGlobalAODSink(ConfigContext const& ctx)
202202
{
203-
auto& ac = ctx.services().get<AnalysisContext>();
203+
auto& ac = ctx.services().get<DanglingEdgesContext>();
204204

205205
// the command line options relevant for the writer are global
206206
// see runDataProcessing.h

Framework/Core/src/ArrowSupport.cxx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -588,68 +588,68 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
588588
auto builder = std::find_if(workflow.begin(), workflow.end(), [](DataProcessorSpec const& spec) { return spec.name == "internal-dpl-aod-index-builder"; });
589589
auto reader = std::find_if(workflow.begin(), workflow.end(), [](DataProcessorSpec const& spec) { return spec.name == "internal-dpl-aod-reader"; });
590590
auto writer = std::find_if(workflow.begin(), workflow.end(), [](DataProcessorSpec const& spec) { return spec.name == "internal-dpl-aod-writer"; });
591-
auto &ac = ctx.services().get<AnalysisContext>();
592-
ac.requestedAODs.clear();
593-
ac.requestedDYNs.clear();
594-
ac.providedDYNs.clear();
595-
ac.providedTIMs.clear();
596-
ac.requestedTIMs.clear();
591+
auto &dec = ctx.services().get<DanglingEdgesContext>();
592+
dec.requestedAODs.clear();
593+
dec.requestedDYNs.clear();
594+
dec.providedDYNs.clear();
595+
dec.providedTIMs.clear();
596+
dec.requestedTIMs.clear();
597597

598598
auto inputSpecLessThan = [](InputSpec const& lhs, InputSpec const& rhs) { return DataSpecUtils::describe(lhs) < DataSpecUtils::describe(rhs); };
599599
auto outputSpecLessThan = [](OutputSpec const& lhs, OutputSpec const& rhs) { return DataSpecUtils::describe(lhs) < DataSpecUtils::describe(rhs); };
600600

601601
if (builder != workflow.end()) {
602602
// collect currently requested IDXs
603-
ac.requestedIDXs.clear();
603+
dec.requestedIDXs.clear();
604604
for (auto& d : workflow | views::exclude_by_name(builder->name)) {
605605
d.inputs |
606606
views::partial_match_filter(header::DataOrigin{"IDX"}) |
607-
sinks::update_input_list{ac.requestedIDXs};
607+
sinks::update_input_list{dec.requestedIDXs};
608608
}
609609
// recreate inputs and outputs
610610
builder->inputs.clear();
611611
builder->outputs.clear();
612612
// replace AlgorithmSpec
613613
// FIXME: it should be made more generic, so it does not need replacement...
614614
builder->algorithm = PluginManager::loadAlgorithmFromPlugin("O2FrameworkOnDemandTablesSupport", "IndexTableBuilder", ctx); // readers::AODReaderHelpers::indexBuilderCallback(ctx);
615-
AnalysisSupportHelpers::addMissingOutputsToBuilder(ac.requestedIDXs, ac.requestedAODs, ac.requestedDYNs, *builder);
615+
AnalysisSupportHelpers::addMissingOutputsToBuilder(dec.requestedIDXs, dec.requestedAODs, dec.requestedDYNs, *builder);
616616
}
617617

618618
if (spawner != workflow.end()) {
619619
// collect currently requested DYNs
620620
for (auto& d : workflow | views::exclude_by_name(spawner->name)) {
621621
d.inputs |
622622
views::partial_match_filter(header::DataOrigin{"DYN"}) |
623-
sinks::update_input_list{ac.requestedDYNs};
623+
sinks::update_input_list{dec.requestedDYNs};
624624
d.outputs |
625625
views::partial_match_filter(header::DataOrigin{"DYN"}) |
626-
sinks::append_to{ac.providedDYNs};
626+
sinks::append_to{dec.providedDYNs};
627627
}
628-
std::sort(ac.requestedDYNs.begin(), ac.requestedDYNs.end(), inputSpecLessThan);
629-
std::sort(ac.providedDYNs.begin(), ac.providedDYNs.end(), outputSpecLessThan);
630-
ac.spawnerInputs.clear();
631-
ac.requestedDYNs |
632-
views::filter_not_matching(ac.providedDYNs) |
633-
sinks::append_to{ac.spawnerInputs};
628+
std::sort(dec.requestedDYNs.begin(), dec.requestedDYNs.end(), inputSpecLessThan);
629+
std::sort(dec.providedDYNs.begin(), dec.providedDYNs.end(), outputSpecLessThan);
630+
dec.spawnerInputs.clear();
631+
dec.requestedDYNs |
632+
views::filter_not_matching(dec.providedDYNs) |
633+
sinks::append_to{dec.spawnerInputs};
634634
// recreate inputs and outputs
635635
spawner->outputs.clear();
636636
spawner->inputs.clear();
637-
AnalysisSupportHelpers::addMissingOutputsToSpawner({}, ac.spawnerInputs, ac.requestedAODs, *spawner);
637+
AnalysisSupportHelpers::addMissingOutputsToSpawner({}, dec.spawnerInputs, dec.requestedAODs, *spawner);
638638
// replace AlgorithmSpec
639639
// FIXME: it should be made more generic, so it does not need replacement...
640640
spawner->algorithm = PluginManager::loadAlgorithmFromPlugin("O2FrameworkOnDemandTablesSupport", "ExtendedTableSpawner", ctx);
641641
}
642642

643643
if (analysisCCDB != workflow.end()) {
644644
for (auto& d : workflow | views::exclude_by_name(analysisCCDB->name)) {
645-
d.inputs | views::partial_match_filter(header::DataOrigin{"ATIM"}) | sinks::update_input_list{ac.requestedTIMs};
646-
d.outputs | views::partial_match_filter(header::DataOrigin{"ATIM"}) | sinks::append_to{ac.providedTIMs};
645+
d.inputs | views::partial_match_filter(header::DataOrigin{"ATIM"}) | sinks::update_input_list{dec.requestedTIMs};
646+
d.outputs | views::partial_match_filter(header::DataOrigin{"ATIM"}) | sinks::append_to{dec.providedTIMs};
647647
}
648-
std::sort(ac.requestedTIMs.begin(), ac.requestedTIMs.end(), inputSpecLessThan);
649-
std::sort(ac.providedTIMs.begin(), ac.providedTIMs.end(), outputSpecLessThan);
648+
std::sort(dec.requestedTIMs.begin(), dec.requestedTIMs.end(), inputSpecLessThan);
649+
std::sort(dec.providedTIMs.begin(), dec.providedTIMs.end(), outputSpecLessThan);
650650
// Use ranges::to<std::vector<>> in C++23...
651-
ac.analysisCCDBInputs.clear();
652-
ac.requestedTIMs | views::filter_not_matching(ac.providedTIMs) | sinks::append_to{ac.analysisCCDBInputs};
651+
dec.analysisCCDBInputs.clear();
652+
dec.requestedTIMs | views::filter_not_matching(dec.providedTIMs) | sinks::append_to{dec.analysisCCDBInputs};
653653

654654
// recreate inputs and outputs
655655
analysisCCDB->outputs.clear();
@@ -658,7 +658,7 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
658658
// FIXME: it should be made more generic, so it does not need replacement...
659659
// FIXME how can I make the lookup depend on DYN tables as well??
660660
analysisCCDB->algorithm = PluginManager::loadAlgorithmFromPlugin("O2FrameworkCCDBSupport", "AnalysisCCDBFetcherPlugin", ctx);
661-
AnalysisSupportHelpers::addMissingOutputsToBuilder(ac.analysisCCDBInputs, ac.requestedAODs, ac.requestedDYNs, *analysisCCDB);
661+
AnalysisSupportHelpers::addMissingOutputsToBuilder(dec.analysisCCDBInputs, dec.requestedAODs, dec.requestedDYNs, *analysisCCDB);
662662
}
663663

664664
if (writer != workflow.end()) {
@@ -671,12 +671,12 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
671671
for (auto& d : workflow) {
672672
d.inputs |
673673
views::partial_match_filter(AODOrigins) |
674-
sinks::update_input_list{ac.requestedAODs};
674+
sinks::update_input_list{dec.requestedAODs};
675675
}
676676

677677
// remove unmatched outputs
678678
auto o_end = std::remove_if(reader->outputs.begin(), reader->outputs.end(), [&](OutputSpec const& o) {
679-
return !DataSpecUtils::partialMatch(o, o2::header::DataDescription{"TFNumber"}) && !DataSpecUtils::partialMatch(o, o2::header::DataDescription{"TFFilename"}) && std::none_of(ac.requestedAODs.begin(), ac.requestedAODs.end(), [&](InputSpec const& i) { return DataSpecUtils::match(i, o); });
679+
return !DataSpecUtils::partialMatch(o, o2::header::DataDescription{"TFNumber"}) && !DataSpecUtils::partialMatch(o, o2::header::DataDescription{"TFFilename"}) && std::none_of(dec.requestedAODs.begin(), dec.requestedAODs.end(), [&](InputSpec const& i) { return DataSpecUtils::match(i, o); });
680680
});
681681
reader->outputs.erase(o_end, reader->outputs.end());
682682
if (reader->outputs.empty()) {
@@ -694,22 +694,22 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
694694
// select outputs of type AOD which need to be saved
695695
// ATTENTION: if there are dangling outputs the getGlobalAODSink
696696
// has to be created in any case!
697-
ac.outputsInputsAOD.clear();
697+
dec.outputsInputsAOD.clear();
698698

699699
for (auto ii = 0u; ii < outputsInputs.size(); ii++) {
700700
if (DataSpecUtils::partialMatch(outputsInputs[ii], extendedAODOrigins)) {
701701
auto ds = dod->getDataOutputDescriptors(outputsInputs[ii]);
702702
if (!ds.empty() || isDangling[ii]) {
703-
ac.outputsInputsAOD.emplace_back(outputsInputs[ii]);
703+
dec.outputsInputsAOD.emplace_back(outputsInputs[ii]);
704704
}
705705
}
706706
}
707707

708708
// file sink for any AOD output
709-
if (!ac.outputsInputsAOD.empty()) {
709+
if (!dec.outputsInputsAOD.empty()) {
710710
// add TFNumber and TFFilename as input to the writer
711-
ac.outputsInputsAOD.emplace_back("tfn", "TFN", "TFNumber");
712-
ac.outputsInputsAOD.emplace_back("tff", "TFF", "TFFilename");
711+
dec.outputsInputsAOD.emplace_back("tfn", "TFN", "TFNumber");
712+
dec.outputsInputsAOD.emplace_back("tff", "TFF", "TFFilename");
713713
workflow.push_back(AnalysisSupportHelpers::getGlobalAODSink(ctx));
714714
}
715715
// Move the dummy sink at the end, if needed

0 commit comments

Comments
 (0)