@@ -420,24 +420,26 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
420420 auto builder = std::find_if (workflow.begin (), workflow.end (), [](DataProcessorSpec const & spec) { return spec.name == " internal-dpl-aod-index-builder" ; });
421421 auto reader = std::find_if (workflow.begin (), workflow.end (), [](DataProcessorSpec const & spec) { return spec.name == " internal-dpl-aod-reader" ; });
422422 auto writer = std::find_if (workflow.begin (), workflow.end (), [](DataProcessorSpec const & spec) { return spec.name == " internal-dpl-aod-writer" ; });
423- std::vector<InputSpec> requestedAODs;
424- std::vector<InputSpec> requestedDYNs;
425- std::vector<OutputSpec> providedDYNs;
423+ auto &ac = ctx.services ().get <AnalysisContext>();
424+ ac.requestedAODs .clear ();
425+ ac.requestedDYNs .clear ();
426+ ac.providedDYNs .clear ();
427+
426428
427429 auto inputSpecLessThan = [](InputSpec const & lhs, InputSpec const & rhs) { return DataSpecUtils::describe (lhs) < DataSpecUtils::describe (rhs); };
428430 auto outputSpecLessThan = [](OutputSpec const & lhs, OutputSpec const & rhs) { return DataSpecUtils::describe (lhs) < DataSpecUtils::describe (rhs); };
429431
430432 if (builder != workflow.end ()) {
431433 // collect currently requested IDXs
432- std::vector<InputSpec> requestedIDXs;
434+ ac. requestedIDXs . clear () ;
433435 for (auto & d : workflow) {
434436 if (d.name == builder->name ) {
435437 continue ;
436438 }
437439 for (auto & i : d.inputs ) {
438440 if (DataSpecUtils::partialMatch (i, header::DataOrigin{" IDX" })) {
439441 auto copy = i;
440- DataSpecUtils::updateInputList (requestedIDXs, std::move (copy));
442+ DataSpecUtils::updateInputList (ac. requestedIDXs , std::move (copy));
441443 }
442444 }
443445 }
@@ -446,8 +448,8 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
446448 builder->outputs .clear ();
447449 // replace AlgorithmSpec
448450 // FIXME: it should be made more generic, so it does not need replacement...
449- builder->algorithm = readers::AODReaderHelpers::indexBuilderCallback (requestedIDXs);
450- AnalysisSupportHelpers::addMissingOutputsToBuilder (requestedIDXs, requestedAODs, requestedDYNs, *builder);
451+ builder->algorithm = readers::AODReaderHelpers::indexBuilderCallback (ac. requestedIDXs );
452+ AnalysisSupportHelpers::addMissingOutputsToBuilder (ac. requestedIDXs , ac. requestedAODs , ac. requestedDYNs , *builder);
451453 }
452454
453455 if (spawner != workflow.end ()) {
@@ -459,20 +461,20 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
459461 for (auto const & i : d.inputs ) {
460462 if (DataSpecUtils::partialMatch (i, header::DataOrigin{" DYN" })) {
461463 auto copy = i;
462- DataSpecUtils::updateInputList (requestedDYNs, std::move (copy));
464+ DataSpecUtils::updateInputList (ac. requestedDYNs , std::move (copy));
463465 }
464466 }
465467 for (auto const & o : d.outputs ) {
466468 if (DataSpecUtils::partialMatch (o, header::DataOrigin{" DYN" })) {
467- providedDYNs.emplace_back (o);
469+ ac. providedDYNs .emplace_back (o);
468470 }
469471 }
470472 }
471- std::sort (requestedDYNs.begin (), requestedDYNs.end (), inputSpecLessThan);
472- std::sort (providedDYNs.begin (), providedDYNs.end (), outputSpecLessThan);
473+ std::sort (ac. requestedDYNs .begin (), ac. requestedDYNs .end (), inputSpecLessThan);
474+ std::sort (ac. providedDYNs .begin (), ac. providedDYNs .end (), outputSpecLessThan);
473475 std::vector<InputSpec> spawnerInputs;
474- for (auto & input : requestedDYNs) {
475- if (std::none_of (providedDYNs.begin (), providedDYNs.end (), [&input](auto const & x) { return DataSpecUtils::match (input, x); })) {
476+ for (auto & input : ac. requestedDYNs ) {
477+ if (std::none_of (ac. providedDYNs .begin (), ac. providedDYNs .end (), [&input](auto const & x) { return DataSpecUtils::match (input, x); })) {
476478 spawnerInputs.emplace_back (input);
477479 }
478480 }
@@ -482,7 +484,7 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
482484 // replace AlgorithmSpec
483485 // FIXME: it should be made more generic, so it does not need replacement...
484486 spawner->algorithm = readers::AODReaderHelpers::aodSpawnerCallback (spawnerInputs);
485- AnalysisSupportHelpers::addMissingOutputsToSpawner ({}, spawnerInputs, requestedAODs, *spawner);
487+ AnalysisSupportHelpers::addMissingOutputsToSpawner ({}, spawnerInputs, ac. requestedAODs , *spawner);
486488 }
487489
488490 if (writer != workflow.end ()) {
@@ -496,14 +498,14 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
496498 for (auto const & i : d.inputs ) {
497499 if (DataSpecUtils::partialMatch (i, AODOrigins)) {
498500 auto copy = i;
499- DataSpecUtils::updateInputList (requestedAODs, std::move (copy));
501+ DataSpecUtils::updateInputList (ac. requestedAODs , std::move (copy));
500502 }
501503 }
502504 }
503505
504506 // remove unmatched outputs
505507 auto o_end = std::remove_if (reader->outputs .begin (), reader->outputs .end (), [&](OutputSpec const & o) {
506- return !DataSpecUtils::partialMatch (o, o2::header::DataDescription{" TFNumber" }) && !DataSpecUtils::partialMatch (o, o2::header::DataDescription{" TFFilename" }) && std::none_of (requestedAODs.begin (), requestedAODs.end (), [&](InputSpec const & i) { return DataSpecUtils::match (i, o); });
508+ 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); });
507509 });
508510 reader->outputs .erase (o_end, reader->outputs .end ());
509511 if (reader->outputs .empty ()) {
@@ -521,22 +523,22 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
521523 // select outputs of type AOD which need to be saved
522524 // ATTENTION: if there are dangling outputs the getGlobalAODSink
523525 // has to be created in any case!
524- std::vector<InputSpec> outputsInputsAOD;
526+ ac. outputsInputsAOD . clear () ;
525527
526528 for (auto ii = 0u ; ii < outputsInputs.size (); ii++) {
527529 if (DataSpecUtils::partialMatch (outputsInputs[ii], extendedAODOrigins)) {
528530 auto ds = dod->getDataOutputDescriptors (outputsInputs[ii]);
529531 if (!ds.empty () || isDangling[ii]) {
530- outputsInputsAOD.emplace_back (outputsInputs[ii]);
532+ ac. outputsInputsAOD .emplace_back (outputsInputs[ii]);
531533 }
532534 }
533535 }
534536
535537 // file sink for any AOD output
536- if (!outputsInputsAOD.empty ()) {
538+ if (!ac. outputsInputsAOD .empty ()) {
537539 // add TFNumber and TFFilename as input to the writer
538- outputsInputsAOD.emplace_back (" tfn" , " TFN" , " TFNumber" );
539- outputsInputsAOD.emplace_back (" tff" , " TFF" , " TFFilename" );
540+ ac. outputsInputsAOD .emplace_back (" tfn" , " TFN" , " TFNumber" );
541+ ac. outputsInputsAOD .emplace_back (" tff" , " TFF" , " TFFilename" );
540542 workflow.push_back (AnalysisSupportHelpers::getGlobalAODSink (ctx));
541543 }
542544 // Move the dummy sink at the end, if needed
0 commit comments