Skip to content

Commit

Permalink
[PWGCF] FemtoUniverse: Adding and editing process functions for MC Pb…
Browse files Browse the repository at this point in the history
…Pb analysis (#9381)
  • Loading branch information
prchakra authored Jan 21, 2025
1 parent 9c02f21 commit ee7cb93
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 15 deletions.
27 changes: 24 additions & 3 deletions PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ using FemtoFullCollisionCentRun2 =
using FemtoFullCollisionCentRun3 =
soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>::iterator;
using FemtoFullCollisionMC = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::McCollisionLabels>::iterator;

using FemtoFullCollisionCentRun3MC =
soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults, aod::McCollisionLabels>::iterator;
using FemtoFullTracks =
soa::Join<aod::FullTracks, aod::TracksDCA, aod::TOFSignal, aod::pidTPCEl, aod::TrackSelection,
aod::pidTPCMu, aod::pidTPCPi, aod::pidTPCKa, aod::pidTPCPr,
Expand Down Expand Up @@ -458,10 +459,10 @@ struct FemtoUniverseProducerTask {

void init(InitContext&)
{
if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == false && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent) == false) {
if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == false && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent || doprocessTrackCentRun3DataMC) == false) {
LOGF(fatal, "Neither processFullData nor processFullMC enabled. Please choose one.");
}
if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == true && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent) == true) {
if ((doprocessFullData || doprocessTrackPhiData || doprocessTrackData || doprocessTrackV0 || doprocessTrackCascadeData || doprocessTrackD0mesonData || doprocessTrackCentRun2Data || doprocessTrackV0CentRun2Data || doprocessTrackCentRun3Data || doprocessV0CentRun3Data || doprocessCascadeCentRun3Data || doprocessTrackDataCentPP) == true && (doprocessFullMC || doprocessTrackMC || doprocessTrackMCTruth || doprocessTrackMCGen || doprocessTruthAndFullMC || doprocessFullMCCent || doprocessTrackCentRun3DataMC) == true) {
LOGF(fatal,
"Cannot enable process Data and process MC at the same time. "
"Please choose one.");
Expand Down Expand Up @@ -1922,6 +1923,26 @@ struct FemtoUniverseProducerTask {
}
PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackCentRun3Data, "Provide experimental data for Run 3 with centrality for track track", false);

void processTrackCentRun3DataMC(aod::FemtoFullCollisionCentRun3MC const& col,
aod::BCsWithTimestamps const&,
soa::Join<aod::FemtoFullTracks, aod::McTrackLabels> const& tracks,
aod::McCollisions const&,
aod::McParticles const&)
{
// get magnetic field for run
auto bc = col.bc_as<aod::BCsWithTimestamps>();
getMagneticFieldTesla(bc);
const auto ir = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; // fetch IR

// fill the tables
const auto colcheck = fillCollisionsCentRun3<true>(col);
if (colcheck) {
fillCollisionsCentRun3ColExtra<true>(col, ir);
fillTracks<true>(tracks);
}
}
PROCESS_SWITCH(FemtoUniverseProducerTask, processTrackCentRun3DataMC, "Provide MC data for track analysis", false);

void processV0CentRun3Data(aod::FemtoFullCollisionCentRun3 const& col,
aod::BCsWithTimestamps const&,
soa::Filtered<aod::FemtoFullTracks> const& tracks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "Framework/RunningWorkflowInfo.h"
#include "Framework/StepTHn.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "TDatabasePDG.h"
#include "ReconstructionDataFormats/PID.h"
#include "Common/DataModel/PIDResponse.h"

Expand Down Expand Up @@ -232,13 +231,13 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
// ConfNsigmaCombined -> TPC and TOF Sigma (combined) for momentum > 0.5

if (mom < twotracksconfigs.ConfTOFPtMin) {
if (TMath::Abs(nsigmaTPCPr) < twotracksconfigs.ConfNsigmaTPC) {
if (std::abs(nsigmaTPCPr) < twotracksconfigs.ConfNsigmaTPC) {
return true;
} else {
return false;
}
} else {
if (TMath::Hypot(nsigmaTOFPr, nsigmaTPCPr) < twotracksconfigs.ConfNsigmaCombined) {
if (std::hypot(nsigmaTOFPr, nsigmaTPCPr) < twotracksconfigs.ConfNsigmaCombined) {
return true;
} else {
return false;
Expand All @@ -250,33 +249,33 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
bool IsKaonNSigma(float mom, float nsigmaTPCK, float nsigmaTOFK)
{
if (mom < 0.3) { // 0.0-0.3
if (TMath::Abs(nsigmaTPCK) < 3.0) {
if (std::abs(nsigmaTPCK) < 3.0) {
return true;
} else {
return false;
}
} else if (mom < 0.45) { // 0.30 - 0.45
if (TMath::Abs(nsigmaTPCK) < 2.0) {
if (std::abs(nsigmaTPCK) < 2.0) {
return true;
} else {
return false;
}
} else if (mom < 0.55) { // 0.45-0.55
if (TMath::Abs(nsigmaTPCK) < 1.0) {
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)
if ((TMath::Abs(nsigmaTOFK) < 3.0) && (TMath::Abs(nsigmaTPCK) < 3.0)) {
if ((std::abs(nsigmaTOFK) < 3.0) && (std::abs(nsigmaTPCK) < 3.0)) {
{
return true;
}
} else {
return false;
}
} else if (mom > 1.5) { // 1.5 -
if ((TMath::Abs(nsigmaTOFK) < 2.0) && (TMath::Abs(nsigmaTPCK) < 3.0)) {
if ((std::abs(nsigmaTOFK) < 2.0) && (std::abs(nsigmaTPCK) < 3.0)) {
return true;
} else {
return false;
Expand All @@ -297,13 +296,13 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
// ConfNsigmaCombined -> TPC and TOF Pion Sigma (combined) for momentum > 0.5
if (true) {
if (mom < twotracksconfigs.ConfTOFPtMin) {
if (TMath::Abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) {
if (std::abs(nsigmaTPCPi) < twotracksconfigs.ConfNsigmaTPC) {
return true;
} else {
return false;
}
} else {
if (TMath::Hypot(nsigmaTOFPi, nsigmaTPCPi) < twotracksconfigs.ConfNsigmaCombined) {
if (std::hypot(nsigmaTOFPi, nsigmaTPCPi) < twotracksconfigs.ConfNsigmaCombined) {
return true;
} else {
return false;
Expand Down Expand Up @@ -609,6 +608,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
auto thegroupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);

bool fillQA = true;
randgen = new TRandom2(0);

if (cfgProcessPM) {
doSameEvent<false>(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA);
Expand All @@ -621,6 +621,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
if (cfgProcessMM) {
doSameEvent<true>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA);
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false);

Expand Down Expand Up @@ -774,6 +775,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)
{
randgen = new TRandom2(0);

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

const int multiplicityCol = collision1.multV0M();
Expand Down Expand Up @@ -804,6 +807,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
doMixedEvent<true>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrack3DMultKtExtended, processMixedEventMC, "Enable processing mixed events MC", false);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,28 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
/// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
/// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
void processSameEventMC(o2::aod::FdCollision& col,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& /*parts*/,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)
{
fillCollision(col);

auto thegroupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
auto thegroupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
bool fillQA = true;
randgen = new TRandom2(0);

if (cfgProcessPM) {
doSameEvent<false>(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA);
}

if (cfgProcessPP) {
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA);
}

if (cfgProcessMM) {
doSameEvent<false>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA);
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processSameEventMC, "Enable processing same event for Monte Carlo", false);

Expand Down Expand Up @@ -716,9 +731,11 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
/// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
/// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
void processMixedEventMC(o2::aod::FdCollisions& cols,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& /*parts*/,
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
o2::aod::FdMCParticles&)
{
randgen = new TRandom2(0);

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

const int multiplicityCol = collision1.multV0M();
Expand All @@ -732,7 +749,24 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
}
/// \todo before mixing we should check whether both collisions contain a pair of particles!
// if (partsOne.size() == 0 || nPart2Evt1 == 0 || nPart1Evt2 == 0 || partsTwo.size() == 0 ) continue;

if (cfgProcessPM) {
auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 1);
}
if (cfgProcessPP) {
auto groupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 2);
}
if (cfgProcessMM) {
auto groupPartsOne = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision1.globalIndex(), cache);
auto groupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, collision2.globalIndex(), cache);
doMixedEvent<false>(groupPartsOne, groupPartsTwo, parts, magFieldTesla1, multiplicityCol, 3);
}
}
delete randgen;
}
PROCESS_SWITCH(femtoUniversePairTaskTrackTrackSpherHarMultKtExtended, processMixedEventMC, "Enable processing mixed events MC", false);
};
Expand Down

0 comments on commit ee7cb93

Please sign in to comment.