Skip to content

Commit b2cae9b

Browse files
ginnocenGian Michele Innocenti
andauthored
Fix selector to allow compatibility with MID (#6356)
Co-authored-by: Gian Michele Innocenti <ginnocen@alicecerno2.cern.ch>
1 parent 10f0702 commit b2cae9b

2 files changed

Lines changed: 64 additions & 19 deletions

File tree

Analysis/Tasks/PWGHF/HFJpsiCandidateSelector.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ struct HFJpsiCandidateSelector {
107107
Configurable<double> d_pidRICHMinpT{"d_pidRICHMinpT", 0.15, "Lower bound of track pT for RICH PID"};
108108
Configurable<double> d_pidRICHMaxpT{"d_pidRICHMaxpT", 10., "Upper bound of track pT for RICH PID"};
109109
Configurable<double> d_nSigmaRICH{"d_nSigmaRICH", 3., "Nsigma cut on RICH only"};
110+
Configurable<double> nSigmaRICHCombinedTOF{"nSigmaRICHCombinedTOF", 5., "Nsigma cut on RICH combined with TOF"};
110111
// topological cuts
111112
Configurable<std::vector<double>> pTBins{"pTBins", std::vector<double>{hf_cuts_jpsi_toee::pTBins_v}, "pT bin limits"};
112113
Configurable<LabeledArray<double>> cuts{"Jpsi_to_ee_cuts", {hf_cuts_jpsi_toee::cuts[0], npTBins, nCutVars, pTBinLabels, cutVarLabels}, "Jpsi candidate selection per pT bin"};
@@ -178,6 +179,7 @@ struct HFJpsiCandidateSelector {
178179
selectorElectron.setRangeNSigmaTOFCondTPC(-d_nSigmaTOFCombined, d_nSigmaTOFCombined);
179180
selectorElectron.setRangePtRICH(d_pidRICHMinpT, d_pidRICHMaxpT);
180181
selectorElectron.setRangeNSigmaRICH(-d_nSigmaRICH, d_nSigmaRICH);
182+
selectorElectron.setRangeNSigmaRICHCondTOF(-nSigmaRICHCombinedTOF, nSigmaRICHCombinedTOF);
181183

182184
TrackSelectorPID selectorMuon(kMuonMinus);
183185

Analysis/Tasks/PWGHF/taskJpsi.cxx

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ struct TaskJpsi {
4242
{"hptprong0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}},
4343
{"hptprong1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 20.}}}}}};
4444

45-
Configurable<int> d_selectionFlagJpsi{"d_selectionFlagJpsi", 1, "Selection Flag for Jpsi"};
45+
Configurable<int> d_selectionFlagJpsi{"d_selectionFlagJpsi", 0, "Selection Flag for Jpsi"};
46+
Configurable<bool> d_modeJpsiToMuMu{"d_modeJpsiToMuMu", false, "Perform Jpsi to mu+mu- analysis"};
4647
Configurable<double> cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"};
4748
Configurable<std::vector<double>> bins{"pTBins", std::vector<double>{hf_cuts_jpsi_toee::pTBins_v}, "pT bin limits"};
4849

4950
void init(o2::framework::InitContext&)
5051
{
51-
registry.add("hmass", "2-prong candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
52+
registry.add("hmass", "2-prong candidates;inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
5253
registry.add("hdeclength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
5354
registry.add("hdeclengthxy", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
5455
registry.add("hd0Prong0", "2-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})"}}});
@@ -61,19 +62,35 @@ struct TaskJpsi {
6162
registry.add("hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
6263
}
6364

64-
Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi);
65+
Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi);
6566

6667
void process(soa::Filtered<soa::Join<aod::HfCandProng2, aod::HFSelJpsiCandidate>> const& candidates)
6768
{
69+
int decayMode = d_modeJpsiToMuMu ? DecayType::JpsiToMuMu : DecayType::JpsiToEE;
70+
6871
for (auto& candidate : candidates) {
69-
if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) {
72+
73+
if (!(candidate.hfflag() & 1 << decayMode)) {
7074
continue;
7175
}
76+
if (d_selectionFlagJpsi > 0) {
77+
if (d_modeJpsiToMuMu) {
78+
if (candidate.isSelJpsiToMuMu() <= 0)
79+
continue;
80+
} else {
81+
if (candidate.isSelJpsiToEE() <= 0)
82+
continue;
83+
}
84+
}
7285
if (cutYCandMax >= 0. && std::abs(YJpsi(candidate)) > cutYCandMax) {
7386
continue;
7487
}
7588

76-
registry.fill(HIST("hmass"), InvMassJpsiToEE(candidate), candidate.pt());
89+
if (d_modeJpsiToMuMu) {
90+
registry.fill(HIST("hmass"), InvMassJpsiToMuMu(candidate), candidate.pt());
91+
} else {
92+
registry.fill(HIST("hmass"), InvMassJpsiToEE(candidate), candidate.pt());
93+
}
7794
registry.fill(HIST("hptcand"), candidate.pt());
7895
registry.fill(HIST("hptprong0"), candidate.ptProng0());
7996
registry.fill(HIST("hptprong1"), candidate.ptProng1());
@@ -107,13 +124,14 @@ struct TaskJpsiMC {
107124
{"hEtaGen", "2-prong candidates (gen. matched);#it{#eta};entries", {HistType::kTH1F, {{100, -2., 2.}}}}}};
108125

109126
Configurable<int> d_selectionFlagJpsi{"d_selectionFlagJpsi", 1, "Selection Flag for Jpsi"};
127+
Configurable<bool> d_modeJpsiToMuMu{"d_modeJpsiToMuMu", false, "Perform Jpsi to mu+mu- analysis"};
110128
Configurable<double> cutYCandMax{"cutYCandMax", -1., "max. cand. rapidity"};
111129
Configurable<std::vector<double>> bins{"pTBins", std::vector<double>{hf_cuts_jpsi_toee::pTBins_v}, "pT bin limits"};
112130

113131
void init(o2::framework::InitContext&)
114132
{
115-
registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
116-
registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
133+
registry.add("hmassSig", "2-prong candidates (rec matched);inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
134+
registry.add("hmassBg", "2-prong candidates (rec unmatched);inv. mass (l^{#plus} l^{#minus}) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{200, 2., 4.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
117135
registry.add("hdeclengthSig", "2-prong candidates (rec matched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
118136
registry.add("hdeclengthBg", "2-prong candidates (rec unmatched);decay length (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
119137
registry.add("hdeclengthxySig", "2-prong candidates (rec matched);decay length xy (cm);entries", {HistType::kTH2F, {{100, 0., 0.01}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
@@ -124,37 +142,56 @@ struct TaskJpsiMC {
124142
registry.add("hd0Prong1Bg", "2-prong candidates (rec unmatched);prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
125143
registry.add("hd0d0Sig", "2-prong candidates (rec matched);product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
126144
registry.add("hd0d0Bg", "2-prong candidates (rec unmatched);product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{400, -0.002, 0.002}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
127-
registry.add("hChi2PCASig", "3-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
128-
registry.add("hChi2PCABg", "3-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
129-
registry.add("hCtSig", "3-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
130-
registry.add("hCtBg", "3-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
131-
registry.add("hYSig", "3-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{100, -2., 2.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
132-
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})"}}});
145+
registry.add("hChi2PCASig", "2-prong candidates (rec. matched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
146+
registry.add("hChi2PCABg", "2-prong candidates (rec. unmatched);chi2 PCA (cm);entries", {HistType::kTH2F, {{1000, 0., 0.0001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
147+
registry.add("hCtSig", "2-prong candidates (rec. matched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
148+
registry.add("hCtBg", "2-prong candidates (rec. unmatched);proper lifetime X(3872) * #it{c} (cm);entries", {HistType::kTH2F, {{400, 0., 0.001}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
149+
registry.add("hYGenSig", "2-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector<double>)bins, "#it{p}^{gen}_{T} (GeV/#it{c})"}}});
150+
registry.add("hYSig", "2-prong candidates (rec. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
151+
registry.add("hYBg", "2-prong candidates (rec. unmatched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
152+
registry.add("hYGen", "2-prong MC particles (gen. matched);candidate rapidity;entries", {HistType::kTH2F, {{10, -2., 2.}, {(std::vector<double>)bins, "#it{p}_{T} (GeV/#it{c})"}}});
133153
}
134154

135-
Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi);
155+
Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi);
136156

137157
void process(soa::Filtered<soa::Join<aod::HfCandProng2, aod::HFSelJpsiCandidate, aod::HfCandProng2MCRec>> const& candidates,
138158
soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const& particlesMC, aod::BigTracksMC const& tracks)
139159
{
140160
// MC rec.
141161
//Printf("MC Candidates: %d", candidates.size());
162+
int decayMode = d_modeJpsiToMuMu ? DecayType::JpsiToMuMu : DecayType::JpsiToEE;
163+
142164
for (auto& candidate : candidates) {
143-
if (!(candidate.hfflag() & 1 << DecayType::JpsiToEE)) {
165+
166+
if (!(candidate.hfflag() & 1 << decayMode)) {
144167
continue;
145168
}
169+
if (d_selectionFlagJpsi > 0) {
170+
if (d_modeJpsiToMuMu) {
171+
if (candidate.isSelJpsiToMuMu() <= 0)
172+
continue;
173+
} else {
174+
if (candidate.isSelJpsiToEE() <= 0)
175+
continue;
176+
}
177+
}
178+
146179
if (cutYCandMax >= 0. && std::abs(YJpsi(candidate)) > cutYCandMax) {
147180
continue;
148181
}
149-
if (candidate.flagMCMatchRec() == 1 << DecayType::JpsiToEE) {
182+
if (candidate.flagMCMatchRec() == 1 << decayMode) {
150183
//Get the corresponding MC particle.
151184
auto indexMother = RecoDecay::getMother(particlesMC, candidate.index0_as<aod::BigTracksMC>().mcParticle_as<soa::Join<aod::McParticles, aod::HfCandProng2MCGen>>(), 443, true);
152185
auto particleMother = particlesMC.iteratorAt(indexMother);
153186
registry.fill(HIST("hPtGenSig"), particleMother.pt()); // gen. level pT
154187
registry.fill(HIST("hPtRecSig"), candidate.pt()); // rec. level pT
155188
registry.fill(HIST("hCPARecSig"), candidate.cpa());
156189
registry.fill(HIST("hEtaRecSig"), candidate.eta());
157-
registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt());
190+
if (d_modeJpsiToMuMu) {
191+
registry.fill(HIST("hmassSig"), InvMassJpsiToMuMu(candidate), candidate.pt());
192+
} else {
193+
registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt());
194+
}
158195
registry.fill(HIST("hdeclengthSig"), candidate.decayLength(), candidate.pt());
159196
registry.fill(HIST("hdeclengthxySig"), candidate.decayLengthXY(), candidate.pt());
160197
registry.fill(HIST("hd0Prong0Sig"), candidate.impactParameter0(), candidate.pt());
@@ -163,12 +200,17 @@ struct TaskJpsiMC {
163200
registry.fill(HIST("hChi2PCASig"), candidate.chi2PCA(), candidate.pt());
164201
registry.fill(HIST("hCtSig"), CtJpsi(candidate), candidate.pt());
165202
registry.fill(HIST("hYSig"), YJpsi(candidate), candidate.pt());
203+
registry.fill(HIST("hYGenSig"), RecoDecay::Y(array{particleMother.px(), particleMother.py(), particleMother.pz()}, RecoDecay::getMassPDG(particleMother.pdgCode())), particleMother.pt());
166204

167205
} else {
168206
registry.fill(HIST("hPtRecBg"), candidate.pt());
169207
registry.fill(HIST("hCPARecBg"), candidate.cpa());
170208
registry.fill(HIST("hEtaRecBg"), candidate.eta());
171-
registry.fill(HIST("hmassBg"), InvMassJpsiToEE(candidate), candidate.pt());
209+
if (d_modeJpsiToMuMu) {
210+
registry.fill(HIST("hmassSig"), InvMassJpsiToMuMu(candidate), candidate.pt());
211+
} else {
212+
registry.fill(HIST("hmassSig"), InvMassJpsiToEE(candidate), candidate.pt());
213+
}
172214
registry.fill(HIST("hdeclengthBg"), candidate.decayLength(), candidate.pt());
173215
registry.fill(HIST("hdeclengthxyBg"), candidate.decayLengthXY(), candidate.pt());
174216
registry.fill(HIST("hd0Prong0Bg"), candidate.impactParameter0(), candidate.pt());
@@ -182,12 +224,13 @@ struct TaskJpsiMC {
182224
// MC gen.
183225
//Printf("MC Particles: %d", particlesMC.size());
184226
for (auto& particle : particlesMC) {
185-
if (particle.flagMCMatchGen() == 1 << DecayType::JpsiToEE) {
227+
if (particle.flagMCMatchGen() == 1 << decayMode) {
186228
if (cutYCandMax >= 0. && std::abs(RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()))) > cutYCandMax) {
187229
continue;
188230
}
189231
registry.fill(HIST("hPtGen"), particle.pt());
190232
registry.fill(HIST("hEtaGen"), particle.eta());
233+
registry.fill(HIST("hYGen"), RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode())), particle.pt());
191234
}
192235
}
193236
}

0 commit comments

Comments
 (0)