Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions PWGHF/D2H/DataModel/ReducedDataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,10 @@ DECLARE_SOA_TABLE(HfMcGenRedB0s, "AOD", "HFMCGENREDB0", //! Generation-level MC
hf_b0_mc::EtaProng0,
hf_b0_mc::PtProng1,
hf_b0_mc::YProng1,
hf_b0_mc::EtaProng1);
hf_b0_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the B0 part
Expand Down Expand Up @@ -923,7 +926,10 @@ DECLARE_SOA_TABLE(HfMcGenRedBps, "AOD", "HFMCGENREDBP", //! Generation-level MC
hf_bplus_mc::EtaProng0,
hf_bplus_mc::PtProng1,
hf_bplus_mc::YProng1,
hf_bplus_mc::EtaProng1);
hf_bplus_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the Bplus part
Expand Down Expand Up @@ -1025,7 +1031,10 @@ DECLARE_SOA_TABLE(HfMcGenRedBss, "AOD", "HFMCGENREDBS", //! Generation-level MC
hf_bs_mc::EtaProng0,
hf_bs_mc::PtProng1,
hf_bs_mc::YProng1,
hf_bs_mc::EtaProng1);
hf_bs_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the Bs part
Expand Down Expand Up @@ -1109,7 +1118,10 @@ DECLARE_SOA_TABLE(HfMcGenRedLbs, "AOD", "HFMCGENREDLB", //! Generation-level MC
hf_lb_mc::EtaProng0,
hf_lb_mc::PtProng1,
hf_lb_mc::YProng1,
hf_lb_mc::EtaProng1);
hf_lb_mc::EtaProng1,
hf_reduced_collision::HfCollisionRejectionMap,
cent::CentFT0C,
cent::CentFT0M);

// store all configurables values used in the first part of the workflow
// so we can use them in the B0 part
Expand Down
217 changes: 139 additions & 78 deletions PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx

Large diffs are not rendered by default.

72 changes: 56 additions & 16 deletions PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pwghf/struct-member-order]

Declare struct members in the conventional order. See the PWGHF coding guidelines.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "Common/DataModel/PIDResponseTPC.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "Framework/RunningWorkflowInfo.h"
#include <CCDB/BasicCCDBManager.h>
#include <CommonConstants/PhysicsConstants.h>
#include <DCAFitter/DCAFitterN.h>
Expand Down Expand Up @@ -122,6 +123,7 @@
Produces<aod::HfCfgBpToJpsi> rowCandidateConfigBplus;
Produces<aod::HfCfgBsToJpsis> rowCandidateConfigBs;

Configurable<bool> skipRejectedCollisions{"skipRejectedCollisions", true, "skips collisions rejected by the event selection, instead of flagging only"};
Configurable<bool> propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"};
Configurable<bool> useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"};
Configurable<bool> useWeightedFinalPCA{"useWeightedFinalPCA", false, "Recalculate vertex position using track covariances, effective only if useAbsDCA is true"};
Expand Down Expand Up @@ -162,10 +164,12 @@
using TracksSel = soa::Join<aod::TracksWDcaExtra, aod::TracksPidPi, aod::PidTpcTofFullPi, aod::TracksPidKa, aod::PidTpcTofFullKa>;
using TracksPidWithSelAndMc = soa::Join<TracksPidWithSel, aod::McTrackLabels>;
using CollisionsWCMcLabels = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
using BCsInfo = soa::Join<aod::BCsWithTimestamps, aod::BcSels>;

Preslice<aod::HfCand2ProngWPid> candsJpsiPerCollision = aod::track_association::collisionId;
Preslice<aod::TrackAssoc> trackIndicesPerCollision = aod::track_association::collisionId;
PresliceUnsorted<CollisionsWCMcLabels> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;

Check failure on line 171 in PWGHF/D2H/TableProducer/dataCreatorJpsiHadReduced.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pwghf/struct-member-order]

HfDataCreatorJpsiHadReduced: PresliceUnsorted< appears too early (before end of Preslice<).
Preslice<aod::McParticles> mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId;

o2::base::Propagator::MatCorrType noMatCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
int runNumber;
Expand All @@ -174,13 +178,15 @@
bool isHfCandBhadConfigFilled = false;

o2::hf_evsel::HfEventSelection hfEvSel;
o2::hf_evsel::HfEventSelectionMc hfEvSelMc;

o2::vertexing::DCAFitterN<2> df2;
o2::vertexing::DCAFitterN<3> df3;
o2::vertexing::DCAFitterN<4> df4;

HistogramRegistry registry{"registry"};

void init(InitContext const&)
void init(InitContext& initContext)
{
std::array<int, 4> doProcess = {doprocessJpsiKData, doprocessJpsiKMc, doprocessJpsiPhiData, doprocessJpsiPhiMc};
if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) {
Expand Down Expand Up @@ -270,6 +276,19 @@
invMass2JpsiHadMin = (MassBS - invMassWindowJpsiHad) * (MassBS - invMassWindowJpsiHad);
invMass2JpsiHadMax = (MassBS + invMassWindowJpsiHad) * (MassBS + invMassWindowJpsiHad);
}

// init HF event selection helper
hfEvSel.init(registry);
if (doprocessJpsiKMc || doprocessJpsiPhiMc) {
const auto& workflows = initContext.services().get<RunningWorkflowInfo const>();
for (const DeviceSpec& device : workflows.devices) {
if (device.name.compare("hf-data-creator-jpsi-had-reduced") == 0) {
// init HF event selection helper
hfEvSelMc.init(device, registry);
break;
}
}
}
}

/// Topological cuts
Expand Down Expand Up @@ -512,10 +531,23 @@
}

template <uint8_t decChannel>
void runMcGen(aod::McParticles const& particlesMc)
void runMcGen(aod::McCollision const& mcCollision,
aod::McParticles const& particlesMc,
CollisionsWCMcLabels const& collisions,
BCsInfo const&)
{
// Check event selection
float centDummy{-1.f}, centFT0C{-1.f}, centFT0M{-1.f};
const auto collSlice = collisions.sliceBy(colPerMcCollision, mcCollision.globalIndex());
auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centDummy);
if (skipRejectedCollisions && hfRejMap != 0) {
return;
}

const auto mcParticlesPerMcColl = particlesMc.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());

// Match generated particles.
for (const auto& particle : particlesMc) {
for (const auto& particle : mcParticlesPerMcColl) {
int8_t sign{0}, flag{0}, channel{0};
if constexpr (decChannel == DecayChannel::BplusToJpsiK) {
// B+ → J/Psi K+ → (µ+µ-) K+
Expand Down Expand Up @@ -556,7 +588,7 @@
}
rowHfBpMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle,
ptProngs[0], yProngs[0], etaProngs[0],
ptProngs[1], yProngs[1], etaProngs[1]);
ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M);
} else if constexpr (decChannel == DecayChannel::BsToJpsiPhi) {
// Bs → J/Psi phi → (µ+µ-) (K+K-)
if (RecoDecay::isMatchedMCGen<true>(particlesMc, particle, Pdg::kBS, std::array{static_cast<int>(Pdg::kJPsi), +kKPlus, -kKPlus}, true, &sign, 2)) {
Expand Down Expand Up @@ -596,22 +628,29 @@
}
rowHfBsMcGenReduced(flag, channel, ptParticle, yParticle, etaParticle,
ptProngs[0], yProngs[0], etaProngs[0],
ptProngs[1], yProngs[1], etaProngs[1]);
ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M);
}
} // gen
}

// Jpsi candidate selection
template <bool doMc, uint8_t decChannel, typename Coll, typename JpsiCands, typename TTracks, typename PParticles>
template <bool doMc, uint8_t decChannel, typename Coll, typename JpsiCands, typename TTracks, typename PParticles, typename BBCs>
void runDataCreation(Coll const& collision,
JpsiCands const& candsJpsi,
aod::TrackAssoc const& trackIndices,
TTracks const&,
PParticles const& particlesMc,
uint64_t const& indexCollisionMaxNumContrib,
aod::BCsWithTimestamps const&)
BBCs const&)
{

registry.fill(HIST("hEvents"), 1 + Event::Processed);
float centrality = -1.f;
auto hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
if (skipRejectedCollisions && hfRejMap != 0) {
return;
}

// helpers for ReducedTables filling
int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1;
// std::map where the key is the track.globalIndex() and
Expand Down Expand Up @@ -959,14 +998,11 @@
}
} // candsJpsi loop

registry.fill(HIST("hEvents"), 1 + Event::Processed);
if (!fillHfReducedCollision) {
registry.fill(HIST("hEvents"), 1 + Event::NoCharmHadPiSelected);
return;
}
registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected);
float centrality = -1.f;
uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask<true, o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
// fill collision table if it contains a J/Psi K pair at minimum
hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz);
hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(),
Expand Down Expand Up @@ -1047,8 +1083,8 @@
aod::TrackAssoc const& trackIndices,
TracksPidWithSelAndMc const& tracks,
aod::McParticles const& particlesMc,
aod::BCsWithTimestamps const& bcs,
McCollisions const&)
BCsInfo const& bcs,
McCollisions const& mcCollisions)
{
// store configurables needed for B+ workflow
if (!isHfCandBhadConfigFilled) {
Expand All @@ -1073,7 +1109,9 @@
}
// handle normalization by the right number of collisions
hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl);
runMcGen<DecayChannel::BplusToJpsiK>(particlesMc);
for (const auto& mcCollision : mcCollisions) {
runMcGen<DecayChannel::BplusToJpsiK>(mcCollision, particlesMc, collisions, bcs);
}
}
PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiKMc, "Process J/Psi K with MC info", false);

Expand All @@ -1082,8 +1120,8 @@
aod::TrackAssoc const& trackIndices,
TracksPidWithSelAndMc const& tracks,
aod::McParticles const& particlesMc,
aod::BCsWithTimestamps const& bcs,
McCollisions const&)
BCsInfo const& bcs,
McCollisions const& mcCollisions)
{
// store configurables needed for B+ workflow
if (!isHfCandBhadConfigFilled) {
Expand All @@ -1108,7 +1146,9 @@
}
// handle normalization by the right number of collisions
hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl);
runMcGen<DecayChannel::BsToJpsiPhi>(particlesMc);
for (const auto& mcCollision : mcCollisions) {
runMcGen<DecayChannel::BsToJpsiPhi>(mcCollision, particlesMc, collisions, bcs);
}
}
PROCESS_SWITCH(HfDataCreatorJpsiHadReduced, processJpsiPhiMc, "Process J/Psi phi with MC info", false);
};
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreator2Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@
// D0(bar) → π+ K−, π+ K− π0, π+ π−, π+ π− π0, K+ K−
for (const auto& [chn, finalState] : hf_cand_2prong::daughtersD0Main) {
std::array<int, 2> finalStateParts2Prong = std::array{finalState[0], finalState[1]};
if (finalState.size() == 3) { // o2-linter: disable=magic-number (Partly Reco 3-prong decays)

Check failure on line 909 in PWGHF/TableProducer/candidateCreator2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, true, true, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, FinalStateDepth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand All @@ -925,7 +925,7 @@
indexRec = -1; // Reset indexRec if the generated decay does not match the reconstructed one does not match the reconstructed one
}
}
} else if (finalState.size() == 2) { // o2-linter: disable=magic-number (Fully Reco 2-prong decays)

Check failure on line 928 in PWGHF/TableProducer/candidateCreator2Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, Pdg::kD0, finalStateParts2Prong, true, &sign, FinalStateDepth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand Down Expand Up @@ -1015,7 +1015,7 @@
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreator3Prong.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@
}
}
}
} else if (finalState.size() == 3) { // o2-linter: disable=magic-number(Fully Reco 3-prong decays)

Check failure on line 1112 in PWGHF/TableProducer/candidateCreator3Prong.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
indexRec = RecoDecay::getMatchedMCRec<false, false, false, true, true>(mcParticles, arrayDaughters, pdg, finalStateParts3Prong, true, &sign, depth, &nKinkedTracks, &nInteractionsWithMaterial);
} else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
Expand Down Expand Up @@ -1304,7 +1304,7 @@
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreatorCascade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
v0cosPA = v0row.v0cosPA();

constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
for (int i = 0; i < 6; i++) {

Check failure on line 228 in PWGHF/TableProducer/candidateCreatorCascade.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
covV[MomInd[i]] = v0row.momentumCovMat()[i];
covV[i] = v0row.positionCovMat()[i];
}
Expand Down Expand Up @@ -254,7 +254,7 @@
v0cosPA = v0row.v0cosPA();

constexpr int MomInd[6] = {9, 13, 14, 18, 19, 20}; // cov matrix elements for momentum component
for (int i = 0; i < 6; i++) {

Check failure on line 257 in PWGHF/TableProducer/candidateCreatorCascade.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
covV[MomInd[i]] = v0row.momentumCovMat()[i];
covV[i] = v0row.positionCovMat()[i];
}
Expand Down Expand Up @@ -564,7 +564,7 @@
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreatorDstar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ struct HfCandidateCreatorDstarExpressions {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
3 changes: 1 addition & 2 deletions PWGHF/TableProducer/candidateCreatorSigmac0plusplus.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,8 @@ struct HfCandidateSigmac0plusplusMc {
/// In case of need, readapt the code templetizing the function
auto mcCollision = particle.mcCollision();
float centrality{-1.f};
uint16_t rejectionMask{0};
const auto collSlice = collInfos.sliceBy(colPerMcCollision, mcCollision.globalIndex());
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centrality);
auto rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, o2::hf_centrality::CentralityEstimator::None>(mcCollision, collSlice, centrality);
hfEvSelMc.fillHistograms<o2::hf_centrality::CentralityEstimator::None>(mcCollision, rejectionMask, 0);
if (rejectionMask != 0) {
// at least one event selection not satisfied --> reject gen particles from this collision
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/TableProducer/candidateCreatorXicToXiPiPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ struct HfCandidateCreatorXicToXiPiPiExpressions {
const auto mcParticlesPerMcColl = mcParticles.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex());
// Slice the collisions table to get the collision info for the current MC collision
float centrality{-1.f};
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
int nSplitColl = 0;
if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C) {
const auto collSlice = collInfos.sliceBy(colPerMcCollisionFT0C, mcCollision.globalIndex());
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/Tasks/taskMcValidation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
if (storeOccupancy) {
occupancy = getOccupancyGenColl(recoCollisions, OccupancyEstimator::Its);
}
uint16_t rejectionMask{0};
uint32_t rejectionMask{0u};
if constexpr (centEstimator == CentralityEstimator::FT0C) {
rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask<BCsInfo, centEstimator>(mcCollision, recoCollisions, centrality);
} else if constexpr (centEstimator == CentralityEstimator::FT0M) {
Expand Down Expand Up @@ -353,7 +353,7 @@
std::vector<int> listDaughters{};

// Check that the decay channel is correct and retrieve the daughters
if (nDaughters[iD] == 2) {

Check failure on line 356 in PWGHF/Tasks/taskMcValidation.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
if (!RecoDecay::isMatchedMCGen(mcParticles, particle, PDGArrayParticle[iD], arrPDGFinal2Prong[iD], true, nullptr, maxDepthForSearch[iD], &listDaughters)) {
continue;
}
Expand Down
Loading