From 69c306f8236cf5b528f8d80c296f66e2a125f402 Mon Sep 17 00:00:00 2001 From: smaff92 Date: Tue, 28 Apr 2026 18:33:40 +0900 Subject: [PATCH 1/3] Added functionality to calculate efficiency for non-hooked MC --- PWGJE/Tasks/statPromptPhoton.cxx | 59 +++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index b7d6fce2dff..79173a79073 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -87,6 +87,11 @@ struct statPromptPhoton { Configurable cfgJETracks{"cfgJETracks", false, "Enables running on derived JE data"}; Configurable cfgGenHistograms{"cfgGenHistograms", false, "Enables Generated histograms"}; Configurable cfgGenReqRec{"cfgGenReqRec", false, "Only consider generated events which are successfully reconstructed"}; + Configurable cfgReqRecPS_REC{"cfgReqRecPS_REC", false, "Only consider reconstructed photons within the EMCAl acceptence"}; + Configurable cfgReqRecPS_GEN{"cfgReqRecPS_GEN", false, "Only consider generated photons within the EMCAl acceptence"}; + Configurable cfgMCptNbins{"cfgMCptNbins", 200, "number of ptbins in MC QA plots"}; + Configurable cfgMCptbinLow{"cfgMCptbinLow", 5, "lower limit of ptbins in MC QA plots"}; + Configurable cfgMCptbinHigh{"cfgMCptbinHigh", 200, "upper limit of ptbins in MC QA plots"}; Configurable cfgRecHistograms{"cfgRecHistograms", false, "Enables Reconstructed histograms"}; Configurable cfgDataHistograms{"cfgDataHistograms", false, "Enables Data histograms"}; Configurable cfgTriggerMasks{"cfgTriggerMasks", "", "possible JE Trigger masks: fJetChLowPt,fJetChHighPt,fTrackLowPt,fTrackHighPt,fJetD0ChLowPt,fJetD0ChHighPt,fJetLcChLowPt,fJetLcChHighPt,fEMCALReadout,fJetFullHighPt,fJetFullLowPt,fJetNeutralHighPt,fJetNeutralLowPt,fGammaVeryHighPtEMCAL,fGammaVeryHighPtDCAL,fGammaHighPtEMCAL,fGammaHighPtDCAL,fGammaLowPtEMCAL,fGammaLowPtDCAL,fGammaVeryLowPtEMCAL,fGammaVeryLowPtDCAL"}; @@ -101,6 +106,9 @@ struct statPromptPhoton { std::vector ptBinning = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, 8.0, 12.0, 16.0, 20.0, 25.0, 30.0, 40.0, 50.0, 75.0, 100.0, 150.0, 200.0, 300.0, 500.0}; AxisSpec pthadAxis = {ptBinning, "#it{p}_{T}^{had sum} [GeV/c]"}; + const AxisSpec MCptAxis = {cfgMCptNbins, cfgMCptbinLow, cfgMCptbinHigh}; + + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasks); if (cfgJETracks) { trackFilter = jetderiveddatautilities::initialiseTrackSelection(static_cast(cfgTrackFilter)); @@ -184,48 +192,48 @@ struct statPromptPhoton { histos.add("REC_dR_Stern", "REC_dR_Stern", kTH1F, {{628, 0.0, 2 * TMath::Pi()}}); histos.add("REC_prompt_phiQA", "REC_prompt_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_prompt_etaQA", "REC_prompt_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_prompt_ptQA", "REC_prompt_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_prompt_ptQA", "REC_prompt_ptQA", kTH1F, {MCptAxis}); histos.add("REC_decay_phiQA", "REC_decay_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_decay_etaQA", "REC_decay_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_decay_ptQA", "REC_decay_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_decay_ptQA", "REC_decay_ptQA", kTH1F, {MCptAxis}); histos.add("REC_frag_phiQA", "REC_frag_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_frag_etaQA", "REC_frag_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_frag_ptQA", "REC_frag_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_frag_ptQA", "REC_frag_ptQA", kTH1F, {MCptAxis}); histos.add("REC_direct_phiQA", "REC_direct_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_direct_etaQA", "REC_direct_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_direct_ptQA", "REC_direct_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_direct_ptQA", "REC_direct_ptQA", kTH1F, {MCptAxis}); histos.add("REC_cluster_phiQA", "REC_cluster_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_cluster_etaQA", "REC_cluster_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_cluster_energyQA", "REC_cluster_energyQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_cluster_energyQA", "REC_cluster_energyQA", kTH1F, {MCptAxis}); histos.add("REC_clusteriso_phiQA", "REC_clusteriso_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_clusteriso_etaQA", "REC_clusteriso_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_clusteriso_energyQA", "REC_clusteriso_energyQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_clusteriso_energyQA", "REC_clusteriso_energyQA", kTH1F, {MCptAxis}); histos.add("REC_track_phiQA", "REC_track_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_track_etaQA", "REC_track_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_track_ptQA", "REC_track_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_track_ptQA", "REC_track_ptQA", kTH1F, {MCptAxis}); histos.add("REC_cluster_direct_phiQA", "REC_cluster_direct_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_cluster_direct_etaQA", "REC_cluster_direct_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_cluster_direct_energyQA", "REC_cluster_direct_energyQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_cluster_direct_energyQA", "REC_cluster_direct_energyQA", kTH1F, {MCptAxis}); histos.add("REC_cluster_frag_phiQA", "REC_cluster_frag_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_cluster_frag_etaQA", "REC_cluster_frag_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_cluster_frag_energyQA", "REC_cluster_frag_energyQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_cluster_frag_energyQA", "REC_cluster_frag_energyQA", kTH1F, {MCptAxis}); histos.add("REC_cluster_both_phiQA", "REC_cluster_both_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("REC_cluster_both_etaQA", "REC_cluster_both_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("REC_cluster_both_energyQA", "REC_cluster_both_energyQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("REC_cluster_both_energyQA", "REC_cluster_both_energyQA", kTH1F, {MCptAxis}); } if (cfgGenHistograms) { histos.add("GEN_prompt_phiQA", "GEN_prompt_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("GEN_prompt_etaQA", "GEN_prompt_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("GEN_prompt_ptQA", "GEN_prompt_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("GEN_prompt_ptQA", "GEN_prompt_ptQA", kTH1F, {MCptAxis}); histos.add("GEN_decay_phiQA", "GEN_decay_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("GEN_decay_etaQA", "GEN_decay_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("GEN_decay_ptQA", "GEN_decay_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("GEN_decay_ptQA", "GEN_decay_ptQA", kTH1F, {MCptAxis}); histos.add("GEN_frag_phiQA", "GEN_frag_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("GEN_frag_etaQA", "GEN_frag_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("GEN_frag_ptQA", "GEN_frag_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("GEN_frag_ptQA", "GEN_frag_ptQA", kTH1F, {MCptAxis}); histos.add("GEN_direct_phiQA", "GEN_direct_phiQA", kTH1F, {{640 * 2, 0, 2 * TMath::Pi()}}); histos.add("GEN_direct_etaQA", "GEN_direct_etaQA", kTH1F, {{100, -1, 1}}); - histos.add("GEN_direct_ptQA", "GEN_direct_ptQA", kTH1F, {{82, -1.0, 40.0}}); + histos.add("GEN_direct_ptQA", "GEN_direct_ptQA", kTH1F, {MCptAxis}); histos.add("GEN_nEvents", "GEN_nEvents", kTH1F, {{4, 0.0, 4.0}}); histos.add("GEN_nEvents_simple", "GEN_nEvents", kTH1F, {{4, 0.0, 4.0}}); histos.add("GEN_True_Trigger_Energy", "GEN_True_Trigger_Energy", kTH1F, {{82, -1.0, 40.0}}); @@ -1513,6 +1521,16 @@ struct statPromptPhoton { continue; if (std::fabs(mcParticle.getGenStatusCode()) >= 81 || !mcParticle.isPhysicalPrimary()) continue; + if(cfgReqRecPS_GEN){ + if(std::fabs(mcParticle.eta())>0.62) + continue; + bool insideCalPhi = false; + if((mcParticle.phi()> 1.42 && mcParticle.phi()<3.26) || (mcParticle.phi()> 4.56 && mcParticle.phi()<5.70)) + insideCalPhi=true; + if(!insideCalPhi) + continue; + } + // Chase this final-state photon upward int chaseindex = -1; @@ -1628,8 +1646,17 @@ struct statPromptPhoton { if (clusterparticle.getGenStatusCode() < 0) continue; if (std::fabs(clusterparticle.getGenStatusCode()) >= 81) - continue; - + continue; + if(cfgReqRecPS_REC){ + if(std::fabs(clusterparticle.eta())>0.62) + continue; + bool insideCalPhi = false; + if((clusterparticle.phi()> 1.42 && clusterparticle.phi()<3.26) || (clusterparticle.phi()> 4.56 && clusterparticle.phi()<5.70)) + insideCalPhi=true; + if(!insideCalPhi) + continue; + } + int chaseindex = -1; for (auto& mom : clusterparticle.mothers_as()) { chaseindex = mom.globalIndex(); From 43d5edc4409bbe6688d09ea91ce502ce3d5d130a Mon Sep 17 00:00:00 2001 From: smaff92 Date: Tue, 28 Apr 2026 22:56:15 +0900 Subject: [PATCH 2/3] Bugfixes for prior commit --- PWGJE/Tasks/statPromptPhoton.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 79173a79073..23cd388f547 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -89,7 +89,12 @@ struct statPromptPhoton { Configurable cfgGenReqRec{"cfgGenReqRec", false, "Only consider generated events which are successfully reconstructed"}; Configurable cfgReqRecPS_REC{"cfgReqRecPS_REC", false, "Only consider reconstructed photons within the EMCAl acceptence"}; Configurable cfgReqRecPS_GEN{"cfgReqRecPS_GEN", false, "Only consider generated photons within the EMCAl acceptence"}; - Configurable cfgMCptNbins{"cfgMCptNbins", 200, "number of ptbins in MC QA plots"}; + Configurable cfgEMClowPSphi{"cfgEMClowPSphi", 1.42, "lower limit of the EMC acceptance if Rec PS is required"}; + Configurable cfgEMChighPSphi{"cfgEMChighPSphi", 3.26, "higher limit of the EMC acceptance if Rec PS is required"}; + Configurable cfgEMChighPSeta{"cfgEMChighPSeta", 0.62, "symmetric eta cut if Rec PS is required"}; + Configurable cfgDClowPSphi{"cfgDClowPSphi", 4.56, "lower limit of the DCal acceptance if Rec PS is required"}; + Configurable cfgDChighPSphi{"cfgDChighPSphi", 5.70, "higher limit of the DCal acceptance if Rec PS is required"}; + Configurable cfgMCptNbins{"cfgMCptNbins", 200, "number of ptbins in MC QA plots"}; Configurable cfgMCptbinLow{"cfgMCptbinLow", 5, "lower limit of ptbins in MC QA plots"}; Configurable cfgMCptbinHigh{"cfgMCptbinHigh", 200, "upper limit of ptbins in MC QA plots"}; Configurable cfgRecHistograms{"cfgRecHistograms", false, "Enables Reconstructed histograms"}; @@ -1522,10 +1527,10 @@ struct statPromptPhoton { if (std::fabs(mcParticle.getGenStatusCode()) >= 81 || !mcParticle.isPhysicalPrimary()) continue; if(cfgReqRecPS_GEN){ - if(std::fabs(mcParticle.eta())>0.62) + if(std::fabs(mcParticle.eta())>cfgEMChighPSeta) continue; bool insideCalPhi = false; - if((mcParticle.phi()> 1.42 && mcParticle.phi()<3.26) || (mcParticle.phi()> 4.56 && mcParticle.phi()<5.70)) + if((mcParticle.phi()> cfgEMClowPSphi && mcParticle.phi() cfgDClowPSphi && mcParticle.phi()= 81) continue; if(cfgReqRecPS_REC){ - if(std::fabs(clusterparticle.eta())>0.62) + if(std::fabs(clusterparticle.eta())>cfgEMChighPSeta) continue; bool insideCalPhi = false; - if((clusterparticle.phi()> 1.42 && clusterparticle.phi()<3.26) || (clusterparticle.phi()> 4.56 && clusterparticle.phi()<5.70)) + if((clusterparticle.phi()> cfgEMClowPSphi && clusterparticle.phi() cfgDClowPSphi && clusterparticle.phi() Date: Tue, 28 Apr 2026 13:58:29 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- PWGJE/Tasks/statPromptPhoton.cxx | 44 +++++++++++++++----------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 23cd388f547..f28a5f107b9 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -93,7 +93,7 @@ struct statPromptPhoton { Configurable cfgEMChighPSphi{"cfgEMChighPSphi", 3.26, "higher limit of the EMC acceptance if Rec PS is required"}; Configurable cfgEMChighPSeta{"cfgEMChighPSeta", 0.62, "symmetric eta cut if Rec PS is required"}; Configurable cfgDClowPSphi{"cfgDClowPSphi", 4.56, "lower limit of the DCal acceptance if Rec PS is required"}; - Configurable cfgDChighPSphi{"cfgDChighPSphi", 5.70, "higher limit of the DCal acceptance if Rec PS is required"}; + Configurable cfgDChighPSphi{"cfgDChighPSphi", 5.70, "higher limit of the DCal acceptance if Rec PS is required"}; Configurable cfgMCptNbins{"cfgMCptNbins", 200, "number of ptbins in MC QA plots"}; Configurable cfgMCptbinLow{"cfgMCptbinLow", 5, "lower limit of ptbins in MC QA plots"}; Configurable cfgMCptbinHigh{"cfgMCptbinHigh", 200, "upper limit of ptbins in MC QA plots"}; @@ -113,7 +113,6 @@ struct statPromptPhoton { const AxisSpec MCptAxis = {cfgMCptNbins, cfgMCptbinLow, cfgMCptbinHigh}; - triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasks); if (cfgJETracks) { trackFilter = jetderiveddatautilities::initialiseTrackSelection(static_cast(cfgTrackFilter)); @@ -1526,16 +1525,15 @@ struct statPromptPhoton { continue; if (std::fabs(mcParticle.getGenStatusCode()) >= 81 || !mcParticle.isPhysicalPrimary()) continue; - if(cfgReqRecPS_GEN){ - if(std::fabs(mcParticle.eta())>cfgEMChighPSeta) - continue; - bool insideCalPhi = false; - if((mcParticle.phi()> cfgEMClowPSphi && mcParticle.phi() cfgDClowPSphi && mcParticle.phi() cfgEMChighPSeta) + continue; + bool insideCalPhi = false; + if ((mcParticle.phi() > cfgEMClowPSphi && mcParticle.phi() < cfgEMChighPSphi) || (mcParticle.phi() > cfgDClowPSphi && mcParticle.phi() < cfgDChighPSphi)) + insideCalPhi = true; + if (!insideCalPhi) + continue; + } // Chase this final-state photon upward int chaseindex = -1; @@ -1651,17 +1649,17 @@ struct statPromptPhoton { if (clusterparticle.getGenStatusCode() < 0) continue; if (std::fabs(clusterparticle.getGenStatusCode()) >= 81) - continue; - if(cfgReqRecPS_REC){ - if(std::fabs(clusterparticle.eta())>cfgEMChighPSeta) - continue; - bool insideCalPhi = false; - if((clusterparticle.phi()> cfgEMClowPSphi && clusterparticle.phi() cfgDClowPSphi && clusterparticle.phi() cfgEMChighPSeta) + continue; + bool insideCalPhi = false; + if ((clusterparticle.phi() > cfgEMClowPSphi && clusterparticle.phi() < cfgEMChighPSphi) || (clusterparticle.phi() > cfgDClowPSphi && clusterparticle.phi() < cfgDChighPSphi)) + insideCalPhi = true; + if (!insideCalPhi) + continue; + } + int chaseindex = -1; for (auto& mom : clusterparticle.mothers_as()) { chaseindex = mom.globalIndex();