Skip to content

Commit 308b178

Browse files
committed
Rearrange included headers, add histograms for MC Truth tracks
1 parent 8890703 commit 308b178

File tree

1 file changed

+67
-39
lines changed

1 file changed

+67
-39
lines changed

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackSpherHarMultKtExtended.cxx

Lines changed: 67 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,32 @@
1414
/// \remark This file is inherited from ~/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrack3DMultKtExtended.cxx on 17/06/2024
1515
/// \author Pritam Chakraborty, WUT Warsaw, pritam.chakraborty@pw.edu.pl
1616

17-
#include <vector>
18-
#include <string>
19-
#include "TRandom2.h"
17+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h"
18+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
19+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
20+
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h"
21+
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h"
22+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
23+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h"
24+
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h"
25+
#include "PWGCF/FemtoUniverse/Core/femtoUtils.h"
26+
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
27+
28+
#include "Common/DataModel/PIDResponse.h"
29+
30+
#include "Framework/ASoAHelpers.h"
2031
#include "Framework/AnalysisTask.h"
21-
#include "Framework/runDataProcessing.h"
2232
#include "Framework/HistogramRegistry.h"
23-
#include "Framework/ASoAHelpers.h"
33+
#include "Framework/O2DatabasePDGPlugin.h"
2434
#include "Framework/RunningWorkflowInfo.h"
2535
#include "Framework/StepTHn.h"
26-
#include "Framework/O2DatabasePDGPlugin.h"
36+
#include "Framework/runDataProcessing.h"
2737
#include "ReconstructionDataFormats/PID.h"
28-
#include "Common/DataModel/PIDResponse.h"
2938

30-
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
31-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
32-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
33-
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairCleaner.h"
34-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseSHContainer.h"
35-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseDetaDphiStar.h"
36-
#include "PWGCF/FemtoUniverse/Core/femtoUtils.h"
37-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
38-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h"
39-
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePairSHCentMultKt.h"
39+
#include "TRandom2.h"
40+
41+
#include <string>
42+
#include <vector>
4043

4144
using namespace o2;
4245
using namespace o2::analysis::femto_universe;
@@ -73,13 +76,24 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
7376
Configurable<bool> ConfIsMC{"ConfIsMC", false, "Enable additional Histogramms in the case of a MonteCarlo Run"};
7477
Configurable<std::vector<float>> ConfTrkPIDnSigmaMax{"ConfTrkPIDnSigmaMax", std::vector<float>{4.f, 3.f, 2.f}, "This configurable needs to be the same as the one used in the producer task"};
7578
Configurable<bool> ConfUse3D{"ConfUse3D", false, "Enable three dimensional histogramms (to be used only for analysis with high statistics): k* vs mT vs multiplicity"};
79+
Configurable<int> ConfPhiBins{"ConfPhiBins", 29, "Number of phi bins in deta dphi"};
80+
Configurable<int> ConfEtaBins{"ConfEtaBins", 29, "Number of eta bins in deta dphi"};
81+
Configurable<bool> ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"};
82+
Configurable<bool> ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"};
83+
Configurable<float> ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"};
84+
Configurable<float> ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"};
85+
Configurable<float> ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"};
86+
Configurable<float> ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"};
87+
Configurable<float> ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"};
7688
} twotracksconfigs;
7789

7890
using FemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles>;
7991
// Filters for selecting particles (both p1 and p2)
8092
Filter trackAdditionalfilter = (nabs(aod::femtouniverseparticle::eta) < twotracksconfigs.ConfEtaMax); // example filtering on configurable
8193
using FilteredFemtoFullParticles = soa::Filtered<FemtoFullParticles>;
8294
// using FilteredFemtoFullParticles = FemtoFullParticles; //if no filtering is applied uncomment this option
95+
using FemtoRecoParticles = soa::Join<aod::FDParticles, aod::FDExtParticles, aod::FDMCLabels>;
96+
using FilteredFemtoRecoParticles = soa::Filtered<FemtoRecoParticles>;
8397

8498
SliceCache cache;
8599
Preslice<FilteredFemtoFullParticles> perCol = aod::femtouniverseparticle::fdCollisionId;
@@ -96,8 +110,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
96110

97111
/// Partition for particle 1
98112
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;
99-
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;
113+
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;
101114
//
102115

103116
/// Histogramming for particle 1
@@ -116,8 +129,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
116129

117130
/// Partition for particle 2
118131
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;
119-
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;
132+
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;
121133

122134
/// Histogramming for particle 2
123135
FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kTrack, 2> trackHistoPartTwo;
@@ -169,13 +181,6 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
169181
Configurable<bool> ConfIsLCMS{"ConfIsLCMS", true, "Choosing LCMS or PRF"};
170182
Configurable<int> ConfNEventsMix{"ConfNEventsMix", 5, "Number of events for mixing"};
171183
Configurable<int> ConfLMax{"ConfLMax", 2, "Maximum value of l"};
172-
Configurable<bool> ConfIsCPR{"ConfIsCPR", true, "Close Pair Rejection"};
173-
Configurable<bool> ConfCPRPlotPerRadii{"ConfCPRPlotPerRadii", false, "Plot CPR per radii"};
174-
Configurable<float> ConfCPRdeltaPhiCutMax{"ConfCPRdeltaPhiCutMax", 0.0, "Delta Phi max cut for Close Pair Rejection"};
175-
Configurable<float> ConfCPRdeltaPhiCutMin{"ConfCPRdeltaPhiCutMin", 0.0, "Delta Phi min cut for Close Pair Rejection"};
176-
Configurable<float> ConfCPRdeltaEtaCutMax{"ConfCPRdeltaEtaCutMax", 0.0, "Delta Eta max cut for Close Pair Rejection"};
177-
Configurable<float> ConfCPRdeltaEtaCutMin{"ConfCPRdeltaEtaCutMin", 0.0, "Delta Eta min cut for Close Pair Rejection"};
178-
Configurable<float> ConfCPRChosenRadii{"ConfCPRChosenRadii", 0.80, "Delta Eta cut for Close Pair Rejection"};
179184
Configurable<bool> cfgProcessPM{"cfgProcessPM", false, "Process particles of the opposite charge"};
180185
Configurable<bool> cfgProcessPP{"cfgProcessPP", true, "Process particles of the same, positice charge"};
181186
Configurable<bool> cfgProcessMM{"cfgProcessMM", true, "Process particles of the same, positice charge"};
@@ -197,6 +202,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
197202
FemtoUniverseSHContainer<femto_universe_sh_container::EventType::same, femto_universe_sh_container::Observable::kstar> sameEventContMM;
198203
FemtoUniverseSHContainer<femto_universe_sh_container::EventType::mixed, femto_universe_sh_container::Observable::kstar> mixedEventContMM;
199204

205+
FemtoUniverseContainer<femto_universe_container::EventType::same, femto_universe_container::Observable::kstar> sameEventCont1D;
206+
200207
FemtoUniversePairCleaner<aod::femtouniverseparticle::ParticleType::kTrack, aod::femtouniverseparticle::ParticleType::kTrack> pairCleaner;
201208
FemtoUniverseDetaDphiStar<aod::femtouniverseparticle::ParticleType::kTrack, aod::femtouniverseparticle::ParticleType::kTrack> pairCloseRejection;
202209
FemtoUniverseTrackSelection trackCuts;
@@ -216,6 +223,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
216223
/// Histogram output
217224
HistogramRegistry qaRegistry{"TrackQA", {}, OutputObjHandlingPolicy::AnalysisObject};
218225
HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
226+
HistogramRegistry resultRegistry1D{"Correlations1D", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
219227
HistogramRegistry resultRegistryPM{"CorrelationsPM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
220228
HistogramRegistry resultRegistryPP{"CorrelationsPP", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
221229
HistogramRegistry resultRegistryMM{"CorrelationsMM", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
@@ -404,6 +412,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
404412
sameEventMultContPP.init(&SameMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax);
405413
mixedEventMultContPP.init(&MixedMultRegistryPP, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax);
406414
}
415+
sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBinsCent, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twotracksconfigs.ConfEtaBins, twotracksconfigs.ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D);
416+
sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo);
407417
}
408418

409419
if (cfgProcessMM) {
@@ -416,11 +426,13 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
416426
sameEventMultContMM.init(&SameMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax);
417427
mixedEventMultContMM.init(&MixedMultRegistryMM, ConfkstarBins, ConfMultKstarBins, ConfKtKstarBins, ConfLMax);
418428
}
429+
sameEventCont1D.init(&resultRegistry1D, ConfkstarBins, ConfMultBinsCent, ConfkTBins, ConfmTBins, ConfmultBins3D, ConfmTBins3D, twotracksconfigs.ConfEtaBins, twotracksconfigs.ConfPhiBins, twotracksconfigs.ConfIsMC, twotracksconfigs.ConfUse3D);
430+
sameEventCont1D.setPDGCodes(trackonefilter.ConfPDGCodePartOne, tracktwofilter.ConfPDGCodePartTwo);
419431
}
420432

421433
pairCleaner.init(&qaRegistry);
422-
if (ConfIsCPR.value) {
423-
pairCloseRejection.init(&resultRegistry, &qaRegistry, ConfCPRdeltaPhiCutMin.value, ConfCPRdeltaPhiCutMax.value, ConfCPRdeltaEtaCutMin.value, ConfCPRdeltaEtaCutMax.value, ConfCPRChosenRadii.value, ConfCPRPlotPerRadii.value);
434+
if (twotracksconfigs.ConfIsCPR.value) {
435+
pairCloseRejection.init(&resultRegistry, &qaRegistry, twotracksconfigs.ConfCPRdeltaPhiCutMin.value, twotracksconfigs.ConfCPRdeltaPhiCutMax.value, twotracksconfigs.ConfCPRdeltaEtaCutMin.value, twotracksconfigs.ConfCPRdeltaEtaCutMax.value, twotracksconfigs.ConfCPRChosenRadii.value, twotracksconfigs.ConfCPRPlotPerRadii.value);
424436
}
425437

426438
vPIDPartOne = trackonefilter.ConfPIDPartOne.value;
@@ -485,7 +497,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
485497
continue;
486498
}
487499

488-
if (ConfIsCPR.value) {
500+
if (twotracksconfigs.ConfIsCPR.value) {
489501
if (confCPRIsAtITS.value) {
490502
if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) {
491503
continue;
@@ -515,7 +527,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
515527
continue;
516528
}
517529

518-
if (ConfIsCPR.value) {
530+
if (twotracksconfigs.ConfIsCPR.value) {
519531
if (confCPRIsAtITS.value) {
520532
if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::same)) {
521533
continue;
@@ -544,9 +556,17 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
544556
if (rand > 0.5) {
545557
sameEventMultContPP.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
546558
f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden);
559+
if (twotracksconfigs.ConfIsMC) {
560+
float weight = 1.0f;
561+
sameEventCont1D.setPair<isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden);
562+
}
547563
} else if (rand <= 0.5) {
548564
sameEventMultContPP.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
549565
f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden);
566+
if (twotracksconfigs.ConfIsMC) {
567+
float weight = 1.0f;
568+
sameEventCont1D.setPair<isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden);
569+
}
550570
}
551571
if (ConfIsFillAngqLCMS) {
552572
kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]);
@@ -559,9 +579,17 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
559579
if (rand > 0.5) {
560580
sameEventMultContMM.fillMultNumDen(p1, p2, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
561581
f3d = FemtoUniverseMath::newpairfunc(p1, mass1, p2, mass2, ConfIsIden);
582+
if (twotracksconfigs.ConfIsMC) {
583+
float weight = 1.0f;
584+
sameEventCont1D.setPair<isMC>(p1, p2, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden);
585+
}
562586
} else if (rand <= 0.5) {
563587
sameEventMultContMM.fillMultNumDen(p2, p1, femto_universe_sh_container::EventType::same, 2, multCol, kT, ConfIsIden);
564588
f3d = FemtoUniverseMath::newpairfunc(p2, mass2, p1, mass1, ConfIsIden);
589+
if (twotracksconfigs.ConfIsMC) {
590+
float weight = 1.0f;
591+
sameEventCont1D.setPair<isMC>(p2, p1, multCol, twotracksconfigs.ConfUse3D, weight, ConfIsIden);
592+
}
565593
}
566594
if (ConfIsFillAngqLCMS) {
567595
kv = std::sqrt(f3d[1] * f3d[1] + f3d[2] * f3d[2] + f3d[3] * f3d[3]);
@@ -620,8 +648,8 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
620648
/// \param parts subscribe to joined table FemtoUniverseParticles and FemtoUniverseMCLables to access Monte Carlo truth
621649
/// \param FemtoUniverseMCParticles subscribe to the Monte Carlo truth table
622650
void processSameEventMC(o2::aod::FdCollision const& col,
623-
soa::Join<FilteredFemtoFullParticles, aod::FDMCLabels> const& parts,
624-
o2::aod::FdMCParticles const&)
651+
FilteredFemtoRecoParticles const& parts,
652+
aod::FdMCParticles const&)
625653
{
626654
fillCollision(col, ConfIsCent);
627655

@@ -635,20 +663,20 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
635663
doSameEvent<false>(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 1, fillQA);
636664
}
637665
if (cfgProcessPP) {
638-
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA);
666+
doSameEvent<true>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multV0M(), 2, fillQA);
639667
}
640668
if (cfgProcessMM) {
641-
doSameEvent<false>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA);
669+
doSameEvent<true>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multV0M(), 3, fillQA);
642670
}
643671
} else {
644672
if (cfgProcessPM) {
645673
doSameEvent<false>(thegroupPartsOne, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 1, fillQA);
646674
}
647675
if (cfgProcessPP) {
648-
doSameEvent<false>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA);
676+
doSameEvent<true>(thegroupPartsOne, thegroupPartsOne, parts, col.magField(), col.multNtr(), 2, fillQA);
649677
}
650678
if (cfgProcessMM) {
651-
doSameEvent<false>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA);
679+
doSameEvent<true>(thegroupPartsTwo, thegroupPartsTwo, parts, col.magField(), col.multNtr(), 3, fillQA);
652680
}
653681
}
654682
delete randgen;
@@ -679,7 +707,7 @@ struct femtoUniversePairTaskTrackTrackSpherHarMultKtExtended {
679707
continue;
680708
}
681709

682-
if (ConfIsCPR.value) {
710+
if (twotracksconfigs.ConfIsCPR.value) {
683711
if (confCPRIsAtITS.value) {
684712
if (pairCloseRejection.isClosePairAtITS(p1, p2, magFieldTesla, femto_universe_container::EventType::mixed)) {
685713
continue;

0 commit comments

Comments
 (0)