Skip to content

Commit 272c31d

Browse files
authored
Fix indices in case of no mother in HF embedding generator (#2498)
1 parent 392eb4d commit 272c31d

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎MC/config/PWGHF/external/generator/generator_pythia8_embed_hf.C‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ Bool_t importParticles() override
280280

281281
/// Establish if this particle comes from charm or beauty
282282
/// If not, ignore this particle and increase the number of discarded particles from the pp event
283-
if(!(nEvsHF == 0 && iPart < 1) && !isFromCharmOrBeauty(iPart, particlesHfEvent)) {
283+
if(!isFromCharmOrBeauty(iPart, particlesHfEvent)) {
284284
continue;
285285
}
286286
/// if we arrive here, then the current particle is from charm or beauty, keep it!
@@ -319,8 +319,8 @@ Bool_t importParticles() override
319319
if(idLastMother != idFirstMotherOrig) {
320320
idLastMother = findKey(mapHfParticles, idLastMother);
321321
if(idLastMother < 0) {
322-
// second mother not found, we set it to 0
323-
idLastMother = 0;
322+
// second mother not found, we set it to -1
323+
idLastMother = -1;
324324
}
325325
} else {
326326
/// idLastMother is equal to idFirstMother
@@ -352,10 +352,10 @@ Bool_t importParticles() override
352352
foundAnyMother = true;
353353
}
354354
}
355-
// set last mother to 0 if no mother has been found so far
355+
// set last mother to -1 if no mother has been found so far
356356
if (!foundAnyMother) {
357-
idLastMother = 0;
358-
idFirstMother = 0;
357+
idLastMother = -1;
358+
idFirstMother = -1;
359359
}
360360
}
361361

@@ -364,10 +364,10 @@ Bool_t importParticles() override
364364
idLastDaughter = findKey(mapHfParticles, idLastDaughter);
365365

366366
/// adjust the particle mother and daughter indices
367-
particle.SetFirstMother((idFirstMother > 0) ? idFirstMother + offset : idFirstMother);
368-
particle.SetLastMother((idLastMother > 0) ? idLastMother + offset : idLastMother);
369-
particle.SetFirstDaughter((idFirstDaughter > 0) ? idFirstDaughter + offset : idFirstDaughter);
370-
particle.SetLastDaughter((idLastDaughter > 0) ? idLastDaughter + offset : idLastDaughter);
367+
particle.SetFirstMother((idFirstMother >= 0) ? idFirstMother + offset : idFirstMother);
368+
particle.SetLastMother((idLastMother >= 0) ? idLastMother + offset : idLastMother);
369+
particle.SetFirstDaughter((idFirstDaughter >= 0) ? idFirstDaughter + offset : idFirstDaughter);
370+
particle.SetLastDaughter((idLastDaughter >= 0) ? idLastDaughter + offset : idLastDaughter);
371371

372372
/// copy inside this.mParticles from mGeneratorEvHF.mParticles, i.e. the particles generated in mGeneratorEvHF
373373
mParticles.push_back(particle);

0 commit comments

Comments
 (0)