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
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {

Service<o2::framework::O2DatabasePDG> pdg;
Service<o2::framework::O2DatabasePDG> pdgMC;

/// Particle selection part

Expand Down Expand Up @@ -279,34 +278,34 @@

bool IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.3) { // 0.0-0.3

Check failure on line 281 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
if (std::abs(nsigmaTPCK) < 3.0) {

Check failure on line 282 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
return true;
} else {
return false;
}
} else if (mom < 0.45) { // 0.30 - 0.45

Check failure on line 287 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
if (std::abs(nsigmaTPCK) < 2.0) {

Check failure on line 288 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
return true;
} else {
return false;
}
} else if (mom < 0.55) { // 0.45-0.55

Check failure on line 293 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
if (std::abs(nsigmaTPCK) < 1.0) {
return true;
} else {
return false;
}
} else if (mom < 1.5) { // 0.55-1.5 (now we use TPC and TOF)

Check failure on line 299 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) {

Check failure on line 300 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
{
return true;
}
} else {
return false;
}
} else if (mom > 1.5) { // 1.5 -

Check failure on line 307 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) {

Check failure on line 308 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
return true;
} else {
return false;
Expand Down Expand Up @@ -371,7 +370,7 @@
return false;
}
return false;
} else if (particle_number == 2) {

Check failure on line 373 in PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.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.
switch (tracktwofilter.ConfPDGCodePartTwo) {
case 2212: // Proton
case -2212: // Antiproton
Expand Down Expand Up @@ -716,40 +715,41 @@
void doSameEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType, bool fillQA)
{

randgen = new TRandom2(0);
/// Histogramming same event
if ((ContType == 1 || ContType == 2) && fillQA) {
if ((cfgProcessPM || cfgProcessPP) && fillQA) {
for (const auto& part : groupPartsOne) {
if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) {
int pdgCode = static_cast<int>(part.tempFitVar());
const auto& pdgParticle = pdgMC->GetParticle(pdgCode);
const auto& pdgParticle = pdg->GetParticle(pdgCode);
if (pdgParticle) {
trackHistoPartOne.fillQA<isMC, false>(part);
}
}
}
}

if ((ContType == 1 || ContType == 3) && fillQA) {
if ((cfgProcessPM || cfgProcessMM) && fillQA) {
for (const auto& part : groupPartsTwo) {
if (part.partType() == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack)) {
int pdgCode = static_cast<int>(part.tempFitVar());
const auto& pdgParticle = pdgMC->GetParticle(pdgCode);
const auto& pdgParticle = pdg->GetParticle(pdgCode);
if (pdgParticle) {
trackHistoPartTwo.fillQA<isMC, false>(part);
}
}
}
}

if (ContType == 1) {
if (cfgProcessPM) {

/// Now build the combinations for non-identical particle pairs
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {

int pdgCodePartOne = static_cast<int>(p1.tempFitVar());
const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne);
const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne);
int pdgCodePartTwo = static_cast<int>(p2.tempFitVar());
const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo);
const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo);
if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) {
float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2);
sameEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
Expand All @@ -759,9 +759,9 @@
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) {

int pdgCodePartOne = static_cast<int>(p1.tempFitVar());
const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne);
const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne);
int pdgCodePartTwo = static_cast<int>(p2.tempFitVar());
const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo);
const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo);

float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2);
double rand;
Expand Down Expand Up @@ -793,6 +793,7 @@
}
}
}
delete randgen;
}

/// process function for to call doSameEvent with Monte Carlo
Expand All @@ -807,30 +808,37 @@
auto thegroupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
auto thegroupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
bool fillQA = true;
randgen = new TRandom2(0);

int pairType = 0;
if (cfgProcessPM) {
pairType = 1;
} else if (cfgProcessPP) {
pairType = 2;
} else if (cfgProcessMM) {
pairType = 3;
}
Comment on lines +812 to +819
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is just an obfuscation of magic numbers. Use enum for properly named values.


if (ConfIsCent) {
if (cfgProcessPM) {
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsTwo, col.multV0M(), 1, fillQA);
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsTwo, col.multV0M(), pairType, fillQA);
}
if (cfgProcessPP) {
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsOne, col.multV0M(), 2, fillQA);
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsOne, col.multV0M(), pairType, fillQA);
}
if (cfgProcessMM) {
doSameEventMCTruth<false>(thegroupPartsTwo, thegroupPartsTwo, col.multV0M(), 3, fillQA);
doSameEventMCTruth<false>(thegroupPartsTwo, thegroupPartsTwo, col.multV0M(), pairType, fillQA);
}
} else {
if (cfgProcessPM) {
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsTwo, col.multNtr(), 1, fillQA);
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsTwo, col.multNtr(), pairType, fillQA);
}
if (cfgProcessPP) {
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsOne, col.multNtr(), 2, fillQA);
doSameEventMCTruth<false>(thegroupPartsOne, thegroupPartsOne, col.multNtr(), pairType, fillQA);
}
if (cfgProcessMM) {
doSameEventMCTruth<false>(thegroupPartsTwo, thegroupPartsTwo, col.multNtr(), 3, fillQA);
doSameEventMCTruth<false>(thegroupPartsTwo, thegroupPartsTwo, col.multNtr(), pairType, fillQA);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMCTruth, "Enable processing same event for MC truth", false);

Expand Down Expand Up @@ -1104,13 +1112,13 @@
template <bool isMC, typename PartitionType>
void doMixedEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType)
{

randgen = new TRandom2(0);
for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {

int pdgCodePartOne = static_cast<int>(p1.tempFitVar());
const auto& pdgParticleOne = pdgMC->GetParticle(pdgCodePartOne);
const auto& pdgParticleOne = pdg->GetParticle(pdgCodePartOne);
int pdgCodePartTwo = static_cast<int>(p2.tempFitVar());
const auto& pdgParticleTwo = pdgMC->GetParticle(pdgCodePartTwo);
const auto& pdgParticleTwo = pdg->GetParticle(pdgCodePartTwo);

float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2);
double rand;
Expand Down Expand Up @@ -1149,6 +1157,7 @@
}
}
}
delete randgen;
}

/// process function for to call doMixedEvent with Data
Expand All @@ -1157,7 +1166,14 @@
void processMixedEventNtrMCTruth(o2::aod::FdCollisions const& cols,
FemtoTruthParticles const&)
{
randgen = new TRandom2(0);
int pairType = 0;
if (cfgProcessPM) {
pairType = 1;
} else if (cfgProcessPP) {
pairType = 2;
} else if (cfgProcessMM) {
pairType = 3;
}

for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningNtr, ConfNEventsMix, -1, cols, cols)) {

Expand All @@ -1167,20 +1183,19 @@
if (cfgProcessPM) {
auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEventMCTruth<false>(groupPartsOne, groupPartsTwo, multiplicityCol, 1);
doMixedEventMCTruth<false>(groupPartsOne, groupPartsTwo, multiplicityCol, pairType);
}
if (cfgProcessPP) {
auto groupPartsOne = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsOneMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEventMCTruth<false>(groupPartsOne, groupPartsTwo, multiplicityCol, 2);
doMixedEventMCTruth<false>(groupPartsOne, groupPartsTwo, multiplicityCol, pairType);
}
if (cfgProcessMM) {
auto groupPartsOne = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwoMCTruth->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEventMCTruth<false>(groupPartsOne, groupPartsTwo, multiplicityCol, 3);
doMixedEventMCTruth<false>(groupPartsOne, groupPartsTwo, multiplicityCol, pairType);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtrMCTruth, "Enable processing MC Truth mixed events for multiplicity", false);
};
Expand Down
Loading