From acf7757a7ff2f0cbd572c027d6bac68a60f4b3b2 Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Tue, 17 Jun 2025 13:59:47 +0900 Subject: [PATCH 1/7] [PWGJE]: Adding MC weights for JEJE injections, and adding mask for software triggers --- PWGJE/Tasks/statPromptPhoton.cxx | 169 +++++++++++++++---------------- 1 file changed, 82 insertions(+), 87 deletions(-) diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 80ebe23550d..63c2061106b 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -13,40 +13,58 @@ /// \brief Reconstruction of Phi yield through track-track Minv correlations for resonance hadrochemistry analysis. /// /// -/// \author Adrian Fereydon Nassirpour +/// \author Adrian Fereydon Nassirpour -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/EMCALClusters.h" -#include "PWGJE/DataModel/JetReducedData.h" +#include -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" +#include +#include +#include +#include + +#include +#include #include "Framework/ASoA.h" #include "Framework/AnalysisDataModel.h" #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" -#include -#include -#include -#include -#include +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" -#include -#include -#include +#include "Common/Core/RecoDecay.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "CommonConstants/PhysicsConstants.h" -#include -#include -#include -#include -#include +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "EMCALBase/Geometry.h" +#include "EMCALCalib/BadChannelMap.h" + +#include "DataFormatsEMCAL/Cell.h" +#include "DataFormatsEMCAL/Constants.h" +#include "DataFormatsEMCAL/AnalysisCluster.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DataFormatsParameters/GRPMagField.h" + +#include "DetectorsBase/Propagator.h" + +#include "CommonDataFormat/InteractionRecord.h" using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; struct statPromptPhoton { + SliceCache cache; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; Configurable cfgMaxDCArToPVcut{"cfgMaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; @@ -85,8 +103,12 @@ struct statPromptPhoton { Configurable cfgGenHistograms{"cfgGenHistograms", false, "Enables Generated histograms"}; Configurable cfgRecHistograms{"cfgRecHistograms", false, "Enables Reconstructed histograms"}; Configurable cfgDataHistograms{"cfgDataHistograms", false, "Enables Data histograms"}; + Configurable cfgSkimmedTrigger{"cfgSkimmedTrigger", false, "Enables trigger for skimmied datasets (2023 onwards)"}; + 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"}; Configurable cfgDebug{"cfgDebug", false, "Enables debug information for local running"}; + int trackFilter = -1; + std::vector triggerMaskBits; // INIT void init(InitContext const&) @@ -94,6 +116,7 @@ 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]"}; + triggerMaskBits = jetderiveddatautilities::initialiseTriggerMaskBits(cfgTriggerMasks); if (cfgJETracks) { trackFilter = jetderiveddatautilities::initialiseTrackSelection(static_cast(cfgTrackFilter)); } @@ -235,8 +258,11 @@ struct statPromptPhoton { using jMCClusters = o2::soa::Join; using jClusters = o2::soa::Join; - using jselectedCollisions = soa::Join; + using jselectedCollisions = soa::Join; + using jselectedDataCollisions = soa::Join; + // using jselectedDataCollisions = soa::Join; using jfilteredCollisions = soa::Filtered; + using jfilteredDataCollisions = soa::Filtered; using jfilteredMCClusters = soa::Filtered; using jfilteredClusters = soa::Filtered; @@ -588,7 +614,7 @@ struct statPromptPhoton { PresliceUnsorted EMCTrackPerTrack = aod::jemctrack::trackId; int nEventsRecMC_JE = 0; - void processMCRec_JE(jfilteredCollisions::iterator const& collision, jfilteredMCClusters const& mcclusters, jTrackCandidates const& tracks, soa::Join const&, TrackCandidates const&, aod::JMcParticles const&, BcCandidates const&, jEMCtracks const& emctracks) + void processMCRec_JE(jfilteredCollisions::iterator const& collision, jfilteredMCClusters const& mcclusters, jTrackCandidates const& tracks, soa::Join const&, TrackCandidates const&, aod::JMcParticles const&, BcCandidates const&, jEMCtracks const& emctracks, aod::JetMcCollisions const&) { nEventsRecMC_JE++; @@ -613,6 +639,20 @@ struct statPromptPhoton { } histos.fill(HIST("REC_nEvents"), 2.5); + + if(cfgSkimmedTrigger){ + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } + }//JE Software Triggers + + histos.fill(HIST("REC_nEvents"), 3.5); + + double weight = 1; + if (collision.has_mcCollision()) { + weight = collision.mcCollision().weight(); + } + bool noTrk = true; for (auto& track : tracks) { if (cfgJETracks) { @@ -828,9 +868,9 @@ struct statPromptPhoton { histos.fill(HIST("REC_Cluster_QA"), 4.5); clustertrigger = true; double pthadsum = GetPtHadSum(tracks, mccluster, cfgMinR, cfgMaxR, false, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Photon"), mccluster.energy(), pthadsum); - histos.fill(HIST("REC_PtHadSum_Photon"), pthadsum); - histos.fill(HIST("REC_Trigger_Energy"), mccluster.energy()); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Photon"), mccluster.energy(), pthadsum, weight); + histos.fill(HIST("REC_PtHadSum_Photon"), pthadsum, weight); + histos.fill(HIST("REC_Trigger_Energy"), mccluster.energy(), weight); } auto ClusterParticles = mccluster.mcParticles_as(); @@ -839,11 +879,6 @@ struct statPromptPhoton { bool goodgentrigger = true; double chPe = 0; for (auto& clusterparticle : ClusterParticles) { - // double etaP = clusterparticle.eta(); - // double etaC = mccluster.eta(); - // double phiP = clusterparticle.phi(); - // double phiC = mccluster.phi(); - // double ptP = clusterparticle.pt(); int cindex = clusterparticle.globalIndex(); double pdgcode = fabs(clusterparticle.pdgCode()); if (!clusterparticle.isPhysicalPrimary()) { @@ -884,8 +919,6 @@ struct statPromptPhoton { histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Phi"), clusterparticle.phi()); histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Eta"), clusterparticle.eta()); histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_Phi"), clusterparticle.pt(), clusterparticle.phi()); - // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) || - // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) { histos.fill(HIST("REC_Cluster_ParticleWITHtrack_Pt_PhiPrime"), ptP, phiPrimeP); if (photontrigger) { histos.fill(HIST("REC_Impurity_ParticleWITHtrack_Pt_PhiPrime"), ptP, phiPrimeP); @@ -904,8 +937,6 @@ struct statPromptPhoton { histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Phi"), clusterparticle.phi()); histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Eta"), clusterparticle.eta()); histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_Phi"), clusterparticle.pt(), clusterparticle.phi()); - // if (phiPrimeP > (0.12/ptP + TMath::Pi()/18. + 0.035) || - // phiPrimeP < (0.1/ptP/ptP + TMath::Pi()/18. - 0.025) ) { histos.fill(HIST("REC_Cluster_ParticleWITHOUTtrack_Pt_PhiPrime"), ptP, phiPrimeP); if (photontrigger) { histos.fill(HIST("REC_Impurity_ParticleWITHOUTtrack_Pt_PhiPrime"), ptP, phiPrimeP); @@ -964,12 +995,12 @@ struct statPromptPhoton { std::cout << "Photon mom 2: " << mom2 << std::endl; } if (std::abs(clusterparticle.getGenStatusCode()) > 19 && std::abs(clusterparticle.getGenStatusCode()) < 90) { - histos.fill(HIST("REC_True_Prompt_Trigger_Energy"), clusterparticle.e()); + histos.fill(HIST("REC_True_Prompt_Trigger_Energy"), clusterparticle.e(), weight); TLorentzVector lRealPhoton; lRealPhoton.SetPxPyPzE(clusterparticle.px(), clusterparticle.py(), clusterparticle.pz(), clusterparticle.e()); double truepthadsum = GetPtHadSum(tracks, lRealPhoton, cfgMinR, cfgMaxR, false, false, false); truephotonPt = clusterparticle.e(); - histos.fill(HIST("REC_TrueTrigger_V_PtHadSum_Photon"), truephotonPt, truepthadsum); + histos.fill(HIST("REC_TrueTrigger_V_PtHadSum_Photon"), truephotonPt, truepthadsum, weight); } } // photon check } // clusterparticle loop @@ -1000,39 +1031,6 @@ struct statPromptPhoton { } } // cluster loop - // auto bc = collision.bc_as(); - // int rnr = bc.runNumber(); - - // std::string rnrstring = std::to_string(rnr); - // if (runs.find(rnrstring) == std::string::npos) { - // std::cout<<"++++++++++++++++++++++++++++++++"<getForTimeStamp(ccdbpath, bc.timestamp()); - // if(grpmag) { - // bfield = std::lround(5.f * grpmag->getL3Current() / 30000.f); - // std::cout<<"++++++++++++++++++++++++++++++++"<getForTimeStamp(ccdbpath, bc.timestamp()); - // if(!grpo) { - // std::cout<<"WE CAN NEITHER FETCH GRPMAG OR GRPO!!! SHIT IS SCREWED"<getNominalL3Field(); - // } - // bfield = 5; - // runs += rnrstring; - // std::cout << "++++++++++++++++++++++++++++++++" << std::endl; - // std::cout << "Run is now appended to string: " << runs << std::endl; - // std::cout << "++++++++++++++++++++++++++++++++" << std::endl; - - // } // check mag field for current run number: done! - // clusters done, now we do the sternheimer tracks for (auto& track : tracks) { bool sterntrigger = false; @@ -1057,19 +1055,9 @@ struct statPromptPhoton { phiPrime = 2 * TMath::Pi() - phiPrime; } - // if (bfield < 0) { - // phiPrime = 2 * TMath::Pi() - phiPrime; - // } - phiPrime = phiPrime + TMath::Pi() / 18.; phiPrime = fmod(phiPrime, 2 * TMath::Pi() / 18.); - // double pt = track.pt(); - // if (phiPrime > (0.12/pt + TMath::Pi()/18. + 0.035) || - // phiPrime < (0.1/pt/pt + TMath::Pi()/18. - 0.025) ) { histos.fill(HIST("REC_Track_PhiPrime_Pt"), phiPrime, track.pt()); - // }//geo cut - // Done with geometric cuts - histos.fill(HIST("REC_Track_Pt"), track.pt()); histos.fill(HIST("REC_Track_Phi"), track.phi()); if (clustertrigger) { @@ -1083,12 +1071,12 @@ struct statPromptPhoton { } } double pthadsum = GetPtHadSum(tracks, track, cfgMinR, cfgMaxR, true, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Nch"), sternPt, pthadsum); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Nch"), sternPt, pthadsum,weight); if (sterntrigger) { bool doStern = true; double sterncount = 1.0; while (doStern) { - histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, 2.0 / sternPt); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, (2.0 / sternPt)*weight); if (sterncount < sternPt) { sterncount++; } else { @@ -1103,9 +1091,8 @@ struct statPromptPhoton { PROCESS_SWITCH(statPromptPhoton, processMCRec_JE, "processJE MC data", false); int nEventsData = 0; - void processData(jfilteredCollisions::iterator const& collision, jfilteredClusters const& clusters, jDataTrackCandidates const& tracks, soa::Join const&, TrackCandidates const&, BcCandidates const&, jEMCtracks const& emctracks) + void processData(jfilteredDataCollisions::iterator const& collision, jfilteredClusters const& clusters, jDataTrackCandidates const& tracks, soa::Join const&, TrackCandidates const&, BcCandidates const&, jEMCtracks const& emctracks) { - nEventsData++; if (cfgDebug) { if (nEventsData == 1) { @@ -1113,8 +1100,12 @@ struct statPromptPhoton { } if ((nEventsData + 1) % 10000 == 0) { std::cout << "Processed Data Events: " << nEventsData << std::endl; + std::cout << "Events Trigger Bit: " << collision.triggerSel() << std::endl; + std::cout << "Trigger Mask Bit: " << triggerMaskBits[0] << std::endl; + std::cout << "Trigger Mask Cfg Line: " << cfgTriggerMasks << std::endl; } } + histos.fill(HIST("DATA_nEvents"), 0.5); // required cuts @@ -1124,13 +1115,21 @@ struct statPromptPhoton { return; histos.fill(HIST("DATA_nEvents"), 1.5); - if (cfgEmcTrigger) { if (!collision.isEmcalReadout()) return; } + histos.fill(HIST("DATA_nEvents"), 2.5); + if(cfgSkimmedTrigger){ + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } + }//JE Software Triggers + + histos.fill(HIST("DATA_nEvents"), 3.5); + bool noTrk = true; for (auto& track : tracks) { @@ -1331,10 +1330,6 @@ struct statPromptPhoton { phiPrime = 2 * TMath::Pi() - phiPrime; } - // if (bfield < 0) { - // phiPrime = 2 * TMath::Pi() - phiPrime; - // } - phiPrime = phiPrime + TMath::Pi() / 18.; phiPrime = fmod(phiPrime, 2 * TMath::Pi() / 18.); double pt = track.pt(); From 3bcf550a3cac69d935c145d3114dab17b3d1d028 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 17 Jun 2025 10:04:39 +0000 Subject: [PATCH 2/7] Please consider the following formatting changes --- PWGJE/Tasks/statPromptPhoton.cxx | 95 +++++++++++++++----------------- 1 file changed, 45 insertions(+), 50 deletions(-) diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 63c2061106b..75fdb2ca5bf 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -15,49 +15,45 @@ /// /// \author Adrian Fereydon Nassirpour -#include - -#include -#include -#include -#include - -#include -#include - -#include "Framework/ASoA.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/AnalysisTask.h" -#include "Framework/HistogramRegistry.h" -#include "Framework/runDataProcessing.h" -#include "ReconstructionDataFormats/Track.h" +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "PWGJE/DataModel/Jet.h" #include "Common/Core/RecoDecay.h" #include "Common/Core/TrackSelection.h" #include "Common/Core/TrackSelectionDefaults.h" #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" #include "Common/DataModel/Multiplicity.h" #include "Common/DataModel/PIDResponse.h" -#include "CommonConstants/PhysicsConstants.h" - -#include "PWGJE/Core/FastJetUtilities.h" -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/EMCALClusters.h" -#include "EMCALBase/Geometry.h" -#include "EMCALCalib/BadChannelMap.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "CommonConstants/PhysicsConstants.h" +#include "CommonDataFormat/InteractionRecord.h" +#include "DataFormatsEMCAL/AnalysisCluster.h" #include "DataFormatsEMCAL/Cell.h" #include "DataFormatsEMCAL/Constants.h" -#include "DataFormatsEMCAL/AnalysisCluster.h" -#include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" - +#include "DataFormatsParameters/GRPObject.h" #include "DetectorsBase/Propagator.h" +#include "EMCALBase/Geometry.h" +#include "EMCALCalib/BadChannelMap.h" +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" +#include -#include "CommonDataFormat/InteractionRecord.h" +#include +#include + +#include +#include +#include +#include using namespace o2; using namespace o2::framework; @@ -106,7 +102,7 @@ struct statPromptPhoton { Configurable cfgSkimmedTrigger{"cfgSkimmedTrigger", false, "Enables trigger for skimmied datasets (2023 onwards)"}; 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"}; Configurable cfgDebug{"cfgDebug", false, "Enables debug information for local running"}; - + int trackFilter = -1; std::vector triggerMaskBits; @@ -259,10 +255,10 @@ struct statPromptPhoton { using jMCClusters = o2::soa::Join; using jClusters = o2::soa::Join; using jselectedCollisions = soa::Join; - using jselectedDataCollisions = soa::Join; - // using jselectedDataCollisions = soa::Join; + using jselectedDataCollisions = soa::Join; + // using jselectedDataCollisions = soa::Join; using jfilteredCollisions = soa::Filtered; - using jfilteredDataCollisions = soa::Filtered; + using jfilteredDataCollisions = soa::Filtered; using jfilteredMCClusters = soa::Filtered; using jfilteredClusters = soa::Filtered; @@ -639,20 +635,19 @@ struct statPromptPhoton { } histos.fill(HIST("REC_nEvents"), 2.5); - - if(cfgSkimmedTrigger){ + if (cfgSkimmedTrigger) { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { - return; + return; } - }//JE Software Triggers - + } // JE Software Triggers + histos.fill(HIST("REC_nEvents"), 3.5); - + double weight = 1; if (collision.has_mcCollision()) { weight = collision.mcCollision().weight(); } - + bool noTrk = true; for (auto& track : tracks) { if (cfgJETracks) { @@ -1071,12 +1066,12 @@ struct statPromptPhoton { } } double pthadsum = GetPtHadSum(tracks, track, cfgMinR, cfgMaxR, true, false, true); - histos.fill(HIST("REC_Trigger_V_PtHadSum_Nch"), sternPt, pthadsum,weight); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Nch"), sternPt, pthadsum, weight); if (sterntrigger) { bool doStern = true; double sterncount = 1.0; while (doStern) { - histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, (2.0 / sternPt)*weight); + histos.fill(HIST("REC_Trigger_V_PtHadSum_Stern"), sterncount, pthadsum, (2.0 / sternPt) * weight); if (sterncount < sternPt) { sterncount++; } else { @@ -1100,9 +1095,9 @@ struct statPromptPhoton { } if ((nEventsData + 1) % 10000 == 0) { std::cout << "Processed Data Events: " << nEventsData << std::endl; - std::cout << "Events Trigger Bit: " << collision.triggerSel() << std::endl; - std::cout << "Trigger Mask Bit: " << triggerMaskBits[0] << std::endl; - std::cout << "Trigger Mask Cfg Line: " << cfgTriggerMasks << std::endl; + std::cout << "Events Trigger Bit: " << collision.triggerSel() << std::endl; + std::cout << "Trigger Mask Bit: " << triggerMaskBits[0] << std::endl; + std::cout << "Trigger Mask Cfg Line: " << cfgTriggerMasks << std::endl; } } @@ -1122,14 +1117,14 @@ struct statPromptPhoton { histos.fill(HIST("DATA_nEvents"), 2.5); - if(cfgSkimmedTrigger){ + if (cfgSkimmedTrigger) { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { - return; + return; } - }//JE Software Triggers - + } // JE Software Triggers + histos.fill(HIST("DATA_nEvents"), 3.5); - + bool noTrk = true; for (auto& track : tracks) { From 864e616ff12a20af7ac1da1d30390aa10cc13e82 Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Wed, 18 Jun 2025 11:22:11 +0900 Subject: [PATCH 3/7] [PWGJE] : Removed the config for skimmed trigger --- PWGJE/Tasks/statPromptPhoton.cxx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/PWGJE/Tasks/statPromptPhoton.cxx b/PWGJE/Tasks/statPromptPhoton.cxx index 75fdb2ca5bf..977b94741c5 100644 --- a/PWGJE/Tasks/statPromptPhoton.cxx +++ b/PWGJE/Tasks/statPromptPhoton.cxx @@ -99,7 +99,6 @@ struct statPromptPhoton { Configurable cfgGenHistograms{"cfgGenHistograms", false, "Enables Generated histograms"}; Configurable cfgRecHistograms{"cfgRecHistograms", false, "Enables Reconstructed histograms"}; Configurable cfgDataHistograms{"cfgDataHistograms", false, "Enables Data histograms"}; - Configurable cfgSkimmedTrigger{"cfgSkimmedTrigger", false, "Enables trigger for skimmied datasets (2023 onwards)"}; 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"}; Configurable cfgDebug{"cfgDebug", false, "Enables debug information for local running"}; @@ -635,11 +634,9 @@ struct statPromptPhoton { } histos.fill(HIST("REC_nEvents"), 2.5); - if (cfgSkimmedTrigger) { - if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { - return; - } - } // JE Software Triggers + if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { + return; + } histos.fill(HIST("REC_nEvents"), 3.5); @@ -1117,11 +1114,9 @@ struct statPromptPhoton { histos.fill(HIST("DATA_nEvents"), 2.5); - if (cfgSkimmedTrigger) { if (!jetderiveddatautilities::selectTrigger(collision, triggerMaskBits)) { return; } - } // JE Software Triggers histos.fill(HIST("DATA_nEvents"), 3.5); From 2fc8f69f5f6313f3e585d4245ce4f1e582aa9028 Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Thu, 26 Jun 2025 18:39:41 +0900 Subject: [PATCH 4/7] Add phiOO task and update CMakeLists --- PWGLF/Tasks/Resonances/CMakeLists.txt | 6 + PWGLF/Tasks/Resonances/phiOO.cxx | 454 ++++++++++++++++++++++++++ 2 files changed, 460 insertions(+) create mode 100644 PWGLF/Tasks/Resonances/phiOO.cxx diff --git a/PWGLF/Tasks/Resonances/CMakeLists.txt b/PWGLF/Tasks/Resonances/CMakeLists.txt index 4ba33fce401..9e75f83a259 100644 --- a/PWGLF/Tasks/Resonances/CMakeLists.txt +++ b/PWGLF/Tasks/Resonances/CMakeLists.txt @@ -213,3 +213,9 @@ o2physics_add_dpl_workflow(double-resonance-scan SOURCES doubleResonanceScan.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore COMPONENT_NAME Analysis) + + o2physics_add_dpl_workflow(phioo + SOURCES phiOO.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + diff --git a/PWGLF/Tasks/Resonances/phiOO.cxx b/PWGLF/Tasks/Resonances/phiOO.cxx new file mode 100644 index 00000000000..e82c82bae41 --- /dev/null +++ b/PWGLF/Tasks/Resonances/phiOO.cxx @@ -0,0 +1,454 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file phiInJets.cxx +/// \brief Reconstruction of Phi yield through track-track Minv correlations for resonance OO analysis +/// +/// +/// \author Adrian Fereydon Nassirpour +#include +#include +#include +#include +#include +#include "TRandom.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct phiOO{ + + SliceCache cache; + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + + //Event configurables + Configurable cfg_Event_Sel{"cfg_Event_Sel", "sel8", "choose event selection"}; + Configurable cfg_Event_VtxCut{"cfg_Event_VtxCut", 10.0, "V_z cut selection"}; + Configurable cfg_Event_Timeframe{"cfg_Event_Timeframe", true, "Timeframe border cut"}; + Configurable cfg_Event_Timerange{"cfg_Event_Timerange", true, "Timerange border cut"}; + Configurable cfg_Event_Centrality{"cfg_Event_Centrality", true, "Centrality cut"}; + Configurable cfg_Event_CentralityMax{"cfg_Event_CentralityMax", 100, "CentralityMax cut"}; + Configurable cfg_Event_Pileup{"cfg_Event_Pileup", true, "Pileup border cut"}; + Configurable cfg_Event_OccupancyCut{"cfg_Event_OccupancyCut", true, "Occupancy border cut"}; + Configurable cfg_Event_MaxOccupancy{"cfg_Event_MaxOccupancy", 1, "Max TPC Occupancy"}; + + ConfigurableAxis cfg_bins_Cent{"cfg_bins_Cent", {VARIABLE_WIDTH, 0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0}, "Binning of the centrality axis"}; + ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; + ConfigurableAxis cfg_bins_MixMult{"cfg_bins_MixMult", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; + + //Track configurables + Configurable cfg_Track_Sel{"cfg_Track_Sel", "globalTracks", "set track selections"}; + Configurable cfg_Track_MinPt{"cfg_Track_MinPt", 0.15, "set track min pT"}; + Configurable cfg_Track_MaxEta{"cfg_Track_MaxEta", 0.9, "set track max Eta"}; + Configurable cfg_Track_MaxDCArToPVcut{"cfg_Track_MaxDCArToPVcut", 0.5, "Track DCAr cut to PV Maximum"}; + Configurable cfg_Track_MaxDCAzToPVcut{"cfg_Track_MaxDCAzToPVcut", 2.0, "Track DCAz cut to PV Maximum"}; + Configurable cfg_Track_PrimaryTrack{"cfg_Track_PrimaryTrack", true, "Primary track selection"}; // kGoldenChi2 | kDCAxy | kDCAz + Configurable cfg_Track_ConnectedToPV{"cfg_Track_ConnectedToPV", true, "PV contributor track selection"}; // PV Contributor + Configurable cfg_Track_GlobalWoDCATrack{"cfg_Track_GlobalWoDCATrack", true, "Global track selection without DCA"}; // kQualityTracks (kTrackType | kTPCNCls | kTPCCrossedRows | kTPCCrossedRowsOverNCls | kTPCChi2NDF | kTPCRefit | kITSNCls | kITSChi2NDF | kITSRefit | kITSHits) | kInAcceptanceTracks (kPtRange | kEtaRange) + Configurable cfg_Track_nFindableTPCClusters{"cfg_Track_FindableTPCClusters", 50, "nFindable TPC Clusters"}; + Configurable cfg_Track_nTPCCrossedRows{"cfg_Track_TPCCrossedRows", 70, "nCrossed TPC Rows"}; + Configurable cfg_Track_nRowsOverFindable{"cfg_Track_RowsOverFindable", 1.2, "nRowsOverFindable TPC CLusters"}; + Configurable cfg_Track_nTPCChi2{"cfg_Track_TPCChi2", 4.0, "nTPC Chi2 per Cluster"}; + Configurable cfg_Track_nITSChi2{"cfg_Track_ITSChi2", 36.0, "nITS Chi2 per Cluster"}; + Configurable cfg_Track_TPCPID{"cfg_Track_TPCPID", true, "Enables TPC PID"}; + Configurable cfg_Track_TOFPID{"cfg_Track_TOFPID", true, "Enables TOF PID"}; + Configurable cfg_Track_Hard_TOFPID{"cfg_Track_Hard_TOFPID", true, "Enables STRICT TOF Reqruirement"}; + Configurable cfg_Track_TPCPID_nSig{"cfg_Track_TPCPID_nSig", 4, "nTPC PID sigma"}; + Configurable cfg_Track_TOFPID_nSig{"cfg_Track_TOFPID_nSig", 4, "nTOF PID sigma"}; + Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; + + //Pair configurables + Configurable cfg_Pair_MinvBins{"cfg_Pair_MinvBins", 300, "Number of bins for Minv axis"}; + Configurable cfg_Pair_MinvMin{"cfg_Pair_MinvMin", 0.90, "Minimum Minv value"}; + Configurable cfg_Pair_MinvMax{"cfg_Pair_MinvMax", 1.50, "Maximum Minv value"}; + + Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 5, "Number of mixed events per event"}; + + + + //Histogram Configurables + Configurable cfg_Event_CutQA{"cfg_Events_CutsQA", true, "Enables Track QA plots"}; + Configurable cfg_Track_CutQA{"cfg_Tracks_CutsQA", true, "Enables Track QA plots"}; + + + void init(o2::framework::InitContext&){ + const AxisSpec MinvAxis = {cfg_Pair_MinvBins, cfg_Pair_MinvMin, cfg_Pair_MinvMax}; + const AxisSpec PtAxis = {200, 0, 20.0}; + const AxisSpec MultAxis = {100, 0, 100}; + const AxisSpec dRAxis = {100, 0, 100}; + const AxisSpec pidAxis = {100, -5, 5}; + + //Event QA + if (cfg_Event_CutQA) { + histos.add("hPosZ_BC", "PosZ_BC", kTH1F, {{100, 0.0, 15.0}}); + histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{100, 0.0, 100.0}}); + histos.add("hOccupancy_BC", "Occupancy_BC", kTH1F, {{100, 0.0, 20000}}); + // + histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{100, 0.0, 100.0}}); + histos.add("hPosZ_AC", "PosZ_AC", kTH1F, {{100, 0.0, 15.0}}); + histos.add("hOccupancy_AC", "Occupancy_AC", kTH1F, {{100, 0.0, 20000}}); + } + //Track QA + if (cfg_Track_CutQA) { + histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hIsPrim_BC", "hIsPrim_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsGood_BC", "hIsGood_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsPrimCont_BC", "hIsPrimCont_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hFindableTPCClusters_BC", "hFindableTPCClusters_BC", kTH1F, {{200, 0, 200}}); + histos.add("hFindableTPCRows_BC", "hFindableTPCRows_BC", kTH1F, {{200, 0, 200}}); + histos.add("hClustersVsRows_BC", "hClustersVsRows_BC", kTH1F, {{200, 0, 2}}); + histos.add("hTPCChi2_BC", "hTPCChi2_BC", kTH1F, {{200, 0, 100}}); + histos.add("hITSChi2_BC", "hITSChi2_BC", kTH1F, {{200, 0, 100}}); + histos.add("hTPC_nSigma_BC", "hTPC_nSigma_BC", kTH1F, {pidAxis}); + histos.add("hTOF_nSigma_BC", "hTOF_nSigma_BC", kTH1F, {pidAxis}); + histos.add("hTPC_nSigma_v_pt_BC", "hTPC_nSigma_v_pt_BC", HistType::kTHnSparseD, {pidAxis,PtAxis}); + histos.add("hTOF_nSigma_v_pt_BC", "hTOF_nSigma_v_pt_BC", HistType::kTHnSparseD, {pidAxis,PtAxis}); + // + histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsGood_AC", "hIsGood_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsPrimCont_AC", "hIsPrimCont_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hFindableTPCClusters_AC", "hFindableTPCClusters_AC", kTH1F, {{200, 0, 200}}); + histos.add("hFindableTPCRows_AC", "hFindableTPCRows_AC", kTH1F, {{200, 0, 200}}); + histos.add("hClustersVsRows_AC", "hClustersVsRows_AC", kTH1F, {{200, 0, 2}}); + histos.add("hTPCChi2_AC", "hTPCChi2_AC", kTH1F, {{200, 0, 100}}); + histos.add("hITSChi2_AC", "hITSChi2_AC", kTH1F, {{200, 0, 100}}); + histos.add("hTPC_nSigma_AC", "hTPC_nSigma_AC", kTH1F, {pidAxis}); + histos.add("hTOF_nSigma_AC", "hTOF_nSigma_AC", kTH1F, {pidAxis}); + histos.add("hTPC_nSigma_v_pt_AC", "hTPC_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis,PtAxis}); + histos.add("hTOF_nSigma_v_pt_AC", "hTOF_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis,PtAxis}); + + } + histos.add("hUSS", "hUSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hLSS", "hLSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + + //Event Histograms + auto h = histos.add("hnEvents", "Event selection decision", kTH1I, {{10, 0, 10}}); + // histos.add("hnEvent", "Event selection decision", kTH1I, + // {AxisSpec{"SelectionCode", BinLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); + + }//end of init + + Filter collisionFilter = nabs(aod::collision::posZ) <= cfg_Event_VtxCut; + Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfg_Event_CentralityMax; + Filter acceptanceFilter = (nabs(aod::track::eta) < cfg_Track_MaxEta && nabs(aod::track::pt) >= cfg_Track_MinPt); + using EventCandidates = soa::Filtered>; + // using TrackCandidates = soa::Filtered>; + using TrackCandidates = soa::Filtered>; + using BinningTypeVtxCent = ColumnBinningPolicy; + + Partition PosKaon = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + Partition NegKaon = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + + double massKa = o2::constants::physics::MassKPlus; + //***********************************// + //First, we declare some helper functions + template + void fillQA(const bool pass, const objType& obj, const int objecttype = 0){ + + if(objecttype==1){ + if constexpr (requires {obj.posZ(); }) { + if(!pass){ + histos.fill(HIST("hPosZ_BC" ), obj.posZ()); + histos.fill(HIST("hcentFT0C_BC" ), obj.centFT0C()); + } else { + histos.fill(HIST("hPosZ_AC" ), obj.posZ()); + histos.fill(HIST("hcentFT0C_AC" ), obj.centFT0C()); + } + } + } + if constexpr (requires {obj.tpcCrossedRowsOverFindableCls(); }) { + if(objecttype==2){ + if(!pass){ + histos.fill(HIST("hDCArToPv_BC" ), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_BC" ), obj.dcaZ()); + histos.fill(HIST("hIsPrim_BC" ), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_BC" ), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_BC" ), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_BC" ), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_BC" ), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_BC" ), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_BC" ), obj.tpcChi2NCl()); + } else { + histos.fill(HIST("hDCArToPv_AC" ), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_AC" ), obj.dcaZ()); + histos.fill(HIST("hIsPrim_AC" ), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_AC" ), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_AC" ), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_AC" ), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_AC" ), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_AC" ), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_AC" ), obj.tpcChi2NCl()); + } + } + if(objecttype==3){ + if(!pass){ + histos.fill(HIST("hTPC_nSigma_BC" ), obj.tpcNSigmaKa()); + histos.fill(HIST("hTOF_nSigma_BC" ), obj.tofNSigmaKa()); + histos.fill(HIST("hTPC_nSigma_v_pt_BC" ), obj.tpcNSigmaKa(), obj.pt()); + histos.fill(HIST("hTOF_nSigma_v_pt_BC" ), obj.tofNSigmaKa(), obj.pt()); + } else { + histos.fill(HIST("hTPC_nSigma_AC" ), obj.tpcNSigmaKa()); + histos.fill(HIST("hTOF_nSigma_AC" ), obj.tofNSigmaKa()); + histos.fill(HIST("hTPC_nSigma_v_pt_AC" ), obj.tpcNSigmaKa(), obj.pt()); + histos.fill(HIST("hTOF_nSigma_v_pt_AC" ), obj.tofNSigmaKa(), obj.pt()); + } + } + } + }; + //***********************************// + + //evsel + template + std::pair eventSelection(const EventType event, const bool QA) + { + + if (cfg_Track_CutQA && QA) + fillQA(false,event,1); + + if (!event.sel8()) + return {false,1}; + if (std::abs(event.posZ()) > cfg_Event_VtxCut) + return {false,2}; + if (cfg_Event_Timeframe && (!event.selection_bit(aod::evsel::kNoTimeFrameBorder) || !event.selection_bit(aod::evsel::kNoITSROFrameBorder))) + return {false,3}; + if (cfg_Event_Timerange && (!event.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) + return {false,4}; + if (cfg_Event_Pileup && (!event.selection_bit(aod::evsel::kNoSameBunchPileup) || !event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) + return {false,5}; + if (cfg_Event_Centrality && (event.centFT0C() > cfg_Event_CentralityMax)) + return {false,6}; + if (cfg_Event_OccupancyCut && (event.trackOccupancyInTimeRange() > cfg_Event_MaxOccupancy)) + return {false,7}; + + if (cfg_Track_CutQA && QA) + fillQA(true,event,1); + + return {true,8}; + }; + + //tracksel + template + bool trackSelection(const TrackType track, const bool QA) + { + if (cfg_Track_CutQA && QA) + fillQA(false,track,2); + + // basic track cuts + if (track.pt() < cfg_Track_MinPt) + return false; + if (std::abs(track.eta()) > cfg_Track_MaxEta) + return false; + if (std::abs(track.dcaXY()) > cfg_Track_MaxDCArToPVcut) + return false; + if (std::abs(track.dcaZ()) > cfg_Track_MaxDCAzToPVcut) + return false; + if (cfg_Track_PrimaryTrack && !track.isPrimaryTrack()) + return false; + if (track.tpcNClsFindable() < cfg_Track_nFindableTPCClusters) + return false; + if (track.tpcNClsCrossedRows() < cfg_Track_nTPCCrossedRows) + return false; + if (track.tpcCrossedRowsOverFindableCls() > cfg_Track_nRowsOverFindable) + return false; + if (track.tpcChi2NCl() > cfg_Track_nTPCChi2) + return false; + if (track.itsChi2NCl() > cfg_Track_nITSChi2) + return false; + if (cfg_Track_ConnectedToPV && !track.isPVContributor()) + return false; + + if (cfg_Track_CutQA && QA) + fillQA(true,track,2); + return true; + }; + + //trackpid + + template + bool trackPIDKaon(const TrackPID& candidate, const bool QA) + { + bool tpcPIDPassed{false}, tofPIDPassed{false}; + + if (cfg_Track_CutQA && QA) + fillQA(false,candidate,3); + + if(!cfg_Track_TPCPID) { + tpcPIDPassed=true; + } else { + if (std::abs(candidate.tpcNSigmaKa()) < cfg_Track_TPCPID_nSig) + tpcPIDPassed = true; + } + + if(!cfg_Track_TOFPID){ + tpcPIDPassed=true; + } else { + if (candidate.hasTOF()) { + if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) { + tofPIDPassed = true; + } + } else if (!cfg_Track_Hard_TOFPID) { + tofPIDPassed = true; + } + } + if (tpcPIDPassed && tofPIDPassed) { + return true; + + if (cfg_Track_CutQA && QA) + fillQA(true,candidate,3); + } + return false; + } + + + + template + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&){ + auto slicedtracks1 = PosKaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto slicedtracks2 = PosKaon->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + auto centrality = collision1.centFT0C(); + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { + auto [Minv,PhiPt] = minvReconstruction(track1, track2, false); + if(Minv<0) + continue; + double conjugate = track1.sign()*track2.sign(); + if(conjugate<0){ + histos.fill(HIST("hUSS_Mix"),centrality,Minv,PhiPt); + } else if (conjugate>0) { + histos.fill(HIST("hLSS_Mix"),centrality,Minv,PhiPt); + } + } + }//TrackSlicing + + + //Invariant mass + template + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) + { + + TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; + //==================================================== + + if (!trackSelection(trk1,QA) || !trackSelection(trk2,false)) + return {-1.0,-1.0}; + + if (!trackPIDKaon(trk1, QA) || !trackPIDKaon(trk2, false)) + return {-1.0,-1.0}; + + if (trk1.globalIndex() >= trk2.globalIndex()) + return {-1.0,-1.0}; + + lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); + lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); + lResonance = lDecayDaughter1 + lDecayDaughter2; + + return {lResonance.M(), lResonance.Pt()}; + } // MinvReconstruction + + int nEvents = 0; + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks){ + if (cDebugLevel > 0) { + nEvents++; + if ((nEvents + 1) % 100 == 0) { + std::cout << "Processed Data Events: " << nEvents << std::endl; + } + } + + auto [goodEv, code] = eventSelection(collision,true); + histos.fill(HIST("hnEvents"), code); + if (!goodEv) + return; + double centrality = collision.centFT0C(); + + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { + auto [Minv,PhiPt] = minvReconstruction(track1, track2, true); + if(Minv<0) + continue; + double conjugate = track1.sign()*track2.sign(); + + if(conjugate<0){ + histos.fill(HIST("hUSS"),centrality,Minv,PhiPt); + } else if (conjugate>0) { + histos.fill(HIST("hLSS"),centrality,Minv,PhiPt); + } + } + }//end of process + + PROCESS_SWITCH(phiOO, processSameEvent, "Process Same events", true); + + + void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks){ + + if (cDebugLevel > 0) { + nEvents++; + if ((nEvents + 1) % 100 == 0) { + std::cout << "Processed Mixed Events: " << nEvents << std::endl; + } + } + + auto tracksTuple = std::make_tuple(tracks); + std::cout<<"we get here"< pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; + + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + auto [goodEv1, code1] = eventSelection(collision1,false); + auto [goodEv2, code2] = eventSelection(collision2,false); + if (!goodEv1 || !goodEv2) + continue; + TrackSlicing(collision1, tracks1, collision2, tracks2); + }//mixing + }//end of process + PROCESS_SWITCH(phiOO, processMixedEvent, "Process Mixed events", false); + +}; // end of main struct + + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +}; From 5c9595a3f812cc9344bd81021cdf42a78b7e529c Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Wed, 9 Jul 2025 11:34:09 +0900 Subject: [PATCH 5/7] Add phiOO task and update CMakeLists --- PWGLF/Tasks/Resonances/phiOO.cxx | 328 ++++++++++++++++++++++++++----- 1 file changed, 274 insertions(+), 54 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phiOO.cxx b/PWGLF/Tasks/Resonances/phiOO.cxx index e82c82bae41..b9ae64dcd8d 100644 --- a/PWGLF/Tasks/Resonances/phiOO.cxx +++ b/PWGLF/Tasks/Resonances/phiOO.cxx @@ -59,6 +59,7 @@ using namespace o2::framework::expressions; struct phiOO{ SliceCache cache; + Preslice perCollision = aod::track::collisionId; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; //Event configurables @@ -95,6 +96,7 @@ struct phiOO{ Configurable cfg_Track_Hard_TOFPID{"cfg_Track_Hard_TOFPID", true, "Enables STRICT TOF Reqruirement"}; Configurable cfg_Track_TPCPID_nSig{"cfg_Track_TPCPID_nSig", 4, "nTPC PID sigma"}; Configurable cfg_Track_TOFPID_nSig{"cfg_Track_TOFPID_nSig", 4, "nTOF PID sigma"}; + Configurable cfg_Track_Explicit_PID{"cfg_Track_Explicit_PID", true, "Enables explicit pid cehck"}; Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; //Pair configurables @@ -104,11 +106,14 @@ struct phiOO{ Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 5, "Number of mixed events per event"}; + //MCGen configurables + Configurable cfg_Force_GenReco{"cfg_Force_GenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; + Configurable cfg_Force_BR{"cfg_Force_BR", false, "Only consider phi->K+K-"}; + Configurable cfg_Force_Kaon_Acceptence{"cfg_Force_Kaon_Acceptence", false, "Only consider phi's whose daughters decay inside acceptence (no signal loss)"}; - //Histogram Configurables - Configurable cfg_Event_CutQA{"cfg_Events_CutsQA", true, "Enables Track QA plots"}; - Configurable cfg_Track_CutQA{"cfg_Tracks_CutsQA", true, "Enables Track QA plots"}; + Configurable cfg_Event_CutQA{"cfg_Event_CutsQA", true, "Enables Track QA plots"}; + Configurable cfg_Track_CutQA{"cfg_Track_CutsQA", true, "Enables Track QA plots"}; void init(o2::framework::InitContext&){ @@ -161,28 +166,65 @@ struct phiOO{ histos.add("hTOF_nSigma_v_pt_AC", "hTOF_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis,PtAxis}); } + //Data histos histos.add("hUSS", "hUSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); histos.add("hLSS", "hLSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hUSS_Mix", "hUSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hLSS_Mix", "hLSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + + //MC histos + histos.add("hMC_USS", "hMC_USS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_LSS", "hMC_LSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_USS_Mix", "hMC_USS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_USS_True", "hMC_USS_True", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_Phi_True", "hMC_Phi_True", HistType::kTHnSparseD, {cfg_bins_Cent, PtAxis}); //Event Histograms - auto h = histos.add("hnEvents", "Event selection decision", kTH1I, {{10, 0, 10}}); - // histos.add("hnEvent", "Event selection decision", kTH1I, - // {AxisSpec{"SelectionCode", BinLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); + histos.add("hnEvents", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); + histos.add("hnEvents_MC", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); + histos.add("hnEvents_MC_True", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); + + // histos.add("hnEvent", "Event selection decision", kTH1I, {AxisSpec{"SelectionCode", aliasLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); + // histos.add("hnEvent_MC", "Event selection decision", kTH1I, {AxisSpec{"SelectionCode", aliasLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); + // histos.add("hnEvent_MC_True", "Event selection decision", kTH1I, {AxisSpec{"SelectionCode", aliasLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); }//end of init Filter collisionFilter = nabs(aod::collision::posZ) <= cfg_Event_VtxCut; + Filter collisionFilter_MC = nabs(aod::mccollision::posZ) <= cfg_Event_VtxCut; Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfg_Event_CentralityMax; Filter acceptanceFilter = (nabs(aod::track::eta) < cfg_Track_MaxEta && nabs(aod::track::pt) >= cfg_Track_MinPt); using EventCandidates = soa::Filtered>; - // using TrackCandidates = soa::Filtered>; + using EventCandidates_True = soa::Filtered; + using TrackCandidates = soa::Filtered>; + using TrackCandidates_MC = soa::Filtered>; + using BinningTypeVtxCent = ColumnBinningPolicy; - Partition PosKaon = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); - Partition NegKaon = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + // Partition PosKaon = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + // Partition NegKaon = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + + Partition PosKaon = + (aod::track::signed1Pt < static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + Partition NegKaon = + (aod::track::signed1Pt > static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + + Partition PosKaon_MC = + (aod::track::signed1Pt < static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + Partition NegKaon_MC = + (aod::track::signed1Pt > static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); + + // Partition PosKaon_MC = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + // Partition NegKaon_MC = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); + double massKa = o2::constants::physics::MassKPlus; //***********************************// @@ -323,9 +365,9 @@ struct phiOO{ if (std::abs(candidate.tpcNSigmaKa()) < cfg_Track_TPCPID_nSig) tpcPIDPassed = true; } - + if(!cfg_Track_TOFPID){ - tpcPIDPassed=true; + tofPIDPassed=true; } else { if (candidate.hasTOF()) { if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) { @@ -336,48 +378,122 @@ struct phiOO{ } } if (tpcPIDPassed && tofPIDPassed) { - return true; - - if (cfg_Track_CutQA && QA) + if (cfg_Track_CutQA && QA) { fillQA(true,candidate,3); + } + return true; } return false; } - - - + template - void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&){ + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix){ auto slicedtracks1 = PosKaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); - auto slicedtracks2 = PosKaon->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + auto slicedtracks2 = NegKaon->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); + auto centrality = collision1.centFT0C(); + for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { + auto [Minv,PhiPt] = minvReconstruction(track1, track2, QA); + if(Minv<0) + continue; + double conjugate = track1.sign()*track2.sign(); + if(!IsMix){ + if(conjugate<0){ + histos.fill(HIST("hUSS"),centrality,Minv,PhiPt); + } else if (conjugate>0) { + histos.fill(HIST("hLSS"),centrality,Minv,PhiPt); + } + } + else{ + if(conjugate<0){ + histos.fill(HIST("hUSS_Mix"),centrality,Minv,PhiPt); + } else if (conjugate>0) { + histos.fill(HIST("hLSS_Mix"),centrality,Minv,PhiPt); + } + } + } + }//TrackSlicing + + template + void TrackSlicing_MC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix){ + auto slicedtracks1 = PosKaon_MC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); + auto slicedtracks2 = NegKaon_MC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { - auto [Minv,PhiPt] = minvReconstruction(track1, track2, false); + auto [Minv,PhiPt] = minvReconstruction(track1, track2, QA); if(Minv<0) continue; double conjugate = track1.sign()*track2.sign(); - if(conjugate<0){ - histos.fill(HIST("hUSS_Mix"),centrality,Minv,PhiPt); - } else if (conjugate>0) { - histos.fill(HIST("hLSS_Mix"),centrality,Minv,PhiPt); + if(!IsMix){ + if(conjugate<0){ + histos.fill(HIST("hMC_USS"),centrality,Minv,PhiPt); + } else if (conjugate>0) { + histos.fill(HIST("hMC_LSS"),centrality,Minv,PhiPt); + } } + else{ + if(conjugate<0){ + histos.fill(HIST("hMC_USS_Mix"),centrality,Minv,PhiPt); + } else if (conjugate>0) { + histos.fill(HIST("hMC_LSS_Mix"),centrality,Minv,PhiPt); + } + } + //now we do mc true + if (!track1.has_mcParticle() || !track2.has_mcParticle()) + continue; + auto part1 = track1.mcParticle(); + auto part2 = track2.mcParticle(); + if (std::fabs(part1.pdgCode()) != 321) + continue; // Not Kaon + if (std::fabs(part2.pdgCode()) != 321) + continue; // Not Kaon + + if (!part1.has_mothers()) + continue; // Not decaying Kaon + if (!part2.has_mothers()) + continue; // Not decaying Kaon + + std::vector mothers1{}; + std::vector mothers1PDG{}; + for (auto& part1_mom : part1.template mothers_as()) { + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); + } + + std::vector mothers2{}; + std::vector mothers2PDG{}; + for (auto& part2_mom : part2.template mothers_as()) { + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); + } + + if (mothers1PDG[0] != 333) + continue; // mother not phi + if (mothers2PDG[0] != 333) + continue; // mother not phi + + if (mothers1[0] != mothers2[0]) + continue; // Kaons not from the same phi + + histos.fill(HIST("hMC_USS_True"),centrality,Minv,PhiPt); } }//TrackSlicing + //Invariant mass template std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) { - TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; //==================================================== if (!trackSelection(trk1,QA) || !trackSelection(trk2,false)) return {-1.0,-1.0}; - if (!trackPIDKaon(trk1, QA) || !trackPIDKaon(trk2, false)) - return {-1.0,-1.0}; + if(cfg_Track_Explicit_PID){ + if (!trackPIDKaon(trk1, QA) || !trackPIDKaon(trk2, false)) + return {-1.0,-1.0}; + } if (trk1.globalIndex() >= trk2.globalIndex()) return {-1.0,-1.0}; @@ -388,12 +504,16 @@ struct phiOO{ return {lResonance.M(), lResonance.Pt()}; } // MinvReconstruction - + + //***************// + //DATA + //***************// + int nEvents = 0; void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks){ if (cDebugLevel > 0) { - nEvents++; - if ((nEvents + 1) % 100 == 0) { + ++nEvents; + if (nEvents % 10000 == 0) { std::cout << "Processed Data Events: " << nEvents << std::endl; } } @@ -402,48 +522,148 @@ struct phiOO{ histos.fill(HIST("hnEvents"), code); if (!goodEv) return; - double centrality = collision.centFT0C(); + TrackSlicing(collision,tracks,collision,tracks,true,false); - for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { - auto [Minv,PhiPt] = minvReconstruction(track1, track2, true); - if(Minv<0) - continue; - double conjugate = track1.sign()*track2.sign(); - - if(conjugate<0){ - histos.fill(HIST("hUSS"),centrality,Minv,PhiPt); - } else if (conjugate>0) { - histos.fill(HIST("hLSS"),centrality,Minv,PhiPt); - } - } }//end of process PROCESS_SWITCH(phiOO, processSameEvent, "Process Same events", true); - + //***************// + //DATA (MIX) + //***************// + + int nEvents_Mix = 0; void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks){ + auto tracksTuple = std::make_tuple(tracks); + BinningTypeVtxCent colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; + SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (cDebugLevel > 0) { + ++nEvents_Mix; + if (nEvents_Mix % 10000 == 0) { + std::cout << "Processed Mixed Events: " << nEvents_Mix << std::endl; + } + } + auto [goodEv1, code1] = eventSelection(collision1,false); + auto [goodEv2, code2] = eventSelection(collision2,false); + if (!goodEv1 || !goodEv2) + continue; + TrackSlicing(collision1,tracks1,collision2,tracks2,false,true); + }//mixing + }//end of process + PROCESS_SWITCH(phiOO, processMixedEvent, "Process Mixed events", false); + + //***************// + //RECONSTRUCTED MC + //***************// + + int nEvents_MC = 0; + void processSameEvent_MC(EventCandidates::iterator const& collision, TrackCandidates_MC const& tracks, aod::McParticles const&){ if (cDebugLevel > 0) { - nEvents++; - if ((nEvents + 1) % 100 == 0) { - std::cout << "Processed Mixed Events: " << nEvents << std::endl; + ++nEvents_MC; + if (nEvents_MC % 10000 == 0) { + std::cout << "Processed MC (REC) Events: " << nEvents_MC << std::endl; } } - + + auto [goodEv, code] = eventSelection(collision,true); + histos.fill(HIST("hnEvents_MC"), code); + if (!goodEv) + return; + TrackSlicing_MC(collision,tracks,collision,tracks,true,false); + + }//end of process + PROCESS_SWITCH(phiOO, processSameEvent_MC, "Process Same events (MC)", true); + + //***************// + //RECONSTRUCTED MC (MIX) + //***************// + + int nEvents_MC_Mix = 0; + void processMixedEvent_MC(EventCandidates const& collisions, TrackCandidates_MC const& tracks, aod::McParticles const&){ auto tracksTuple = std::make_tuple(tracks); - std::cout<<"we get here"< pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; - + SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { + if (cDebugLevel > 0) { + ++nEvents_MC_Mix; + if (nEvents_MC_Mix % 10000 == 0) { + std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; + } + } auto [goodEv1, code1] = eventSelection(collision1,false); auto [goodEv2, code2] = eventSelection(collision2,false); if (!goodEv1 || !goodEv2) continue; - TrackSlicing(collision1, tracks1, collision2, tracks2); + TrackSlicing_MC(collision1,tracks1,collision2,tracks2,false,true); }//mixing }//end of process - PROCESS_SWITCH(phiOO, processMixedEvent, "Process Mixed events", false); + PROCESS_SWITCH(phiOO, processMixedEvent_MC, "Process Mixed events (MC)", false); + + //***************// + //GENERATED MC + //***************// + + int nEvents_True = 0; + void processParticles(EventCandidates_True::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& particles){ + if (cDebugLevel > 0) { + ++nEvents_True; + if (nEvents_True % 10000 == 0) { + std::cout << "Processed MC (GEN) Events: " << nEvents_True << std::endl; + } + } + + if (fabs(collision.posZ()) > cfg_Event_VtxCut) + return; + + if (recocolls.size() <= 0){ // not reconstructed + if(cfg_Force_GenReco){ + return; + } + } + + double centrality; + for (auto& recocoll : recocolls) { // poorly reconstructed + centrality = recocoll.centFT0C(); + auto [goodEv, code] = eventSelection(recocoll,false); + histos.fill(HIST("hnEvents_MC_True"), code); + if (!goodEv) + return; + } + + for(auto& particle : particles) { + if(particle.pdgCode()!=333) + continue; + if(std::fabs(particle.eta())> cfg_Track_MaxEta) + continue; + + if(cfg_Force_BR){ + bool baddecay = false; + for (auto& phidaughter : particle.daughters_as()) { + if(std::fabs(phidaughter.pdgCode())!=321) { + baddecay=true; + break; + } + if(cfg_Force_Kaon_Acceptence){ + if(std::fabs(phidaughter.eta())> cfg_Track_MaxEta) { + baddecay=true; + break; + } + } + }//loop over daughters + + if(baddecay) + continue; + }//enforce BR restriction + + histos.fill(HIST("hMC_Phi_True"),centrality,particle.pt()); + }//loop over particles + + }//end of process + PROCESS_SWITCH(phiOO, processParticles, "Process Particles", false); + + }; // end of main struct From 2f2c606e5ccf7781724f33bea394005e6f3494ec Mon Sep 17 00:00:00 2001 From: Adrian Nassirpour Date: Fri, 11 Jul 2025 16:15:33 +0900 Subject: [PATCH 6/7] [PWGLF] Update phiOO task and CMakeLists.txt --- PWGLF/Tasks/Resonances/phiOO.cxx | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phiOO.cxx b/PWGLF/Tasks/Resonances/phiOO.cxx index b9ae64dcd8d..a98f6574f67 100644 --- a/PWGLF/Tasks/Resonances/phiOO.cxx +++ b/PWGLF/Tasks/Resonances/phiOO.cxx @@ -51,6 +51,7 @@ #include #include #include +#include using namespace o2; using namespace o2::framework; @@ -93,7 +94,7 @@ struct phiOO{ Configurable cfg_Track_nITSChi2{"cfg_Track_ITSChi2", 36.0, "nITS Chi2 per Cluster"}; Configurable cfg_Track_TPCPID{"cfg_Track_TPCPID", true, "Enables TPC PID"}; Configurable cfg_Track_TOFPID{"cfg_Track_TOFPID", true, "Enables TOF PID"}; - Configurable cfg_Track_Hard_TOFPID{"cfg_Track_Hard_TOFPID", true, "Enables STRICT TOF Reqruirement"}; + Configurable cfg_Track_Hard_TOFPID {"cfg_Track_Hard_TOFPID", true, "Enables STRICT TOF Reqruirement"}; Configurable cfg_Track_TPCPID_nSig{"cfg_Track_TPCPID_nSig", 4, "nTPC PID sigma"}; Configurable cfg_Track_TOFPID_nSig{"cfg_Track_TOFPID_nSig", 4, "nTOF PID sigma"}; Configurable cfg_Track_Explicit_PID{"cfg_Track_Explicit_PID", true, "Enables explicit pid cehck"}; @@ -184,11 +185,7 @@ struct phiOO{ histos.add("hnEvents", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); histos.add("hnEvents_MC", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); histos.add("hnEvents_MC_True", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); - - // histos.add("hnEvent", "Event selection decision", kTH1I, {AxisSpec{"SelectionCode", aliasLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); - // histos.add("hnEvent_MC", "Event selection decision", kTH1I, {AxisSpec{"SelectionCode", aliasLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); - // histos.add("hnEvent_MC_True", "Event selection decision", kTH1I, {AxisSpec{"SelectionCode", aliasLabels{"Success", "FailSel8", "FailVertex", "FailTimeframe", "FailTimeRange", "FailPileup", "FailCentrality", "FailOccupancy"}}}); - + }//end of init Filter collisionFilter = nabs(aod::collision::posZ) <= cfg_Event_VtxCut; @@ -204,27 +201,19 @@ struct phiOO{ aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTOFbeta, aod::McTrackLabels>>; using BinningTypeVtxCent = ColumnBinningPolicy; - - // Partition PosKaon = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); - // Partition NegKaon = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); - Partition PosKaon = - (aod::track::signed1Pt < static_cast(0)) && - (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); - Partition NegKaon = + Partition PosKaon_MC = (aod::track::signed1Pt > static_cast(0)) && (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); - - Partition PosKaon_MC = + Partition NegKaon_MC = (aod::track::signed1Pt < static_cast(0)) && (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); - Partition NegKaon_MC = + Partition PosKaon = (aod::track::signed1Pt > static_cast(0)) && (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); - - // Partition PosKaon_MC = (aod::track::signed1Pt < static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); - // Partition NegKaon_MC = (aod::track::signed1Pt > static_cast(0)) && (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig); - + Partition NegKaon = + (aod::track::signed1Pt < static_cast(0)) && + (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); double massKa = o2::constants::physics::MassKPlus; //***********************************// @@ -376,6 +365,9 @@ struct phiOO{ } else if (!cfg_Track_Hard_TOFPID) { tofPIDPassed = true; } + if (!candidate.hasTOF()) { + std::cout< Date: Fri, 11 Jul 2025 07:35:44 +0000 Subject: [PATCH 7/7] Please consider the following formatting changes --- PWGLF/Tasks/Resonances/phiOO.cxx | 652 ++++++++++++++++--------------- 1 file changed, 328 insertions(+), 324 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phiOO.cxx b/PWGLF/Tasks/Resonances/phiOO.cxx index a98f6574f67..2bbefdb5c4b 100644 --- a/PWGLF/Tasks/Resonances/phiOO.cxx +++ b/PWGLF/Tasks/Resonances/phiOO.cxx @@ -16,32 +16,35 @@ /// \author Adrian Fereydon Nassirpour #include #include #include #include #include + #include "TRandom.h" #include #include #include #include + #include + #include #include #include @@ -49,21 +52,22 @@ #include #include #include +#include #include + #include -#include using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -struct phiOO{ +struct phiOO { SliceCache cache; Preslice perCollision = aod::track::collisionId; HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; - //Event configurables + // Event configurables Configurable cfg_Event_Sel{"cfg_Event_Sel", "sel8", "choose event selection"}; Configurable cfg_Event_VtxCut{"cfg_Event_VtxCut", 10.0, "V_z cut selection"}; Configurable cfg_Event_Timeframe{"cfg_Event_Timeframe", true, "Timeframe border cut"}; @@ -78,7 +82,7 @@ struct phiOO{ ConfigurableAxis cfg_bins_MixVtx{"cfg_bins_MixVtx", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"}; ConfigurableAxis cfg_bins_MixMult{"cfg_bins_MixMult", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f}, "Mixing bins - z-vertex"}; - //Track configurables + // Track configurables Configurable cfg_Track_Sel{"cfg_Track_Sel", "globalTracks", "set track selections"}; Configurable cfg_Track_MinPt{"cfg_Track_MinPt", 0.15, "set track min pT"}; Configurable cfg_Track_MaxEta{"cfg_Track_MaxEta", 0.9, "set track max Eta"}; @@ -94,112 +98,111 @@ struct phiOO{ Configurable cfg_Track_nITSChi2{"cfg_Track_ITSChi2", 36.0, "nITS Chi2 per Cluster"}; Configurable cfg_Track_TPCPID{"cfg_Track_TPCPID", true, "Enables TPC PID"}; Configurable cfg_Track_TOFPID{"cfg_Track_TOFPID", true, "Enables TOF PID"}; - Configurable cfg_Track_Hard_TOFPID {"cfg_Track_Hard_TOFPID", true, "Enables STRICT TOF Reqruirement"}; + Configurable cfg_Track_Hard_TOFPID{"cfg_Track_Hard_TOFPID", true, "Enables STRICT TOF Reqruirement"}; Configurable cfg_Track_TPCPID_nSig{"cfg_Track_TPCPID_nSig", 4, "nTPC PID sigma"}; Configurable cfg_Track_TOFPID_nSig{"cfg_Track_TOFPID_nSig", 4, "nTOF PID sigma"}; Configurable cfg_Track_Explicit_PID{"cfg_Track_Explicit_PID", true, "Enables explicit pid cehck"}; Configurable cDebugLevel{"cDebugLevel", 0, "Resolution of Debug"}; - //Pair configurables + // Pair configurables Configurable cfg_Pair_MinvBins{"cfg_Pair_MinvBins", 300, "Number of bins for Minv axis"}; Configurable cfg_Pair_MinvMin{"cfg_Pair_MinvMin", 0.90, "Minimum Minv value"}; Configurable cfg_Pair_MinvMax{"cfg_Pair_MinvMax", 1.50, "Maximum Minv value"}; - + Configurable cfg_Mix_NMixedEvents{"cfg_Mix_NMixedEvents", 5, "Number of mixed events per event"}; - //MCGen configurables + // MCGen configurables Configurable cfg_Force_GenReco{"cfg_Force_GenReco", false, "Only consider events which are reconstructed (neglect event-loss)"}; Configurable cfg_Force_BR{"cfg_Force_BR", false, "Only consider phi->K+K-"}; Configurable cfg_Force_Kaon_Acceptence{"cfg_Force_Kaon_Acceptence", false, "Only consider phi's whose daughters decay inside acceptence (no signal loss)"}; - - //Histogram Configurables + + // Histogram Configurables Configurable cfg_Event_CutQA{"cfg_Event_CutsQA", true, "Enables Track QA plots"}; Configurable cfg_Track_CutQA{"cfg_Track_CutsQA", true, "Enables Track QA plots"}; - - void init(o2::framework::InitContext&){ + void init(o2::framework::InitContext&) + { const AxisSpec MinvAxis = {cfg_Pair_MinvBins, cfg_Pair_MinvMin, cfg_Pair_MinvMax}; const AxisSpec PtAxis = {200, 0, 20.0}; const AxisSpec MultAxis = {100, 0, 100}; const AxisSpec dRAxis = {100, 0, 100}; const AxisSpec pidAxis = {100, -5, 5}; - //Event QA - if (cfg_Event_CutQA) { - histos.add("hPosZ_BC", "PosZ_BC", kTH1F, {{100, 0.0, 15.0}}); - histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{100, 0.0, 100.0}}); - histos.add("hOccupancy_BC", "Occupancy_BC", kTH1F, {{100, 0.0, 20000}}); - // - histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{100, 0.0, 100.0}}); - histos.add("hPosZ_AC", "PosZ_AC", kTH1F, {{100, 0.0, 15.0}}); - histos.add("hOccupancy_AC", "Occupancy_AC", kTH1F, {{100, 0.0, 20000}}); - } - //Track QA - if (cfg_Track_CutQA) { - histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {{300, 0.0, 3.0}}); - histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {{300, 0.0, 3.0}}); - histos.add("hIsPrim_BC", "hIsPrim_BC", kTH1F, {{2, -0.5, 1.5}}); - histos.add("hIsGood_BC", "hIsGood_BC", kTH1F, {{2, -0.5, 1.5}}); - histos.add("hIsPrimCont_BC", "hIsPrimCont_BC", kTH1F, {{2, -0.5, 1.5}}); - histos.add("hFindableTPCClusters_BC", "hFindableTPCClusters_BC", kTH1F, {{200, 0, 200}}); - histos.add("hFindableTPCRows_BC", "hFindableTPCRows_BC", kTH1F, {{200, 0, 200}}); - histos.add("hClustersVsRows_BC", "hClustersVsRows_BC", kTH1F, {{200, 0, 2}}); - histos.add("hTPCChi2_BC", "hTPCChi2_BC", kTH1F, {{200, 0, 100}}); - histos.add("hITSChi2_BC", "hITSChi2_BC", kTH1F, {{200, 0, 100}}); - histos.add("hTPC_nSigma_BC", "hTPC_nSigma_BC", kTH1F, {pidAxis}); - histos.add("hTOF_nSigma_BC", "hTOF_nSigma_BC", kTH1F, {pidAxis}); - histos.add("hTPC_nSigma_v_pt_BC", "hTPC_nSigma_v_pt_BC", HistType::kTHnSparseD, {pidAxis,PtAxis}); - histos.add("hTOF_nSigma_v_pt_BC", "hTOF_nSigma_v_pt_BC", HistType::kTHnSparseD, {pidAxis,PtAxis}); - // - histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {{300, 0.0, 3.0}}); - histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {{300, 0.0, 3.0}}); - histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}}); - histos.add("hIsGood_AC", "hIsGood_AC", kTH1F, {{2, -0.5, 1.5}}); - histos.add("hIsPrimCont_AC", "hIsPrimCont_AC", kTH1F, {{2, -0.5, 1.5}}); - histos.add("hFindableTPCClusters_AC", "hFindableTPCClusters_AC", kTH1F, {{200, 0, 200}}); - histos.add("hFindableTPCRows_AC", "hFindableTPCRows_AC", kTH1F, {{200, 0, 200}}); - histos.add("hClustersVsRows_AC", "hClustersVsRows_AC", kTH1F, {{200, 0, 2}}); - histos.add("hTPCChi2_AC", "hTPCChi2_AC", kTH1F, {{200, 0, 100}}); - histos.add("hITSChi2_AC", "hITSChi2_AC", kTH1F, {{200, 0, 100}}); - histos.add("hTPC_nSigma_AC", "hTPC_nSigma_AC", kTH1F, {pidAxis}); - histos.add("hTOF_nSigma_AC", "hTOF_nSigma_AC", kTH1F, {pidAxis}); - histos.add("hTPC_nSigma_v_pt_AC", "hTPC_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis,PtAxis}); - histos.add("hTOF_nSigma_v_pt_AC", "hTOF_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis,PtAxis}); - - } - //Data histos - histos.add("hUSS", "hUSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hLSS", "hLSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hUSS_Mix", "hUSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hLSS_Mix", "hLSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - - //MC histos - histos.add("hMC_USS", "hMC_USS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hMC_LSS", "hMC_LSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hMC_USS_Mix", "hMC_USS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hMC_USS_True", "hMC_USS_True", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); - histos.add("hMC_Phi_True", "hMC_Phi_True", HistType::kTHnSparseD, {cfg_bins_Cent, PtAxis}); - - //Event Histograms - histos.add("hnEvents", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); - histos.add("hnEvents_MC", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); - histos.add("hnEvents_MC_True", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); - - }//end of init - + // Event QA + if (cfg_Event_CutQA) { + histos.add("hPosZ_BC", "PosZ_BC", kTH1F, {{100, 0.0, 15.0}}); + histos.add("hcentFT0C_BC", "centFT0C_BC", kTH1F, {{100, 0.0, 100.0}}); + histos.add("hOccupancy_BC", "Occupancy_BC", kTH1F, {{100, 0.0, 20000}}); + // + histos.add("hcentFT0C_AC", "centFT0C_AC", kTH1F, {{100, 0.0, 100.0}}); + histos.add("hPosZ_AC", "PosZ_AC", kTH1F, {{100, 0.0, 15.0}}); + histos.add("hOccupancy_AC", "Occupancy_AC", kTH1F, {{100, 0.0, 20000}}); + } + // Track QA + if (cfg_Track_CutQA) { + histos.add("hDCArToPv_BC", "DCArToPv_BC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hDCAzToPv_BC", "DCAzToPv_BC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hIsPrim_BC", "hIsPrim_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsGood_BC", "hIsGood_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsPrimCont_BC", "hIsPrimCont_BC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hFindableTPCClusters_BC", "hFindableTPCClusters_BC", kTH1F, {{200, 0, 200}}); + histos.add("hFindableTPCRows_BC", "hFindableTPCRows_BC", kTH1F, {{200, 0, 200}}); + histos.add("hClustersVsRows_BC", "hClustersVsRows_BC", kTH1F, {{200, 0, 2}}); + histos.add("hTPCChi2_BC", "hTPCChi2_BC", kTH1F, {{200, 0, 100}}); + histos.add("hITSChi2_BC", "hITSChi2_BC", kTH1F, {{200, 0, 100}}); + histos.add("hTPC_nSigma_BC", "hTPC_nSigma_BC", kTH1F, {pidAxis}); + histos.add("hTOF_nSigma_BC", "hTOF_nSigma_BC", kTH1F, {pidAxis}); + histos.add("hTPC_nSigma_v_pt_BC", "hTPC_nSigma_v_pt_BC", HistType::kTHnSparseD, {pidAxis, PtAxis}); + histos.add("hTOF_nSigma_v_pt_BC", "hTOF_nSigma_v_pt_BC", HistType::kTHnSparseD, {pidAxis, PtAxis}); + // + histos.add("hDCArToPv_AC", "DCArToPv_AC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hDCAzToPv_AC", "DCAzToPv_AC", kTH1F, {{300, 0.0, 3.0}}); + histos.add("hIsPrim_AC", "hIsPrim_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsGood_AC", "hIsGood_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hIsPrimCont_AC", "hIsPrimCont_AC", kTH1F, {{2, -0.5, 1.5}}); + histos.add("hFindableTPCClusters_AC", "hFindableTPCClusters_AC", kTH1F, {{200, 0, 200}}); + histos.add("hFindableTPCRows_AC", "hFindableTPCRows_AC", kTH1F, {{200, 0, 200}}); + histos.add("hClustersVsRows_AC", "hClustersVsRows_AC", kTH1F, {{200, 0, 2}}); + histos.add("hTPCChi2_AC", "hTPCChi2_AC", kTH1F, {{200, 0, 100}}); + histos.add("hITSChi2_AC", "hITSChi2_AC", kTH1F, {{200, 0, 100}}); + histos.add("hTPC_nSigma_AC", "hTPC_nSigma_AC", kTH1F, {pidAxis}); + histos.add("hTOF_nSigma_AC", "hTOF_nSigma_AC", kTH1F, {pidAxis}); + histos.add("hTPC_nSigma_v_pt_AC", "hTPC_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis, PtAxis}); + histos.add("hTOF_nSigma_v_pt_AC", "hTOF_nSigma_v_pt_AC", HistType::kTHnSparseD, {pidAxis, PtAxis}); + } + // Data histos + histos.add("hUSS", "hUSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hLSS", "hLSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hUSS_Mix", "hUSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hLSS_Mix", "hLSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + + // MC histos + histos.add("hMC_USS", "hMC_USS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_LSS", "hMC_LSS", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_USS_Mix", "hMC_USS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_LSS_Mix", "hMC_LSS_Mix", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_USS_True", "hMC_USS_True", HistType::kTHnSparseD, {cfg_bins_Cent, MinvAxis, PtAxis}); + histos.add("hMC_Phi_True", "hMC_Phi_True", HistType::kTHnSparseD, {cfg_bins_Cent, PtAxis}); + + // Event Histograms + histos.add("hnEvents", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); + histos.add("hnEvents_MC", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); + histos.add("hnEvents_MC_True", "Event selection decision", kTH1I, {{10, -0.5, 9.5}}); + + } // end of init + Filter collisionFilter = nabs(aod::collision::posZ) <= cfg_Event_VtxCut; Filter collisionFilter_MC = nabs(aod::mccollision::posZ) <= cfg_Event_VtxCut; Filter centralityFilter = nabs(aod::cent::centFT0C) <= cfg_Event_CentralityMax; Filter acceptanceFilter = (nabs(aod::track::eta) < cfg_Track_MaxEta && nabs(aod::track::pt) >= cfg_Track_MinPt); using EventCandidates = soa::Filtered>; using EventCandidates_True = soa::Filtered; - + using TrackCandidates = soa::Filtered>; using TrackCandidates_MC = soa::Filtered>; - + aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTOFbeta, aod::McTrackLabels>>; + using BinningTypeVtxCent = ColumnBinningPolicy; Partition PosKaon_MC = @@ -214,101 +217,102 @@ struct phiOO{ Partition NegKaon = (aod::track::signed1Pt < static_cast(0)) && (!cfg_Track_TPCPID || (nabs(aod::pidtpc::tpcNSigmaKa) <= cfg_Track_TPCPID_nSig)); - + double massKa = o2::constants::physics::MassKPlus; //***********************************// - //First, we declare some helper functions + // First, we declare some helper functions template - void fillQA(const bool pass, const objType& obj, const int objecttype = 0){ - - if(objecttype==1){ - if constexpr (requires {obj.posZ(); }) { - if(!pass){ - histos.fill(HIST("hPosZ_BC" ), obj.posZ()); - histos.fill(HIST("hcentFT0C_BC" ), obj.centFT0C()); - } else { - histos.fill(HIST("hPosZ_AC" ), obj.posZ()); - histos.fill(HIST("hcentFT0C_AC" ), obj.centFT0C()); - } + void fillQA(const bool pass, const objType& obj, const int objecttype = 0) + { + + if (objecttype == 1) { + if constexpr (requires { obj.posZ(); }) { + if (!pass) { + histos.fill(HIST("hPosZ_BC"), obj.posZ()); + histos.fill(HIST("hcentFT0C_BC"), obj.centFT0C()); + } else { + histos.fill(HIST("hPosZ_AC"), obj.posZ()); + histos.fill(HIST("hcentFT0C_AC"), obj.centFT0C()); + } } } - if constexpr (requires {obj.tpcCrossedRowsOverFindableCls(); }) { - if(objecttype==2){ - if(!pass){ - histos.fill(HIST("hDCArToPv_BC" ), obj.dcaXY()); - histos.fill(HIST("hDCAzToPv_BC" ), obj.dcaZ()); - histos.fill(HIST("hIsPrim_BC" ), obj.isPrimaryTrack()); - histos.fill(HIST("hIsGood_BC" ), obj.isGlobalTrackWoDCA()); - histos.fill(HIST("hIsPrimCont_BC" ), obj.isPVContributor()); - histos.fill(HIST("hFindableTPCClusters_BC" ), obj.tpcNClsFindable()); - histos.fill(HIST("hFindableTPCRows_BC" ), obj.tpcNClsCrossedRows()); - histos.fill(HIST("hClustersVsRows_BC" ), obj.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("hTPCChi2_BC" ), obj.tpcChi2NCl()); - } else { - histos.fill(HIST("hDCArToPv_AC" ), obj.dcaXY()); - histos.fill(HIST("hDCAzToPv_AC" ), obj.dcaZ()); - histos.fill(HIST("hIsPrim_AC" ), obj.isPrimaryTrack()); - histos.fill(HIST("hIsGood_AC" ), obj.isGlobalTrackWoDCA()); - histos.fill(HIST("hIsPrimCont_AC" ), obj.isPVContributor()); - histos.fill(HIST("hFindableTPCClusters_AC" ), obj.tpcNClsFindable()); - histos.fill(HIST("hFindableTPCRows_AC" ), obj.tpcNClsCrossedRows()); - histos.fill(HIST("hClustersVsRows_AC" ), obj.tpcCrossedRowsOverFindableCls()); - histos.fill(HIST("hTPCChi2_AC" ), obj.tpcChi2NCl()); - } + if constexpr (requires { obj.tpcCrossedRowsOverFindableCls(); }) { + if (objecttype == 2) { + if (!pass) { + histos.fill(HIST("hDCArToPv_BC"), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_BC"), obj.dcaZ()); + histos.fill(HIST("hIsPrim_BC"), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_BC"), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_BC"), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_BC"), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_BC"), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_BC"), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_BC"), obj.tpcChi2NCl()); + } else { + histos.fill(HIST("hDCArToPv_AC"), obj.dcaXY()); + histos.fill(HIST("hDCAzToPv_AC"), obj.dcaZ()); + histos.fill(HIST("hIsPrim_AC"), obj.isPrimaryTrack()); + histos.fill(HIST("hIsGood_AC"), obj.isGlobalTrackWoDCA()); + histos.fill(HIST("hIsPrimCont_AC"), obj.isPVContributor()); + histos.fill(HIST("hFindableTPCClusters_AC"), obj.tpcNClsFindable()); + histos.fill(HIST("hFindableTPCRows_AC"), obj.tpcNClsCrossedRows()); + histos.fill(HIST("hClustersVsRows_AC"), obj.tpcCrossedRowsOverFindableCls()); + histos.fill(HIST("hTPCChi2_AC"), obj.tpcChi2NCl()); + } } - if(objecttype==3){ - if(!pass){ - histos.fill(HIST("hTPC_nSigma_BC" ), obj.tpcNSigmaKa()); - histos.fill(HIST("hTOF_nSigma_BC" ), obj.tofNSigmaKa()); - histos.fill(HIST("hTPC_nSigma_v_pt_BC" ), obj.tpcNSigmaKa(), obj.pt()); - histos.fill(HIST("hTOF_nSigma_v_pt_BC" ), obj.tofNSigmaKa(), obj.pt()); - } else { - histos.fill(HIST("hTPC_nSigma_AC" ), obj.tpcNSigmaKa()); - histos.fill(HIST("hTOF_nSigma_AC" ), obj.tofNSigmaKa()); - histos.fill(HIST("hTPC_nSigma_v_pt_AC" ), obj.tpcNSigmaKa(), obj.pt()); - histos.fill(HIST("hTOF_nSigma_v_pt_AC" ), obj.tofNSigmaKa(), obj.pt()); - } + if (objecttype == 3) { + if (!pass) { + histos.fill(HIST("hTPC_nSigma_BC"), obj.tpcNSigmaKa()); + histos.fill(HIST("hTOF_nSigma_BC"), obj.tofNSigmaKa()); + histos.fill(HIST("hTPC_nSigma_v_pt_BC"), obj.tpcNSigmaKa(), obj.pt()); + histos.fill(HIST("hTOF_nSigma_v_pt_BC"), obj.tofNSigmaKa(), obj.pt()); + } else { + histos.fill(HIST("hTPC_nSigma_AC"), obj.tpcNSigmaKa()); + histos.fill(HIST("hTOF_nSigma_AC"), obj.tofNSigmaKa()); + histos.fill(HIST("hTPC_nSigma_v_pt_AC"), obj.tpcNSigmaKa(), obj.pt()); + histos.fill(HIST("hTOF_nSigma_v_pt_AC"), obj.tofNSigmaKa(), obj.pt()); + } } } }; //***********************************// - //evsel + // evsel template - std::pair eventSelection(const EventType event, const bool QA) + std::pair eventSelection(const EventType event, const bool QA) { - if (cfg_Track_CutQA && QA) - fillQA(false,event,1); + if (cfg_Track_CutQA && QA) + fillQA(false, event, 1); if (!event.sel8()) - return {false,1}; + return {false, 1}; if (std::abs(event.posZ()) > cfg_Event_VtxCut) - return {false,2}; + return {false, 2}; if (cfg_Event_Timeframe && (!event.selection_bit(aod::evsel::kNoTimeFrameBorder) || !event.selection_bit(aod::evsel::kNoITSROFrameBorder))) - return {false,3}; + return {false, 3}; if (cfg_Event_Timerange && (!event.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) - return {false,4}; + return {false, 4}; if (cfg_Event_Pileup && (!event.selection_bit(aod::evsel::kNoSameBunchPileup) || !event.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) - return {false,5}; + return {false, 5}; if (cfg_Event_Centrality && (event.centFT0C() > cfg_Event_CentralityMax)) - return {false,6}; + return {false, 6}; if (cfg_Event_OccupancyCut && (event.trackOccupancyInTimeRange() > cfg_Event_MaxOccupancy)) - return {false,7}; + return {false, 7}; - if (cfg_Track_CutQA && QA) - fillQA(true,event,1); + if (cfg_Track_CutQA && QA) + fillQA(true, event, 1); - return {true,8}; + return {true, 8}; }; - //tracksel + // tracksel template bool trackSelection(const TrackType track, const bool QA) { - if (cfg_Track_CutQA && QA) - fillQA(false,track,2); - + if (cfg_Track_CutQA && QA) + fillQA(false, track, 2); + // basic track cuts if (track.pt() < cfg_Track_MinPt) return false; @@ -333,162 +337,160 @@ struct phiOO{ if (cfg_Track_ConnectedToPV && !track.isPVContributor()) return false; - if (cfg_Track_CutQA && QA) - fillQA(true,track,2); + if (cfg_Track_CutQA && QA) + fillQA(true, track, 2); return true; }; - //trackpid - + // trackpid + template bool trackPIDKaon(const TrackPID& candidate, const bool QA) { bool tpcPIDPassed{false}, tofPIDPassed{false}; - - if (cfg_Track_CutQA && QA) - fillQA(false,candidate,3); - if(!cfg_Track_TPCPID) { - tpcPIDPassed=true; + if (cfg_Track_CutQA && QA) + fillQA(false, candidate, 3); + + if (!cfg_Track_TPCPID) { + tpcPIDPassed = true; } else { if (std::abs(candidate.tpcNSigmaKa()) < cfg_Track_TPCPID_nSig) - tpcPIDPassed = true; + tpcPIDPassed = true; } - if(!cfg_Track_TOFPID){ - tofPIDPassed=true; + if (!cfg_Track_TOFPID) { + tofPIDPassed = true; } else { if (candidate.hasTOF()) { - if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) { - tofPIDPassed = true; - } + if (std::abs(candidate.tofNSigmaKa()) < cfg_Track_TOFPID_nSig) { + tofPIDPassed = true; + } } else if (!cfg_Track_Hard_TOFPID) { - tofPIDPassed = true; + tofPIDPassed = true; } if (!candidate.hasTOF()) { - std::cout< - void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix){ + void TrackSlicing(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) + { auto slicedtracks1 = PosKaon->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto slicedtracks2 = NegKaon->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { - auto [Minv,PhiPt] = minvReconstruction(track1, track2, QA); - if(Minv<0) - continue; - double conjugate = track1.sign()*track2.sign(); - if(!IsMix){ - if(conjugate<0){ - histos.fill(HIST("hUSS"),centrality,Minv,PhiPt); - } else if (conjugate>0) { - histos.fill(HIST("hLSS"),centrality,Minv,PhiPt); - } - } - else{ - if(conjugate<0){ - histos.fill(HIST("hUSS_Mix"),centrality,Minv,PhiPt); - } else if (conjugate>0) { - histos.fill(HIST("hLSS_Mix"),centrality,Minv,PhiPt); - } + auto [Minv, PhiPt] = minvReconstruction(track1, track2, QA); + if (Minv < 0) + continue; + double conjugate = track1.sign() * track2.sign(); + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hUSS"), centrality, Minv, PhiPt); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS"), centrality, Minv, PhiPt); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hUSS_Mix"), centrality, Minv, PhiPt); + } else if (conjugate > 0) { + histos.fill(HIST("hLSS_Mix"), centrality, Minv, PhiPt); + } } } - }//TrackSlicing + } // TrackSlicing template - void TrackSlicing_MC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix){ + void TrackSlicing_MC(const CollisionType& collision1, const TracksType&, const CollisionType& collision2, const TracksType&, const bool QA, const bool IsMix) + { auto slicedtracks1 = PosKaon_MC->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); auto slicedtracks2 = NegKaon_MC->sliceByCached(aod::track::collisionId, collision2.globalIndex(), cache); auto centrality = collision1.centFT0C(); for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(slicedtracks1, slicedtracks2))) { - auto [Minv,PhiPt] = minvReconstruction(track1, track2, QA); - if(Minv<0) - continue; - double conjugate = track1.sign()*track2.sign(); - if(!IsMix){ - if(conjugate<0){ - histos.fill(HIST("hMC_USS"),centrality,Minv,PhiPt); - } else if (conjugate>0) { - histos.fill(HIST("hMC_LSS"),centrality,Minv,PhiPt); - } - } - else{ - if(conjugate<0){ - histos.fill(HIST("hMC_USS_Mix"),centrality,Minv,PhiPt); - } else if (conjugate>0) { - histos.fill(HIST("hMC_LSS_Mix"),centrality,Minv,PhiPt); - } + auto [Minv, PhiPt] = minvReconstruction(track1, track2, QA); + if (Minv < 0) + continue; + double conjugate = track1.sign() * track2.sign(); + if (!IsMix) { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS"), centrality, Minv, PhiPt); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS"), centrality, Minv, PhiPt); + } + } else { + if (conjugate < 0) { + histos.fill(HIST("hMC_USS_Mix"), centrality, Minv, PhiPt); + } else if (conjugate > 0) { + histos.fill(HIST("hMC_LSS_Mix"), centrality, Minv, PhiPt); + } } - //now we do mc true + // now we do mc true if (!track1.has_mcParticle() || !track2.has_mcParticle()) - continue; + continue; auto part1 = track1.mcParticle(); auto part2 = track2.mcParticle(); if (std::fabs(part1.pdgCode()) != 321) - continue; // Not Kaon + continue; // Not Kaon if (std::fabs(part2.pdgCode()) != 321) - continue; // Not Kaon + continue; // Not Kaon if (!part1.has_mothers()) - continue; // Not decaying Kaon + continue; // Not decaying Kaon if (!part2.has_mothers()) - continue; // Not decaying Kaon + continue; // Not decaying Kaon std::vector mothers1{}; std::vector mothers1PDG{}; for (auto& part1_mom : part1.template mothers_as()) { - mothers1.push_back(part1_mom.globalIndex()); - mothers1PDG.push_back(part1_mom.pdgCode()); + mothers1.push_back(part1_mom.globalIndex()); + mothers1PDG.push_back(part1_mom.pdgCode()); } std::vector mothers2{}; std::vector mothers2PDG{}; for (auto& part2_mom : part2.template mothers_as()) { - mothers2.push_back(part2_mom.globalIndex()); - mothers2PDG.push_back(part2_mom.pdgCode()); + mothers2.push_back(part2_mom.globalIndex()); + mothers2PDG.push_back(part2_mom.pdgCode()); } - - if (mothers1PDG[0] != 333) - continue; // mother not phi - if (mothers2PDG[0] != 333) - continue; // mother not phi - + + if (mothers1PDG[0] != 333) + continue; // mother not phi + if (mothers2PDG[0] != 333) + continue; // mother not phi + if (mothers1[0] != mothers2[0]) - continue; // Kaons not from the same phi - - histos.fill(HIST("hMC_USS_True"),centrality,Minv,PhiPt); - } - }//TrackSlicing + continue; // Kaons not from the same phi + histos.fill(HIST("hMC_USS_True"), centrality, Minv, PhiPt); + } + } // TrackSlicing - - //Invariant mass + // Invariant mass template - std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) + std::pair minvReconstruction(const TracksType& trk1, const TracksType& trk2, const bool QA) { TLorentzVector lDecayDaughter1, lDecayDaughter2, lResonance; //==================================================== - if (!trackSelection(trk1,QA) || !trackSelection(trk2,false)) - return {-1.0,-1.0}; + if (!trackSelection(trk1, QA) || !trackSelection(trk2, false)) + return {-1.0, -1.0}; - if(cfg_Track_Explicit_PID){ + if (cfg_Track_Explicit_PID) { if (!trackPIDKaon(trk1, QA) || !trackPIDKaon(trk2, false)) - return {-1.0,-1.0}; + return {-1.0, -1.0}; } - + if (trk1.globalIndex() >= trk2.globalIndex()) - return {-1.0,-1.0}; + return {-1.0, -1.0}; lDecayDaughter1.SetXYZM(trk1.px(), trk1.py(), trk1.pz(), massKa); lDecayDaughter2.SetXYZM(trk2.px(), trk2.py(), trk2.pz(), massKa); @@ -498,168 +500,170 @@ struct phiOO{ } // MinvReconstruction //***************// - //DATA + // DATA //***************// - + int nEvents = 0; - void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks){ + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& tracks) + { if (cDebugLevel > 0) { ++nEvents; if (nEvents % 10000 == 0) { std::cout << "Processed Data Events: " << nEvents << std::endl; } } - - auto [goodEv, code] = eventSelection(collision,true); + + auto [goodEv, code] = eventSelection(collision, true); histos.fill(HIST("hnEvents"), code); if (!goodEv) return; - TrackSlicing(collision,tracks,collision,tracks,true,false); - - }//end of process + TrackSlicing(collision, tracks, collision, tracks, true, false); + + } // end of process PROCESS_SWITCH(phiOO, processSameEvent, "Process Same events", true); //***************// - //DATA (MIX) + // DATA (MIX) //***************// - int nEvents_Mix = 0; - void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks){ + int nEvents_Mix = 0; + void processMixedEvent(EventCandidates const& collisions, TrackCandidates const& tracks) + { auto tracksTuple = std::make_tuple(tracks); BinningTypeVtxCent colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; - + for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { - ++nEvents_Mix; - if (nEvents_Mix % 10000 == 0) { - std::cout << "Processed Mixed Events: " << nEvents_Mix << std::endl; - } + ++nEvents_Mix; + if (nEvents_Mix % 10000 == 0) { + std::cout << "Processed Mixed Events: " << nEvents_Mix << std::endl; + } } - auto [goodEv1, code1] = eventSelection(collision1,false); - auto [goodEv2, code2] = eventSelection(collision2,false); + auto [goodEv1, code1] = eventSelection(collision1, false); + auto [goodEv2, code2] = eventSelection(collision2, false); if (!goodEv1 || !goodEv2) - continue; - TrackSlicing(collision1,tracks1,collision2,tracks2,false,true); - }//mixing - }//end of process + continue; + TrackSlicing(collision1, tracks1, collision2, tracks2, false, true); + } // mixing + } // end of process PROCESS_SWITCH(phiOO, processMixedEvent, "Process Mixed events", false); - - //***************// - //RECONSTRUCTED MC + + //***************// + // RECONSTRUCTED MC //***************// int nEvents_MC = 0; - void processSameEvent_MC(EventCandidates::iterator const& collision, TrackCandidates_MC const& tracks, aod::McParticles const&){ + void processSameEvent_MC(EventCandidates::iterator const& collision, TrackCandidates_MC const& tracks, aod::McParticles const&) + { if (cDebugLevel > 0) { ++nEvents_MC; if (nEvents_MC % 10000 == 0) { std::cout << "Processed MC (REC) Events: " << nEvents_MC << std::endl; } } - - auto [goodEv, code] = eventSelection(collision,true); + + auto [goodEv, code] = eventSelection(collision, true); histos.fill(HIST("hnEvents_MC"), code); if (!goodEv) return; - TrackSlicing_MC(collision,tracks,collision,tracks,true,false); - - }//end of process + TrackSlicing_MC(collision, tracks, collision, tracks, true, false); + + } // end of process PROCESS_SWITCH(phiOO, processSameEvent_MC, "Process Same events (MC)", true); - - //***************// - //RECONSTRUCTED MC (MIX) + + //***************// + // RECONSTRUCTED MC (MIX) //***************// - int nEvents_MC_Mix = 0; - void processMixedEvent_MC(EventCandidates const& collisions, TrackCandidates_MC const& tracks, aod::McParticles const&){ + int nEvents_MC_Mix = 0; + void processMixedEvent_MC(EventCandidates const& collisions, TrackCandidates_MC const& tracks, aod::McParticles const&) + { auto tracksTuple = std::make_tuple(tracks); BinningTypeVtxCent colBinning{{cfg_bins_MixVtx, cfg_bins_MixMult}, true}; SameKindPair pairs{colBinning, cfg_Mix_NMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pairs) { if (cDebugLevel > 0) { - ++nEvents_MC_Mix; - if (nEvents_MC_Mix % 10000 == 0) { - std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; - } + ++nEvents_MC_Mix; + if (nEvents_MC_Mix % 10000 == 0) { + std::cout << "Processed Mixed Events: " << nEvents_MC_Mix << std::endl; + } } - auto [goodEv1, code1] = eventSelection(collision1,false); - auto [goodEv2, code2] = eventSelection(collision2,false); + auto [goodEv1, code1] = eventSelection(collision1, false); + auto [goodEv2, code2] = eventSelection(collision2, false); if (!goodEv1 || !goodEv2) - continue; - TrackSlicing_MC(collision1,tracks1,collision2,tracks2,false,true); - }//mixing - }//end of process + continue; + TrackSlicing_MC(collision1, tracks1, collision2, tracks2, false, true); + } // mixing + } // end of process PROCESS_SWITCH(phiOO, processMixedEvent_MC, "Process Mixed events (MC)", false); - //***************// - //GENERATED MC - //***************// + //***************// + // GENERATED MC + //***************// - int nEvents_True = 0; - void processParticles(EventCandidates_True::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& particles){ + int nEvents_True = 0; + void processParticles(EventCandidates_True::iterator const& collision, soa::SmallGroups> const& recocolls, aod::McParticles const& particles) + { if (cDebugLevel > 0) { ++nEvents_True; if (nEvents_True % 10000 == 0) { std::cout << "Processed MC (GEN) Events: " << nEvents_True << std::endl; } } - + if (fabs(collision.posZ()) > cfg_Event_VtxCut) return; - if (recocolls.size() <= 0){ // not reconstructed - if(cfg_Force_GenReco){ - return; - } + if (recocolls.size() <= 0) { // not reconstructed + if (cfg_Force_GenReco) { + return; + } } double centrality; for (auto& recocoll : recocolls) { // poorly reconstructed centrality = recocoll.centFT0C(); - auto [goodEv, code] = eventSelection(recocoll,false); + auto [goodEv, code] = eventSelection(recocoll, false); histos.fill(HIST("hnEvents_MC_True"), code); if (!goodEv) - return; + return; } - for(auto& particle : particles) { - if(particle.pdgCode()!=333) - continue; - if(std::fabs(particle.eta())> cfg_Track_MaxEta) - continue; - - if(cfg_Force_BR){ - bool baddecay = false; - for (auto& phidaughter : particle.daughters_as()) { - if(std::fabs(phidaughter.pdgCode())!=321) { - baddecay=true; - break; - } - if(cfg_Force_Kaon_Acceptence){ - if(std::fabs(phidaughter.eta())> cfg_Track_MaxEta) { - baddecay=true; - break; - } - } - }//loop over daughters - - if(baddecay) - continue; - }//enforce BR restriction - - histos.fill(HIST("hMC_Phi_True"),centrality,particle.pt()); - }//loop over particles - - }//end of process + for (auto& particle : particles) { + if (particle.pdgCode() != 333) + continue; + if (std::fabs(particle.eta()) > cfg_Track_MaxEta) + continue; + + if (cfg_Force_BR) { + bool baddecay = false; + for (auto& phidaughter : particle.daughters_as()) { + if (std::fabs(phidaughter.pdgCode()) != 321) { + baddecay = true; + break; + } + if (cfg_Force_Kaon_Acceptence) { + if (std::fabs(phidaughter.eta()) > cfg_Track_MaxEta) { + baddecay = true; + break; + } + } + } // loop over daughters + + if (baddecay) + continue; + } // enforce BR restriction + + histos.fill(HIST("hMC_Phi_True"), centrality, particle.pt()); + } // loop over particles + + } // end of process PROCESS_SWITCH(phiOO, processParticles, "Process Particles", false); - - }; // end of main struct - WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)};