Skip to content

Commit b14a2c0

Browse files
authored
INEL > 0 fix and new DCA parametrization
1 parent eb1a220 commit b14a2c0

1 file changed

Lines changed: 151 additions & 40 deletions

File tree

PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx

Lines changed: 151 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ struct StudyPnch {
114114
Configurable<bool> isPtdecrease{"isPtdecrease", false, "Varies low pT particles by a conservative amount of -50%"};
115115
Configurable<bool> cPrint{"cPrint", false, "Enable printing information for debugging"};
116116
Configurable<bool> isApplyStrangenessSysUncert{"isApplyStrangenessSysUncert", false, "Enable the evaluation of systematics due to strange particle contribution"};
117+
Configurable<bool> isApplyDCAstandardcuts{"isApplyDCAstandardcuts", true, "Apply DCA standard run 2 cuts"};
118+
Configurable<bool> isApplyDCAcustomcuts{"isApplyDCAcustomcuts", false, "Apply DCA custom cuts"};
119+
Configurable<float> cDcazP0{"cDcazP0", 1.0f, "dcaz parameter0"};
120+
Configurable<float> cDcazP1{"cDcazP1", 1.0f, "dcaz parameter1"};
121+
Configurable<float> cDcazP2{"cDcazP2", 1.0f, "dcaz parameter2"};
122+
Configurable<float> cDcaxyP0{"cDcaxyP0", 1.0f, "dcaxy parameter0"};
123+
Configurable<float> cDcaxyP1{"cDcaxyP1", 1.0f, "dcaxy parameter1"};
124+
Configurable<float> cDcaxyP2{"cDcaxyP2", 1.0f, "dcaxy parameter2"};
117125

118126
void init(InitContext const&)
119127
{
@@ -147,6 +155,7 @@ struct StudyPnch {
147155
}
148156
if (doprocessData) {
149157
histos.add("hMultiplicityData", "hMultiplicityData", kTH1F, {axisMult}, true);
158+
histos.add("hMultiplicityDataINELgt0", "hMultiplicityDataINELgt0", kTH1F, {axisMult}, true);
150159
}
151160
if (doprocessCorrelation) {
152161
histos.add("GlobalMult_vs_FT0A", "GlobalMult_vs_FT0A", kTH2F, {axisMult, axisFt0aMult}, true);
@@ -215,6 +224,12 @@ struct StudyPnch {
215224
template <typename CheckTrack>
216225
bool isTrackSelected(CheckTrack const& track)
217226
{
227+
if (isApplyDCAcustomcuts) {
228+
if (std::abs(track.dcaXY()) > cDcaxyP0 + cDcaxyP1 / std::pow(track.pt(), cDcaxyP2))
229+
return false;
230+
if (std::abs(track.dcaZ()) > cDcazP0 + cDcazP1 / std::pow(track.pt(), cDcazP2))
231+
return false;
232+
}
218233
if (std::abs(track.eta()) >= etaRange) {
219234
return false;
220235
}
@@ -224,6 +239,24 @@ struct StudyPnch {
224239
return true;
225240
}
226241

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

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

333+
template <typename countInelgt0Trk>
334+
int countINELTracks(countInelgt0Trk const& tracks)
335+
{
336+
auto nTrkinel = 0;
337+
for (const auto& track : tracks) {
338+
if (!isInegt0Selected(track)) {
339+
continue;
340+
}
341+
if (isApplyPhiSelection && (track.phi() < minPhi || track.phi() > maxPhi)) {
342+
continue;
343+
}
344+
nTrkinel++;
345+
}
346+
return nTrkinel;
347+
}
348+
273349
template <typename countTrk, typename McColType>
274350
int countGenTracks(countTrk const& tracks, McColType const& McCol)
275351
{
@@ -292,6 +368,25 @@ struct StudyPnch {
292368
return nTrk;
293369
}
294370

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

422+
template <typename countInelgt0RecTrk, typename McColType>
423+
int countINELMcCol(countInelgt0RecTrk const& tracks, McColType const& McCol)
424+
{
425+
auto nTrkrecinel = 0;
426+
std::vector<int> mcRecIDs;
427+
for (const auto& track : tracks) {
428+
if (!isInegt0Selected(track)) {
429+
continue;
430+
}
431+
if (track.has_mcParticle()) {
432+
auto particle = track.mcParticle();
433+
if (isApplyCheckID && particle.mcCollisionId() != McCol.mcCollisionId()) {
434+
continue;
435+
}
436+
if (isApplyDuplicatedTrack && find(mcRecIDs.begin(), mcRecIDs.end(), particle.globalIndex()) != mcRecIDs.end()) {
437+
continue;
438+
}
439+
mcRecIDs.push_back(particle.globalIndex());
440+
if (isApplyPhiSelection && (track.phi() < minPhi || track.phi() > maxPhi)) {
441+
continue;
442+
}
443+
nTrkrecinel++;
444+
}
445+
}
446+
return nTrkrecinel;
447+
}
448+
327449
template <typename countTrk, typename McColType>
328450
int countStrangeTracksMcCol(countTrk const& tracks, McColType const& McCol)
329451
{
@@ -392,22 +514,19 @@ struct StudyPnch {
392514
ncheckbit(aod::track::trackCutFlag, TrackSelectionIts);
393515
Filter fTrackSelectionTPC = ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC),
394516
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));
517+
Filter fTrackSelectionDCA = ifnode(isApplyDCAstandardcuts.node(), nabs(aod::track::dcaZ) <= dcaZ && ncheckbit(aod::track::trackCutFlag, TrackSelectionDcaxyOnly), true);
397518

398519
void processData(ColDataTable::iterator const& cols, FilTrackDataTable const& tracks)
399520
{
400521
if (!isEventSelected(cols)) {
401522
return;
402523
}
403524
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);
525+
auto multINELgt0 = countINELTracks(tracks);
526+
if (isApplyInelgt0 && multINELgt0 == 0) {
527+
return;
410528
}
529+
histos.fill(HIST("hMultiplicityData"), mult);
411530
}
412531

413532
void processCorrelation(ColDataTable::iterator const& cols, FilTrackDataTable const& tracks)
@@ -425,10 +544,6 @@ struct StudyPnch {
425544

426545
void processMonteCarlo(soa::Join<aod::McCollisions, aod::McCollsExtra, aod::MultMCExtras>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
427546
{
428-
if (isApplyInelgt0 && !mcCollision.isInelGt0()) {
429-
return;
430-
}
431-
432547
for (const auto& RecCol : RecCols) {
433548
if (!isEventSelected(RecCol)) {
434549
continue;
@@ -442,22 +557,21 @@ struct StudyPnch {
442557
}
443558
auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
444559
auto multrec = countNTracksMcCol(recTracksPart, RecCol);
560+
auto multrecinelgt = countINELMcCol(recTracksPart, RecCol);
445561
float multgen = countGenTracks(GenParticles, RecCol);
562+
float multgeninelgt = countINELGenTracks(GenParticles, RecCol);
446563
float nTrkPtCut = countTracksPtCut(GenParticles, RecCol);
447-
if (isApplyInelgt0 && etaRange == 1.0f) {
448-
if (multrec == 0 || multgen == 0) {
449-
if (nTrkPtCut == 0) {
450-
continue;
451-
}
564+
if (isApplyInelgt0) {
565+
if (multrecinelgt == 0 || multgeninelgt == 0) {
452566
continue;
453567
}
454568
}
455569
histos.fill(HIST("hMultiplicityMCrec"), multrec);
570+
histos.fill(HIST("hMultiplicityMCgen"), multgen);
571+
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
456572
if (cPrint) {
457573
LOG(info) << "Generated Particles with standard pT:" << multgen;
458574
}
459-
histos.fill(HIST("hMultiplicityMCgen"), multgen);
460-
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
461575
nTrkPtCut = multgen + nTrkPtCut;
462576
if (cPrint) {
463577
LOG(info) << "After Counting low pT: " << nTrkPtCut;
@@ -475,9 +589,6 @@ struct StudyPnch {
475589

476590
void processEvtLossSigLossMC(soa::Join<ColMCTrueTable, aod::MultMCExtras>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles)
477591
{
478-
if (isApplyInelgt0 && !mcCollision.isInelGt0()) {
479-
return;
480-
}
481592
if (isApplyTVX && !(mcCollision.multMCFT0C() > 0 && mcCollision.multMCFT0A() > 0)) {
482593
return;
483594
}
@@ -487,19 +598,19 @@ struct StudyPnch {
487598
// All generated events
488599
histos.fill(HIST("MCEventHist"), 1);
489600
auto nTrk_multAll = 0;
601+
auto nTrk_multInelAll = 0;
490602
for (const auto& GenParticle : GenParticles) {
491-
if (!isGenTrackSelected(GenParticle)) {
492-
continue;
603+
if (isInelgt0GenSelected(GenParticle)) {
604+
nTrk_multInelAll++;
493605
}
494-
nTrk_multAll++;
495-
}
496-
if (isApplyInelgt0 && etaRange == 1.0f) {
497-
if (nTrk_multAll > 0) {
498-
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
606+
if (isGenTrackSelected(GenParticle)) {
607+
nTrk_multAll++;
499608
}
500-
} else {
501-
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
502609
}
610+
if (isApplyInelgt0 && nTrk_multInelAll == 0) {
611+
return;
612+
}
613+
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
503614

504615
bool atLeastOne = false;
505616
auto numcontributors = -999;
@@ -518,19 +629,19 @@ struct StudyPnch {
518629
if (atLeastOne) {
519630
histos.fill(HIST("MCEventHist"), 2);
520631
auto nTrk_multSel = 0;
632+
auto nTrk_multInelSel = 0;
521633
for (const auto& GenParticle : GenParticles) {
522-
if (!isGenTrackSelected(GenParticle)) {
523-
continue;
634+
if (isInelgt0GenSelected(GenParticle)) {
635+
nTrk_multInelSel++;
524636
}
525-
nTrk_multSel++;
526-
}
527-
if (isApplyInelgt0 && etaRange == 1.0f) {
528-
if (nTrk_multSel > 0) {
529-
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
637+
if (isGenTrackSelected(GenParticle)) {
638+
nTrk_multSel++;
530639
}
531-
} else {
532-
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
533640
}
641+
if (isApplyInelgt0 && nTrk_multInelSel == 0) {
642+
return;
643+
}
644+
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
534645
}
535646
}
536647

0 commit comments

Comments
 (0)