Skip to content

Commit a881bab

Browse files
authored
Fix: fix classification of particle origins (#6673)
1 parent 5e7c564 commit a881bab

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de
1515

1616
#include <CCDB/BasicCCDBManager.h>
17+
#include <fairlogger/Logger.h>
1718
#include "Common/Core/trackUtilities.h"
1819
#include "Common/DataModel/EventSelection.h"
1920
#include "Common/DataModel/Multiplicity.h"
@@ -327,27 +328,37 @@ struct femtoDreamProducerTask {
327328
auto pdgCode = particleMC.pdgCode();
328329
int particleOrigin = 99;
329330
int pdgCodeMother = -1;
330-
// get list of mothers
331-
// could be empty (for example in case of injected light nuclei)
331+
// get list of mothers, but it could be empty (for example in case of injected light nuclei)
332332
auto motherparticlesMC = particleMC.template mothers_as<aod::McParticles>();
333333
// check pdg code
334+
// if this fails, the particle is a fake
334335
if (abs(pdgCode) == abs(ConfTrkPDGCode.value)) {
336+
// check first if particle is from pile up
337+
// check if the collision associated with the particle is the same as the analyzed collision by checking their Ids
335338
if ((col.has_mcCollision() && (particleMC.mcCollisionId() != col.mcCollisionId())) || !col.has_mcCollision()) {
336339
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kWrongCollision;
340+
// check if particle is primary
337341
} else if (particleMC.isPhysicalPrimary()) {
338342
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kPrimary;
339-
} else if (particleMC.getGenStatusCode() == -1) {
340-
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kMaterial;
341-
} else if (!motherparticlesMC.empty()) {
342-
// get direct mother of the particle
343+
// check if particle is secondary
344+
// particle is from a decay -> getProcess() == 4
345+
// particle is generated during transport -> getGenStatusCode() == -1
346+
// list of mothers is not empty
347+
} else if (particleMC.getProcess() == 4 && particleMC.getGenStatusCode() == -1 && !motherparticlesMC.empty()) {
348+
// get direct mother
343349
auto motherparticleMC = motherparticlesMC.front();
344350
pdgCodeMother = motherparticleMC.pdgCode();
345-
if (motherparticleMC.isPhysicalPrimary() && particleMC.getProcess() == 4) {
346-
particleOrigin = checkDaughterType(fdparttype, motherparticleMC.pdgCode());
347-
}
351+
particleOrigin = checkDaughterType(fdparttype, motherparticleMC.pdgCode());
352+
// check if particle is material
353+
// particle is from inelastic hadronic interaction -> getProcess() == 23
354+
// particle is generated during transport -> getGenStatusCode() == -1
355+
} else if (particleMC.getProcess() == 23 && particleMC.getGenStatusCode() == -1) {
356+
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kMaterial;
357+
// cross check to see if we missed a case
348358
} else {
349359
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kElse;
350360
}
361+
// if pdg code is wrong, particle is fake
351362
} else {
352363
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake;
353364
}

0 commit comments

Comments
 (0)