diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index 388845edc575c..c232d5a698d83 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -1781,15 +1781,6 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto fwdTracksCursor = createTableCursor(pc); auto fwdTracksCovCursor = createTableCursor(pc); auto fwdTrkClsCursor = createTableCursor(pc); - auto mcColLabelsCursor = createTableCursor(pc); - auto mcCollisionsCursor = createTableCursor(pc); - auto hepmcXSectionsCursor = createTableCursor(pc); - auto hepmcPdfInfosCursor = createTableCursor(pc); - auto hepmcHeavyIonsCursor = createTableCursor(pc); - auto mcMFTTrackLabelCursor = createTableCursor(pc); - auto mcFwdTrackLabelCursor = createTableCursor(pc); - auto mcParticlesCursor = createTableCursor(pc); - auto mcTrackLabelCursor = createTableCursor(pc); auto mftTracksCursor = createTableCursor(pc); auto tracksCursor = createTableCursor(pc); auto tracksCovCursor = createTableCursor(pc); @@ -1803,10 +1794,33 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto hmpCursor = createTableCursor(pc); auto caloCellsCursor = createTableCursor(pc); auto caloCellsTRGTableCursor = createTableCursor(pc); - auto mcCaloLabelsCursor = createTableCursor(pc); auto cpvClustersCursor = createTableCursor(pc); auto originCursor = createTableCursor(pc); + // Declare MC cursors type without adding the output for a table + o2::framework::Produces mcColLabelsCursor; + o2::framework::Produces mcCollisionsCursor; + o2::framework::Produces hepmcXSectionsCursor; + o2::framework::Produces hepmcPdfInfosCursor; + o2::framework::Produces hepmcHeavyIonsCursor; + o2::framework::Produces mcMFTTrackLabelCursor; + o2::framework::Produces mcFwdTrackLabelCursor; + o2::framework::Produces mcParticlesCursor; + o2::framework::Produces mcTrackLabelCursor; + o2::framework::Produces mcCaloLabelsCursor; + if (mUseMC) { // This creates the actual writercursor + mcColLabelsCursor = createTableCursor(pc); + mcCollisionsCursor = createTableCursor(pc); + hepmcXSectionsCursor = createTableCursor(pc); + hepmcPdfInfosCursor = createTableCursor(pc); + hepmcHeavyIonsCursor = createTableCursor(pc); + mcMFTTrackLabelCursor = createTableCursor(pc); + mcFwdTrackLabelCursor = createTableCursor(pc); + mcParticlesCursor = createTableCursor(pc); + mcTrackLabelCursor = createTableCursor(pc); + mcCaloLabelsCursor = createTableCursor(pc); + } + std::unique_ptr mcReader; if (mUseMC) { mcReader = std::make_unique("collisioncontext.root"); @@ -2909,14 +2923,6 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), - OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), @@ -2935,18 +2941,30 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), - OutputForTable::spec(), OutputForTable::spec(), - // todo: use addTableToOuput helper? - // currently the description is MCCOLLISLABEL, so - // the name in AO2D would be O2mccollislabel - // addTableToOutput(outputs); - {OutputLabel{"McCollisionLabels"}, "AOD", "MCCOLLISIONLABEL", 0, Lifetime::Timeframe}, OutputSpec{"TFN", "TFNumber"}, OutputSpec{"TFF", "TFFilename"}, OutputSpec{"AMD", "AODMetadataKeys"}, OutputSpec{"AMD", "AODMetadataVals"}}; + if (useMC) { + outputs.insert(outputs.end(), + {OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + OutputForTable::spec(), + // todo: use addTableToOuput helper? + // currently the description is MCCOLLISLABEL, so + // the name in AO2D would be O2mccollislabel + // addTableToOutput(outputs); + {OutputLabel{"McCollisionLabels"}, "AOD", "MCCOLLISIONLABEL", 0, Lifetime::Timeframe}}); + } + return DataProcessorSpec{ "aod-producer-workflow", dataRequest->inputs,