Skip to content

Commit fcedf62

Browse files
authored
[PWGCF] Update lambdaR2Correlation.cxx (#10271)
1 parent 57978ae commit fcedf62

File tree

1 file changed

+134
-17
lines changed

1 file changed

+134
-17
lines changed

PWGCF/TwoParticleCorrelations/Tasks/lambdaR2Correlation.cxx

Lines changed: 134 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,18 @@ struct LambdaTableProducer {
252252
// V0s MC
253253
Configurable<bool> cHasMcFlag{"cHasMcFlag", true, "Has Mc Tag"};
254254
Configurable<bool> cSelectTrueLambda{"cSelectTrueLambda", false, "Select True Lambda"};
255+
Configurable<bool> cSelectPrimaryV0{"cSelectPrimaryV0", true, "Select Primary V0"};
255256
Configurable<bool> cRecPrimaryLambda{"cRecPrimaryLambda", false, "Primary Reconstructed Lambda"};
256257
Configurable<bool> cRecSecondaryLambda{"cRecSecondaryLambda", false, "Secondary Reconstructed Lambda"};
257258
Configurable<bool> cGenPrimaryLambda{"cGenPrimaryLambda", true, "Primary Generated Lambda"};
258259
Configurable<bool> cGenSecondaryLambda{"cGenSecondaryLambda", false, "Secondary Generated Lambda"};
259260
Configurable<bool> cGenDecayChannel{"cGenDecayChannel", true, "Gen Level Decay Channel Flag"};
260261
Configurable<bool> cMcGenDauTrackKinCutFlag{"cMcGenDauTrackKinCutFlag", false, "Gen Level Daughter Track Kinematic Cut Flag"};
261262

263+
// Mc Matching
264+
Configurable<float> cSelMcMatchValue{"cSelMcMatchValue", 0.4, "Mc Matching Percentage"};
265+
Configurable<bool> cDoMcMatching{"cDoMcMatching", true, "Do Mc Matching Flag"};
266+
262267
// Efficiency Correction
263268
Configurable<bool> cCorrectionFlag{"cCorrectionFlag", false, "Efficiency Correction Flag"};
264269
Configurable<int> cCorrFactHist{"cCorrFactHist", 0, "Correction Factor Histogram"};
@@ -299,9 +304,9 @@ struct LambdaTableProducer {
299304
const AxisSpec axisPID(8000, -4000, 4000, "PdgCode");
300305

301306
const AxisSpec axisV0Mass(200, 1.09, 1.14, "M_{p#pi} (GeV/#it{c}^{2})");
302-
const AxisSpec axisV0Pt(38, 0.2, 4.0, "p_{T} (GeV/#it{c})");
303-
const AxisSpec axisV0Rap(24, -1.2, 1.2, "y");
304-
const AxisSpec axisV0Eta(24, -1.2, 1.2, "#eta");
307+
const AxisSpec axisV0Pt(84, 0.2, 4.4, "p_{T} (GeV/#it{c})");
308+
const AxisSpec axisV0Rap(48, -1.2, 1.2, "y");
309+
const AxisSpec axisV0Eta(48, -1.2, 1.2, "#eta");
305310
const AxisSpec axisV0Phi(36, 0., TwoPI, "#phi (rad)");
306311

307312
const AxisSpec axisRadius(2000, 0, 200, "r(cm)");
@@ -343,6 +348,11 @@ struct LambdaTableProducer {
343348
histos.add("QA/Lambda/h1f_V0_ctau", "V_{0} c#tau", kTH1F, {axisCTau});
344349
histos.add("QA/Lambda/h1f_V0_gctau", "V_{0} #gammac#tau", kTH1F, {axisGCTau});
345350

351+
histos.add("QA/Lambda/h2f_V0_ptpt", "Rec vs Truth p_{T}", kTH2F, {axisV0Pt, axisV0Pt});
352+
histos.add("QA/Lambda/h2f_V0_etaeta", "Rec vs Truth #eta", kTH2F, {axisV0Eta, axisV0Eta});
353+
histos.add("QA/Lambda/h2f_V0_raprap", "Rec vs Truth y", kTH2F, {axisV0Rap, axisV0Rap});
354+
histos.add("QA/Lambda/h2f_V0_phiphi", "Rec vs Truth #phi", kTH2F, {axisV0Phi, axisV0Phi});
355+
346356
histos.add("QA/Lambda/h1f_pos_prong_pt", "Pos-Prong p_{T}", kTH1F, {axisTrackPt});
347357
histos.add("QA/Lambda/h1f_neg_prong_pt", "Neg-Prong p_{T}", kTH1F, {axisTrackPt});
348358
histos.add("QA/Lambda/h1f_pos_prong_eta", "Pos-Prong #eta-distribution", kTH1F, {axisV0Eta});
@@ -694,15 +704,11 @@ struct LambdaTableProducer {
694704
return true;
695705
}
696706

697-
template <typename V, typename T>
698-
bool selTrueMcRecLambda(V const& v0, T const&)
707+
template <typename V>
708+
bool selPrimaryV0(V const& v0)
699709
{
700710
auto mcpart = v0.template mcParticle_as<aod::McParticles>();
701711

702-
if (std::abs(mcpart.pdgCode()) != kLambda0) {
703-
return false;
704-
}
705-
706712
// check for primary/secondary lambda
707713
if (cRecPrimaryLambda && !mcpart.isPhysicalPrimary()) {
708714
histos.fill(HIST("Tracks/h1f_tracks_info"), kNotPrimaryLambda);
@@ -712,6 +718,18 @@ struct LambdaTableProducer {
712718
return false;
713719
}
714720

721+
return true;
722+
}
723+
724+
template <typename V, typename T>
725+
bool selTrueMcRecLambda(V const& v0, T const&)
726+
{
727+
auto mcpart = v0.template mcParticle_as<aod::McParticles>();
728+
729+
if (std::abs(mcpart.pdgCode()) != kLambda0) {
730+
return false;
731+
}
732+
715733
auto postrack = v0.template posTrack_as<T>();
716734
auto negtrack = v0.template negTrack_as<T>();
717735

@@ -751,6 +769,42 @@ struct LambdaTableProducer {
751769
return true;
752770
}
753771

772+
template <typename T>
773+
bool getMcMatch(T const& vrec, T const& vgen)
774+
{
775+
float v = std::abs(1. - (vrec / vgen));
776+
777+
if (v >= cSelMcMatchValue) {
778+
return false;
779+
}
780+
781+
return true;
782+
}
783+
784+
template <typename V>
785+
bool passMcMatching(V const& v0)
786+
{
787+
auto mcpart = v0.template mcParticle_as<aod::McParticles>();
788+
789+
if (!getMcMatch(v0.pt(), mcpart.pt())) {
790+
return false;
791+
}
792+
793+
if (!getMcMatch(v0.eta(), mcpart.eta())) {
794+
return false;
795+
}
796+
797+
if (!getMcMatch(v0.yLambda(), mcpart.y())) {
798+
return false;
799+
}
800+
801+
if (!getMcMatch(v0.phi(), mcpart.phi())) {
802+
return false;
803+
}
804+
805+
return true;
806+
}
807+
754808
template <ParticleType part, typename C, typename V>
755809
float getCorrectionFactors(C const& col, V const& v0)
756810
{
@@ -793,6 +847,18 @@ struct LambdaTableProducer {
793847
return retVal;
794848
}
795849

850+
template <ParticleType part, typename V>
851+
void fillMCMatchingHistos(V const& v0)
852+
{
853+
static constexpr std::string_view SubDir[] = {"QA/Lambda/", "QA/AntiLambda/"};
854+
auto mcpart = v0.template mcParticle_as<aod::McParticles>();
855+
856+
histos.fill(HIST(SubDir[part]) + HIST("h2f_V0_ptpt"), v0.pt(), mcpart.pt());
857+
histos.fill(HIST(SubDir[part]) + HIST("h2f_V0_etaeta"), v0.eta(), mcpart.eta());
858+
histos.fill(HIST(SubDir[part]) + HIST("h2f_V0_raprap"), v0.yLambda(), mcpart.y());
859+
histos.fill(HIST(SubDir[part]) + HIST("h2f_V0_phiphi"), v0.phi(), mcpart.phi());
860+
}
861+
796862
template <ParticleType part, typename C, typename V, typename T>
797863
void fillLambdaQAHistos(C const& col, V const& v0, T const&)
798864
{
@@ -902,9 +968,21 @@ struct LambdaTableProducer {
902968
// do MC analysis
903969
if constexpr (dmc == kMC) {
904970
histos.fill(HIST("Tracks/h2f_tracks_pid_before_sel"), v0.mcParticle().pdgCode(), v0.pt());
905-
if (cSelectTrueLambda && !selTrueMcRecLambda(v0, tracks)) {
971+
if (cSelectPrimaryV0 && !selPrimaryV0(v0)) { // check for Primary V0
972+
continue;
973+
}
974+
if (cSelectTrueLambda && !selTrueMcRecLambda(v0, tracks)) { // check for true Lambda/Anti-Lambda
975+
continue;
976+
}
977+
if (cDoMcMatching && !passMcMatching(v0)) { // Do Mc Matching
906978
continue;
907979
}
980+
// Fill MC Matching Histos (MC Matching Cuts to be implemented soon...)
981+
if (v0Type == kLambda) {
982+
fillMCMatchingHistos<kLambda>(v0);
983+
} else {
984+
fillMCMatchingHistos<kAntiLambda>(v0);
985+
}
908986
histos.fill(HIST("Tracks/h1f_tracks_info"), kPassTrueLambdaSel);
909987
histos.fill(HIST("Tracks/h2f_tracks_pid_after_sel"), v0.mcParticle().pdgCode(), v0.pt());
910988
}
@@ -1000,8 +1078,16 @@ struct LambdaTableProducer {
10001078
if (cMcGenDauTrackKinCutFlag && !dauKinCutFlag) { // check daughter acceptance
10011079
continue;
10021080
}
1003-
if (cGenDecayChannel && (std::abs(daughterPDGs[0]) != kProton || std::abs(daughterPDGs[1]) != kPiPlus)) { // check decay channel
1004-
continue;
1081+
if (cGenDecayChannel) { // check decay channel
1082+
if (v0Type == kLambda) {
1083+
if (daughterPDGs[0] != kProton || daughterPDGs[1] != kPiMinus) {
1084+
continue;
1085+
}
1086+
} else if (v0Type == kAntiLambda) {
1087+
if (daughterPDGs[0] != kProtonBar || daughterPDGs[1] != kPiPlus) {
1088+
continue;
1089+
}
1090+
}
10051091
}
10061092

10071093
histos.fill(HIST("Tracks/h1f_tracks_info"), kGenLambdaToPrPi);
@@ -1058,6 +1144,10 @@ struct LambdaTableProducer {
10581144
if (!collisions.begin().has_mcCollision() || !selCollision<run>(collisions.begin()) || collisions.begin().mcCollisionId() != mcCollision.globalIndex()) {
10591145
return;
10601146
}
1147+
// Mc Matching
1148+
if (cDoMcMatching && !getMcMatch(collisions.begin().posZ(), mcCollision.posZ())) {
1149+
return;
1150+
}
10611151
histos.fill(HIST("McGen/h1f_collisions_info"), kPassSelCol);
10621152
histos.fill(HIST("McGen/h2f_collision_posZ"), mcCollision.posZ(), collisions.begin().posZ());
10631153
auto v0Tracks = V0s.sliceBy(perCollision, collisions.begin().globalIndex());
@@ -1277,6 +1367,10 @@ struct LambdaR2Correlation {
12771367
// Eta/Rap Analysis
12781368
Configurable<bool> cDoEtaAnalysis{"cDoEtaAnalysis", false, "Eta/Rap Analysis Flag"};
12791369

1370+
// Generator Level Particles
1371+
Configurable<bool> cGenParticleFlag{"cGenParticleFlag", true, "Generator Number Flag"};
1372+
Configurable<int> cGenParticles{"cGenParticles", 3, "Number of Truth Lambda to construct correlation"};
1373+
12801374
// Rotation Angle Min/Max
12811375
Configurable<float> cRotAngleMin{"cRotAngleMin", -0.12, "Rotation Angle Minimum"};
12821376
Configurable<float> cRotAngleMax{"cRotAngleMax", 0.12, "Rotation Angle Minimum"};
@@ -1367,6 +1461,10 @@ struct LambdaR2Correlation {
13671461
histos.add("Reco/h2d_n1_rapphi_LaM", "#rho_{1}^{#bar{#Lambda}}", kTH2D, {axisRap, axisPhi});
13681462

13691463
// rho2 for R2 Rap1Phi1Rap2Phi2 histograms
1464+
histos.add("Reco/h2d_n2_raprap_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisRap, axisRap});
1465+
histos.add("Reco/h2d_n2_raprap_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisRap, axisRap});
1466+
histos.add("Reco/h2d_n2_raprap_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisRap, axisRap});
1467+
13701468
histos.add("Reco/h2d_n2_rapphi_LaP_LaM", "#rho_{2}^{#Lambda#bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi});
13711469
histos.add("Reco/h2d_n2_rapphi_LaP_LaP", "#rho_{2}^{#Lambda#Lambda}", kTH2D, {axisRapPhi, axisRapPhi});
13721470
histos.add("Reco/h2d_n2_rapphi_LaM_LaM", "#rho_{2}^{#bar{#Lambda}#bar{#Lambda}}", kTH2D, {axisRapPhi, axisRapPhi});
@@ -1520,11 +1618,30 @@ struct LambdaR2Correlation {
15201618
auto lambdaMcGenTracks = partLambdaMcGenTracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cachemc);
15211619
auto antiLambdaMcGenTracks = partAntiLambdaMcGenTracks->sliceByCached(aod::lambdamcgentrack::lambdaMcGenCollisionId, mcgencol.globalIndex(), cachemc);
15221620

1523-
analyzeSingles<kLambda, kGen>(mcgencol, lambdaMcGenTracks);
1524-
analyzeSingles<kAntiLambda, kGen>(mcgencol, antiLambdaMcGenTracks);
1525-
analyzePairs<kLambdaAntiLambda, kGen, false>(lambdaMcGenTracks, antiLambdaMcGenTracks);
1526-
analyzePairs<kLambdaLambda, kGen, true>(lambdaMcGenTracks, lambdaMcGenTracks);
1527-
analyzePairs<kAntiLambdaAntiLambda, kGen, true>(antiLambdaMcGenTracks, antiLambdaMcGenTracks);
1621+
bool lambdaFlag = true, antiLambdaFlag = true;
1622+
1623+
if (cGenParticleFlag) {
1624+
if (lambdaMcGenTracks.size() > cGenParticles) {
1625+
lambdaFlag = false;
1626+
}
1627+
if (antiLambdaMcGenTracks.size() > cGenParticles) {
1628+
antiLambdaFlag = false;
1629+
}
1630+
}
1631+
1632+
if (lambdaFlag) {
1633+
analyzeSingles<kLambda, kGen>(mcgencol, lambdaMcGenTracks);
1634+
analyzePairs<kLambdaLambda, kGen, true>(lambdaMcGenTracks, lambdaMcGenTracks);
1635+
}
1636+
1637+
if (antiLambdaFlag) {
1638+
analyzeSingles<kAntiLambda, kGen>(mcgencol, antiLambdaMcGenTracks);
1639+
analyzePairs<kAntiLambdaAntiLambda, kGen, true>(antiLambdaMcGenTracks, antiLambdaMcGenTracks);
1640+
}
1641+
1642+
if (lambdaFlag && antiLambdaFlag) {
1643+
analyzePairs<kLambdaAntiLambda, kGen, false>(lambdaMcGenTracks, antiLambdaMcGenTracks);
1644+
}
15281645
}
15291646

15301647
PROCESS_SWITCH(LambdaR2Correlation, processMCGen, "Process for MC Generated", false);

0 commit comments

Comments
 (0)