Skip to content

Commit 17d865e

Browse files
jackal1-66sawenzel
authored andcommitted
Fix Header info forwarding
1 parent 48c0b54 commit 17d865e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Generators/src/GeneratorHybrid.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ bool GeneratorHybrid::importParticles()
420420
mMCEventHeader.clearInfo();
421421
if (mCocktailMode) {
422422
// in cocktail mode we need to merge the particles from the different generators
423+
bool baseGen = true; // first generator of the cocktail is used as reference to update the event header information
423424
for (auto subIndex : subGenIndex) {
424425
LOG(info) << "Importing particles for task " << subIndex;
425426
auto subParticles = gens[subIndex]->getParticles();
@@ -441,8 +442,10 @@ bool GeneratorHybrid::importParticles()
441442
}
442443

443444
mParticles.insert(mParticles.end(), subParticles.begin(), subParticles.end());
444-
// fetch the event Header information from the underlying generator
445-
gens[subIndex]->updateHeader(&mMCEventHeader);
445+
if (baseGen) {
446+
gens[subIndex]->updateHeader(&mMCEventHeader);
447+
baseGen = false;
448+
}
446449
mInputTaskQueue.push(subIndex);
447450
mTasksStarted++;
448451
}
@@ -481,7 +484,9 @@ bool GeneratorHybrid::importParticles()
481484
void GeneratorHybrid::updateHeader(o2::dataformats::MCEventHeader* eventHeader)
482485
{
483486
if (eventHeader) {
484-
// we forward the original header information if any
487+
// Forward the base class fields from FairMCEventHeader
488+
static_cast<FairMCEventHeader&>(*eventHeader) = static_cast<FairMCEventHeader&>(mMCEventHeader);
489+
// Copy the key-value store info
485490
eventHeader->copyInfoFrom(mMCEventHeader);
486491

487492
// put additional information about

0 commit comments

Comments
 (0)