Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 10 additions & 6 deletions PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@
#ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECONTAINER_H_
#define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSECONTAINER_H_

#include <fairlogger/Logger.h>
#include <vector>
#include <string>
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"

#include "Framework/HistogramRegistry.h"
#include "Common/Core/RecoDecay.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"

#include "Framework/HistogramRegistry.h"

#include "Math/Vector4D.h"
#include "TMath.h"
#include "TDatabasePDG.h"
#include "TMath.h"

#include <fairlogger/Logger.h>

#include <string>
#include <vector>

using namespace o2::framework;

Expand Down
31 changes: 16 additions & 15 deletions PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCorrection.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
#ifndef PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEEFFICIENCYCORRECTION_H_
#define PWGCF_FEMTOUNIVERSE_CORE_FEMTOUNIVERSEEFFICIENCYCORRECTION_H_

#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"

#include <CCDB/BasicCCDBManager.h>
#include <Framework/Configurable.h>
#include <Framework/ConfigurableKinds.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>

#include <Framework/O2DatabasePDGPlugin.h>

#include <TH1.h>
#include <TH2.h>

#include <vector>
#include <string>
#include <algorithm>
#include <ranges>

#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
#include <string>
#include <vector>

namespace o2::analysis::femto_universe::efficiency_correction
{
Expand Down Expand Up @@ -115,7 +115,7 @@
}
}

template <uint8_t N>
template <uint8_t N, typename CollisionType = aod::FdCollisions>
requires IsOneOrTwo<N>
void fillTruthHist(auto particle)
{
Expand All @@ -126,10 +126,10 @@
histRegistry->fill(HIST(histDirectory) + HIST("/") + HIST(histSuffix[N - 1]) + HIST("/hMCTruth"),
particle.pt(),
particle.eta(),
particle.fdCollision().multV0M());
particle.template fdCollision_as<CollisionType>().multV0M());
}

template <uint8_t N>
template <uint8_t N, typename CollisionType = aod::FdCollisions>
requires IsOneOrTwo<N>
void fillRecoHist(auto particle, int particlePDG)
{
Expand All @@ -149,7 +149,7 @@
histRegistry->fill(HIST(histDirectory) + HIST("/") + HIST(histSuffix[N - 1]) + HIST("/hPrimary"),
mcParticle.pt(),
mcParticle.eta(),
particle.fdCollision().multV0M());
particle.template fdCollision_as<CollisionType>().multV0M());
break;

case (o2::aod::femtouniverse_mc_particle::kDaughter):
Expand All @@ -158,33 +158,34 @@
histRegistry->fill(HIST(histDirectory) + HIST("/") + HIST(histSuffix[N - 1]) + HIST("/hSecondary"),
mcParticle.pt(),
mcParticle.eta(),
particle.fdCollision().multV0M());
particle.template fdCollision_as<CollisionType>().multV0M());
break;

case (o2::aod::femtouniverse_mc_particle::kMaterial):
histRegistry->fill(HIST(histDirectory) + HIST("/") + HIST(histSuffix[N - 1]) + HIST("/hMaterial"),
mcParticle.pt(),
mcParticle.eta(),
particle.fdCollision().multV0M());
particle.template fdCollision_as<CollisionType>().multV0M());
break;

case (o2::aod::femtouniverse_mc_particle::kFake):
histRegistry->fill(HIST(histDirectory) + HIST("/") + HIST(histSuffix[N - 1]) + HIST("/hFake"),
mcParticle.pt(),
mcParticle.eta(),
particle.fdCollision().multV0M());
particle.template fdCollision_as<CollisionType>().multV0M());
break;

default:
histRegistry->fill(HIST(histDirectory) + HIST("/") + HIST(histSuffix[N - 1]) + HIST("/hOther"),
mcParticle.pt(),
mcParticle.eta(),
particle.fdCollision().multV0M());
particle.template fdCollision_as<CollisionType>().multV0M());
break;
}
}
}

template <typename CollisionType = aod::FdCollisions>
auto getWeight(ParticleNo partNo, auto particle) -> float
{
auto weight = 1.0f;
Expand All @@ -203,9 +204,9 @@
} else if (config->confEffCorVariables.value == "pt,eta") {
bin = hWeights->FindBin(particle.pt(), particle.eta());
} else if (config->confEffCorVariables.value == "pt,mult") {
bin = hWeights->FindBin(particle.pt(), particle.fdCollision().multV0M());
bin = hWeights->FindBin(particle.pt(), particle.template fdCollision_as<CollisionType>().multV0M());
} else if (config->confEffCorVariables.value == "pt,eta,mult") {
bin = hWeights->FindBin(particle.pt(), particle.eta(), particle.fdCollision().multV0M());
bin = hWeights->FindBin(particle.pt(), particle.eta(), particle.template fdCollision_as<CollisionType>().multV0M());
} else {
LOGF(fatal, notify("Unknown configuration for efficiency variables"));
return weight;
Expand Down Expand Up @@ -281,8 +282,8 @@
std::array<TH1*, 2> hLoaded{nullptr, nullptr};

framework::HistogramRegistry* histRegistry{};
static constexpr std::string_view histDirectory{"EfficiencyCorrection"};

Check failure on line 285 in PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCorrection.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
static constexpr std::string_view histSuffix[2]{"one", "two"};

Check failure on line 286 in PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCorrection.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
};

} // namespace o2::analysis::femto_universe::efficiency_correction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,35 @@
/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch
/// \author Shirajum Monira, WUT Warsaw, shirajum.monira.dokt@pw.edu.pl

#include <vector>
#include <string>
#include <memory>
#include "Framework/AnalysisTask.h"
#include "Framework/runDataProcessing.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/ASoAHelpers.h"
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEfficiencyCorrection.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h"
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"

#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "Framework/runDataProcessing.h"

#include <TFile.h>
#include <TH1.h>
#include <TPDGCode.h>

#include <memory>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::soa;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::analysis::femto_universe;
using namespace o2::aod::pidutils;
using namespace o2::track;
using namespace o2::analysis::femto_universe::efficiency_correction;

struct FemtoUniversePairTaskTrackV0Extended {

Expand Down Expand Up @@ -140,6 +144,9 @@ struct FemtoUniversePairTaskTrackV0Extended {
// Efficiency
Configurable<std::string> confLocalEfficiency{"confLocalEfficiency", "", "Local path to efficiency .root file"};

EffCorConfigurableGroup effCorConfGroup;
EfficiencyCorrection effCorrection{&effCorConfGroup};

static constexpr unsigned int V0ChildTable[][2] = {{0, 1}, {1, 0}, {1, 1}}; // Table to select the V0 children

FemtoUniverseContainer<femto_universe_container::EventType::same, femto_universe_container::Observable::kstar> sameEventCont;
Expand All @@ -154,8 +161,6 @@ struct FemtoUniversePairTaskTrackV0Extended {
HistogramRegistry registryMCtruth{"MCtruthHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
HistogramRegistry registryMCreco{"MCrecoHistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};

HistogramRegistry mixQaRegistry{"mixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject};

std::unique_ptr<TFile> plocalEffFile;
std::unique_ptr<TH1> plocalEffp1;
std::unique_ptr<TH1> plocalEffp2;
Expand Down Expand Up @@ -228,7 +233,7 @@ struct FemtoUniversePairTaskTrackV0Extended {
posChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "posChildV0Type2");
negChildV0Type2.init(&qaRegistry, confChildTempFitVarpTBins, confChildTempFitVarBins, false, 0, true, "negChildV0Type2");

mixQaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}});
qaRegistry.add("MixingQA/hMECollisionBins", ";bin;Entries", kTH1F, {{120, -0.5, 119.5}});

// MC truth
registryMCtruth.add("plus/MCtruthLambda", "MC truth Lambdas;#it{p}_{T} (GeV/c); #eta", {HistType::kTH2F, {{500, 0, 5}, {400, -1.0, 1.0}}});
Expand Down Expand Up @@ -300,6 +305,8 @@ struct FemtoUniversePairTaskTrackV0Extended {
LOGF(info, "Loaded efficiency histograms for V0-V0.");
}
}

effCorrection.init(&qaRegistry, {static_cast<framework::AxisSpec>(confV0TempFitVarpTBins), {confEtaBins, -2, 2}, confMultBins});
}
/// This function processes the same event for track - V0
template <typename PartType, typename PartitionType, typename MCParticles = std::nullptr_t>
Expand Down Expand Up @@ -379,7 +386,7 @@ struct FemtoUniversePairTaskTrackV0Extended {
}

/// This function processes the same event for V0 - V0
template <typename PartType, typename PartitionType, typename MCParticles = std::nullptr_t>
template <bool isMC, typename PartType, typename PartitionType, typename MCParticles = std::nullptr_t>
void doSameEventV0(FilteredFDCollision const& col, PartType const& parts, PartitionType& groupPartsTwo, [[maybe_unused]] MCParticles mcParts = nullptr)
{
const auto& magFieldTesla = col.magField();
Expand All @@ -402,6 +409,9 @@ struct FemtoUniversePairTaskTrackV0Extended {
negChildV0Type1.fillQABase<false, true>(negChild, HIST("negChildV0Type1"));
qaRegistry.fill(HIST("V0Type1/hInvMassLambdaVsCent"), multCol, part.mLambda());
qaRegistry.fill(HIST("V0Type1/hInvMassAntiLambdaVsCent"), multCol, part.mAntiLambda());
if constexpr (isMC) {
effCorrection.fillRecoHist<ParticleNo::ONE, FilteredFDCollisions>(part, kLambda0);
}
}
/// Check daughters of second V0 particle
if (isParticleTPC(posChild, V0ChildTable[confV0Type2][0]) && isParticleTPC(negChild, V0ChildTable[confV0Type2][1])) {
Expand All @@ -410,6 +420,9 @@ struct FemtoUniversePairTaskTrackV0Extended {
negChildV0Type2.fillQABase<false, true>(negChild, HIST("negChildV0Type2"));
qaRegistry.fill(HIST("V0Type2/hInvMassLambdaVsCent"), multCol, part.mLambda());
qaRegistry.fill(HIST("V0Type2/hInvMassAntiLambdaVsCent"), multCol, part.mAntiLambda());
if constexpr (isMC) {
effCorrection.fillRecoHist<ParticleNo::TWO, FilteredFDCollisions>(part, kLambda0Bar);
}
}
}

Expand Down Expand Up @@ -481,14 +494,14 @@ struct FemtoUniversePairTaskTrackV0Extended {
void processSameEventV0(FilteredFDCollision const& col, FemtoFullParticles const& parts)
{
auto groupPartsTwo = partsTwo->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
doSameEventV0(col, parts, groupPartsTwo);
doSameEventV0<false>(col, parts, groupPartsTwo);
}
PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Extended, processSameEventV0, "Enable processing same event for V0 - V0", false);

void processSameEventV0MCReco(FilteredFDCollision const& col, FemtoRecoParticles const& parts, aod::FdMCParticles const& mcparts)
{
auto groupPartsTwo = partsTwoMCReco->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
doSameEventV0(col, parts, groupPartsTwo, mcparts);
doSameEventV0<true>(col, parts, groupPartsTwo, mcparts);
}
PROCESS_SWITCH(FemtoUniversePairTaskTrackV0Extended, processSameEventV0MCReco, "Enable processing same event for V0 - V0 MC Reco", false);

Expand Down Expand Up @@ -565,13 +578,15 @@ struct FemtoUniversePairTaskTrackV0Extended {
negChildV0Type1.fillQABase<false, true>(negChild, HIST("negChildV0Type1"));
qaRegistry.fill(HIST("V0Type1/hInvMassLambdaVsCent"), multCol, part.mLambda());
qaRegistry.fill(HIST("V0Type1/hInvMassAntiLambdaVsCent"), multCol, part.mAntiLambda());
effCorrection.fillTruthHist<ParticleNo::ONE, FilteredFDCollisions>(part);
}
if ((confV0Type2 == 0 && pdgCode == kLambda0) || (confV0Type2 == 1 && pdgCode == kLambda0Bar)) {
trackHistoV0Type2.fillQABase<false, true>(part, HIST("V0Type2"));
posChildV0Type2.fillQABase<false, true>(posChild, HIST("posChildV0Type2"));
negChildV0Type2.fillQABase<false, true>(negChild, HIST("negChildV0Type2"));
qaRegistry.fill(HIST("V0Type2/hInvMassLambdaVsCent"), multCol, part.mLambda());
qaRegistry.fill(HIST("V0Type2/hInvMassAntiLambdaVsCent"), multCol, part.mAntiLambda());
effCorrection.fillTruthHist<ParticleNo::TWO, FilteredFDCollisions>(part);
}
}

Expand Down Expand Up @@ -657,12 +672,12 @@ struct FemtoUniversePairTaskTrackV0Extended {
if (confUseCent) {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
}
} else {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
}
}
}
Expand Down Expand Up @@ -729,12 +744,12 @@ struct FemtoUniversePairTaskTrackV0Extended {
if (confUseCent) {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
}
} else {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
}
}
}
Expand Down Expand Up @@ -799,12 +814,12 @@ struct FemtoUniversePairTaskTrackV0Extended {
if (confUseCent) {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
}
} else {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
}
}
}
Expand Down Expand Up @@ -837,12 +852,12 @@ struct FemtoUniversePairTaskTrackV0Extended {
if (confUseCent) {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningCent, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningCent.getBin({collision1.posZ(), collision1.multV0M()}));
}
} else {
for (const auto& [collision1, collision2] : soa::selfCombinations(colBinningMult, confNEventsMix, -1, cols, cols)) {
mixedCollProcessFunc(collision1, collision2);
mixQaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
qaRegistry.fill(HIST("MixingQA/hMECollisionBins"), colBinningMult.getBin({collision1.posZ(), collision1.multNtr()}));
}
}
}
Expand Down
Loading