Skip to content

Commit

Permalink
Adding process function without DCA tables from DQ (AliceO2Group#3679)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucamicheletti93 <[email protected]>
  • Loading branch information
lucamicheletti93 and lucamicheletti authored Oct 24, 2023
1 parent 74da06a commit e4132f3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
6 changes: 3 additions & 3 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class VarManager : public TObject
};

enum DileptonCharmHadronTypes {
kJPsiToMuMu = 0,
kJPsi = 0,
kD0ToPiK,
kD0barToKPi
};
Expand Down Expand Up @@ -2191,7 +2191,7 @@ void VarManager::FillSingleDileptonCharmHadron(Cand const& candidate, H hfHelper
values = fgValues;
}

if constexpr (partType == kJPsiToMuMu) {
if constexpr (partType == kJPsi) {
values[kMass] = candidate.mass();
values[kPt] = candidate.pt();
values[kPhi] = candidate.phi();
Expand All @@ -2214,7 +2214,7 @@ void VarManager::FillSingleDileptonCharmHadron(Cand const& candidate, H hfHelper
template <int partTypeCharmHad, typename DQ, typename HF, typename H>
void VarManager::FillDileptonCharmHadron(DQ const& dilepton, HF const& charmHadron, H hfHelper, float* values)
{
FillSingleDileptonCharmHadron<kJPsiToMuMu>(dilepton, hfHelper, values);
FillSingleDileptonCharmHadron<kJPsi>(dilepton, hfHelper, values);
FillSingleDileptonCharmHadron<partTypeCharmHad>(charmHadron, hfHelper, values);
}

Expand Down
26 changes: 16 additions & 10 deletions PWGDQ/TableProducer/tableMakerJpsiHf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ using namespace o2::aod::hf_cand_2prong;

// Declarations of various short names
using MyEvents = soa::Join<aod::Collisions, aod::EvSels>;
using MyPairCandidatesSelected = soa::Join<aod::Dileptons, aod::DileptonsExtra, aod::DileptonsInfo>;
using MyDileptonCandidatesSelected = soa::Join<aod::Dileptons, aod::DileptonsInfo>;
using MyDileptonCandidatesSelectedWithDca = soa::Join<aod::Dileptons, aod::DileptonsExtra, aod::DileptonsInfo>;
using MyD0CandidatesSelected = soa::Join<aod::HfCand2Prong, aod::HfSelD0>;
using MyD0CandidatesSelectedWithBdt = soa::Join<aod::HfCand2Prong, aod::HfSelD0, aod::HfMlD0>;

Expand Down Expand Up @@ -71,12 +72,13 @@ struct tableMakerJpsiHf {
Configurable<bool> configDebug{"configDebug", true, "If true, fill D0 - J/psi histograms separately"};

SliceCache cache;
Partition<MyPairCandidatesSelected> selectedDileptonCandidates = aod::reducedpair::mass > 1.0f && aod::reducedpair::mass < 5.0f && aod::reducedpair::sign == 0;
Partition<MyDileptonCandidatesSelected> selectedDileptonCandidates = aod::reducedpair::mass > 1.0f && aod::reducedpair::mass < 5.0f && aod::reducedpair::sign == 0;
Partition<MyDileptonCandidatesSelectedWithDca> selectedDileptonCandidatesWithDca = aod::reducedpair::mass > 1.0f && aod::reducedpair::mass < 5.0f && aod::reducedpair::sign == 0;
Partition<MyD0CandidatesSelected> selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1;
Partition<MyD0CandidatesSelectedWithBdt> selectedD0CandidatesWithBdt = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1;

Preslice<MyD0CandidatesSelected> perCollisionDmeson = aod::hf_cand::collisionId;
Preslice<MyPairCandidatesSelected> perCollisionDilepton = aod::reducedpair::collisionId;
Preslice<MyDileptonCandidatesSelected> perCollisionDilepton = aod::reducedpair::collisionId;

// Define histograms manager
float* fValuesDileptonCharmHadron{};
Expand All @@ -102,7 +104,7 @@ struct tableMakerJpsiHf {

// Template function to run pair - hadron combinations
// TODO: generalise to all charm-hadron species
template <bool withBdt, typename TDqTrack, typename THfTrack>
template <bool withDca, bool withBdt, typename TDqTrack, typename THfTrack>
void runDileptonDmeson(TDqTrack const& dileptons, THfTrack const& dmesons, MyEvents::iterator const& collision)
{
VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron);
Expand Down Expand Up @@ -151,7 +153,7 @@ struct tableMakerJpsiHf {
}

if (configDebug) {
VarManager::FillSingleDileptonCharmHadron<VarManager::kJPsiToMuMu>(dilepton, hfHelper, fValuesDileptonCharmHadron);
VarManager::FillSingleDileptonCharmHadron<VarManager::kJPsi>(dilepton, hfHelper, fValuesDileptonCharmHadron);
fHistMan->FillHistClass("JPsi", fValuesDileptonCharmHadron);
VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron);
}
Expand All @@ -177,7 +179,11 @@ struct tableMakerJpsiHf {
isCollSel = true;
}
auto indexRed = redCollisions.lastIndex();
redDileptons(indexRed, dilepton.px(), dilepton.py(), dilepton.pz(), dilepton.mass(), dilepton.sign(), dilepton.mcDecision(), dilepton.tauz(), dilepton.lz(), dilepton.lxy());
if constexpr (withDca) {
redDileptons(indexRed, dilepton.px(), dilepton.py(), dilepton.pz(), dilepton.mass(), dilepton.sign(), dilepton.mcDecision(), dilepton.tauz(), dilepton.lz(), dilepton.lxy());
} else {
redDileptons(indexRed, dilepton.px(), dilepton.py(), dilepton.pz(), dilepton.mass(), dilepton.sign(), dilepton.mcDecision(), 0, 0, 0);
}
redDmesons(indexRed, dmeson.px(), dmeson.py(), dmeson.pz(), dmeson.xSecondaryVertex(), dmeson.ySecondaryVertex(), dmeson.zSecondaryVertex(), 0, 0);
if constexpr (withBdt) {
auto scores = dmeson.mlProbD0();
Expand Down Expand Up @@ -207,25 +213,25 @@ struct tableMakerJpsiHf {
}

// process J/psi - D0
void processJspiD0(MyEvents const& collisions, MyPairCandidatesSelected const& dileptons, MyD0CandidatesSelected const& dmesons)
void processJspiD0(MyEvents const& collisions, MyDileptonCandidatesSelected const& dileptons, MyD0CandidatesSelected const& dmesons)
{
redCollCounter(collisions.size());
for (auto& collision : collisions) {
auto groupedDmesonCandidates = selectedD0Candidates->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
auto groupedDileptonCandidates = selectedDileptonCandidates->sliceByCached(aod::reducedpair::collisionId, collision.globalIndex(), cache);
runDileptonDmeson<false>(groupedDileptonCandidates, groupedDmesonCandidates, collision);
runDileptonDmeson<false, false>(groupedDileptonCandidates, groupedDmesonCandidates, collision);
}
}
PROCESS_SWITCH(tableMakerJpsiHf, processJspiD0, "Process J/psi - D0", true);

// process J/psi - D0 adding the BDT output scores to the D0 table
void processJspiD0WithBdt(MyEvents const& collisions, MyPairCandidatesSelected const& dileptons, MyD0CandidatesSelectedWithBdt const& dmesons)
void processJspiD0WithBdt(MyEvents const& collisions, MyDileptonCandidatesSelected const& dileptons, MyD0CandidatesSelectedWithBdt const& dmesons)
{
redCollCounter(collisions.size());
for (auto& collision : collisions) {
auto groupedDmesonCandidates = selectedD0CandidatesWithBdt->sliceByCached(aod::hf_cand::collisionId, collision.globalIndex(), cache);
auto groupedDileptonCandidates = selectedDileptonCandidates->sliceByCached(aod::reducedpair::collisionId, collision.globalIndex(), cache);
runDileptonDmeson<true>(groupedDileptonCandidates, groupedDmesonCandidates, collision);
runDileptonDmeson<false, true>(groupedDileptonCandidates, groupedDmesonCandidates, collision);
}
}
PROCESS_SWITCH(tableMakerJpsiHf, processJspiD0WithBdt, "Process J/psi - D0", true);
Expand Down
4 changes: 3 additions & 1 deletion PWGDQ/Tasks/tableReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,9 @@ struct AnalysisSameEventPairing {
dileptonFilterMap = twoTrackFilter;

dileptonList(event, VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kPhi], t1.sign() + t2.sign(), dileptonFilterMap, dileptonMcDecision);
if constexpr (TPairType == pairTypeMuMu) {
dileptonInfoList(t1.collisionId(), event.posX(), event.posY(), event.posZ());
}

constexpr bool trackHasCov = ((TTrackFillMap & VarManager::ObjTypes::TrackCov) > 0 || (TTrackFillMap & VarManager::ObjTypes::ReducedTrackBarrelCov) > 0);
if constexpr ((TPairType == pairTypeEE) && trackHasCov) {
Expand All @@ -1002,7 +1005,6 @@ struct AnalysisSameEventPairing {
if constexpr ((TPairType == pairTypeMuMu) && muonHasCov) {
// LOGP(info, "mu1 collId = {}, mu2 collId = {}", t1.collisionId(), t2.collisionId());
dileptonExtraList(t1.globalIndex(), t2.globalIndex(), VarManager::fgValues[VarManager::kVertexingTauz], VarManager::fgValues[VarManager::kVertexingLz], VarManager::fgValues[VarManager::kVertexingLxy]);
dileptonInfoList(t1.collisionId(), event.posX(), event.posY(), event.posZ());
if (fConfigFlatTables.value) {
dimuonAllList(event.posX(), event.posY(), event.posZ(), event.numContrib(),
-999., -999., -999.,
Expand Down

0 comments on commit e4132f3

Please sign in to comment.