From 87471b4b9023e63e71d51e4b5de3df82115dc4fa Mon Sep 17 00:00:00 2001 From: Victor Gonzalez Date: Fri, 4 Feb 2022 22:19:32 +0100 Subject: [PATCH] Moving to the default McParticles --- PWGCF/TableProducer/dptdptfilter.cxx | 14 ++++++------- PWGCF/TableProducer/dptdptfilter.h | 30 +++++++++++++++++----------- PWGCF/Tasks/match-reco-gen.cxx | 4 ++-- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/PWGCF/TableProducer/dptdptfilter.cxx b/PWGCF/TableProducer/dptdptfilter.cxx index 79b4b245ceb..d70a1ec1a70 100644 --- a/PWGCF/TableProducer/dptdptfilter.cxx +++ b/PWGCF/TableProducer/dptdptfilter.cxx @@ -638,15 +638,15 @@ struct DptDptFilter { PROCESS_SWITCH(DptDptFilter, processWithoutCentPIDDetectorLevel, "Process PID MC detector level without centrality", false); template - void processGenerated(CollisionObject const& mccollision, aod::McParticles_000 const& mcparticles, float centormult); + void processGenerated(CollisionObject const& mccollision, aod::McParticles const& mcparticles, float centormult); void processWithCentGeneratorLevel(aod::McCollision const& mccollision, soa::Join const& collisions, - aod::McParticles_000 const& mcparticles); + aod::McParticles const& mcparticles); PROCESS_SWITCH(DptDptFilter, processWithCentGeneratorLevel, "Process generated with centrality", false); void processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, - aod::McParticles_000 const& mcparticles); + aod::McParticles const& mcparticles); PROCESS_SWITCH(DptDptFilter, processWithoutCentGeneratorLevel, "Process generated without centrality", false); }; @@ -666,7 +666,7 @@ MatchRecoGenSpecies DptDptFilter::trackIdentification(TrackObject const& track) } } else if (recoIdMethod == 2) { if constexpr (framework::has_type_v) { - sp = IdentifyParticle(track.template mcParticle_as()); + sp = IdentifyParticle(track.template mcParticle_as()); } else { LOGF(fatal, "Track identification required from MC particle but MC information not present"); } @@ -936,7 +936,7 @@ void DptDptFilter::processWithoutCentPIDDetectorLevel(aod::CollisionEvSel const& } template -void DptDptFilter::processGenerated(CollisionObject const& mccollision, aod::McParticles_000 const& mcparticles, float centormult) +void DptDptFilter::processGenerated(CollisionObject const& mccollision, aod::McParticles const& mcparticles, float centormult) { using namespace dptdptfilter; @@ -972,7 +972,7 @@ void DptDptFilter::processGenerated(CollisionObject const& mccollision, aod::McP void DptDptFilter::processWithCentGeneratorLevel(aod::McCollision const& mccollision, soa::Join const& collisions, - aod::McParticles_000 const& mcparticles) + aod::McParticles const& mcparticles) { using namespace dptdptfilter; @@ -996,7 +996,7 @@ void DptDptFilter::processWithCentGeneratorLevel(aod::McCollision const& mccolli } void DptDptFilter::processWithoutCentGeneratorLevel(aod::McCollision const& mccollision, - aod::McParticles_000 const& mcparticles) + aod::McParticles const& mcparticles) { using namespace dptdptfilter; diff --git a/PWGCF/TableProducer/dptdptfilter.h b/PWGCF/TableProducer/dptdptfilter.h index 80b92889e8f..f7a60e1b3de 100644 --- a/PWGCF/TableProducer/dptdptfilter.h +++ b/PWGCF/TableProducer/dptdptfilter.h @@ -421,6 +421,20 @@ inline void AcceptTrack(TrackObject const& track, uint8_t& asone, uint8_t& astwo } } +template +void exploreMothers(ParticleObject& particle, MCCollisionObject& collision) +{ + for (auto& m : particle.template mothers_as()) { + LOGF(info, " mother index: %d", m.globalIndex()); + LOGF(info, " Tracking back mother"); + LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", m.mcCollisionId(), collision.globalIndex()); + LOGF(info, " index: %d, pdg code: %d", m.globalIndex(), m.pdgCode()); + LOGF(info, " Passed isPhysicalPrimary(): %s", m.isPhysicalPrimary() ? "YES" : "NO"); + + exploreMothers(m, collision); + } +} + template inline void AcceptParticle(ParticleObject& particle, MCCollisionObject const& collision, uint8_t& asone, uint8_t& astwo) { @@ -439,21 +453,13 @@ inline void AcceptParticle(ParticleObject& particle, MCCollisionObject const& co float dcaz = TMath::Abs(particle.vz() - collision.posZ()); if (not((dcaxy < particleMaxDCAxy) and (dcaz < particleMaxDCAZ))) { if ((particle.mcCollisionId() == 0) and traceCollId0) { - auto currparticle = particle; LOGF(info, "Rejecting particle with dcaxy: %.2f and dcaz: %.2f", dcaxy, dcaz); - LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", currparticle.mcCollisionId(), collision.globalIndex()); + LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", particle.mcCollisionId(), collision.globalIndex()); LOGF(info, " Collision x: %.5f, y: %.5f, z: %.5f", collision.posX(), collision.posY(), collision.posZ()); LOGF(info, " Particle x: %.5f, y: %.5f, z: %.5f", particle.vx(), particle.vy(), particle.vz()); - LOGF(info, " index: %d, pdg code: %d", currparticle.globalIndex(), currparticle.pdgCode()); - while (currparticle.has_mother0()) { - LOGF(info, " mother0 index: %d, mother1 index: %d", currparticle.mother0Id(), currparticle.mother1Id()); - LOGF(info, " Tracking back mother0 index"); - auto newcurrparticle = currparticle.template mother0_as(); - LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", newcurrparticle.mcCollisionId(), collision.globalIndex()); - LOGF(info, " index: %d, pdg code: %d", newcurrparticle.globalIndex(), newcurrparticle.pdgCode()); - LOGF(info, " Passed isPhysicalPrimary(): %s", newcurrparticle.isPhysicalPrimary() ? "YES" : "NO"); - currparticle = newcurrparticle; - } + LOGF(info, " index: %d, pdg code: %d", particle.globalIndex(), particle.pdgCode()); + + exploreMothers(particle, collision); } return; } diff --git a/PWGCF/Tasks/match-reco-gen.cxx b/PWGCF/Tasks/match-reco-gen.cxx index 7fc143d43c0..f89c788b529 100644 --- a/PWGCF/Tasks/match-reco-gen.cxx +++ b/PWGCF/Tasks/match-reco-gen.cxx @@ -352,7 +352,7 @@ struct CheckGeneratorLevelVsDetectorLevel { int64_t recix = track.globalIndex(); int32_t label = track.mcParticleId(); - LOGF(MATCHRECGENLOGTRACKS, "Track with global Id %d and collision Id %d has label %d associated to MC collision %d", recix, track.collisionId(), label, track.template mcParticle_as().mcCollisionId()); + LOGF(MATCHRECGENLOGTRACKS, "Track with global Id %d and collision Id %d has label %d associated to MC collision %d", recix, track.collisionId(), label, track.template mcParticle_as().mcCollisionId()); if (track.collisionId() < 0) { if (label >= 0) { mclabelpos[kNEGATIVE][label].push_back(recix); @@ -415,7 +415,7 @@ struct CheckGeneratorLevelVsDetectorLevel { if ((asone == uint8_t(true)) or (astwo == uint8_t(true))) { /* the track has been accepted */ nreco++; - LOGF(MATCHRECGENLOGTRACKS, "Accepted track with global Id %d and collision Id %d has label %d associated to MC collision %d", recix, track.collisionId(), label, track.template mcParticle_as().mcCollisionId()); + LOGF(MATCHRECGENLOGTRACKS, "Accepted track with global Id %d and collision Id %d has label %d associated to MC collision %d", recix, track.collisionId(), label, track.template mcParticle_as().mcCollisionId()); mclabelpos[kPOSITIVE][label].push_back(recix); } }