Skip to content

Commit ab4d79a

Browse files
authored
[PWGLF] INEL > 0 fix and new DCA parametrization (#17950)
1 parent aee99a3 commit ab4d79a

1 file changed

Lines changed: 152 additions & 42 deletions

File tree

PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx

Lines changed: 152 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ static constexpr TrackSelectionFlags::flagtype TrackSelectionTpc =
6464
TrackSelectionFlags::kTPCNCls |
6565
TrackSelectionFlags::kTPCCrossedRowsOverNCls |
6666
TrackSelectionFlags::kTPCChi2NDF;
67-
static constexpr TrackSelectionFlags::flagtype TrackSelectionDca =
68-
TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy;
67+
// static constexpr TrackSelectionFlags::flagtype TrackSelectionDca = TrackSelectionFlags::kDCAz | TrackSelectionFlags::kDCAxy;
6968
static constexpr TrackSelectionFlags::flagtype TrackSelectionDcaxyOnly =
7069
TrackSelectionFlags::kDCAxy;
7170

@@ -114,6 +113,14 @@ struct StudyPnch {
114113
Configurable<bool> isPtdecrease{"isPtdecrease", false, "Varies low pT particles by a conservative amount of -50%"};
115114
Configurable<bool> cPrint{"cPrint", false, "Enable printing information for debugging"};
116115
Configurable<bool> isApplyStrangenessSysUncert{"isApplyStrangenessSysUncert", false, "Enable the evaluation of systematics due to strange particle contribution"};
116+
Configurable<bool> isApplyDCAstandardcuts{"isApplyDCAstandardcuts", true, "Apply DCA standard run 2 cuts"};
117+
Configurable<bool> isApplyDCAcustomcuts{"isApplyDCAcustomcuts", false, "Apply DCA custom cuts"};
118+
Configurable<float> cDcazP0{"cDcazP0", 1.0f, "dcaz parameter0"};
119+
Configurable<float> cDcazP1{"cDcazP1", 1.0f, "dcaz parameter1"};
120+
Configurable<float> cDcazP2{"cDcazP2", 1.0f, "dcaz parameter2"};
121+
Configurable<float> cDcaxyP0{"cDcaxyP0", 1.0f, "dcaxy parameter0"};
122+
Configurable<float> cDcaxyP1{"cDcaxyP1", 1.0f, "dcaxy parameter1"};
123+
Configurable<float> cDcaxyP2{"cDcaxyP2", 1.0f, "dcaxy parameter2"};
117124

118125
void init(InitContext const&)
119126
{
@@ -147,6 +154,7 @@ struct StudyPnch {
147154
}
148155
if (doprocessData) {
149156
histos.add("hMultiplicityData", "hMultiplicityData", kTH1F, {axisMult}, true);
157+
histos.add("hMultiplicityDataINELgt0", "hMultiplicityDataINELgt0", kTH1F, {axisMult}, true);
150158
}
151159
if (doprocessCorrelation) {
152160
histos.add("GlobalMult_vs_FT0A", "GlobalMult_vs_FT0A", kTH2F, {axisMult, axisFt0aMult}, true);
@@ -215,6 +223,12 @@ struct StudyPnch {
215223
template <typename CheckTrack>
216224
bool isTrackSelected(CheckTrack const& track)
217225
{
226+
if (isApplyDCAcustomcuts) {
227+
if (std::abs(track.dcaXY()) > cDcaxyP0 + cDcaxyP1 / std::pow(track.pt(), cDcaxyP2))
228+
return false;
229+
if (std::abs(track.dcaZ()) > cDcazP0 + cDcazP1 / std::pow(track.pt(), cDcazP2))
230+
return false;
231+
}
218232
if (std::abs(track.eta()) >= etaRange) {
219233
return false;
220234
}
@@ -224,6 +238,24 @@ struct StudyPnch {
224238
return true;
225239
}
226240

241+
template <typename CheckInelgt0>
242+
bool isInegt0Selected(CheckInelgt0 const& track)
243+
{
244+
if (isApplyDCAcustomcuts) {
245+
if (std::abs(track.dcaXY()) > cDcaxyP0 + cDcaxyP1 / std::pow(track.pt(), cDcaxyP2))
246+
return false;
247+
if (std::abs(track.dcaZ()) > cDcazP0 + cDcazP1 / std::pow(track.pt(), cDcazP2))
248+
return false;
249+
}
250+
if (!isApplyInelgt0) {
251+
return false;
252+
}
253+
if (std::abs(track.eta()) >= 1.0f) {
254+
return false;
255+
}
256+
return true;
257+
}
258+
227259
template <typename CheckGenTrack>
228260
bool isGenTrackSelected(CheckGenTrack const& track)
229261
{
@@ -249,6 +281,33 @@ struct StudyPnch {
249281
return true;
250282
}
251283

284+
template <typename CheckGenInelgt0>
285+
bool isInelgt0GenSelected(CheckGenInelgt0 const& track)
286+
{
287+
if (!isApplyInelgt0) {
288+
return false;
289+
}
290+
if (!track.isPhysicalPrimary()) {
291+
return false;
292+
}
293+
if (!track.producedByGenerator()) {
294+
return false;
295+
}
296+
auto pdgTrack = pdg->GetParticle(track.pdgCode());
297+
if (pdgTrack == nullptr) {
298+
return false;
299+
}
300+
if (std::abs(pdgTrack->Charge()) < kMinCharge) {
301+
return false;
302+
}
303+
if (std::abs(track.eta()) >= 1.0f) {
304+
return false;
305+
}
306+
if (isApplyExtraPhiCut && ((track.phi() > extraphicut1 && track.phi() < extraphicut2) || track.phi() <= extraphicut3 || track.phi() >= extraphicut4)) {
307+
return false;
308+
}
309+
return true;
310+
}
252311
template <typename countTrk>
253312
int countNTracks(countTrk const& tracks)
254313
{
@@ -270,6 +329,22 @@ struct StudyPnch {
270329
return nTrk;
271330
}
272331

332+
template <typename countInelgt0Trk>
333+
int countINELTracks(countInelgt0Trk const& tracks)
334+
{
335+
auto nTrkinel = 0;
336+
for (const auto& track : tracks) {
337+
if (!isInegt0Selected(track)) {
338+
continue;
339+
}
340+
if (isApplyPhiSelection && (track.phi() < minPhi || track.phi() > maxPhi)) {
341+
continue;
342+
}
343+
nTrkinel++;
344+
}
345+
return nTrkinel;
346+
}
347+
273348
template <typename countTrk, typename McColType>
274349
int countGenTracks(countTrk const& tracks, McColType const& McCol)
275350
{
@@ -292,6 +367,25 @@ struct StudyPnch {
292367
return nTrk;
293368
}
294369

370+
template <typename countInelgt0GenTrk, typename McColType>
371+
int countINELGenTracks(countInelgt0GenTrk const& tracks, McColType const& McCol)
372+
{
373+
auto nTrkgeninel = 0;
374+
for (const auto& track : tracks) {
375+
if (!isInelgt0GenSelected(track)) {
376+
continue;
377+
}
378+
if (track.mcCollisionId() != McCol.mcCollisionId()) {
379+
continue;
380+
}
381+
if (isApplyPhiSelection && (track.phi() < minPhi || track.phi() > maxPhi)) {
382+
continue;
383+
}
384+
nTrkgeninel++;
385+
}
386+
return nTrkgeninel;
387+
}
388+
295389
template <typename countTrk, typename McColType>
296390
int countNTracksMcCol(countTrk const& tracks, McColType const& McCol)
297391
{
@@ -324,6 +418,33 @@ struct StudyPnch {
324418
return nTrk;
325419
}
326420

421+
template <typename countInelgt0RecTrk, typename McColType>
422+
int countINELMcCol(countInelgt0RecTrk const& tracks, McColType const& McCol)
423+
{
424+
auto nTrkrecinel = 0;
425+
std::vector<int> mcRecIDs;
426+
for (const auto& track : tracks) {
427+
if (!isInegt0Selected(track)) {
428+
continue;
429+
}
430+
if (track.has_mcParticle()) {
431+
auto particle = track.mcParticle();
432+
if (isApplyCheckID && particle.mcCollisionId() != McCol.mcCollisionId()) {
433+
continue;
434+
}
435+
if (isApplyDuplicatedTrack && find(mcRecIDs.begin(), mcRecIDs.end(), particle.globalIndex()) != mcRecIDs.end()) {
436+
continue;
437+
}
438+
mcRecIDs.push_back(particle.globalIndex());
439+
if (isApplyPhiSelection && (track.phi() < minPhi || track.phi() > maxPhi)) {
440+
continue;
441+
}
442+
nTrkrecinel++;
443+
}
444+
}
445+
return nTrkrecinel;
446+
}
447+
327448
template <typename countTrk, typename McColType>
328449
int countStrangeTracksMcCol(countTrk const& tracks, McColType const& McCol)
329450
{
@@ -392,22 +513,19 @@ struct StudyPnch {
392513
ncheckbit(aod::track::trackCutFlag, TrackSelectionIts);
393514
Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC),
394515
ncheckbit(aod::track::trackCutFlag, TrackSelectionTpc), true);
395-
Filter fTrackSelectionDCA = ifnode(dcaZ.node() > 0.f, nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly),
396-
ncheckbit(aod::track::trackCutFlag, TrackSelectionDca));
516+
Filter fTrackSelectionDCA = ifnode(isApplyDCAstandardcuts.node(), nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), true);
397517

398518
void processData(ColDataTable::iterator const& cols, FilTrackDataTable const& tracks)
399519
{
400520
if (!isEventSelected(cols)) {
401521
return;
402522
}
403523
auto mult = countNTracks(tracks);
404-
if (isApplyInelgt0 && etaRange == 1.0f) {
405-
if (mult > 0) {
406-
histos.fill(HIST("hMultiplicityData"), mult);
407-
}
408-
} else {
409-
histos.fill(HIST("hMultiplicityData"), mult);
524+
auto multINELgt0 = countINELTracks(tracks);
525+
if (isApplyInelgt0 && multINELgt0 == 0) {
526+
return;
410527
}
528+
histos.fill(HIST("hMultiplicityData"), mult);
411529
}
412530

413531
void processCorrelation(ColDataTable::iterator const& cols, FilTrackDataTable const& tracks)
@@ -425,10 +543,6 @@ struct StudyPnch {
425543

426544
void processMonteCarlo(soa::Join<aod::McCollisions, aod::McCollsExtra, aod::MultMCExtras>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
427545
{
428-
if (isApplyInelgt0 && !mcCollision.isInelGt0()) {
429-
return;
430-
}
431-
432546
for (const auto& RecCol : RecCols) {
433547
if (!isEventSelected(RecCol)) {
434548
continue;
@@ -442,22 +556,21 @@ struct StudyPnch {
442556
}
443557
auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
444558
auto multrec = countNTracksMcCol(recTracksPart, RecCol);
559+
auto multrecinelgt = countINELMcCol(recTracksPart, RecCol);
445560
float multgen = countGenTracks(GenParticles, RecCol);
561+
float multgeninelgt = countINELGenTracks(GenParticles, RecCol);
446562
float nTrkPtCut = countTracksPtCut(GenParticles, RecCol);
447-
if (isApplyInelgt0 && etaRange == 1.0f) {
448-
if (multrec == 0 || multgen == 0) {
449-
if (nTrkPtCut == 0) {
450-
continue;
451-
}
563+
if (isApplyInelgt0) {
564+
if (multrecinelgt == 0 || multgeninelgt == 0) {
452565
continue;
453566
}
454567
}
455568
histos.fill(HIST("hMultiplicityMCrec"), multrec);
569+
histos.fill(HIST("hMultiplicityMCgen"), multgen);
570+
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
456571
if (cPrint) {
457572
LOG(info) << "Generated Particles with standard pT:" << multgen;
458573
}
459-
histos.fill(HIST("hMultiplicityMCgen"), multgen);
460-
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
461574
nTrkPtCut = multgen + nTrkPtCut;
462575
if (cPrint) {
463576
LOG(info) << "After Counting low pT: " << nTrkPtCut;
@@ -475,9 +588,6 @@ struct StudyPnch {
475588

476589
void processEvtLossSigLossMC(soa::Join<ColMCTrueTable, aod::MultMCExtras>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles)
477590
{
478-
if (isApplyInelgt0 && !mcCollision.isInelGt0()) {
479-
return;
480-
}
481591
if (isApplyTVX && !(mcCollision.multMCFT0C() > 0 && mcCollision.multMCFT0A() > 0)) {
482592
return;
483593
}
@@ -487,19 +597,19 @@ struct StudyPnch {
487597
// All generated events
488598
histos.fill(HIST("MCEventHist"), 1);
489599
auto nTrk_multAll = 0;
600+
auto nTrk_multInelAll = 0;
490601
for (const auto& GenParticle : GenParticles) {
491-
if (!isGenTrackSelected(GenParticle)) {
492-
continue;
602+
if (isInelgt0GenSelected(GenParticle)) {
603+
nTrk_multInelAll++;
493604
}
494-
nTrk_multAll++;
495-
}
496-
if (isApplyInelgt0 && etaRange == 1.0f) {
497-
if (nTrk_multAll > 0) {
498-
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
605+
if (isGenTrackSelected(GenParticle)) {
606+
nTrk_multAll++;
499607
}
500-
} else {
501-
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
502608
}
609+
if (isApplyInelgt0 && nTrk_multInelAll == 0) {
610+
return;
611+
}
612+
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
503613

504614
bool atLeastOne = false;
505615
auto numcontributors = -999;
@@ -518,19 +628,19 @@ struct StudyPnch {
518628
if (atLeastOne) {
519629
histos.fill(HIST("MCEventHist"), 2);
520630
auto nTrk_multSel = 0;
631+
auto nTrk_multInelSel = 0;
521632
for (const auto& GenParticle : GenParticles) {
522-
if (!isGenTrackSelected(GenParticle)) {
523-
continue;
633+
if (isInelgt0GenSelected(GenParticle)) {
634+
nTrk_multInelSel++;
524635
}
525-
nTrk_multSel++;
526-
}
527-
if (isApplyInelgt0 && etaRange == 1.0f) {
528-
if (nTrk_multSel > 0) {
529-
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
636+
if (isGenTrackSelected(GenParticle)) {
637+
nTrk_multSel++;
530638
}
531-
} else {
532-
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
533639
}
640+
if (isApplyInelgt0 && nTrk_multInelSel == 0) {
641+
return;
642+
}
643+
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
534644
}
535645
}
536646

0 commit comments

Comments
 (0)