Skip to content

Commit 5981b31

Browse files
sangwoo184sangwoo
andauthored
[PWGLF] Add and fix for code test using kaon (#10776)
Co-authored-by: sangwoo <sangwoo@sangwooui-MacBookPro.local>
1 parent 8d34811 commit 5981b31

File tree

1 file changed

+99
-42
lines changed

1 file changed

+99
-42
lines changed

PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx

Lines changed: 99 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,17 @@
6060
#include "CCDB/CcdbApi.h"
6161
#include "CCDB/BasicCCDBManager.h"
6262

63+
// from phi
64+
#include "PWGLF/DataModel/EPCalibrationTables.h"
65+
#include "Common/DataModel/PIDResponseITS.h"
66+
6367
using namespace o2;
6468
using namespace o2::framework;
6569
using namespace o2::framework::expressions;
6670
using namespace o2::soa;
6771
using namespace o2::constants::physics;
6872

69-
struct f0980pbpbanalysis {
73+
struct F0980pbpbanalysis {
7074
HistogramRegistry histos{
7175
"histos",
7276
{},
@@ -108,7 +112,8 @@ struct f0980pbpbanalysis {
108112
Configurable<double> cMaxTPCnSigmaPion{"cMaxTPCnSigmaPion", 5.0, "TPC nSigma cut for Pion"}; // TPC
109113
Configurable<double> cMaxTPCnSigmaPionS{"cMaxTPCnSigmaPionS", 3.0, "TPC nSigma cut for Pion as a standalone"};
110114
Configurable<bool> cfgUSETOF{"cfgUSETOF", false, "TPC usage"};
111-
Configurable<int> cfgSelectType{"cfgSelectType", 0, "PID selection type"};
115+
Configurable<int> cfgSelectPID{"cfgSelectPID", 0, "PID selection type"};
116+
Configurable<int> cfgSelectPtl{"cfgSelectPtl", 0, "Particle selection type"};
112117

113118
Configurable<int> cfgnMods{"cfgnMods", 1, "The number of modulations of interest starting from 2"};
114119
Configurable<int> cfgNQvec{"cfgNQvec", 7, "The number of total Qvectors for looping over the task"};
@@ -120,6 +125,16 @@ struct f0980pbpbanalysis {
120125
Configurable<bool> cfgRotBkg{"cfgRotBkg", true, "flag to construct rotational backgrounds"};
121126
Configurable<int> cfgNRotBkg{"cfgNRotBkg", 10, "the number of rotational backgrounds"};
122127

128+
// for phi test
129+
Configurable<bool> cfgTPCFinableClsSel{"cfgTPCFinableClsSel", true, "TPC Crossed Rows to Findable Clusters selection flag"};
130+
Configurable<bool> cfgITSClsSel{"cfgITSClsSel", false, "ITS cluster selection flag"};
131+
Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"};
132+
Configurable<bool> cfgpTDepPID{"cfgpTDepPID", false, "pT dependent PID"};
133+
Configurable<bool> cfgBetaCutSel{"cfgBetaCutSel", false, "TOF beta cut selection flag"};
134+
Configurable<float> cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"};
135+
Configurable<bool> isDeepAngle{"isDeepAngle", true, "Deep Angle cut"};
136+
Configurable<double> cfgDeepAngle{"cfgDeepAngle", 0.04, "Deep Angle cut value"};
137+
123138
ConfigurableAxis massAxis{"massAxis", {400, 0.2, 2.2}, "Invariant mass axis"};
124139
ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 13.0, 20.0}, "Transverse momentum Binning"};
125140
ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"};
@@ -144,15 +159,37 @@ struct f0980pbpbanalysis {
144159
// double massPi = o2::constants::physics::MassPionCharged;
145160
double massPtl;
146161

162+
enum CentEstList {
163+
FT0C = 0,
164+
FT0M = 1,
165+
};
166+
167+
enum PIDList {
168+
PIDRun3 = 0,
169+
PIDRun2 = 1,
170+
PIDTest = 2,
171+
};
172+
173+
enum PtlList {
174+
PtlPion = 0,
175+
PtlKaon = 1,
176+
};
177+
147178
TRandom* rn = new TRandom();
148179
// float theta2;
149180

150181
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
151182
Filter acceptanceFilter = (nabs(aod::track::eta) < cfgMaxEta && nabs(aod::track::pt) > cfgMinPt);
152183
Filter cutDCAFilter = (nabs(aod::track::dcaXY) < cfgMaxDCArToPVcut) && (nabs(aod::track::dcaZ) < cfgMaxDCAzToPVcut);
184+
// from phi
185+
// Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCentSel;
186+
// Filter PIDcutFilter = nabs(aod::pidtpc::tpcNSigmaKa) < cMaxTPCnSigmaPion;
187+
// Filter PIDcutFilter = nabs(aod::pidTPCFullKa::tpcNSigmaKa) < cMaxTPCnSigmaPion;
153188

154-
using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::Mults, aod::Qvectors>>;
155-
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTPCFullKa>>;
189+
using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::Mults, aod::Qvectors, aod::EPCalibrationTables>>;
190+
// aod::EPCalibrationTables 추가됨
191+
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTPCFullKa, aod::pidTOFbeta>>;
192+
// aod::pidTOFbeta 추가됨
156193

157194
template <typename T>
158195
int getDetId(const T& name)
@@ -199,7 +236,7 @@ struct f0980pbpbanalysis {
199236
if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
200237
return 0;
201238
}
202-
if (cfgQvecSel && (collision.qvecAmp()[detId] < 1e-4 || collision.qvecAmp()[refAId] < 1e-4 || collision.qvecAmp()[refAId] < 1e-4)) {
239+
if (cfgQvecSel && (collision.qvecAmp()[detId] < 1e-4 || collision.qvecAmp()[refAId] < 1e-4 || collision.qvecAmp()[refBId] < 1e-4)) {
203240
return 0;
204241
}
205242
if (cfgOccupancySel && (collision.trackOccupancyInTimeRange() > cfgMaxOccupancy || collision.trackOccupancyInTimeRange() < cfgMinOccupancy)) {
@@ -211,7 +248,6 @@ struct f0980pbpbanalysis {
211248
if (cfgPVSel && std::abs(collision.posZ()) > cfgPV) {
212249
return 0;
213250
}
214-
215251
return 1;
216252
} // event selection
217253

@@ -230,9 +266,6 @@ struct f0980pbpbanalysis {
230266
if (std::fabs(track.dcaZ()) > cfgMaxDCAzToPVcut) {
231267
return 0;
232268
}
233-
if (track.tpcNClsFound() < cfgTPCcluster) {
234-
return 0;
235-
}
236269
if (cfgPVContributor && !track.isPVContributor()) {
237270
return 0;
238271
}
@@ -242,17 +275,22 @@ struct f0980pbpbanalysis {
242275
if (cfgGlobalWoDCATrack && !track.isGlobalTrackWoDCA()) {
243276
return 0;
244277
}
245-
if (track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) {
278+
if (track.tpcNClsFound() < cfgTPCcluster) {
279+
return 0;
280+
}
281+
if (cfgTPCFinableClsSel && track.tpcCrossedRowsOverFindableCls() < cfgRatioTPCRowsOverFindableCls) {
282+
return 0;
283+
}
284+
if (cfgITSClsSel && track.itsNCls() < cfgITScluster) {
246285
return 0;
247286
}
248-
249287
return 1;
250288
}
251289

252290
template <typename TrackType>
253291
bool selectionPID(const TrackType track)
254292
{
255-
if (cfgSelectType == 0) {
293+
if (cfgSelectPID == PIDList::PIDRun3) {
256294
if (cfgUSETOF) {
257295
if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) {
258296
return 0;
@@ -264,7 +302,7 @@ struct f0980pbpbanalysis {
264302
if (std::fabs(track.tpcNSigmaPi()) > cMaxTPCnSigmaPionS) {
265303
return 0;
266304
}
267-
} else if (cfgSelectType == 1) {
305+
} else if (cfgSelectPID == PIDList::PIDRun2) {
268306
if (cfgUSETOF) {
269307
if (track.hasTOF()) {
270308
if (std::fabs(track.tofNSigmaPi()) > cMaxTOFnSigmaPion) {
@@ -283,46 +321,57 @@ struct f0980pbpbanalysis {
283321
return 0;
284322
}
285323
}
286-
} else if (cfgSelectType == 2) {
287-
if (cfgUSETOF) {
288-
if (track.hasTOF()) {
289-
if (std::fabs(track.tofNSigmaKa()) > 3) {
290-
return 0;
291-
}
292-
if (std::fabs(track.tpcNSigmaKa()) > 3) {
293-
return 0;
294-
}
295-
} else {
296-
if (std::fabs(track.tpcNSigmaKa()) > 3) {
297-
return 0;
298-
}
324+
} else if (cfgSelectPID == PIDList::PIDTest) {
325+
if (track.hasTOF()) {
326+
if (std::fabs(getTofNSigma(track)) > cMaxTOFnSigmaPion) {
327+
return 0;
328+
}
329+
if (std::fabs(getTpcNSigma(track)) > cMaxTPCnSigmaPion) {
330+
return 0;
299331
}
300332
} else {
301-
if (std::fabs(track.tpcNSigmaKa()) > 3) {
333+
if (std::fabs(getTpcNSigma(track)) > cMaxTPCnSigmaPionS) {
302334
return 0;
303335
}
304336
}
305337
}
306338
return 1;
307339
}
308340

341+
template <typename TrackType1, typename TrackType2>
342+
bool selectionPair(const TrackType1 track1, const TrackType2 track2)
343+
{
344+
double pt1, pt2, pz1, pz2, p1, p2, angle;
345+
pt1 = track1.pt();
346+
pt2 = track2.pt();
347+
pz1 = track1.pz();
348+
pz2 = track2.pz();
349+
p1 = track1.p();
350+
p2 = track2.p();
351+
angle = std::acos((pt1 * pt2 + pz1 * pz2) / (p1 * p2));
352+
if (isDeepAngle && angle < cfgDeepAngle) {
353+
return 0;
354+
}
355+
return 1;
356+
}
357+
309358
template <typename TrackType>
310359
float getTpcNSigma(const TrackType track)
311360
{
312-
if (cfgSelectType == 2) {
313-
return track.tpcNSigmaKa();
314-
} else {
361+
if (cfgSelectPtl == PtlList::PtlPion) {
315362
return track.tpcNSigmaPi();
363+
} else {
364+
return track.tpcNSigmaKa();
316365
}
317366
}
318367

319368
template <typename TrackType>
320369
float getTofNSigma(const TrackType track)
321370
{
322-
if (cfgSelectType == 2) {
323-
return track.tofNSigmaKa();
324-
} else {
371+
if (cfgSelectPtl == PtlList::PtlPion) {
325372
return track.tofNSigmaPi();
373+
} else {
374+
return track.tofNSigmaKa();
326375
}
327376
}
328377

@@ -373,6 +422,14 @@ struct f0980pbpbanalysis {
373422
histos.fill(HIST("QA/TPC_TOF_selected"), getTpcNSigma(trk2), getTofNSigma(trk2));
374423
}
375424

425+
if (cfgSelectPID == PIDList::PIDTest && trk2.globalIndex() == trk1.globalIndex()) {
426+
continue;
427+
}
428+
429+
if (cfgSelectPID == PIDList::PIDTest && !selectionPair(trk1, trk2)) {
430+
continue;
431+
}
432+
376433
pion1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massPtl);
377434
pion2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massPtl);
378435
reco = pion1 + pion2;
@@ -407,7 +464,7 @@ struct f0980pbpbanalysis {
407464

408465
void init(o2::framework::InitContext&)
409466
{
410-
AxisSpec epAxis = {6, 0.0, 2.0 * o2::constants::math::PI};
467+
AxisSpec epAxis = {6, 0.0, o2::constants::math::TwoPI};
411468
AxisSpec qaCentAxis = {110, 0, 110};
412469
AxisSpec qaVzAxis = {100, -20, 20};
413470
AxisSpec qaPIDAxis = {100, -10, 10};
@@ -455,10 +512,10 @@ struct f0980pbpbanalysis {
455512
refBId = 5;
456513
}
457514

458-
if (cfgSelectType == 2) {
459-
massPtl = o2::constants::physics::MassKaonCharged;
460-
} else {
515+
if (cfgSelectPtl == PtlList::PtlPion) {
461516
massPtl = o2::constants::physics::MassPionCharged;
517+
} else if (cfgSelectPtl == PtlList::PtlKaon) {
518+
massPtl = o2::constants::physics::MassKaonCharged;
462519
}
463520

464521
fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100);
@@ -476,9 +533,9 @@ struct f0980pbpbanalysis {
476533
void processData(EventCandidates::iterator const& collision,
477534
TrackCandidates const& tracks, aod::BCsWithTimestamps const&)
478535
{
479-
if (cfgCentEst == 1) {
536+
if (cfgCentEst == CentEstList::FT0C) {
480537
centrality = collision.centFT0C();
481-
} else if (cfgCentEst == 2) {
538+
} else if (cfgCentEst == CentEstList::FT0M) {
482539
centrality = collision.centFT0M();
483540
}
484541
if (!eventSelected(collision)) {
@@ -488,12 +545,12 @@ struct f0980pbpbanalysis {
488545
histos.fill(HIST("QA/Vz"), collision.posZ(), 1.0);
489546

490547
fillHistograms<false>(collision, tracks, 2); // second order
491-
}
492-
PROCESS_SWITCH(f0980pbpbanalysis, processData, "Process Event for data", true);
548+
};
549+
PROCESS_SWITCH(F0980pbpbanalysis, processData, "Process Event for data", true);
493550
};
494551

495552
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
496553
{
497554
return WorkflowSpec{
498-
adaptAnalysisTask<f0980pbpbanalysis>(cfgc, TaskName{"lf-f0980pbpbanalysis"})};
555+
adaptAnalysisTask<F0980pbpbanalysis>(cfgc)};
499556
}

0 commit comments

Comments
 (0)