Skip to content

Commit 2791c70

Browse files
[PWGCF] IdentifiedBf added Histogram to measure single particle purity (#10941)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 80f31ee commit 2791c70

File tree

2 files changed

+77
-2
lines changed

2 files changed

+77
-2
lines changed

PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,13 +1679,14 @@ inline int8_t IdentifiedBfFilterTracks::acceptParticle(ParticleObject& particle,
16791679
}
16801680

16811681
if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) {
1682-
MatchRecoGenSpecies sp;
1682+
MatchRecoGenSpecies sp = kWrongSpecies;
16831683
if (recoIdMethod == recoIdMethods[0]) {
16841684
sp = kIdBfCharged;
16851685
}
1686-
if (recoIdMethod == recoIdMethods[1]) {
1686+
if (recoIdMethod == recoIdMethods[1] || recoIdMethod == recoIdMethods[2]) {
16871687
sp = identifyParticle(particle);
16881688
}
1689+
16891690
if (sp != kWrongSpecies) {
16901691
if (sp != kIdBfCharged) {
16911692
/* fill the charged particle histograms */

PWGCF/TwoParticleCorrelations/Tasks/identifiedbf.cxx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ struct IdentifiedbfTask {
100100
std::vector<TH3F*> fhN1VsZEtaPhiPt{nch + 1, nullptr}; //!<! single particle distribution vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
101101
std::vector<TH3F*> fhN1VsZEtaPhiPtPrimary{nch, nullptr}; //!<! single particle distribution of primary particles vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
102102
std::vector<TH3F*> fhN1VsZEtaPhiPtSecondary{nch, nullptr}; //!<! single particle distribution of primary particles vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
103+
std::vector<TH3F*> fhN1VsZEtaPhiPtPure{nch + 1, nullptr}; //!<! single particle distribution of pure particles vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
103104
std::vector<TH3F*> fhSum1PtVsZEtaPhiPt{nch, nullptr}; //!<! accumulated sum of weighted \f$p_T\f$ vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the different species
104105
std::vector<TH3*> fhNuaNueVsZEtaPhiPt{nch, nullptr}; //!<! NUA+NUE correction vs \f$\mbox{vtx}_z,\; \eta,\;\phi,\;p_T\f$, for the differents species
105106
std::vector<TH2*> fhPtAvgVsEtaPhi{nch, nullptr}; //!<! average \f$p_T\f$ vs \f$\eta,\;\phi\f$, for the different species
@@ -297,6 +298,56 @@ struct IdentifiedbfTask {
297298
return particle.isPhysicalPrimary();
298299
}
299300

301+
/// \brief checks whether MC track is a physical primary or secondary
302+
/// \param particle passed MC track converted to MCParticle
303+
template <typename ParticleObject>
304+
bool isSpeciesCheck(ParticleObject const& particle, int trkId)
305+
{
306+
int pdgcode = particle.pdgCode();
307+
int realPID = -1;
308+
switch (pdgcode) {
309+
case kPositron:
310+
realPID = 0;
311+
break;
312+
case kElectron:
313+
realPID = 1;
314+
break;
315+
case kPiPlus:
316+
realPID = 2;
317+
break;
318+
case kPiMinus:
319+
realPID = 3;
320+
break;
321+
case kKPlus:
322+
realPID = 4;
323+
break;
324+
case kKMinus:
325+
realPID = 5;
326+
break;
327+
case kProton:
328+
realPID = 6;
329+
break;
330+
case kProtonBar:
331+
realPID = 7;
332+
break;
333+
default:
334+
realPID = -1;
335+
break;
336+
}
337+
return (realPID == trkId);
338+
}
339+
340+
/// \brief checks whether MC track is a physical primary or secondary
341+
/// \param particle passed MC track converted to MCParticle
342+
template <typename TrackObject>
343+
bool isPrimarySpeciesCheck(TrackObject const& track, int trkId)
344+
{
345+
if constexpr (framework::has_type_v<aod::mctracklabel::McParticleId, typename TrackObject::all_columns>) {
346+
return (isPrimaryCheck(track.template mcParticle_as<aod::McParticles>()) && isSpeciesCheck(track.template mcParticle_as<aod::McParticles>(), trkId));
347+
}
348+
return false;
349+
}
350+
300351
/// \brief fills the singles histograms in singles execution mode
301352
/// \param passedtracks filtered table with the tracks associated to the passed index
302353
/// \param tix index, in the singles histogram bank, for the passed filetered track table
@@ -315,6 +366,9 @@ struct IdentifiedbfTask {
315366
fhN1VsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr);
316367
fhSum1PtVsZEtaPhiPt[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), track.pt() * corr);
317368
trackPrimaryCheck(track, zvtx, corr);
369+
if (isPrimarySpeciesCheck(track, track.trackacceptedid())) {
370+
fhN1VsZEtaPhiPtPure[track.trackacceptedid()]->Fill(zvtx, getEtaPhiIndex(track) + 0.5, track.pt(), corr);
371+
}
318372
}
319373
index++;
320374
}
@@ -583,6 +637,23 @@ struct IdentifiedbfTask {
583637
ptlow,
584638
ptup);
585639

640+
fhN1VsZEtaPhiPtPure[i] = new TH3F(
641+
TString::Format("n1_%s_Pure_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(),
642+
TString::Format("#LT n_{1} Pure #GT;vtx_{z};#eta_{%s}#times#varphi_{%s};p_{t,%s} (GeV/c)",
643+
tname[i].c_str(),
644+
tname[i].c_str(),
645+
tname[i].c_str())
646+
.Data(),
647+
zvtxbins,
648+
zvtxlow,
649+
zvtxup,
650+
etabins * phibins,
651+
0.0,
652+
static_cast<double>(etabins * phibins),
653+
ptbins,
654+
ptlow,
655+
ptup);
656+
586657
fhSum1PtVsZEtaPhiPt[i] = new TH3F(
587658
TString::Format("sumPt1_%s_vsZ_vsEtaPhi_vsPt", tname[i].c_str()).Data(),
588659
TString::Format(
@@ -618,6 +689,8 @@ struct IdentifiedbfTask {
618689
fhN1VsZEtaPhiPtPrimary[i]->Sumw2(false);
619690
fhN1VsZEtaPhiPtSecondary[i]->SetBit(TH1::kIsNotW);
620691
fhN1VsZEtaPhiPtSecondary[i]->Sumw2(false);
692+
fhN1VsZEtaPhiPtPure[i]->SetBit(TH1::kIsNotW);
693+
fhN1VsZEtaPhiPtPure[i]->Sumw2(false);
621694
fhSum1PtVsZEtaPhiPt[i]->SetBit(TH1::kIsNotW);
622695
fhSum1PtVsZEtaPhiPt[i]->Sumw2(false);
623696
}
@@ -632,6 +705,7 @@ struct IdentifiedbfTask {
632705
fOutputList->Add(fhN1VsZEtaPhiPt[i]);
633706
fOutputList->Add(fhN1VsZEtaPhiPtPrimary[i]);
634707
fOutputList->Add(fhN1VsZEtaPhiPtSecondary[i]);
708+
fOutputList->Add(fhN1VsZEtaPhiPtPure[i]);
635709
fOutputList->Add(fhSum1PtVsZEtaPhiPt[i]);
636710
}
637711
}

0 commit comments

Comments
 (0)