@@ -974,17 +974,15 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
974974 auto v0sCursor = v0sBuilder.cursor <o2::aod::StoredV0s>();
975975 auto zdcCursor = zdcBuilder.cursor <o2::aod::Zdcs>();
976976
977- o2::steer::MCKinematicsReader mcReader (" collisioncontext.root" );
978- const auto mcContext = mcReader.getDigitizationContext ();
979- const auto & mcRecords = mcContext->getEventRecords ();
980- const auto & mcParts = mcContext->getEventParts ();
981-
982- LOG (DEBUG ) << " FOUND " << mcRecords.size () << " records" ;
983- LOG (DEBUG ) << " FOUND " << mcParts.size () << " parts" ;
977+ std::unique_ptr<o2::steer::MCKinematicsReader> mcReader;
978+ if (mUseMC ) {
979+ mcReader = std::make_unique<o2::steer::MCKinematicsReader>(" collisioncontext.root" );
980+ LOG (DEBUG ) << " FOUND " << mcReader->getDigitizationContext ()->getEventRecords ().size ()
981+ << " records" << mcReader->getDigitizationContext ()->getEventParts ().size () << " parts" ;
982+ }
984983
985984 std::map<uint64_t , int > bcsMap;
986- collectBCs (fddRecPoints, ft0RecPoints, fv0RecPoints, primVertices, mcRecords, bcsMap);
987-
985+ collectBCs (fddRecPoints, ft0RecPoints, fv0RecPoints, primVertices, mUseMC ? mcReader->getDigitizationContext ().getEventRecords () : std::vector<o2::InteractionTimeRecord>{}, bcsMap);
988986 const auto * dh = o2::header::get<o2::header::DataHeader*>(pc.inputs ().getFirstValid (true ).header );
989987 o2::InteractionRecord startIR = {0 , dh->firstTForbit };
990988
@@ -1071,7 +1069,9 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
10711069 // TODO: figure out collision weight
10721070 float mcColWeight = 1 .;
10731071 // filling mcCollision table
1074- int nMCCollisions = mcContext->getNCollisions ();
1072+ int nMCCollisions = mcReader->getDigitizationContext ()->getNCollisions ();
1073+ const auto & mcRecords = mcReader->getDigitizationContext ()->getEventRecords ();
1074+ const auto & mcParts = mcReader->getDigitizationContext ()->getEventParts ();
10751075 for (int iCol = 0 ; iCol < nMCCollisions; iCol++) {
10761076 auto time = mcRecords[iCol].getTimeNS ();
10771077 auto globalBC = mcRecords[iCol].toLong ();
@@ -1090,7 +1090,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
10901090 // FIXME:
10911091 // use generators' names for generatorIDs (?)
10921092 short generatorID = sourceID;
1093- auto & header = mcReader. getMCEventHeader (sourceID, eventID);
1093+ auto & header = mcReader-> getMCEventHeader (sourceID, eventID);
10941094 mcCollisionsCursor (0 ,
10951095 bcID,
10961096 generatorID,
@@ -1294,7 +1294,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
12941294
12951295 if (mUseMC ) {
12961296 // filling mc particles table
1297- fillMCParticlesTable (mcReader,
1297+ fillMCParticlesTable (* mcReader,
12981298 mcParticlesCursor,
12991299 primVer2TRefs,
13001300 primVerGIs,
0 commit comments