Skip to content

Commit

Permalink
Changes in femtoUniverseEfficiencyBase task (AliceO2Group#7266)
Browse files Browse the repository at this point in the history
  • Loading branch information
alicja-pp authored Aug 12, 2024
1 parent 7ab4f94 commit 0701504
Showing 1 changed file with 42 additions and 62 deletions.
104 changes: 42 additions & 62 deletions PWGCF/FemtoUniverse/Tasks/femtoUniverseEfficiencyBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,13 @@
/// \author Alicja Płachta, WUT Warsaw, [email protected]

#include <vector>
#include <random>
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/RunningWorkflowInfo.h"
#include "Framework/StepTHn.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "TDatabasePDG.h"

#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUtils.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h"

using namespace o2;
Expand All @@ -43,15 +35,22 @@ struct femtoUniverseEfficiencyBase {
using FemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles, aod::FDMCLabels>;
Preslice<FemtoFullParticles> perCol = aod::femtouniverseparticle::fdCollisionId;

// Collisions
Configurable<float> ConfZVertex{"ConfZVertex", 10.f, "Event sel: Maximum z-Vertex (cm)"};

Filter collisionFilter = (nabs(aod::collision::posZ) < ConfZVertex);
using FilteredFDCollisions = soa::Filtered<o2::aod::FDCollisions>;
using FilteredFDCollision = FilteredFDCollisions::iterator;

/// Particle selection part
/// Configurables for both particles
Configurable<float> ConfEtaMax{"ConfEtaMax", 0.8f, "Higher limit for |Eta| (the same for both particles)"};
Configurable<float> ConfMomProton{"ConfMomProton", 0.75, "momentum threshold for proton identification using TOF"};
Configurable<float> ConfMomProton{"ConfMomProton", 0.75, "Momentum threshold for proton identification using TOF"};

/// Particle 1
Configurable<int32_t> ConfPDGCodePartOne{"ConfPDGCodePartOne", 2212, "Particle 1 - PDG code"};
Configurable<uint8_t> ConfParticleTypePartOne{"ConfParticleTypePartOne", aod::femtouniverseparticle::ParticleType::kTrack, "Particle 1 - particle type"};
Configurable<bool> ConfNoPDGPartOne{"ConfNoPDGPartOne", false, "0: selecting part by PDG, 1: no PID selection"};
Configurable<bool> ConfNoPDGPartOne{"ConfNoPDGPartOne", false, "0: selecting part one by PDG, 1: no PID selection"};
Configurable<float> ConfPtLowPart1{"ConfPtLowPart1", 0.2, "Lower limit for Pt for the first particle"};
Configurable<float> ConfPtHighPart1{"ConfPtHighPart1", 2.5, "Higher limit for Pt for the first particle"};
Configurable<int> ConfChargePart1{"ConfChargePart1", 1, "Charge of the first particle"};
Expand All @@ -72,6 +71,7 @@ struct femtoUniverseEfficiencyBase {
Configurable<bool> ConfIsSame{"ConfIsSame", false, "Pairs of the same particle"};
Configurable<int32_t> ConfPDGCodePartTwo{"ConfPDGCodePartTwo", 333, "Particle 2 - PDG code"};
Configurable<uint8_t> ConfParticleTypePartTwo{"ConfParticleTypePartTwo", aod::femtouniverseparticle::ParticleType::kTrack, "Particle 2 - particle type"};
Configurable<bool> ConfNoPDGPartTwo{"ConfNoPDGPartTwo", false, "0: selecting part two by PDG, 1: no PID selection"};
Configurable<float> ConfPtLowPart2{"ConfPtLowPart2", 0.2, "Lower limit for Pt for the second particle"};
Configurable<float> ConfPtHighPart2{"ConfPtHighPart2", 2.5, "Higher limit for Pt for the second particle"};
Configurable<int> ConfChargePart2{"ConfChargePart2", 1, "Charge of the second particle"};
Expand All @@ -87,20 +87,19 @@ struct femtoUniverseEfficiencyBase {
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0, 2> trackHistoV0TwoRec;
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child, 3> trackHistoV0TwoChildPosRec;
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child, 4> trackHistoV0TwoChildNegRec;

/// Histogramming for Event
FemtoUniverseEventHisto eventHisto;

/// The configurables need to be passed to an std::vector
int vPIDPartOne, vPIDPartTwo;
std::vector<float> kNsigma;

/// particle part
ConfigurableAxis ConfTempFitVarpTBins{"ConfTempFitVarpTBins", {20, 0.5, 4.05}, "pT binning of the pT vs. TempFitVar plot"};
ConfigurableAxis ConfTempFitVarPDGBins{"ConfTempFitVarPDGBins", {6000, -2300, 2300}, "binning of the TempFitVar in the pT vs. TempFitVar plot"};
/// Particle part
ConfigurableAxis ConfTempFitVarpTBins{"ConfTempFitVarpTBins", {20, 0.5, 4.05}, "Binning of the pT in the pT vs. TempFitVar plot"};
ConfigurableAxis ConfTempFitVarPDGBins{"ConfTempFitVarPDGBins", {6000, -2300, 2300}, "Binning of the PDG code in the pT vs. TempFitVar plot"};
ConfigurableAxis ConfTempFitVarCPABins{"ConfTempFitVarCPABins", {1000, 0.9, 1}, "Binning of the pointing angle cosinus in the pT vs. TempFitVar plot"};
ConfigurableAxis ConfTempFitVarDCABins{"ConfTempFitVarDCABins", {1000, -5, 5}, "Binning of the PDG code in the pT vs. TempFitVar plot"};

struct : o2::framework::ConfigurableGroup {
Configurable<float> ConfNsigmaCombinedProton{"ConfNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > 0.5"};
Configurable<float> ConfNsigmaTPCProton{"ConfNsigmaTPCProton", 3.0, "TPC Proton Sigma for momentum < 0.5"};
Configurable<float> ConfNsigmaCombinedProton{"ConfNsigmaCombinedProton", 3.0, "TPC and TOF Proton Sigma (combined) for momentum > ConfMomProton"};
Configurable<float> ConfNsigmaTPCProton{"ConfNsigmaTPCProton", 3.0, "TPC Proton Sigma for momentum < ConfMomProton"};
Configurable<float> ConfNsigmaCombinedPion{"ConfNsigmaCombinedPion", 3.0, "TPC and TOF Pion Sigma (combined) for momentum > 0.5"};
Configurable<float> ConfNsigmaTPCPion{"ConfNsigmaTPCPion", 3.0, "TPC Pion Sigma for momentum < 0.5"};
} ConfBothTracks;
Expand All @@ -110,6 +109,7 @@ struct femtoUniverseEfficiencyBase {
Configurable<float> ConfV0InvMassUpLimit{"ConfV0InvV0MassUpLimit", 1.13, "Upper limit of the V0 invariant mass"};

FemtoUniverseTrackSelection trackCuts;

/// Histogram output
HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry registryPDG{"PDGHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
Expand All @@ -120,26 +120,26 @@ struct femtoUniverseEfficiencyBase {

eventHisto.init(&qaRegistry);
trackHistoPartOneGen.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartOne, false);
trackHistoPartOneRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartOne, false);
registryMCOrigin.add("part1/hPt", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH1F, {{240, 0, 6}}});
trackHistoPartOneRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarDCABins, 0, ConfPDGCodePartOne, false);
registryMCOrigin.add("part1/hPt", " ;#it{p}_{T} (GeV/c); Entries", {HistType::kTH1F, {{240, 0, 6}}});
registryPDG.add("part1/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}});
if (ConfParticleTypePartOne == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) {
trackHistoV0OneRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartOne, true);
trackHistoV0OneChildPosRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, 0, true, "posChildV0_1");
trackHistoV0OneChildNegRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, 0, true, "negChildV0_1");
trackHistoV0OneRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarCPABins, 0, ConfPDGCodePartOne, true);
trackHistoV0OneChildPosRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarDCABins, 0, 0, true, "posChildV0_1");
trackHistoV0OneChildNegRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarDCABins, 0, 0, true, "negChildV0_1");
registryPDG.add("part1/dpositive/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}});
registryPDG.add("part1/dnegative/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}});
}

registryPDG.add("part2/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}});
if (!ConfIsSame) {
trackHistoPartTwoGen.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartTwo, false);
trackHistoPartTwoRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartTwo, false);
registryMCOrigin.add("part2/hPt", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH1F, {{240, 0, 6}}});
trackHistoPartTwoRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarDCABins, 0, ConfPDGCodePartTwo, false);
registryMCOrigin.add("part2/hPt", " ;#it{p}_{T} (GeV/c); Entries", {HistType::kTH1F, {{240, 0, 6}}});
if (ConfParticleTypePartTwo == uint8_t(aod::femtouniverseparticle::ParticleType::kV0)) {
trackHistoV0TwoRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, ConfPDGCodePartTwo, true);
trackHistoV0TwoChildPosRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, 0, true, "posChildV0_2");
trackHistoV0TwoChildNegRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarPDGBins, 0, 0, true, "negChildV0_2");
trackHistoV0TwoRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarCPABins, 0, ConfPDGCodePartTwo, true);
trackHistoV0TwoChildPosRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarDCABins, 0, 0, true, "posChildV0_2");
trackHistoV0TwoChildNegRec.init(&qaRegistry, ConfTempFitVarpTBins, ConfTempFitVarDCABins, 0, 0, true, "negChildV0_2");
registryPDG.add("part2/dpositive/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}});
registryPDG.add("part2/dnegative/PDGvspT", "PDG;#it{p}_{T} (GeV/c); PDG", {HistType::kTH2F, {{500, 0, 5}, {16001, -8000.5, 8000.5}}});
}
Expand Down Expand Up @@ -256,15 +256,10 @@ struct femtoUniverseEfficiencyBase {
}

/// 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 grouppartsOneMCGen partition for the first particle passed by the process function
/// @param grouppartsTwoGen 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 doMCGen(PartitionType grouppartsOneMCGen, PartitionType grouppartsTwoGen)
{
Expand All @@ -278,7 +273,7 @@ struct femtoUniverseEfficiencyBase {

if (!ConfIsSame) {
for (auto& part : grouppartsTwoGen) {
if (!ConfNoPDGPartOne && part.pidcut() != ConfPDGCodePartTwo) {
if (!ConfNoPDGPartTwo && part.pidcut() != ConfPDGCodePartTwo) {
continue;
}
trackHistoPartTwoGen.fillQA<isMC, false>(part);
Expand All @@ -287,15 +282,10 @@ struct femtoUniverseEfficiencyBase {
}

/// 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 grouppartsOneMCGen partition for the first particle passed by the process function
/// @param grouppartsTwoGen 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 doMCRecTrackTrack(PartitionType grouppartsOneMCGen, PartitionType grouppartsTwoGen)
{
Expand Down Expand Up @@ -335,15 +325,10 @@ struct femtoUniverseEfficiencyBase {
}

/// 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 grouppartsOneMCGen partition for the first particle passed by the process function
/// @param grouppartsTwoGen 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 doMCRecTrackPhi(PartitionType grouppartsOneMCGen, PartitionType grouppartsTwoGen)
{ // part1 is track and part2 is Phi
Expand Down Expand Up @@ -384,15 +369,12 @@ struct femtoUniverseEfficiencyBase {
}

/// 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 ParticlesType
/// @tparam isMC: enables Monte Carlo truth specific histograms
/// @param grouppartsOneMCGen partition for the first particle passed by the process function
/// @param grouppartsTwoGen 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
/// @param parts all tracks
template <bool isMC, typename PartitionType, typename ParticlesType>
void doMCRecV0V0(PartitionType grouppartsOneMCGen, PartitionType grouppartsTwoGen, ParticlesType parts)
{
Expand Down Expand Up @@ -467,13 +449,12 @@ struct femtoUniverseEfficiencyBase {
}

/// 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 ParticlesType
/// @tparam isMC: enables Monte Carlo truth specific histograms
/// @param grouppartsOneMCGen partition for the first particle passed by the process function
/// @param grouppartsTwoGen partition for the second particle passed by the process function
/// @param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels)
/// @param parts all tracks
template <bool isMC, typename PartitionType, typename ParticlesType>
void doMCRecTrackV0(PartitionType grouppartsOneMCGen, PartitionType grouppartsTwoGen, ParticlesType const& parts)
{ // part1 is track and part2 is V0
Expand Down Expand Up @@ -528,10 +509,9 @@ struct femtoUniverseEfficiencyBase {
}
}

/// process function for to call doMCPlots with Data
/// process function for to call doMCRecTrackTrack with Data
/// \param col subscribe to the collision table (Data)
/// \param parts subscribe to the femtoUniverseParticleTable
void processTrackTrack(o2::aod::FDCollision& col,
void processTrackTrack(FilteredFDCollision& col,
FemtoFullParticles&, aod::FDMCParticles const&)
{
fillCollision(col);
Expand All @@ -546,10 +526,9 @@ struct femtoUniverseEfficiencyBase {
}
PROCESS_SWITCH(femtoUniverseEfficiencyBase, processTrackTrack, "Enable processing track-track efficiency task", true);

/// process function for to call doMCPlots with Data
/// process function for to call doMCRecTrackPhi with Data
/// \param col subscribe to the collision table (Data)
/// \param parts subscribe to the femtoUniverseParticleTable
void processTrackPhi(o2::aod::FDCollision& col,
void processTrackPhi(FilteredFDCollision& col,
FemtoFullParticles&, aod::FDMCParticles const&)
{
fillCollision(col);
Expand All @@ -564,10 +543,10 @@ struct femtoUniverseEfficiencyBase {
}
PROCESS_SWITCH(femtoUniverseEfficiencyBase, processTrackPhi, "Enable processing track-phi efficiency task", false);

/// process function for to call doMCPlots with Data
/// process function for to call doMCRecV0V0 with Data
/// \param col subscribe to the collision table (Data)
/// \param parts subscribe to the femtoUniverseParticleTable
void processV0V0(o2::aod::FDCollision& col,
void processV0V0(FilteredFDCollision& col,
FemtoFullParticles& parts, aod::FDMCParticles const&)
{
fillCollision(col);
Expand All @@ -583,9 +562,10 @@ struct femtoUniverseEfficiencyBase {
}
PROCESS_SWITCH(femtoUniverseEfficiencyBase, processV0V0, "Enable processing V0-V0 efficiency task", false);

/// process function for to call doMCRecTrackV0 with Data
/// \param col subscribe to the collision table (Data)
/// \param parts subscribe to the femtoUniverseParticleTable
void processTrackV0(o2::aod::FDCollision& col,
void processTrackV0(FilteredFDCollision& col,
FemtoFullParticles& parts, aod::FDMCParticles const&)
{
fillCollision(col);
Expand Down

0 comments on commit 0701504

Please sign in to comment.