Skip to content

Commit b759a34

Browse files
sangwoo184sangwoo
andauthored
[PWGLF] Add PID flag and change main loop using two for loop (AliceO2Group#9894)
Co-authored-by: sangwoo <[email protected]>
1 parent e18f23f commit b759a34

File tree

1 file changed

+65
-48
lines changed

1 file changed

+65
-48
lines changed

PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx

Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111

1212
/// \author Junlee Kim ([email protected])
1313

14+
#include <Framework/Configurable.h>
1415
#include <cmath>
1516
#include <array>
1617
#include <cstdlib>
1718
#include <chrono>
19+
#include <iostream>
1820
#include <string>
1921

2022
#include "TLorentzVector.h"
@@ -103,6 +105,7 @@ struct f0980pbpbanalysis {
103105
Configurable<double> cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 5.0, "TPC nSigma cut for Pion"}; // TPC
104106
Configurable<double> cMaxTPCnSigmaPionS{"cMaxTPCnSigmaPionS", 3.0, "TPC nSigma cut for Pion as a standalone"};
105107
Configurable<bool> cfgUSETOF{"cfgUSETOF", false, "TPC usage"};
108+
Configurable<int> SelectType{"SelectType", 0, "PID selection type"};
106109

107110
Configurable<int> cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"};
108111
Configurable<int> cfgNQvec{"cfgNQvec", 7, "The number of total Qvectors for looping over the task"};
@@ -238,16 +241,38 @@ struct f0980pbpbanalysis {
238241
template <typename TrackType>
239242
bool PIDSelected(const TrackType track)
240243
{
241-
if (cfgUSETOF) {
242-
if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) {
243-
return 0;
244+
if (SelectType == 0) {
245+
if (cfgUSETOF) {
246+
if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) {
247+
return 0;
248+
}
249+
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPion) {
250+
return 0;
251+
}
244252
}
245-
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPion) {
253+
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPionS) {
246254
return 0;
247255
}
248256
}
249-
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPionS) {
250-
return 0;
257+
if (SelectType == 1) {
258+
if (cfgUSETOF) {
259+
if (track.hasTOF()) {
260+
if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) {
261+
return 0;
262+
}
263+
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPion) {
264+
return 0;
265+
}
266+
} else {
267+
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPionS) {
268+
return 0;
269+
}
270+
}
271+
} else {
272+
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPionS) {
273+
return 0;
274+
}
275+
}
251276
}
252277

253278
return 1;
@@ -271,54 +296,46 @@ struct f0980pbpbanalysis {
271296
histos.fill(HIST("QA/EPResBC"), centrality, TMath::Cos(static_cast<float>(nmode) * (eventPlaneRefA - eventPlaneRefB)));
272297

273298
TLorentzVector Pion1, Pion2, Reco;
274-
for (auto& [trk1, trk2] :
275-
combinations(CombinationsUpperIndexPolicy(dTracks, dTracks))) {
276-
if (trk1.index() == trk2.index()) {
277-
if (!trackSelected(trk1))
278-
continue;
279-
histos.fill(HIST("QA/Nsigma_TPC"), trk1.pt(), trk1.tpcNSigmaPi());
280-
histos.fill(HIST("QA/Nsigma_TOF"), trk1.pt(), trk1.tofNSigmaPi());
281-
histos.fill(HIST("QA/TPC_TOF"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi());
299+
for (auto& trk1 : dTracks) {
300+
if (!trackSelected(trk1))
282301
continue;
283-
}
302+
histos.fill(HIST("QA/Nsigma_TPC"), trk1.pt(), trk1.tpcNSigmaPi());
303+
histos.fill(HIST("QA/Nsigma_TOF"), trk1.pt(), trk1.tofNSigmaPi());
304+
histos.fill(HIST("QA/TPC_TOF"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi());
284305

285-
if (!trackSelected(trk1) || !trackSelected(trk2))
286-
continue;
287-
if (!PIDSelected(trk1) || !PIDSelected(trk2))
288-
continue;
306+
for (auto& trk2 : dTracks) {
307+
if (!trackSelected(trk1) || !trackSelected(trk2)) {
308+
continue;
309+
}
289310

290-
if (trk1.index() == trk2.index()) {
291-
histos.fill(HIST("QA/Nsigma_TPC_selected"), trk1.pt(), trk1.tpcNSigmaPi());
292-
histos.fill(HIST("QA/Nsigma_TOF_selected"), trk1.pt(), trk1.tofNSigmaPi());
293-
histos.fill(HIST("QA/TPC_TOF_selected"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi());
294-
}
311+
// PID
312+
if (!PIDSelected(trk1) || !PIDSelected(trk2)) {
313+
continue;
314+
}
295315

296-
Pion1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi);
297-
Pion2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
298-
Reco = Pion1 + Pion2;
316+
if (trk1.index() == trk2.index()) {
317+
histos.fill(HIST("QA/Nsigma_TPC_selected"), trk1.pt(), trk1.tpcNSigmaPi());
318+
histos.fill(HIST("QA/Nsigma_TOF_selected"), trk1.pt(), trk1.tofNSigmaPi());
319+
histos.fill(HIST("QA/TPC_TOF_selected"), trk1.tpcNSigmaPi(), trk1.tofNSigmaPi());
320+
}
299321

300-
if (Reco.Rapidity() > cfgMaxRap || Reco.Rapidity() < cfgMinRap)
301-
continue;
322+
Pion1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPi);
323+
Pion2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPi);
324+
Reco = Pion1 + Pion2;
325+
326+
if (Reco.Rapidity() > cfgMaxRap || Reco.Rapidity() < cfgMinRap) {
327+
continue;
328+
}
329+
330+
relPhi = TVector2::Phi_0_2pi((Reco.Phi() - eventPlaneDet) * static_cast<float>(nmode));
302331

303-
relPhi = TVector2::Phi_0_2pi((Reco.Phi() - eventPlaneDet) * static_cast<float>(nmode));
304-
305-
if (trk1.sign() * trk2.sign() < 0) {
306-
histos.fill(HIST("hInvMass_f0980_US_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi);
307-
/*
308-
if constexpr (IsMC) {
309-
if (abs(trk1.pdgCode()) != 211 || abs(trk2.pdgCode()) != 211)
310-
continue;
311-
if (trk1.motherId() != trk2.motherId())
312-
continue;
313-
if (abs(trk1.motherPDG()) != 9010221)
314-
continue;
315-
histos.fill(HIST("MCL/hpT_f0980_REC"), Reco.M(), Reco.Pt(), centrality);
316-
}
317-
*/
318-
} else if (trk1.sign() > 0 && trk2.sign() > 0) {
319-
histos.fill(HIST("hInvMass_f0980_LSpp_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi);
320-
} else if (trk1.sign() < 0 && trk2.sign() < 0) {
321-
histos.fill(HIST("hInvMass_f0980_LSmm_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi);
332+
if (trk1.sign() * trk2.sign() < 0) {
333+
histos.fill(HIST("hInvMass_f0980_US_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi);
334+
} else if (trk1.sign() > 0 && trk2.sign() > 0) {
335+
histos.fill(HIST("hInvMass_f0980_LSpp_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi);
336+
} else if (trk1.sign() < 0 && trk2.sign() < 0) {
337+
histos.fill(HIST("hInvMass_f0980_LSmm_EPA"), Reco.M(), Reco.Pt(), centrality, relPhi);
338+
}
322339
}
323340
}
324341
}

0 commit comments

Comments
 (0)