1414// / \note Adapted from HFCandidateCreator3Prong
1515// /
1616// / \author Rik Spijkers <r.spijkers@students.uu.nl>, Utrecht University
17+ // / \author Luca Micheletti <luca.micheletti@to.infn.it>, INFN
1718
1819#include " Framework/AnalysisTask.h"
1920#include " DetectorsVertexing/DCAFitterN.h"
2425#include " PWGHF/DataModel/HFCandidateSelectionTables.h"
2526
2627using namespace o2 ;
28+ using namespace o2 ::aod;
2729using namespace o2 ::framework;
2830using namespace o2 ::aod::hf_cand;
2931using namespace o2 ::aod::hf_cand_prong2;
30- using namespace o2 ::aod::hf_cand_prong3;
3132using namespace o2 ::aod::hf_cand_x;
3233using namespace o2 ::framework::expressions;
3334
@@ -52,10 +53,13 @@ struct HFCandidateCreatorX {
5253 Configurable<double > ptPionMin{" ptPionMin" , 0.15 , " minimum pion pT threshold (GeV/c)" };
5354 Configurable<bool > b_dovalplots{" b_dovalplots" , true , " do validation plots" };
5455
55- OutputObj<TH1F> hMassJpsi{TH1F (" hMassJpsi" , " J/#psi candidates;inv. mass (#e+ e-) (GeV/#it{c}^{2});entries" , 500 , 0 ., 5 .)};
56+ OutputObj<TH1F> hMassJpsiToEE{TH1F (" hMassJpsiToEE" , " J/#psi candidates;inv. mass (e^{#plus} e^{#minus}) (GeV/#it{c}^{2});entries" , 500 , 0 ., 5 .)};
57+ OutputObj<TH1F> hMassJpsiToMuMu{TH1F (" hMassJpsiToMuMu" , " J/#psi candidates;inv. mass (#mu^{#plus} #mu^{#minus}) (GeV/#it{c}^{2});entries" , 500 , 0 ., 5 .)};
5658 OutputObj<TH1F> hPtJpsi{TH1F (" hPtJpsi" , " J/#psi candidates;candidate #it{p}_{T} (GeV/#it{c});entries" , 100 , 0 ., 10 .)};
59+ OutputObj<TH1F> hPtPion{TH1F (" hPtPion" , " #pi candidates;candidate #it{p}_{T} (GeV/#it{c});entries" , 100 , 0 ., 10 .)};
5760 OutputObj<TH1F> hCPAJpsi{TH1F (" hCPAJpsi" , " J/#psi candidates;cosine of pointing angle;entries" , 110 , -1.1 , 1.1 )};
58- OutputObj<TH1F> hMassX{TH1F (" hMassX" , " 3-prong candidates;inv. mass (J/#psi #pi+ #pi-) (GeV/#it{c}^{2});entries" , 500 , 0 ., 5 .)};
61+ 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 .)};
62+ 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 .)};
5963 OutputObj<TH1F> hCovPVXX{TH1F (" hCovPVXX" , " 3-prong candidates;XX element of cov. matrix of prim. vtx position (cm^{2});entries" , 100 , 0 ., 1 .e -4 )};
6064 OutputObj<TH1F> hCovSVXX{TH1F (" hCovSVXX" , " 3-prong candidates;XX element of cov. matrix of sec. vtx position (cm^{2});entries" , 100 , 0 ., 0.2 )};
6165
@@ -65,7 +69,7 @@ struct HFCandidateCreatorX {
6569
6670 Configurable<int > d_selectionFlagJpsi{" d_selectionFlagJpsi" , 1 , " Selection Flag for Jpsi" };
6771 Configurable<double > cutYCandMax{" cutYCandMax" , -1 ., " max. cand. rapidity" };
68- Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi);
72+ Filter filterSelectCandidates = (aod::hf_selcandidate_jpsi::isSelJpsiToEE >= d_selectionFlagJpsi || aod::hf_selcandidate_jpsi::isSelJpsiToMuMu >= d_selectionFlagJpsi );
6973
7074 void process (aod::Collision const & collision,
7175 soa::Filtered<soa::Join<
@@ -95,13 +99,18 @@ struct HFCandidateCreatorX {
9599
96100 // loop over Jpsi candidates
97101 for (auto & jpsiCand : jpsiCands) {
98- if (!(jpsiCand.hfflag () & 1 << JpsiToEE)) {
102+ if (!(jpsiCand.hfflag () & 1 << hf_cand_prong2::DecayType:: JpsiToEE) && !(jpsiCand. hfflag () & 1 << hf_cand_prong2::DecayType::JpsiToMuMu )) {
99103 continue ;
100104 }
101105 if (cutYCandMax >= 0 . && std::abs (YJpsi (jpsiCand)) > cutYCandMax) {
102106 continue ;
103107 }
104- hMassJpsi->Fill (InvMassJpsiToEE (jpsiCand));
108+ if (jpsiCand.isSelJpsiToEE () > 0 ) {
109+ hMassJpsiToEE->Fill (InvMassJpsiToEE (jpsiCand));
110+ }
111+ if (jpsiCand.isSelJpsiToMuMu () > 0 ) {
112+ hMassJpsiToMuMu->Fill (InvMassJpsiToMuMu (jpsiCand));
113+ }
105114 hPtJpsi->Fill (jpsiCand.pt ());
106115 hCPAJpsi->Fill (jpsiCand.cpa ());
107116 // create Jpsi track to pass to DCA fitter; use cand table + rebuild vertex
@@ -138,6 +147,7 @@ struct HFCandidateCreatorX {
138147 if (trackPos.pt () < ptPionMin) {
139148 continue ;
140149 }
150+ hPtPion->Fill (trackPos.pt ());
141151
142152 // loop over pi- candidates
143153 for (auto & trackNeg : tracks) {
@@ -150,6 +160,7 @@ struct HFCandidateCreatorX {
150160 if (trackNeg.pt () < ptPionMin) {
151161 continue ;
152162 }
163+ hPtPion->Fill (trackNeg.pt ());
153164
154165 auto trackParVarPos = getTrackParCov (trackPos);
155166 auto trackParVarNeg = getTrackParCov (trackNeg);
@@ -190,7 +201,13 @@ struct HFCandidateCreatorX {
190201 auto errorDecayLength = std::sqrt (getRotatedCovMatrixXX (covMatrixPV, phi, theta) + getRotatedCovMatrixXX (covMatrixPCA, phi, theta));
191202 auto errorDecayLengthXY = std::sqrt (getRotatedCovMatrixXX (covMatrixPV, phi, 0 .) + getRotatedCovMatrixXX (covMatrixPCA, phi, 0 .));
192203
193- int hfFlag = 1 << XToJpsiPiPi;
204+ int hfFlag = 0 ;
205+ if (TESTBIT (jpsiCand.hfflag (), hf_cand_prong2::DecayType::JpsiToMuMu)) {
206+ SETBIT (hfFlag, hf_cand_x::DecayType::XToJpsiToMuMuPiPi); // dimuon channel
207+ }
208+ if (TESTBIT (jpsiCand.hfflag (), hf_cand_prong2::DecayType::JpsiToEE)) {
209+ SETBIT (hfFlag, hf_cand_x::DecayType::XToJpsiToEEPiPi); // dielectron channel
210+ }
194211
195212 // fill the candidate table for the X here:
196213 rowCandidateBase (collision.globalIndex (),
@@ -209,7 +226,12 @@ struct HFCandidateCreatorX {
209226 // calculate invariant mass
210227 auto arrayMomenta = array{pvecJpsi, pvecPos, pvecNeg};
211228 massJpsiPiPi = RecoDecay::M (std::move (arrayMomenta), array{massJpsi, massPi, massPi});
212- hMassX->Fill (massJpsiPiPi);
229+ if (jpsiCand.isSelJpsiToEE () > 0 ) {
230+ hMassXToJpsiToEEPiPi->Fill (massJpsiPiPi);
231+ }
232+ if (jpsiCand.isSelJpsiToMuMu () > 0 ) {
233+ hMassXToJpsiToMuMuPiPi->Fill (massJpsiPiPi);
234+ }
213235 } // pi- loop
214236 } // pi+ loop
215237 } // Jpsi loop
@@ -233,6 +255,8 @@ struct HFCandidateCreatorXMC {
233255 aod::McParticles const & particlesMC)
234256 {
235257 int indexRec = -1 ;
258+ int pdgCodeX = pdg::Code::kX3872 ;
259+ int pdgCodeJpsi = pdg::Code::kJpsi ;
236260 int8_t sign = 0 ;
237261 int8_t flag = 0 ;
238262 int8_t origin = 0 ;
@@ -245,16 +269,32 @@ struct HFCandidateCreatorXMC {
245269 origin = 0 ;
246270 channel = 0 ;
247271 auto jpsiTrack = candidate.index0 ();
272+ auto daughterPosJpsi = jpsiTrack.index0_as <aod::BigTracksMC>();
273+ auto daughterNegJpsi = jpsiTrack.index1_as <aod::BigTracksMC>();
274+ auto arrayJpsiDaughters = array{daughterPosJpsi, daughterNegJpsi};
248275 auto arrayDaughters = array{candidate.index1_as <aod::BigTracksMC>(),
249276 candidate.index2_as <aod::BigTracksMC>(),
250- jpsiTrack. index0_as <aod::BigTracksMC>() ,
251- jpsiTrack. index1_as <aod::BigTracksMC>() };
277+ daughterPosJpsi ,
278+ daughterNegJpsi };
252279
253280 // X → J/ψ π+ π-
254281 // Printf("Checking X → J/ψ π+ π-");
255- indexRec = RecoDecay::getMatchedMCRec (particlesMC, arrayDaughters, 9920443 , array{+kPiPlus , - kPiPlus , + kElectron , -kElectron }, true , &sign, 2 );
282+ indexRec = RecoDecay::getMatchedMCRec (particlesMC, arrayJpsiDaughters, pdg::Code:: kJpsi , array{+kElectron , -kElectron }, true );
256283 if (indexRec > -1 ) {
257- flag = 1 << XToJpsiPiPi;
284+ indexRec = RecoDecay::getMatchedMCRec (particlesMC, arrayDaughters, pdgCodeX, array{+kPiPlus , -kPiPlus , +kElectron , -kElectron }, true , &sign, 2 );
285+ if (indexRec > -1 ) {
286+ flag = 1 << hf_cand_x::DecayType::XToJpsiToEEPiPi;
287+ }
288+ }
289+
290+ if (flag == 0 ) {
291+ indexRec = RecoDecay::getMatchedMCRec (particlesMC, arrayJpsiDaughters, pdg::Code::kJpsi , array{+kMuonPlus , -kMuonPlus }, true );
292+ if (indexRec > -1 ) {
293+ indexRec = RecoDecay::getMatchedMCRec (particlesMC, arrayDaughters, pdgCodeX, array{+kPiPlus , -kPiPlus , +kMuonPlus , -kMuonPlus }, true , &sign, 2 );
294+ if (indexRec > -1 ) {
295+ flag = 1 << hf_cand_x::DecayType::XToJpsiToMuMuPiPi;
296+ }
297+ }
258298 }
259299
260300 // Check whether the particle is non-prompt (from a b quark).
@@ -275,13 +315,19 @@ struct HFCandidateCreatorXMC {
275315
276316 // X → J/ψ π+ π-
277317 // Printf("Checking X → J/ψ π+ π-");
278- if (RecoDecay::isMatchedMCGen (particlesMC, particle, 9920443 , array{443 , +kPiPlus , -kPiPlus }, true )) {
318+ if (RecoDecay::isMatchedMCGen (particlesMC, particle, pdgCodeX , array{pdgCodeJpsi , +kPiPlus , -kPiPlus }, true )) {
279319 // Match J/psi --> e+e-
280320 std::vector<int > arrDaughter;
281- RecoDecay::getDaughters (particlesMC, particle, &arrDaughter, array{443 }, 1 );
321+ RecoDecay::getDaughters (particlesMC, particle, &arrDaughter, array{pdgCodeJpsi }, 1 );
282322 auto jpsiCandMC = particlesMC.iteratorAt (arrDaughter[0 ]);
283- if (RecoDecay::isMatchedMCGen (particlesMC, jpsiCandMC, 443 , array{+kElectron , -kElectron }, true )) {
284- flag = 1 << XToJpsiPiPi;
323+ if (RecoDecay::isMatchedMCGen (particlesMC, jpsiCandMC, pdgCodeJpsi, array{+kElectron , -kElectron }, true )) {
324+ flag = 1 << hf_cand_x::DecayType::XToJpsiToEEPiPi;
325+ }
326+
327+ if (flag == 0 ) {
328+ if (RecoDecay::isMatchedMCGen (particlesMC, jpsiCandMC, pdgCodeJpsi, array{+kMuonPlus , -kMuonPlus }, true )) {
329+ flag = 1 << hf_cand_x::DecayType::XToJpsiToMuMuPiPi;
330+ }
285331 }
286332 }
287333
0 commit comments