Skip to content

Commit

Permalink
Add mc collision counter vs centrality
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi Dello Stritto committed Jan 6, 2025
1 parent bc31718 commit 6e7c764
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 36 deletions.
9 changes: 5 additions & 4 deletions PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ struct HfCandidateCreator2ProngExpressions {
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
using McCollisionsFT0Ms = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Ms>;
using McCollisionsCentFT0Ms = soa::Join<aod::McCollisions, aod::McCentFT0Ms>;
PresliceUnsorted<McCollisionsNoCents> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Cs> colPerMcCollisionFT0C = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Ms> colPerMcCollisionFT0M = aod::mccollisionlabel::mcCollisionId;
Expand Down Expand Up @@ -716,11 +717,11 @@ struct HfCandidateCreator2ProngExpressions {
}

/// Performs MC matching.
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs>
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs, typename McCollisions>
void runCreator2ProngMc(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
CCs const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisions const& mcCollisions,
BCsInfo const&)
{
rowCandidateProng2->bindExternalIndices(&tracks);
Expand Down Expand Up @@ -813,7 +814,7 @@ struct HfCandidateCreator2ProngExpressions {
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
}
hfEvSelMc.fillHistograms(rejectionMask);
hfEvSelMc.fillHistograms<centEstimator>(mcCollision, rejectionMask);
if (rejectionMask != 0) {
// at least one event selection not satisfied --> reject all particles from this collision
for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) {
Expand Down Expand Up @@ -888,7 +889,7 @@ struct HfCandidateCreator2ProngExpressions {
void processMcCentFT0M(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Ms const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisionsCentFT0Ms const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreator2ProngMc<CentralityEstimator::FT0M>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
Expand Down
9 changes: 5 additions & 4 deletions PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ struct HfCandidateCreator3ProngExpressions {
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
using McCollisionsFT0Ms = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Ms>;
using McCollisionsCentFT0Ms = soa::Join<aod::McCollisions, aod::McCentFT0Ms>;
PresliceUnsorted<McCollisionsNoCents> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Cs> colPerMcCollisionFT0C = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Ms> colPerMcCollisionFT0M = aod::mccollisionlabel::mcCollisionId;
Expand Down Expand Up @@ -516,11 +517,11 @@ struct HfCandidateCreator3ProngExpressions {
}

/// Performs MC matching.
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs>
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs, typename McCollisions>
void runCreator3ProngMc(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
CCs const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisions const& mcCollisions,
BCsInfo const&)
{
rowCandidateProng3->bindExternalIndices(&tracks);
Expand Down Expand Up @@ -692,7 +693,7 @@ struct HfCandidateCreator3ProngExpressions {
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
}
hfEvSelMc.fillHistograms(rejectionMask);
hfEvSelMc.fillHistograms<centEstimator>(mcCollision, rejectionMask);
if (rejectionMask != 0) {
// at least one event selection not satisfied --> reject all gen particles from this collision
for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) {
Expand Down Expand Up @@ -816,7 +817,7 @@ struct HfCandidateCreator3ProngExpressions {
void processMcCentFT0M(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Ms const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisionsCentFT0Ms const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreator3ProngMc<CentralityEstimator::FT0M>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
Expand Down
13 changes: 7 additions & 6 deletions PWGHF/TableProducer/candidateCreatorCascade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ struct HfCandidateCreatorCascadeMc {
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
using McCollisionsFT0Ms = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Ms>;
using McCollisionsCentFT0Ms = soa::Join<aod::McCollisions, aod::McCentFT0Ms>;
PresliceUnsorted<McCollisionsNoCents> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Cs> colPerMcCollisionFT0C = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Ms> colPerMcCollisionFT0M = aod::mccollisionlabel::mcCollisionId;
Expand All @@ -471,11 +472,11 @@ struct HfCandidateCreatorCascadeMc {
hfEvSelMc.addHistograms(registry); // particles monitoring
}

template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs>
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs, typename McCollisions>
void runCreatorCascMc(MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
CCs const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisions const& mcCollisions,
BCsInfo const&)
{
// Match reconstructed candidates.
Expand Down Expand Up @@ -548,7 +549,7 @@ struct HfCandidateCreatorCascadeMc {
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
}
hfEvSelMc.fillHistograms(rejectionMask);
hfEvSelMc.fillHistograms<centEstimator>(mcCollision, rejectionMask);
if (rejectionMask != 0) {
// at least one event selection not satisfied --> reject all particles from this collision
for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) {
Expand Down Expand Up @@ -578,11 +579,11 @@ struct HfCandidateCreatorCascadeMc {
}
if (sign != 0) {
// we check the K0S
for (const auto& daughterK0 : particle.daughters_as<aod::McParticles>()) {
for (const auto& daughterK0 : particle.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterK0.pdgCode()) != kK0) {
continue;
}
for (const auto& daughterK0S : daughterK0.daughters_as<aod::McParticles>()) {
for (const auto& daughterK0S : daughterK0.template daughters_as<aod::McParticles>()) {
if (daughterK0S.pdgCode() != kK0Short) {
continue;
}
Expand Down Expand Up @@ -628,7 +629,7 @@ struct HfCandidateCreatorCascadeMc {
void processMcCentFT0M(MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Ms const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisionsCentFT0Ms const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreatorCascMc<CentralityEstimator::FT0M>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
Expand Down
9 changes: 5 additions & 4 deletions PWGHF/TableProducer/candidateCreatorDstar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ struct HfCandidateCreatorDstarExpressions {
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
using McCollisionsFT0Ms = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Ms>;
using McCollisionsCentFT0Ms = soa::Join<aod::McCollisions, aod::McCentFT0Ms>;
PresliceUnsorted<McCollisionsNoCents> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Cs> colPerMcCollisionFT0C = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Ms> colPerMcCollisionFT0M = aod::mccollisionlabel::mcCollisionId;
Expand Down Expand Up @@ -542,11 +543,11 @@ struct HfCandidateCreatorDstarExpressions {
}

/// Perform MC Matching.
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs>
template <o2::hf_centrality::CentralityEstimator centEstimator, typename CCs, typename McCollisions>
void runCreatorDstarMc(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
CCs const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisions const& mcCollisions,
BCsInfo const&)
{
rowsCandidateD0->bindExternalIndices(&tracks);
Expand Down Expand Up @@ -644,7 +645,7 @@ struct HfCandidateCreatorDstarExpressions {
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
}
hfEvSelMc.fillHistograms(rejectionMask);
hfEvSelMc.fillHistograms<centEstimator>(mcCollision, rejectionMask);
if (rejectionMask != 0) {
// at least one event selection not satisfied --> reject all particles from this collision
for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) {
Expand Down Expand Up @@ -718,7 +719,7 @@ struct HfCandidateCreatorDstarExpressions {
void processMcCentFT0M(aod::TracksWMc const& tracks,
aod::McParticles const& mcParticles,
McCollisionsFT0Ms const& collInfos,
aod::McCollisions const& mcCollisions,
McCollisionsCentFT0Ms const& mcCollisions,
BCsInfo const& BCsInfo)
{
runCreatorDstarMc<CentralityEstimator::FT0M>(tracks, mcParticles, collInfos, mcCollisions, BCsInfo);
Expand Down
31 changes: 16 additions & 15 deletions PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
using McCollisionsNoCents = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels>;
using McCollisionsFT0Cs = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs>;
using McCollisionsFT0Ms = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Ms>;
using McCollisionsCentFT0Ms = soa::Join<aod::McCollisions, aod::McCentFT0Ms>;
PresliceUnsorted<McCollisionsNoCents> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Cs> colPerMcCollisionFT0C = aod::mccollisionlabel::mcCollisionId;
PresliceUnsorted<McCollisionsFT0Ms> colPerMcCollisionFT0M = aod::mccollisionlabel::mcCollisionId;
Expand Down Expand Up @@ -1798,12 +1799,12 @@ struct HfCandidateCreatorXic0Omegac0Mc {
hGenCharmBaryonPtRapidityLooseOmegacToOmegaK = registry.add<TH1>("hGenCharmBaryonPtRapidityLooseOmegacToOmegaK", "Generated charm baryon #it{p}_{T};#it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1D, {{20, 0.0, 20.0}}});
}

template <o2::hf_centrality::CentralityEstimator centEstimator, int decayChannel, typename Colls, typename TMyRecoCand>
template <o2::hf_centrality::CentralityEstimator centEstimator, int decayChannel, typename Colls, typename TMyRecoCand, typename McCollisions>
void runXic0Omegac0Mc(TMyRecoCand const& candidates,
MyTracksWMc const&,
aod::McParticles const& mcParticles,
Colls const& collsWithMcLabels,
aod::McCollisions const& mcCollisions,
McCollisions const& mcCollisions,
BCsInfo const&)
{
float ptCharmBaryonGen = -999.;
Expand Down Expand Up @@ -2048,7 +2049,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
const auto collSlice = collsWithMcLabels.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
}
hfEvSelMc.fillHistograms(rejectionMask);
hfEvSelMc.fillHistograms<centEstimator>(mcCollision, rejectionMask);
if (rejectionMask != 0) {
/// at least one event selection not satisfied --> reject all particles from this collision
for (unsigned int i = 0; i < mcParticlesPerMcColl.size(); ++i) {
Expand Down Expand Up @@ -2097,14 +2098,14 @@ struct HfCandidateCreatorXic0Omegac0Mc {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
for (const auto& daughterCharm : particle.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeXiMinus) {
continue;
}
// Xi -> Lambda pi
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, daughterCharm, pdgCodeXiMinus, std::array{pdgCodeLambda, pdgCodePiMinus}, true)) {
debugGenCasc = 1;
for (const auto& daughterCascade : daughterCharm.daughters_as<aod::McParticles>()) {
for (const auto& daughterCascade : daughterCharm.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCascade.pdgCode()) != pdgCodeLambda) {
continue;
}
Expand Down Expand Up @@ -2139,14 +2140,14 @@ struct HfCandidateCreatorXic0Omegac0Mc {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
for (const auto& daughterCharm : particle.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeXiMinus) {
continue;
}
// Xi -> Lambda pi
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, daughterCharm, pdgCodeXiMinus, std::array{pdgCodeLambda, pdgCodePiMinus}, true)) {
debugGenCasc = 1;
for (const auto& daughterCascade : daughterCharm.daughters_as<aod::McParticles>()) {
for (const auto& daughterCascade : daughterCharm.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCascade.pdgCode()) != pdgCodeLambda) {
continue;
}
Expand Down Expand Up @@ -2181,14 +2182,14 @@ struct HfCandidateCreatorXic0Omegac0Mc {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
for (const auto& daughterCharm : particle.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeOmegaMinus) {
continue;
}
// Omega -> Lambda K
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, daughterCharm, pdgCodeOmegaMinus, std::array{pdgCodeLambda, pdgCodeKaonMinus}, true)) {
debugGenCasc = 1;
for (const auto& daughterCascade : daughterCharm.daughters_as<aod::McParticles>()) {
for (const auto& daughterCascade : daughterCharm.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCascade.pdgCode()) != pdgCodeLambda) {
continue;
}
Expand Down Expand Up @@ -2223,14 +2224,14 @@ struct HfCandidateCreatorXic0Omegac0Mc {
debugGenCharmBar = 1;
ptCharmBaryonGen = particle.pt();
rapidityCharmBaryonGen = particle.y();
for (const auto& daughterCharm : particle.daughters_as<aod::McParticles>()) {
for (const auto& daughterCharm : particle.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCharm.pdgCode()) != pdgCodeOmegaMinus) {
continue;
}
// Omega -> Lambda K
if (RecoDecay::isMatchedMCGen<false, true>(mcParticles, daughterCharm, pdgCodeOmegaMinus, std::array{pdgCodeLambda, pdgCodeKaonMinus}, true)) {
debugGenCasc = 1;
for (const auto& daughterCascade : daughterCharm.daughters_as<aod::McParticles>()) {
for (const auto& daughterCascade : daughterCharm.template daughters_as<aod::McParticles>()) {
if (std::abs(daughterCascade.pdgCode()) != pdgCodeLambda) {
continue;
}
Expand Down Expand Up @@ -2294,7 +2295,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
void processMcXicToXiPiFT0m(aod::HfCandToXiPi const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
McCollisionsCentFT0Ms const& mcColls,
McCollisionsFT0Ms const& collsWithMcLabels,
BCsInfo const& bcs)
{
Expand Down Expand Up @@ -2327,7 +2328,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
void processMcOmegacToXiPiFT0m(aod::HfCandToXiPi const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
McCollisionsCentFT0Ms const& mcColls,
McCollisionsFT0Ms const& collsWithMcLabels,
BCsInfo const& bcs)
{
Expand Down Expand Up @@ -2360,7 +2361,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
void processMcOmegacToOmegaPiFT0m(aod::HfCandToOmegaPi const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
McCollisionsCentFT0Ms const& mcColls,
McCollisionsFT0Ms const& collsWithMcLabels,
BCsInfo const& bcs)
{
Expand Down Expand Up @@ -2393,7 +2394,7 @@ struct HfCandidateCreatorXic0Omegac0Mc {
void processMcOmegacToOmegaKFT0m(aod::HfCandToOmegaK const& candidates,
MyTracksWMc const& tracks,
aod::McParticles const& mcParticles,
aod::McCollisions const& mcColls,
McCollisionsCentFT0Ms const& mcColls,
McCollisionsFT0Ms const& collsWithMcLabels,
BCsInfo const& bcs)
{
Expand Down
Loading

0 comments on commit 6e7c764

Please sign in to comment.