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,6 +61,7 @@
struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {

Service<o2::framework::O2DatabasePDG> pdg;
Service<o2::framework::O2DatabasePDG> pdgMC;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you adding a second identical service member?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #13388


/// Particle selection part

Expand Down Expand Up @@ -101,6 +102,9 @@
SliceCache cache;
Preslice<FilteredFemtoFullParticles> perCol = aod::femtouniverseparticle::fdCollisionId;

using FemtoTruthParticles = soa::Join<aod::FDParticles, aod::FDExtParticles, aod::FDMCLabels>;
Preslice<FemtoTruthParticles> perColMCTruth = aod::femtouniverseparticle::fdCollisionId;

/// Particle 1
struct : o2::framework::ConfigurableGroup {
Configurable<int> ConfPDGCodePartOne{"ConfPDGCodePartOne", 211, "Particle 1 - PDG code"};
Expand All @@ -114,6 +118,8 @@
/// Partition for particle 1
Partition<FilteredFemtoFullParticles> partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as<int8_t>(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1;
Partition<FilteredFemtoRecoParticles> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == as<int8_t>(trackonefilter.ConfChargePart1) && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1;
Partition<FemtoTruthParticles> partsOneMCTruth = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack);

//

/// Histogramming for particle 1
Expand All @@ -133,6 +139,7 @@
/// Partition for particle 2
Partition<FilteredFemtoFullParticles> partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == as<int8_t>(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2;
Partition<FilteredFemtoRecoParticles> partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == as<int8_t>(tracktwofilter.ConfChargePart2)) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2;
Partition<FemtoTruthParticles> partsTwoMCTruth = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kMCTruthTrack);

/// Histogramming for particle 2
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kTrack, 2> trackHistoPartTwo;
Expand Down Expand Up @@ -272,34 +279,34 @@

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

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.
if (std::abs(nsigmaTPCK) < 3.0) {

Check failure on line 283 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 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.
if (std::abs(nsigmaTPCK) < 2.0) {

Check failure on line 289 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 294 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 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.
if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) {

Check failure on line 301 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 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.
if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) {

Check failure on line 309 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 @@ -364,7 +371,7 @@
return false;
}
return false;
} else if (particle_number == 2) {

Check failure on line 374 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 @@ -695,6 +702,138 @@
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false);

/// This function processes the same event and takes care of all the histogramming
/// \todo the trivial loops over the tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ...
/// @tparam PartitionType
/// @tparam PartType
/// @tparam isMC: enables Monte Carlo truth specific histograms
/// @param groupPartsOne partition for the first particle passed by the process function
/// @param groupPartsTwo partition for the second particle passed by the process function
/// @param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels)
/// @param magFieldTesla magnetic field of the collision
/// @param multCol multiplicity of the collision
template <bool isMC, typename PartitionType>
void doSameEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType, bool fillQA)
{

/// Histogramming same event
if ((ContType == 1 || ContType == 2) && fillQA) {
Comment on lines +719 to +720
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do values 1 and 2 mean? Name them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean to add a comment about them?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No. Please read the O2 linter error messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #13388

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);
if (pdgParticle) {
trackHistoPartOne.fillQA<isMC, false>(part);
}
}
}
}

if ((ContType == 1 || ContType == 3) && 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);
if (pdgParticle) {
trackHistoPartTwo.fillQA<isMC, false>(part);
}
}
}
}

if (ContType == 1) {

/// 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);
int pdgCodePartTwo = static_cast<int>(p2.tempFitVar());
const auto& pdgParticleTwo = pdgMC->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);
}
}
} else {
for (const auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsOne))) {

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

float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2);
double rand;
rand = randgen->Rndm();
std::vector<double> f3d;
if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) {

switch (ContType) {
case 2: {
Comment on lines +772 to +773
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

if (rand > 0.5) {
sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
} else if (rand <= 0.5) {
sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
}
break;
}

case 3: {
if (rand > 0.5) {
sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
} else if (rand <= 0.5) {
sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
}
break;
}
default:
break;
}
}
}
}
}

/// process function for to call doSameEvent with Monte Carlo
/// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed)
/// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
/// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
void processSameEventMCTruth(o2::aod::FdCollision const& col,
FemtoTruthParticles const&)
{
fillCollision(col, ConfIsCent);

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

randgen is not 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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The line you are referring is in another function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #13388


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

/// This function processes the mixed event
/// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ...
/// \tparam PartitionType
Expand Down Expand Up @@ -864,26 +1003,6 @@
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtr, "Enable processing mixed events for centrality", false);

/// process function for to fill covariance histograms
/// \param col subscribe to the collision table (Data)
/// \param parts subscribe to the femtoUniverseParticleTable
void processCov(soa::Filtered<o2::aod::FdCollisions>::iterator const& /*col*/,
FilteredFemtoFullParticles const& /*parts*/)
{
int JMax = (ConfLMax + 1) * (ConfLMax + 1);
if (cfgProcessMM) {
sameEventMultContMM.fillMultkTCov(femto_universe_sh_container::EventType::same, JMax);
mixedEventMultContMM.fillMultkTCov(femto_universe_sh_container::EventType::mixed, JMax);
} else if (cfgProcessPP) {
sameEventMultContPP.fillMultkTCov(femto_universe_sh_container::EventType::same, JMax);
mixedEventMultContPP.fillMultkTCov(femto_universe_sh_container::EventType::mixed, JMax);
} else if (cfgProcessPM) {
sameEventMultCont.fillMultkTCov(femto_universe_sh_container::EventType::same, JMax);
mixedEventMultCont.fillMultkTCov(femto_universe_sh_container::EventType::mixed, JMax);
}
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processCov, "Enable processing same event covariance", false);

/// brief process function for to call doMixedEvent with Monte Carlo
/// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed)
/// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
Expand Down Expand Up @@ -971,6 +1090,99 @@
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventMCNtr, "Enable processing mixed events MC", false);

/// This function processes the mixed event
/// \todo the trivial loops over the collisions and tracks should be factored out since they will be common to all combinations of T-T, T-V0, V0-V0, ...
/// \tparam PartitionType
/// \tparam PartType
/// \tparam isMC: enables Monte Carlo truth specific histograms
/// \param groupPartsOne partition for the first particle passed by the process function
/// \param groupPartsTwo partition for the second particle passed by the process function
/// \param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels)
/// \param magFieldTesla magnetic field of the collision
/// \param multCol multiplicity of the collision
template <bool isMC, typename PartitionType>
void doMixedEventMCTruth(PartitionType groupPartsOne, PartitionType groupPartsTwo, int multCol, int ContType)
{

for (const auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {

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

float kT = FemtoUniverseMath::getkT(p1, mass1, p2, mass2);
double rand;
rand = randgen->Rndm();
if (pdgParticleOne && pdgParticleTwo && (pdgCodePartOne == trackonefilter.ConfPDGCodePartOne) && (pdgCodePartTwo == tracktwofilter.ConfPDGCodePartTwo)) {

switch (ContType) {
case 1: {
if (rand > 0.5) {
mixedEventMultCont.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden);
} else {
mixedEventMultCont.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden);
}
break;
}

case 2: {
if (rand > 0.5) {
mixedEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden);
} else {
mixedEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden);
}
break;
}

case 3: {
if (rand > 0.5) {
mixedEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden);
} else {
mixedEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::mixed, 2, multCol, kT, ConfIsIden);
}
break;
}
default:
break;
}
}
}
}

/// process function for to call doMixedEvent with Data
/// @param cols subscribe to the collisions table (Data)
/// @param parts subscribe to the femtoUniverseParticleTable
void processMixedEventNtrMCTruth(o2::aod::FdCollisions const& cols,
FemtoTruthParticles const&)
{
randgen = new TRandom2(0);

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

const int multiplicityCol = collision1.multNtr();
MixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningNtr.getBin({collision1.posZ(), multiplicityCol}));

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);
}
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);
}
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);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventNtrMCTruth, "Enable processing MC Truth mixed events for multiplicity", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading