Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 173 additions & 9 deletions PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@
kSpeciesend
};

enum {
kGenTrkTypebegin = 0,
kGenAll = 1,
kGenPion,
kGenKaon,
kGenProton,
kGenOther,
kGenTrkTypeend
};

enum {
kRecTrkTypebegin = 0,
kRecoAll = 1,
kRecoPrimary,
kRecoPion,
kRecoKaon,
kRecoProton,
kRecoOther,
kRecoSecondary,
kRecoWeakDecay,
kRecoFake,
kRecoBkg,
kRecTrkTypeend
};

static constexpr TrackSelectionFlags::flagtype TrackSelectionIts =
TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF |
TrackSelectionFlags::kITSHits;
Expand All @@ -113,12 +138,15 @@
AxisSpec axisTrackType = {kTrackTypeend - 1, +kTrackTypebegin + 0.5, +kTrackTypeend - 0.5, "", "TrackTypeAxis"};
AxisSpec axisGenPtVary = {kGenpTend - 1, +kGenpTbegin + 0.5, +kGenpTend - 0.5, "", "GenpTVaryAxis"};
AxisSpec axisSpecies = {kSpeciesend - 1, +kSpeciesbegin + 0.5, +kSpeciesend - 0.5, "", "SpeciesAxis"};
AxisSpec axisGenTrkType = {kGenTrkTypeend - 1, +kGenTrkTypebegin + 0.5, +kGenTrkTypeend - 0.5, "", "GenTrackTypeAxis"};
AxisSpec axisRecTrkType = {kRecTrkTypeend - 1, +kRecTrkTypebegin + 0.5, +kRecTrkTypeend - 0.5, "", "RecTrackTypeAxis"};
AxisSpec axisMassK0s = {200, 0.4, 0.6, "K0sMass", "K0sMass"};
AxisSpec axisMassLambda = {200, 1.07, 1.17, "Lambda/AntiLamda Mass", "Lambda/AntiLamda Mass"};
AxisSpec axisTracks{9, 0.5, 9.5, "#tracks", "TrackAxis"};
auto static constexpr kMinCharge = 3.f;
auto static constexpr kMinpTcut = 0.1f;
auto static constexpr kNItslayers = 7;
AxisSpec axisDeltaEta{50, -1.0, +1.0, "#Delta(#eta)"};
auto static constexpr KminCharge = 3.f;
auto static constexpr KminPtCut = 0.1f;
auto static constexpr KnItsLayers = 7;

struct HeavyionMultiplicity {

Expand Down Expand Up @@ -229,7 +257,7 @@
auto* x2 = htrack->GetAxis(1);
x2->SetBinLabel(1, "All tracks");
x2->SetBinLabel(2, "Non-fake tracks");
for (int i = 0; i < kNItslayers; i++) {
for (int i = 0; i < KnItsLayers; i++) {
x2->SetBinLabel(i + 3, Form("layer %d", i));
}
}
Expand Down Expand Up @@ -293,6 +321,22 @@
histos.add("hgendndetaVscentBeforeEvtSel", "hgendndetaBeforeEvtSel vs centrality", kTH2F, {axisEta, impactParAxis});
histos.add("hgendndetaVscentAfterEvtSel", "hgendndetaAfterEvtSel vs centrality", kTH2F, {axisEta, impactParAxis});
}

if (doprocessMCeff) {
histos.add("hGenMCvertexZ", "hGenMCvertexZ", kTH1D, {axisVtxZ}, false);
histos.add("hGenMCvtxzcent", "hGenMCvtxzcent", kTH3D, {axisVtxZ, centAxis, axisOccupancy}, false);
histos.add("hGenMCAssoRecvertexZ", "hGenMCAssoRecvertexZ", kTH1D, {axisVtxZ}, false);
histos.add("hGenMCAssoRecvtxzcent", "hGenMCAssoRecvtxzcent", kTH3D, {axisVtxZ, centAxis, axisOccupancy}, false);
histos.add("hGenMCdndeta", "hGenMCdndeta", kTHnSparseD, {axisVtxZ, centAxis, axisOccupancy, axisEta, axisPhi}, false);
histos.add("hGenMCAssoRecdndeta", "hGenMCAssoRecdndeta", kTHnSparseD, {axisVtxZ, centAxis, axisOccupancy, axisEta, axisPhi, axisGenTrkType, axisGenPtVary}, false);

histos.add("hRecMCvertexZ", "hRecMCvertexZ", kTH1D, {axisVtxZ}, false);
histos.add("hRecMCvtxzcent", "hRecMCvtxzcent", kTH3D, {axisVtxZ, centAxis, axisOccupancy}, false);
histos.add("hRecMCcentrality", "hRecMCcentrality", kTH1D, {axisCent}, false);
histos.add("hRecMCphivseta", "hRecMCphivseta", kTH2D, {axisPhi2, axisEta}, false);
histos.add("hRecMCdndeta", "hRecMCdndeta", kTHnSparseD, {axisVtxZ, centAxis, axisOccupancy, axisEta, axisPhi, axisRecTrkType}, false);
histos.add("etaResolution", "etaResolution", kTH2D, {axisEta, axisDeltaEta});
}
}

template <typename CheckCol>
Expand Down Expand Up @@ -402,7 +446,7 @@
if (pdgTrack == nullptr) {
return false;
}
if (std::abs(pdgTrack->Charge()) < kMinCharge) {
if (std::abs(pdgTrack->Charge()) < KminCharge) {
return false;
}
if (std::abs(track.eta()) >= etaRange) {
Expand Down Expand Up @@ -543,7 +587,7 @@
continue;
}
histos.fill(HIST("hmcgendndeta"), RecCol.posZ(), selColCent(RecCol), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kNoGenpTVar);
if (particle.pt() < kMinpTcut) {
if (particle.pt() < KminPtCut) {
histos.fill(HIST("hmcgendndeta"), RecCol.posZ(), selColCent(RecCol), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTup, -10.0 * particle.pt() + 2);
histos.fill(HIST("hmcgendndeta"), RecCol.posZ(), selColCent(RecCol), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTdown, 5.0 * particle.pt() + 0.5);
} else {
Expand Down Expand Up @@ -607,7 +651,7 @@
continue;
}
histos.fill(HIST("hmcgendndpt"), selColCent(RecCol), particle.pt(), kNoGenpTVar);
if (particle.pt() < kMinpTcut) {
if (particle.pt() < KminPtCut) {
histos.fill(HIST("hmcgendndpt"), selColCent(RecCol), particle.pt(), kGenpTup, -10.0 * particle.pt() + 2);
histos.fill(HIST("hmcgendndpt"), selColCent(RecCol), particle.pt(), kGenpTdown, 5.0 * particle.pt() + 0.5);
} else {
Expand Down Expand Up @@ -641,7 +685,7 @@
}
histos.fill(HIST("hTracksCount"), selColCent(RecCol), 1);
bool isFakeItsTracks = false;
for (int i = 0; i < kNItslayers; i++) {
for (int i = 0; i < KnItsLayers; i++) {
if (Rectrack.mcMask() & 1 << i) {
isFakeItsTracks = true;
histos.fill(HIST("hTracksCount"), selColCent(RecCol), i + 3);
Expand Down Expand Up @@ -793,7 +837,7 @@
continue;
}
histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kNoGenpTVar);
if (particle.pt() < kMinpTcut) {
if (particle.pt() < KminPtCut) {
histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTup, -10.0 * particle.pt() + 2);
histos.fill(HIST("hmcgendndetapp"), RecCol.posZ(), RecCol.centFT0M(), particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTdown, 5.0 * particle.pt() + 0.5);
} else {
Expand Down Expand Up @@ -835,10 +879,10 @@
if (std::abs(particle.eta()) < 1.0) {
multBarrelEta10++;
}
if (-3.3 < particle.eta() && particle.eta() < -2.1) {

Check failure on line 882 in PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
multFT0C++;
}
if (3.5 < particle.eta() && particle.eta() < 4.9) {

Check failure on line 885 in PWGLF/Tasks/GlobalEventProperties/heavyionMultiplicity.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
multFT0A++;
}
}
Expand Down Expand Up @@ -916,6 +960,125 @@
}
}

void processMCeff(soa::Join<aod::McCollisions, aod::McCollsExtra>::iterator const& mcCollision, CollisionMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
{
auto gencent = -999;
auto genoccu = -999;
bool atLeastOne = false;

for (const auto& RecCol : RecCols) {
if (!isEventSelected(RecCol)) {
continue;
}
if (RecCol.globalIndex() != mcCollision.bestCollisionIndex()) {
continue;
}
atLeastOne = true;
gencent = selColCent(RecCol);
genoccu = selColOccu(RecCol);
}

histos.fill(HIST("hGenMCvertexZ"), mcCollision.posZ());
histos.fill(HIST("hGenMCvtxzcent"), mcCollision.posZ(), gencent, genoccu);

if (atLeastOne) {
histos.fill(HIST("hGenMCAssoRecvertexZ"), mcCollision.posZ());
histos.fill(HIST("hGenMCAssoRecvtxzcent"), mcCollision.posZ(), gencent, genoccu);
}

for (const auto& particle : GenParticles) {
if (!isGenTrackSelected(particle)) {
continue;
}
histos.fill(HIST("hGenMCdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi());
if (atLeastOne) {
histos.fill(HIST("hGenMCAssoRecdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi(), static_cast<double>(kGenAll), kNoGenpTVar);
if (particle.pt() < KminPtCut) {
histos.fill(HIST("hGenMCAssoRecdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi(), static_cast<double>(kGenAll), kGenpTup, -10.0 * particle.pt() + 2);
histos.fill(HIST("hGenMCAssoRecdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi(), static_cast<double>(kGenAll), kGenpTdown, 5.0 * particle.pt() + 0.5);
} else {
histos.fill(HIST("hGenMCAssoRecdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi(), static_cast<double>(kSpAll), kGenpTup);
histos.fill(HIST("hGenMCAssoRecdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi(), static_cast<double>(kGenAll), kGenpTdown);
}
int pid = 0;
switch (std::abs(particle.pdgCode())) {
case PDG_t::kPiPlus:
pid = kGenPion;
break;
case PDG_t::kKPlus:
pid = kGenKaon;
break;
case PDG_t::kProton:
pid = kGenProton;
break;
default:
pid = kGenOther;
break;
}
histos.fill(HIST("hGenMCAssoRecdndeta"), mcCollision.posZ(), gencent, genoccu, particle.eta(), particle.phi(), static_cast<double>(pid), kNoGenpTVar);
} // Associated with reco col
} // track (mcgen) loop

for (const auto& RecCol : RecCols) {
if (!isEventSelected(RecCol)) {
continue;
}
if (RecCol.globalIndex() != mcCollision.bestCollisionIndex()) {
continue;
}
histos.fill(HIST("hRecMCvertexZ"), RecCol.posZ());
histos.fill(HIST("hRecMCcentrality"), selColCent(RecCol));
histos.fill(HIST("hRecMCvtxzcent"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol));

auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
std::vector<int> mclabels;
for (const auto& Rectrack : recTracksPart) {
if (!isTrackSelected(Rectrack)) {
continue;
}
histos.fill(HIST("hRecMCphivseta"), Rectrack.phi(), Rectrack.eta());
histos.fill(HIST("hRecMCdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kRecoAll));
if (Rectrack.has_mcParticle()) {
int pid = 0;
auto mcpart = Rectrack.mcParticle();
histos.fill(HIST("etaResolution"), Rectrack.eta(), Rectrack.eta() - mcpart.eta());
if (mcpart.isPhysicalPrimary()) {
pid = kRecoPrimary;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is never used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @vkucera, sorry, I do not understand your comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abmodak , the value kRecoPrimary assigned in the variable pid is never used, therefore the assignment is useless.

switch (std::abs(mcpart.pdgCode())) {
case PDG_t::kPiPlus:
pid = kRecoPion;
break;
case PDG_t::kKPlus:
pid = kRecoKaon;
break;
case PDG_t::kProton:
pid = kRecoProton;
break;
default:
pid = kRecoOther;
break;
}
} else {
pid = kRecoSecondary;
}
if (mcpart.has_mothers()) {
auto mcpartMother = mcpart.template mothers_as<aod::McParticles>().front();
if (mcpartMother.pdgCode() == PDG_t::kK0Short || std::abs(mcpartMother.pdgCode()) == PDG_t::kLambda0) {
pid = kRecoWeakDecay;
}
}
if (find(mclabels.begin(), mclabels.end(), Rectrack.mcParticleId()) != mclabels.end()) {
pid = kRecoFake;
}
mclabels.push_back(Rectrack.mcParticleId());
histos.fill(HIST("hRecMCdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), mcpart.eta(), mcpart.phi(), static_cast<double>(pid));
} else {
histos.fill(HIST("hRecMCdndeta"), RecCol.posZ(), selColCent(RecCol), selColOccu(RecCol), Rectrack.eta(), Rectrack.phi(), static_cast<double>(kRecoBkg));
}
} // track (mcrec) loop
} // collision loop
}

PROCESS_SWITCH(HeavyionMultiplicity, processData, "process data CentFT0C", false);
PROCESS_SWITCH(HeavyionMultiplicity, processCorrelation, "do correlation study in data", false);
PROCESS_SWITCH(HeavyionMultiplicity, processMonteCarlo, "process MC CentFT0C", false);
Expand All @@ -926,6 +1089,7 @@
PROCESS_SWITCH(HeavyionMultiplicity, processppMonteCarlo, "process pp MC", false);
PROCESS_SWITCH(HeavyionMultiplicity, processGen, "process pure MC gen", false);
PROCESS_SWITCH(HeavyionMultiplicity, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false);
PROCESS_SWITCH(HeavyionMultiplicity, processMCeff, "process extra efficiency function", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading