Skip to content

Commit 2c272d2

Browse files
committed
Modifying MC process function to store both truth and reco info
1 parent 1b6d2e2 commit 2c272d2

File tree

1 file changed

+58
-22
lines changed

1 file changed

+58
-22
lines changed

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
3333
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h"
3434
#include "PWGCF/FemtoUniverse/Core/FemtoUniverse3DContainer.h"
35+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseContainer.h"
3536
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h"
3637
#include "PWGCF/FemtoUniverse/Core/femtoUtils.h"
3738
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
@@ -75,15 +76,17 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
7576
Configurable<bool> ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"};
7677
} twotracksconfigs;
7778

79+
SliceCache cache;
80+
7881
using FemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles>;
79-
// Filters for selecting particles (both p1 and p2)
8082
Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable
8183
using FilteredFemtoFullParticles = soa::Filtered<FemtoFullParticles>;
82-
// using FilteredFemtoFullParticles = FemtoFullParticles; //if no filtering is applied uncomment this option
83-
84-
SliceCache cache;
8584
Preslice<FilteredFemtoFullParticles> perCol = aod::femtouniverseparticle::fdCollisionId;
8685

86+
using FemtoRecoParticles = soa::Join<aod::FDParticles, aod::FDExtParticles, aod::FDMCLabels>;
87+
using FilteredFemtoRecoParticles = soa::Filtered<FemtoRecoParticles>;
88+
Preslice<FilteredFemtoRecoParticles> perColMC = aod::femtouniverseparticle::fdCollisionId;
89+
8790
/// Particle 1
8891
struct : o2::framework::ConfigurableGroup {
8992
Configurable<int> ConfPDGCodePartOne{"ConfPDGCodePartOne", 211, "Particle 1 - PDG code"};
@@ -97,7 +100,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
97100
/// Partition for particle 1
98101
Partition<FilteredFemtoFullParticles> partsOne = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1;
99102

100-
Partition<soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1;
103+
Partition<FilteredFemtoRecoParticles> partsOneMC = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && aod::femtouniverseparticle::sign == trackonefilter.ConfChargePart1 && aod::femtouniverseparticle::pt < trackonefilter.ConfPtHighPart1 && aod::femtouniverseparticle::pt > trackonefilter.ConfPtLowPart1;
101104
//
102105

103106
/// Histogramming for particle 1
@@ -117,7 +120,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
117120
/// Partition for particle 2
118121
Partition<FilteredFemtoFullParticles> partsTwo = (aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack)) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2;
119122

120-
Partition<soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>> partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2;
123+
Partition<FilteredFemtoRecoParticles> partsTwoMC = aod::femtouniverseparticle::partType == uint8_t(aod::femtouniverseparticle::ParticleType::kTrack) && (aod::femtouniverseparticle::sign == tracktwofilter.ConfChargePart2) && aod::femtouniverseparticle::pt < tracktwofilter.ConfPtHighPart2 && aod::femtouniverseparticle::pt > tracktwofilter.ConfPtLowPart2;
121124

122125
/// Histogramming for particle 2
123126
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kTrack, 2> trackHistoPartTwo;
@@ -170,13 +173,18 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
170173
Configurable<float> ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"};
171174
Configurable<float> ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"};
172175
Configurable<float> ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"};
176+
Configurable<int> ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"};
177+
Configurable<int> ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"};
173178
Configurable<bool> cfgProcessPM{"cfgProcessPM", false, "Process particles of the opposite charge"};
174179
Configurable<bool> cfgProcessPP{"cfgProcessPP", true, "Process particles of the same, positice charge"};
175180
Configurable<bool> cfgProcessMM{"cfgProcessMM", true, "Process particles of the same, positice charge"};
176181
Configurable<bool> cfgProcessMultBins{"cfgProcessMultBins", true, "Process kstar histograms in multiplicity bins (in multiplicity bins)"};
177182
Configurable<bool> cfgProcessKtBins{"cfgProcessKtBins", true, "Process kstar histograms in kT bins (if cfgProcessMultBins is set false, this will not be processed regardless this Configurable state)"};
178183
Configurable<bool> cfgProcessKtMt3DCF{"cfgProcessKtMt3DCF", false, "Process 3D histograms in kT and Mult bins"};
179184

185+
FemtoUniverseContainer<femto_universe_container::EventType::same, femto_universe_container::Observable::kstar> sameEventCont1D;
186+
FemtoUniverseContainer<femto_universe_container::EventType::mixed, femto_universe_container::Observable::kstar> mixedEventCont1D;
187+
180188
FemtoUniverse3DContainer<femto_universe3d_container::EventType::same, femto_universe3d_container::Observable::kstar> sameEventCont;
181189
FemtoUniverse3DContainer<femto_universe3d_container::EventType::mixed, femto_universe3d_container::Observable::kstar> mixedEventCont;
182190

@@ -205,6 +213,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
205213
/// Histogram output
206214
HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject};
207215
HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
216+
HistogramRegistry resultRegistry1D{"Correlations1D", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
208217
HistogramRegistry resultRegistryPM{"CorrelationsPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
209218
HistogramRegistry resultRegistryPP{"CorrelationsPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
210219
HistogramRegistry resultRegistryMM{"CorrelationsMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
@@ -393,6 +402,10 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
393402
sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF);
394403
mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, cfgProcessKtBins, cfgProcessKtMt3DCF);
395404
}
405+
sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfEtaBins, ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D);
406+
sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo);
407+
mixedEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBins, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, ConfEtaBins, ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D);
408+
mixedEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo);
396409
}
397410

398411
if (cfgProcessMM) {
@@ -438,8 +451,8 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
438451
/// @param parts femtoUniverseParticles table (in case of Monte Carlo joined with FemtoUniverseMCLabels)
439452
/// @param magFieldTesla magnetic field of the collision
440453
/// @param multCol multiplicity of the collision
441-
template <bool isMC, typename PartitionType, typename PartType>
442-
void doSameEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartType parts, float magFieldTesla, int multCol, int ContType, bool fillQA)
454+
template <bool isMC, typename PartitionType, typename PartType, typename MCParticles = std::nullptr_t>
455+
void doSameEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartType parts, float magFieldTesla, int multCol, int ContType, bool fillQA, [[maybe_unused]] MCParticles mcParts = nullptr)
443456
{
444457

445458
/// Histogramming same event
@@ -531,13 +544,25 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
531544
k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden);
532545
sameEventMultContPP.fill3D<float>(k3d[1], k3d[2], k3d[3], multCol, kT);
533546
}
547+
float weight = 1.0f;
548+
if constexpr (std::is_same<PartType, FilteredFemtoRecoParticles>::value) {
549+
sameEventCont1D.setPair<true>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
550+
} else {
551+
sameEventCont1D.setPair<false>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
552+
}
534553
} else {
535554
if (!cfgProcessMultBins) {
536-
sameEventContPP.setPair<isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden);
555+
sameEventContPP.setPair<true>(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden);
537556
} else {
538557
k3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden);
539558
sameEventMultContPP.fill3D<float>(k3d[1], k3d[2], k3d[3], multCol, kT);
540559
}
560+
float weight = 1.0f;
561+
if constexpr (std::is_same<PartType, FemtoRecoParticles>::value) {
562+
sameEventCont1D.setPair<true>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
563+
} else {
564+
sameEventCont1D.setPair<false>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
565+
}
541566
}
542567
break;
543568
}
@@ -554,13 +579,25 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
554579
k3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden);
555580
sameEventMultContMM.fill3D<float>(k3d[1], k3d[2], k3d[3], multCol, kT);
556581
}
582+
float weight = 1.0f;
583+
if constexpr (std::is_same<PartType, FilteredFemtoRecoParticles>::value) {
584+
sameEventCont1D.setPair<true>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
585+
} else {
586+
sameEventCont1D.setPair<false>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
587+
}
557588
} else {
558589
if (!cfgProcessMultBins) {
559-
sameEventContMM.setPair<isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden);
590+
sameEventContMM.setPair<true>(p2, p1, multCol, twotracksconfigs.ConfUse3D, ConfIsIden);
560591
} else {
561592
k3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden);
562593
sameEventMultContMM.fill3D<float>(k3d[1], k3d[2], k3d[3], multCol, kT);
563594
}
595+
float weight = 1.0f;
596+
if constexpr (std::is_same<PartType, FemtoRecoParticles>::value) {
597+
sameEventCont1D.setPair<true>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
598+
} else {
599+
sameEventCont1D.setPair<false>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight);
600+
}
564601
}
565602
break;
566603
}
@@ -614,12 +651,11 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
614651
/// \param col subscribe to the collision table (Monte Carlo Reconstructed reconstructed)
615652
/// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
616653
/// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
617-
void processSameEventMC(o2::aod::FdCollision const& col,
618-
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels> const& parts,
619-
o2::aod::FdMCParticles const&)
654+
void processSameEventMC(FilteredFDCollision const& col,
655+
FilteredFemtoRecoParticles const& parts,
656+
aod::FdMCParticles const& mcparts)
620657
{
621658
fillCollision(col, ConfIsCent);
622-
623659
auto thegroupPartsOne = partsOneMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
624660
auto thegroupPartsTwo = partsTwoMC->sliceByCached(aod::femtouniverseparticle::fdCollisionId, col.globalIndex(), cache);
625661

@@ -631,7 +667,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
631667
doSameEvent<false>(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA);
632668
}
633669
if (cfgProcessPP) {
634-
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA);
670+
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA, mcparts);
635671
}
636672
if (cfgProcessMM) {
637673
doSameEvent<false>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA);
@@ -641,7 +677,7 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
641677
doSameEvent<false>(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA);
642678
}
643679
if (cfgProcessPP) {
644-
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA);
680+
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA, mcparts);
645681
}
646682
if (cfgProcessMM) {
647683
doSameEvent<false>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA);
@@ -797,9 +833,9 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
797833
/// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed)
798834
/// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
799835
/// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
800-
void processMixedEventMCCent(o2::aod::FdCollisions const& cols,
801-
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels> const& parts,
802-
o2::aod::FdMCParticles const&)
836+
void processMixedEventMCCent(FilteredFDCollisions const& cols,
837+
FemtoRecoParticles const& parts,
838+
aod::FdMCParticles const&)
803839
{
804840
randgen = new TRandom2(0);
805841

@@ -881,9 +917,9 @@ struct femtoUniversePairTaskTrackTrack3DMultKtExtended {
881917
/// @param cols subscribe to the collisions table (Monte Carlo Reconstructed reconstructed)
882918
/// @param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
883919
/// @param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
884-
void processMixedEventMCNtr(o2::aod::FdCollisions& cols,
885-
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels>& parts,
886-
o2::aod::FdMCParticles&)
920+
void processMixedEventMCNtr(FilteredFDCollisions const& cols,
921+
FemtoRecoParticles const& parts,
922+
aod::FdMCParticles const&)
887923
{
888924
randgen = new TRandom2(0);
889925

0 commit comments

Comments
 (0)