Skip to content
Prev Previous commit
Next Next commit
Implementing comments
  • Loading branch information
Luca Micheletti committed Sep 17, 2021
commit 8f7ab86f88b07682ff41bfe52a81be33f8a2ba41
4 changes: 2 additions & 2 deletions PWGHF/DataModel/HFCandidateSelectionTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ DECLARE_SOA_TABLE(HFSelBPlusToD0PiCandidate, "AOD", "HFSELBPLUSCAND", //!

namespace hf_selcandidate_x
{
DECLARE_SOA_COLUMN(IsSelXToJpsiPiPi, isSelXToJpsiPiPi, int); //!
DECLARE_SOA_COLUMN(IsSelXToJpsiToEEPiPi, isSelXToJpsiToEEPiPi, int); //!
DECLARE_SOA_COLUMN(IsSelXToJpsiToMuMuPiPi, isSelXToJpsiToMuMuPiPi, int); //!
} // namespace hf_selcandidate_x
DECLARE_SOA_TABLE(HFSelXToJpsiPiPiCandidate, "AOD", "HFSELXCAND", //!
hf_selcandidate_x::IsSelXToJpsiPiPi, hf_selcandidate_x::IsSelXToJpsiToMuMuPiPi);
hf_selcandidate_x::IsSelXToJpsiToEEPiPi, hf_selcandidate_x::IsSelXToJpsiToMuMuPiPi);
} // namespace o2::aod

namespace o2::aod
Expand Down
2 changes: 1 addition & 1 deletion PWGHF/DataModel/HFSecondaryVertex.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ DECLARE_SOA_COLUMN(OriginMCGen, originMCGen, int8_t); // particle
DECLARE_SOA_COLUMN(FlagMCDecayChanRec, flagMCDecayChanRec, int8_t); // resonant decay channel flag, reconstruction level
DECLARE_SOA_COLUMN(FlagMCDecayChanGen, flagMCDecayChanGen, int8_t); // resonant decay channel flag, generator level
// mapping of decay types
enum DecayType { XToJpsiPiPi = 0,
enum DecayType { XToJpsiToEEPiPi = 0,
XToJpsiToMuMuPiPi }; // move this to a dedicated cascade namespace in the future?
} // namespace hf_cand_x

Expand Down
52 changes: 27 additions & 25 deletions PWGHF/TableProducer/HFCandidateCreatorX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/// \note Adapted from HFCandidateCreator3Prong
///
/// \author Rik Spijkers <r.spijkers@students.uu.nl>, Utrecht University
/// \author Luca Micheletti <luca.micheletti@to.infn>, INFN

#include "Framework/AnalysisTask.h"
#include "DetectorsVertexing/DCAFitterN.h"
Expand Down Expand Up @@ -52,9 +53,10 @@ struct HFCandidateCreatorX {
Configurable<double> ptPionMin{"ptPionMin", 0.15, "minimum pion pT threshold (GeV/c)"};
Configurable<bool> b_dovalplots{"b_dovalplots", true, "do validation plots"};

OutputObj<TH1F> hMassJpsiToEE{TH1F("hMassJpsiToEE", "J/#psi candidates;inv. mass (e+ e-) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
OutputObj<TH1F> hMassJpsiToMuMu{TH1F("hMassJpsiToMuMu", "J/#psi candidates;inv. mass (#mu+ #mu-) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
OutputObj<TH1F> hMassJpsiToEE{TH1F("hMassJpsiToEE", "J/#psi candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
OutputObj<TH1F> hMassJpsiToMuMu{TH1F("hMassJpsiToMuMu", "J/#psi candidates;inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
OutputObj<TH1F> hPtJpsi{TH1F("hPtJpsi", "J/#psi candidates;candidate #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)};
OutputObj<TH1F> hPtPion{TH1F("hPtPion", "#pi candidates;candidate #it{p}_{T} (GeV/#it{c});entries", 100, 0., 10.)};
OutputObj<TH1F> hCPAJpsi{TH1F("hCPAJpsi", "J/#psi candidates;cosine of pointing angle;entries", 110, -1.1, 1.1)};
OutputObj<TH1F> hMassXToJpsiToEEPiPi{TH1F("hMassXToJpsiToEEPiPi", "3-prong candidates;inv. mass (J/#psi (#rightarrow e+ e-) #pi+ #pi-) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
OutputObj<TH1F> hMassXToJpsiToMuMuPiPi{TH1F("hMassXToJpsiToMuMuPiPi", "3-prong candidates;inv. mass (J/#psi (#rightarrow #mu+ #mu-) #pi+ #pi-) (GeV/#it{c}^{2});entries", 500, 0., 5.)};
Expand Down Expand Up @@ -97,7 +99,7 @@ struct HFCandidateCreatorX {

// loop over Jpsi candidates
for (auto& jpsiCand : jpsiCands) {
if (!(jpsiCand.hfflag() & 1 << JpsiToEE) && !(jpsiCand.hfflag() & 1 << JpsiToMuMu)) {
if (!(jpsiCand.hfflag() & 1 << o2::aod::hf_cand_prong2::DecayType::JpsiToEE) && !(jpsiCand.hfflag() & 1 << o2::aod::hf_cand_prong2::DecayType::JpsiToMuMu)) {
continue;
}
if (cutYCandMax >= 0. && std::abs(YJpsi(jpsiCand)) > cutYCandMax) {
Expand Down Expand Up @@ -145,6 +147,7 @@ struct HFCandidateCreatorX {
if (trackPos.pt() < ptPionMin) {
continue;
}
hPtPion->Fill(trackPos.pt());

// loop over pi- candidates
for (auto& trackNeg : tracks) {
Expand All @@ -157,6 +160,7 @@ struct HFCandidateCreatorX {
if (trackNeg.pt() < ptPionMin) {
continue;
}
hPtPion->Fill(trackNeg.pt());

auto trackParVarPos = getTrackParCov(trackPos);
auto trackParVarNeg = getTrackParCov(trackNeg);
Expand Down Expand Up @@ -198,18 +202,18 @@ struct HFCandidateCreatorX {
auto errorDecayLengthXY = std::sqrt(getRotatedCovMatrixXX(covMatrixPV, phi, 0.) + getRotatedCovMatrixXX(covMatrixPCA, phi, 0.));

int hfFlag = 0;
if (jpsiCand.hfflag() & 1 << JpsiToMuMu) {
hfFlag = 1 << XToJpsiToMuMuPiPi; // dimuon channel
} else {
hfFlag = 1 << XToJpsiPiPi; // dielectron channel
}
//if (jpsiCand.hfflag() & 1 << o2::aod::hf_cand_prong2::DecayType::JpsiToMuMu) {
//hfFlag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi; // dimuon channel
//} else {
//hfFlag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi; // dielectron channel
//}

if (jpsiCand.isSelJpsiToEE() > 0) {
hfFlag = 1 << XToJpsiPiPi;
hfFlag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi;
}

if (jpsiCand.isSelJpsiToMuMu() > 0) {
hfFlag = 1 << XToJpsiToMuMuPiPi;
hfFlag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi;
}

// fill the candidate table for the X here:
Expand Down Expand Up @@ -258,6 +262,8 @@ struct HFCandidateCreatorXMC {
aod::McParticles const& particlesMC)
{
int indexRec = -1;
int xPdgCode = 9920443;
int jpsiPdgCode = 443;
int8_t sign = 0;
int8_t flag = 0;
int8_t origin = 0;
Expand All @@ -277,17 +283,15 @@ struct HFCandidateCreatorXMC {

// X → J/ψ π+ π-
//Printf("Checking X → J/ψ π+ π-");
if (flag == 0) {
indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, 9920443, array{+kPiPlus, -kPiPlus, +kElectron, -kElectron}, true, &sign, 2);
if (indexRec > -1) {
flag = 1 << XToJpsiPiPi;
}
indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, xPdgCode, array{+kPiPlus, -kPiPlus, +kElectron, -kElectron}, true, &sign, 2);
if (indexRec > -1) {
flag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi;
}

if (flag == 0) {
indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, 9920443, array{+kPiPlus, -kPiPlus, +kMuonPlus, -kMuonPlus}, true, &sign, 2);
indexRec = RecoDecay::getMatchedMCRec(particlesMC, arrayDaughters, xPdgCode, array{+kPiPlus, -kPiPlus, +kMuonPlus, -kMuonPlus}, true, &sign, 2);
if (indexRec > -1) {
flag = 1 << XToJpsiToMuMuPiPi;
flag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi;
}
}

Expand All @@ -309,20 +313,18 @@ struct HFCandidateCreatorXMC {

// X → J/ψ π+ π-
//Printf("Checking X → J/ψ π+ π-");
if (RecoDecay::isMatchedMCGen(particlesMC, particle, 9920443, array{443, +kPiPlus, -kPiPlus}, true)) {
if (RecoDecay::isMatchedMCGen(particlesMC, particle, xPdgCode, array{jpsiPdgCode, +kPiPlus, -kPiPlus}, true)) {
// Match J/psi --> e+e-
std::vector<int> arrDaughter;
RecoDecay::getDaughters(particlesMC, particle, &arrDaughter, array{443}, 1);
RecoDecay::getDaughters(particlesMC, particle, &arrDaughter, array{jpsiPdgCode}, 1);
auto jpsiCandMC = particlesMC.iteratorAt(arrDaughter[0]);
if (flag == 0) {
if (RecoDecay::isMatchedMCGen(particlesMC, jpsiCandMC, 443, array{+kElectron, -kElectron}, true)) {
flag = 1 << XToJpsiPiPi;
}
if (RecoDecay::isMatchedMCGen(particlesMC, jpsiCandMC, jpsiPdgCode, array{+kElectron, -kElectron}, true)) {
flag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi;
}

if (flag == 0) {
if (RecoDecay::isMatchedMCGen(particlesMC, jpsiCandMC, 443, array{+kMuonPlus, -kMuonPlus}, true)) {
flag = 1 << XToJpsiToMuMuPiPi;
if (RecoDecay::isMatchedMCGen(particlesMC, jpsiCandMC, jpsiPdgCode, array{+kMuonPlus, -kMuonPlus}, true)) {
flag = 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions PWGHF/TableProducer/HFTreeCreatorXToJpsiPiPi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,15 @@ struct HfTreeCreatorXTojpsipipi {
}
};

fillTable(0, candidate.isSelXToJpsiPiPi(), InvMassXToJpsiPiPi(candidate), CtX(candidate), YX(candidate));
fillTable(0, candidate.isSelXToJpsiToEEPiPi(), InvMassXToJpsiPiPi(candidate), CtX(candidate), YX(candidate));
fillTable(1, candidate.isSelXToJpsiToMuMuPiPi(), InvMassXToJpsiPiPi(candidate), CtX(candidate), YX(candidate));
}

// Filling particle properties
float massX = 3.872;
rowCandidateFullParticles.reserve(particles.size());
for (auto& particle : particles) {
if (std::abs(particle.flagMCMatchGen()) == 1 << DecayType::XToJpsiPiPi) {
if (std::abs(particle.flagMCMatchGen()) == 1 << DecayType::XToJpsiToEEPiPi || std::abs(particle.flagMCMatchGen()) == 1 << DecayType::XToJpsiToMuMuPiPi) {
rowCandidateFullParticles(
particle.mcCollision().bcId(),
particle.pt(),
Expand Down
5 changes: 3 additions & 2 deletions PWGHF/TableProducer/HFXToJpsiPiPiCandidateSelector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/// \brief X(3872) selection task.
/// \note Adapted from HFJpsiCandidateSelector.cxx
/// \author Rik Spijkers <r.spijkers@students.uu.nl>, Utrecht University
/// \author Luca Micheletti <luca.micheletti@to.infn>, INFN

#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
Expand Down Expand Up @@ -195,11 +196,11 @@ struct HFXToJpsiPiPiCandidateSelector {
int selJpsiToMuMu = 1;

// check if flagged as X --> Jpsi Pi Pi
if (!(hfCandX.hfflag() & 1 << XToJpsiPiPi)) {
if (!(hfCandX.hfflag() & 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi)) {
selJpsiToEE = 0;
}

if (!(hfCandX.hfflag() & 1 << XToJpsiToMuMuPiPi)) {
if (!(hfCandX.hfflag() & 1 << o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi)) {
selJpsiToMuMu = 0;
}

Expand Down
39 changes: 12 additions & 27 deletions PWGHF/Tasks/taskX.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
///
/// \author Gian Michele Innocenti <gian.michele.innocenti@cern.ch>, CERN
/// \author Rik Spijkers <r.spijkers@students.uu.nl>, Utrecht University
/// \author Luca Micheletti <luca.micheletti@to.infn>, INFN

#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
Expand Down Expand Up @@ -49,16 +50,12 @@ struct TaskX {

Configurable<int> d_selectionFlagX{"d_selectionFlagX", 1, "Selection Flag for X"};
Configurable<double> cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"};
Configurable<bool> d_modeXToJpsiToMuMuPiPi{"d_modeXToJpsiToMuMuPiPi", false, "Perform Jpsi to mu+mu- analysis"};
Configurable<bool> modeXToJpsiToMuMuPiPi{"modeXToJpsiToMuMuPiPi", false, "Perform Jpsi to mu+mu- analysis"};
Configurable<std::vector<double>> bins{"pTBins", std::vector<double>{hf_cuts_x_tojpsipipi::pTBins_v}, "pT bin limits"};

void init(o2::framework::InitContext&)
{
if (d_modeXToJpsiToMuMuPiPi) {
registry.add("hMass", "3-prong candidates;inv. mass (J/#psi(#mu+#mu-) #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
} else {
registry.add("hMass", "3-prong candidates;inv. mass (J/#psi(e+e-) #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
}
registry.add("hMass", "3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 3., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
registry.add("hdeclength", "3-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
registry.add("hdeclengthxy", "3-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
registry.add("hd0Prong0", "3-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
Expand All @@ -71,20 +68,14 @@ struct TaskX {
registry.add("hDecLenXYErr", "3-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
}

Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX || aod::hf_selcandidate_x::isSelXToJpsiToMuMuPiPi >= d_selectionFlagX);
Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiToEEPiPi >= d_selectionFlagX || aod::hf_selcandidate_x::isSelXToJpsiToMuMuPiPi >= d_selectionFlagX);

void process(soa::Filtered<soa::Join<aod::HfCandX, aod::HFSelXToJpsiPiPiCandidate>> const& candidates)
{
int decayMode = d_modeXToJpsiToMuMuPiPi ? XToJpsiToMuMuPiPi : XToJpsiPiPi;
int decayMode = modeXToJpsiToMuMuPiPi ? o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi : o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi;
for (auto& candidate : candidates) {
if (d_modeXToJpsiToMuMuPiPi) {
if (!(candidate.hfflag() & 1 << decayMode)) {
continue;
}
} else {
if (!(candidate.hfflag() & 1 << decayMode)) {
continue;
}
if (!(candidate.hfflag() & 1 << decayMode)) {
continue;
}
if (cutYCandMax >= 0. && std::abs(YX(candidate)) > cutYCandMax) {
continue;
Expand Down Expand Up @@ -120,7 +111,7 @@ struct TaskXMC {

Configurable<int> d_selectionFlagX{"d_selectionFlagX", 1, "Selection Flag for X"};
Configurable<double> cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"};
Configurable<bool> d_modeXToJpsiToMuMuPiPi{"d_modeXToJpsiToMuMuPiPi", false, "Perform Jpsi to mu+mu- analysis"};
Configurable<bool> modeXToJpsiToMuMuPiPi{"modeXToJpsiToMuMuPiPi", false, "Perform Jpsi to mu+mu- analysis"};
Configurable<std::vector<double>> bins{"pTBins", std::vector<double>{hf_cuts_x_tojpsipipi::pTBins_v}, "pT bin limits"};

void init(o2::framework::InitContext&)
Expand Down Expand Up @@ -160,23 +151,17 @@ struct TaskXMC {
registry.add("hYBg", "3-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
}

Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiPiPi >= d_selectionFlagX || aod::hf_selcandidate_x::isSelXToJpsiToMuMuPiPi >= d_selectionFlagX);
Filter filterSelectCandidates = (aod::hf_selcandidate_x::isSelXToJpsiToEEPiPi >= d_selectionFlagX || aod::hf_selcandidate_x::isSelXToJpsiToMuMuPiPi >= d_selectionFlagX);

void process(soa::Filtered<soa::Join<aod::HfCandX, aod::HFSelXToJpsiPiPiCandidate, aod::HfCandXMCRec>> const& candidates,
soa::Join<aod::McParticles, aod::HfCandXMCGen> const& particlesMC, aod::BigTracksMC const& tracks)
{
// MC rec.
//Printf("MC Candidates: %d", candidates.size());
int decayMode = d_modeXToJpsiToMuMuPiPi ? XToJpsiToMuMuPiPi : XToJpsiPiPi;
int decayMode = modeXToJpsiToMuMuPiPi ? o2::aod::hf_cand_x::DecayType::XToJpsiToMuMuPiPi : o2::aod::hf_cand_x::DecayType::XToJpsiToEEPiPi;
for (auto& candidate : candidates) {
if (d_modeXToJpsiToMuMuPiPi) {
if (!(candidate.hfflag() & 1 << decayMode)) {
continue;
}
} else {
if (!(candidate.hfflag() & 1 << decayMode)) {
continue;
}
if (!(candidate.hfflag() & 1 << decayMode)) {
continue;
}
if (cutYCandMax >= 0. && std::abs(YX(candidate)) > cutYCandMax) {
continue;
Expand Down