diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 02cab44cb2b..10e997f7ed4 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -50,7 +50,7 @@ namespace aod namespace hf_reduced_collision { DECLARE_SOA_COLUMN(Bz, bz, float); //! Magnetic field in z-direction -DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, uint16_t); //! Bitmask with failed selection criteria +DECLARE_SOA_COLUMN(HfCollisionRejectionMap, hfCollisionRejectionMap, uint32_t); //! Bitmask with failed selection criteria // keep track of the number of studied events (for normalization purposes) DECLARE_SOA_COLUMN(OriginalCollisionCount, originalCollisionCount, int); //! Size of COLLISION table processed DECLARE_SOA_COLUMN(ZvtxSelectedCollisionCount, zvtxSelectedCollisionCount, int); //! Number of COLLISIONS with |zvtx| < zvtxMax diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index fde8c3b553e..5470de035b0 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1258,7 +1258,7 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx index a424d95d95b..36deb224116 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmResoReduced.cxx @@ -1307,7 +1307,7 @@ struct HfDataCreatorCharmResoReduced { } registry.fill(HIST("hEvents"), 1 + Event::DV0Selected); float centrality = -1.f; - uint16_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); // fill collision table if it contains a DPi pair a minima hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); } // end of runDataCreation function diff --git a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx index 6a090bfd2ed..65608d34ffe 100644 --- a/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx +++ b/PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx @@ -343,7 +343,7 @@ struct HfTaskFlowCharmHadrons { /// Get the event selection flags /// \param hfevselflag is the event selection flag - std::vector getEventSelectionFlags(uint16_t hfevselflag) + std::vector getEventSelectionFlags(uint32_t hfevselflag) { return { TESTBIT(hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup), @@ -373,7 +373,7 @@ struct HfTaskFlowCharmHadrons { float& sp, std::vector& outputMl, float& occupancy, - uint16_t& hfevselflag) + uint32_t& hfevselflag) { if (occEstimator != 0) { std::vector evtSelFlags = getEventSelectionFlags(hfevselflag); @@ -491,7 +491,7 @@ struct HfTaskFlowCharmHadrons { return; } float occupancy = 0.; - uint16_t hfevflag{}; + uint32_t hfevflag{}; if (occEstimator != 0) { occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); @@ -784,7 +784,7 @@ struct HfTaskFlowCharmHadrons { float occupancy{-1.f}; occupancy = getOccupancyColl(collision, occEstimator); registry.fill(HIST("trackOccVsFT0COcc"), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); - uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t hfevflag = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); std::vector evtSelFlags = getEventSelectionFlags(hfevflag); registry.fill(HIST("spReso/hSparseReso"), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a, xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot, diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 83b9a594912..4280dbb94a6 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -39,6 +39,7 @@ namespace o2::aod { // Table aliases +using BcFullInfos = soa::Join; using TracksWCov = soa::Join; using TracksWDca = soa::Join; @@ -191,7 +192,7 @@ DECLARE_SOA_TABLE(PidTpcTofTinyPr, "AOD", "PIDTPCTOFTINYPR", //! Table of the TP namespace hf_sel_collision { -DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, uint16_t); //! +DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, uint32_t); //! } // namespace hf_sel_collision DECLARE_SOA_TABLE(HfSelCollision, "AOD", "HFSELCOLLISION", //! diff --git a/PWGHF/TableProducer/CMakeLists.txt b/PWGHF/TableProducer/CMakeLists.txt index 2ec33b5d134..aa94cea8c22 100644 --- a/PWGHF/TableProducer/CMakeLists.txt +++ b/PWGHF/TableProducer/CMakeLists.txt @@ -13,7 +13,7 @@ o2physics_add_dpl_workflow(track-index-skim-creator SOURCES trackIndexSkimCreator.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing O2::DCAFitter O2Physics::AnalysisCCDB O2Physics::MLCore O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing O2::DCAFitter O2Physics::AnalysisCCDB O2Physics::MLCore O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) # Helpers @@ -37,12 +37,12 @@ o2physics_add_dpl_workflow(mc-pid-tof o2physics_add_dpl_workflow(candidate-creator-2prong SOURCES candidateCreator2Prong.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-3prong SOURCES candidateCreator3Prong.cxx - PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::EventFilteringUtils O2Physics::SGCutParHolder COMPONENT_NAME Analysis) o2physics_add_dpl_workflow(candidate-creator-b0 diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index 7396a0b6f0f..851fa76c33d 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -112,18 +112,20 @@ struct HfCandidateCreator2Prong { void init(InitContext const&) { - std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, + std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, doprocessPvRefitWithDCAFitterNCentFT0C, doprocessNoPvRefitWithDCAFitterNCentFT0C, - doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M}; - std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, + doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M, doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc}; + std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, doprocessPvRefitWithKFParticleCentFT0C, doprocessNoPvRefitWithKFParticleCentFT0C, - doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M}; + doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc}; if ((std::accumulate(doprocessDF.begin(), doprocessDF.end(), 0) + std::accumulate(doprocessKF.begin(), doprocessKF.end(), 0)) != 1) { LOGP(fatal, "One and only one process function must be enabled at a time."); } - std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M}; + std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M, doprocessCollisionsUpc}; const int nProcessesCollisions = std::accumulate(processesCollisions.begin(), processesCollisions.end(), 0); + std::array processesUpc = {doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc, doprocessCollisionsUpc}; + const int nProcessesUpc = std::accumulate(processesUpc.begin(), processesUpc.end(), 0); if (nProcessesCollisions > 1) { LOGP(fatal, "At most one process function for collision monitoring can be enabled at a time."); } @@ -137,6 +139,12 @@ struct HfCandidateCreator2Prong { if ((doprocessPvRefitWithDCAFitterNCentFT0M || doprocessNoPvRefitWithDCAFitterNCentFT0M || doprocessPvRefitWithKFParticleCentFT0M || doprocessNoPvRefitWithKFParticleCentFT0M) && !doprocessCollisionsCentFT0M) { LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisionsCentFT0M\"?"); } + if ((doprocessPvRefitWithDCAFitterNUpc || doprocessNoPvRefitWithDCAFitterNUpc || doprocessPvRefitWithKFParticleUpc || doprocessNoPvRefitWithKFParticleUpc) && !doprocessCollisionsUpc) { + LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisionsUpc\"?"); + } + } + if (nProcessesUpc > 0 && isRun2) { + LOGP(fatal, "Process function for UPC is only available in Run 3!"); } // histograms @@ -185,11 +193,11 @@ struct HfCandidateCreator2Prong { setLabelHistoCands(hCandidates); } - template + template void runCreator2ProngWithDCAFitterN(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCsType const& bcs) { // loop over pairs of track indices for (const auto& rowTrackIndexProng2 : rowsTrackIndexProng2) { @@ -197,7 +205,12 @@ struct HfCandidateCreator2Prong { /// reject candidates not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t rejectionMask{0}; + if constexpr (applyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -211,7 +224,7 @@ struct HfCandidateCreator2Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -333,11 +346,11 @@ struct HfCandidateCreator2Prong { } } - template + template void runCreator2ProngWithKFParticle(Coll const&, CandType const& rowsTrackIndexProng2, TTracks const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCsType const& bcs) { for (const auto& rowTrackIndexProng2 : rowsTrackIndexProng2) { @@ -345,7 +358,12 @@ struct HfCandidateCreator2Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng2.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t rejectionMask{0}; + if constexpr (applyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -357,7 +375,7 @@ struct HfCandidateCreator2Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -497,7 +515,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter w/ PV refit and w/o centrality selections", false); @@ -507,7 +525,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter w/o PV refit and w/o centrality selections", true); @@ -517,7 +535,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticle, "Run candidate creator using KFParticle package w/ PV refit and w/o centrality selections", false); @@ -527,7 +545,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticle, "Run candidate creator using KFParticle package w/o PV refit and w/o centrality selections", false); @@ -543,7 +561,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on FT0C", false); @@ -553,7 +571,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection FT0C", false); @@ -563,7 +581,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on FT0C", false); @@ -573,7 +591,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package w/o PV refit and w/ centrality selection on FT0C", false); @@ -589,7 +607,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on FT0M", false); @@ -599,7 +617,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection FT0M", false); @@ -609,7 +627,7 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on FT0M", false); @@ -619,10 +637,72 @@ struct HfCandidateCreator2Prong { TracksWCovExtraPidPiKa const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package w/o PV refit and w/ centrality selection on FT0M", false); + ///////////////////////////////////////////// + /// /// + /// with centrality selection on UPC /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithDCAFitterNUpc(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNUpc, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on UltraPeripheral Collision", false); + + /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection UPC + void processNoPvRefitWithDCAFitterNUpc(soa::Join const& collisions, + aod::Hf2Prongs const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithDCAFitterN(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNUpc, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection UltraPeripheral Collision", false); + + /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithKFParticleUpc(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleUpc, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on UltraPeripheral Collision", false); + + /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections on UPC + void processNoPvRefitWithKFParticleUpc(soa::Join const& collisions, + aod::Hf2Prongs const& rowsTrackIndexProng2, + TracksWCovExtraPidPiKa const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator2ProngWithKFParticle(collisions, rowsTrackIndexProng2, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithKFParticleUpc, "Run candidate creator using KFParticle package w/o PV refit and w/ centrality selection on UltraPeripheral Collision", false); + /////////////////////////////////////////////////////////// /// /// /// Process functions only for collision monitoring /// @@ -682,6 +762,29 @@ struct HfCandidateCreator2Prong { } /// end loop over collisions } PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsCentFT0M, "Collision monitoring - FT0M centrality", false); + + /// @brief process function to monitor collisions - UPC collision + void processCollisionsUpc(soa::Join const& collisions, + aod::BcFullInfos const& bcs, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + /// loop over collisions + for (const auto& collision : collisions) { + + /// bitmask with event. selection info + float centrality{-1.f}; + float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + + /// monitor the satisfied event selections + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); + + } /// end loop over collisions + } + PROCESS_SWITCH(HfCandidateCreator2Prong, processCollisionsUpc, "Collision monitoring - UPC", false); }; /// Extends the base table with expression columns. diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 3460ff0a8a3..40ab5709951 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -136,18 +136,21 @@ struct HfCandidateCreator3Prong { void init(InitContext const&) { - std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, + std::array doprocessDF{doprocessPvRefitWithDCAFitterN, doprocessNoPvRefitWithDCAFitterN, doprocessPvRefitWithDCAFitterNCentFT0C, doprocessNoPvRefitWithDCAFitterNCentFT0C, - doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M}; - std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, + doprocessPvRefitWithDCAFitterNCentFT0M, doprocessNoPvRefitWithDCAFitterNCentFT0M, doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc}; + std::array doprocessKF{doprocessPvRefitWithKFParticle, doprocessNoPvRefitWithKFParticle, doprocessPvRefitWithKFParticleCentFT0C, doprocessNoPvRefitWithKFParticleCentFT0C, - doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M}; + doprocessPvRefitWithKFParticleCentFT0M, doprocessNoPvRefitWithKFParticleCentFT0M, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc}; if ((std::accumulate(doprocessDF.begin(), doprocessDF.end(), 0) + std::accumulate(doprocessKF.begin(), doprocessKF.end(), 0)) != 1) { LOGP(fatal, "One and only one process function must be enabled at a time."); } - - std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M}; + std::array processesCollisions = {doprocessCollisions, doprocessCollisionsCentFT0C, doprocessCollisionsCentFT0M, doprocessCollisionsUpc}; const int nProcessesCollisions = std::accumulate(processesCollisions.begin(), processesCollisions.end(), 0); + + std::array processesUpc = {doprocessPvRefitWithDCAFitterNUpc, doprocessNoPvRefitWithDCAFitterNUpc, doprocessPvRefitWithKFParticleUpc, doprocessNoPvRefitWithKFParticleUpc, doprocessCollisionsUpc}; + const int nProcessesUpc = std::accumulate(processesUpc.begin(), processesUpc.end(), 0); + if (nProcessesCollisions > 1) { LOGP(fatal, "At most one process function for collision monitoring can be enabled at a time."); } @@ -161,8 +164,13 @@ struct HfCandidateCreator3Prong { if ((doprocessPvRefitWithDCAFitterNCentFT0M || doprocessNoPvRefitWithDCAFitterNCentFT0M || doprocessPvRefitWithKFParticleCentFT0M || doprocessNoPvRefitWithKFParticleCentFT0M) && !doprocessCollisionsCentFT0M) { LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisionsCentFT0M\"?"); } + if ((doprocessPvRefitWithDCAFitterNUpc || doprocessNoPvRefitWithDCAFitterNUpc || doprocessPvRefitWithKFParticleUpc || doprocessNoPvRefitWithKFParticleUpc) && !doprocessCollisionsUpc) { + LOGP(fatal, "Process function for collision monitoring not correctly enabled. Did you enable \"processCollisionsUpc\"?"); + } + } + if (nProcessesUpc > 0 && isRun2) { + LOGP(fatal, "Process function for UPC is only available in Run 3!"); } - std::array creationFlags = {createDplus, createDs, createLc, createXic}; if (std::accumulate(creationFlags.begin(), creationFlags.end(), 0) == 0) { LOGP(fatal, "At least one particle specie should be enabled for the creation."); @@ -236,11 +244,11 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithDCAFitterN(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCsType const& bcs) { // loop over triplets of track indices for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { @@ -248,7 +256,12 @@ struct HfCandidateCreator3Prong { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t rejectionMask{0}; + if constexpr (applyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -264,7 +277,7 @@ struct HfCandidateCreator3Prong { /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, /// but this is not true when running on Run2 data/MC already converted into AO2Ds. - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); if (runNumber != bc.runNumber()) { LOG(info) << ">>>>>>>>>>>> Current run number: " << runNumber; initCCDB(bc, runNumber, ccdb, isRun2 ? ccdbPathGrp : ccdbPathGrpMag, nullptr, isRun2); @@ -404,17 +417,22 @@ struct HfCandidateCreator3Prong { } } - template + template void runCreator3ProngWithKFParticle(Coll const&, Cand const& rowsTrackIndexProng3, TracksWCovExtraPidPiKaPr const&, - aod::BCsWithTimestamps const& /*bcWithTimeStamps*/) + BCsType const& bcs) { for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { /// reject candidates in collisions not satisfying the event selections auto collision = rowTrackIndexProng3.template collision_as(); float centrality{-1.f}; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t rejectionMask{0}; + if constexpr (applyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + } if (rejectionMask != 0) { /// at least one event selection not satisfied --> reject the candidate continue; @@ -654,7 +672,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter with PV refit and w/o centrality selections", false); @@ -664,7 +682,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter without PV refit and w/o centrality selections", true); @@ -674,7 +692,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticle, "Run candidate creator using KFParticle package with PV refit and w/o centrality selections", false); @@ -684,7 +702,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticle, "Run candidate creator using KFParticle package without PV refit and w/o centrality selections", false); @@ -700,7 +718,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter with PV refit and w/ centrality selection on FT0C", false); @@ -710,7 +728,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter without PV refit and w/ centrality selection on FT0C", false); @@ -720,7 +738,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package with PV refit and w/ centrality selection on FT0C", false); @@ -730,7 +748,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package without PV refit and w/ centrality selection on FT0C", false); @@ -746,7 +764,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter with PV refit and w/ centrality selection on FT0M", false); @@ -756,7 +774,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter without PV refit and w/ centrality selection on FT0M", false); @@ -766,7 +784,7 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package with PV refit and w/ centrality selection on FT0M", false); @@ -776,10 +794,72 @@ struct HfCandidateCreator3Prong { TracksWCovExtraPidPiKaPr const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package without PV refit and w/ centrality selection on FT0M", false); + ///////////////////////////////////////////// + /// /// + /// with centrality selection on UPC /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithDCAFitterNUpc(soa::Join const& collisions, + FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithDCAFitterNUpc, "Run candidate creator using DCA fitter with PV refit and w/ centrality selection on UPC", false); + + /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection on UPC + void processNoPvRefitWithDCAFitterNUpc(soa::Join const& collisions, + FilteredHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithDCAFitterN(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithDCAFitterNUpc, "Run candidate creator using DCA fitter without PV refit and w/ centrality selection on UPC", false); + + /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on UPC + void processPvRefitWithKFParticleUpc(soa::Join const& collisions, + FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitWithKFParticleUpc, "Run candidate creator using KFParticle package with PV refit and w/ centrality selection on UPC", false); + + /// @brief process function using KFParticle package w/o PV refit and w/ centrality selection on UPC + void processNoPvRefitWithKFParticleUpc(soa::Join const& collisions, + FilteredHf3Prongs const& rowsTrackIndexProng3, + TracksWCovExtraPidPiKaPr const& tracks, + aod::BcFullInfos const& bcWithTimeStamps, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + runCreator3ProngWithKFParticle(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitWithKFParticleUpc, "Run candidate creator using KFParticle package without PV refit and w/ centrality selection on UPC", false); + /////////////////////////////////////////////////////////// /// /// /// Process functions only for collision monitoring /// @@ -839,6 +919,29 @@ struct HfCandidateCreator3Prong { } /// end loop over collisions } PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsCentFT0M, "Collision monitoring - FT0M centrality", false); + + /// @brief process function to monitor collisions - UPC + void processCollisionsUpc(soa::Join const& collisions, + aod::BcFullInfos const& bcs, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + /// loop over collisions + for (const auto& collision : collisions) { + + /// bitmask with event. selection info + float centrality{-1.f}; + float occupancy = getOccupancyColl(collision, OccupancyEstimator::Its); + const auto rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc(collision, centrality, ccdb, registry, bcs); + + /// monitor the satisfied event selections + hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy); + + } /// end loop over collisions + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processCollisionsUpc, "Collision monitoring - UPC", false); }; /// Extends the base table with expression columns. diff --git a/PWGHF/TableProducer/trackIndexSkimCreator.cxx b/PWGHF/TableProducer/trackIndexSkimCreator.cxx index 0f98525ceb1..2c6dfd66343 100644 --- a/PWGHF/TableProducer/trackIndexSkimCreator.cxx +++ b/PWGHF/TableProducer/trackIndexSkimCreator.cxx @@ -108,7 +108,7 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { void init(InitContext const&) { - std::array doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel}; + std::array doProcess = {doprocessTrigAndCentFT0ASel, doprocessTrigAndCentFT0CSel, doprocessTrigAndCentFT0MSel, doprocessTrigAndCentFV0ASel, doprocessTrigSel, doprocessNoTrigSel, doprocessUpcSel}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function for collision selection can be enabled at a time!"); } @@ -132,11 +132,19 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { /// Collision selection /// \param collision collision table with - template - void selectCollision(const Col& collision, const BCs&) + template + void selectCollision(const Col& collision, const BCsType& bcs) { float centrality = -1.; - const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + uint32_t rejectionMask; + + if constexpr (applyUpcSel) { + rejectionMask = hfEvSel.getHfCollisionRejectionMaskWithUpc( + collision, centrality, ccdb, registry, bcs); + } else { + rejectionMask = hfEvSel.getHfCollisionRejectionMask( + collision, centrality, ccdb, registry); + } if (fillHistograms) { hfEvSel.fillHistograms(collision, rejectionMask, centrality); @@ -155,46 +163,69 @@ struct HfTrackIndexSkimCreatorTagSelCollisions { } /// Event selection with trigger and FT0A centrality selection - void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFT0ASel(soa::Join::iterator const& collision, + aod::BcFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0ASel, "Use trigger and centrality selection with FT0A", false); /// Event selection with trigger and FT0C centrality selection - void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFT0CSel(soa::Join::iterator const& collision, + aod::BcFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0CSel, "Use trigger and centrality selection with FT0C", false); /// Event selection with trigger and FT0M centrality selection - void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFT0MSel(soa::Join::iterator const& collision, + aod::BcFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFT0MSel, "Use trigger and centrality selection with FT0M", false); /// Event selection with trigger and FV0A centrality selection - void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigAndCentFV0ASel(soa::Join::iterator const& collision, + aod::BcFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigAndCentFV0ASel, "Use trigger and centrality selection with FV0A", false); /// Event selection with trigger selection - void processTrigSel(soa::Join::iterator const& collision, aod::BCsWithTimestamps const& bcs) + void processTrigSel(soa::Join::iterator const& collision, + aod::BcFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processTrigSel, "Use trigger selection", false); /// Event selection without trigger selection - void processNoTrigSel(aod::Collision const& collision, aod::BCsWithTimestamps const& bcs) + void processNoTrigSel(aod::Collision const& collision, + aod::BcFullInfos const& bcs) { - selectCollision(collision, bcs); + selectCollision(collision, bcs); } PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processNoTrigSel, "Do not use trigger selection", true); + + /// Event selection with UPC + void processUpcSel(soa::Join::iterator const& collision, + aod::BcFullInfos const& bcs, + aod::FT0s const& /*ft0s*/, + aod::FV0As const& /*fv0as*/, + aod::FDDs const& /*fdds*/, + aod::Zdcs const& /*zdcs*/) + { + selectCollision(collision, bcs); + } + PROCESS_SWITCH(HfTrackIndexSkimCreatorTagSelCollisions, processUpcSel, "Use UPC event selection", false); }; /// Track selection @@ -1246,7 +1277,7 @@ struct HfTrackIndexSkimCreator { using FilteredTrackAssocSel = soa::Filtered>; // filter collisions - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); // filter track indices Filter filterSelectTrackIds = ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand2Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::Cand3Prong))) != 0u) || ((aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandDstar))) != 0u); @@ -3058,7 +3089,7 @@ struct HfTrackIndexSkimCreatorCascades { using SelectedCollisions = soa::Filtered>; using FilteredTrackAssocSel = soa::Filtered>; - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandV0bachelor))) != 0u && (config.applyProtonPid == false || (aod::hf_sel_track::isIdentifiedPid & static_cast(BIT(ChannelsProtonPid::LcToPK0S))) != 0u); Preslice trackIndicesPerCollision = aod::track_association::collisionId; @@ -3337,7 +3368,7 @@ struct HfTrackIndexSkimCreatorLfCascades { using CascFull = soa::Join; using V0Full = soa::Join; - Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); + Filter filterSelectCollisions = (aod::hf_sel_collision::whyRejectColl == static_cast(0)); Filter filterSelectTrackIds = (aod::hf_sel_track::isSelProng & static_cast(BIT(CandidateType::CandCascadeBachelor))) != 0u; Preslice tracksPerCollision = aod::track::collisionId; // needed for PV refit diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h index 5d57ffb5eff..27426db230e 100644 --- a/PWGHF/Utils/utilsEvSelHf.h +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -18,11 +18,13 @@ #ifndef PWGHF_UTILS_UTILSEVSELHF_H_ #define PWGHF_UTILS_UTILSEVSELHF_H_ -#include +#include "PWGHF/Core/CentralityEstimation.h" +#include "PWGUD/Core/SGSelector.h" -#include -#include -#include +#include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" +#include "EventFiltering/Zorro.h" +#include "EventFiltering/ZorroSummary.h" #include #include @@ -30,18 +32,18 @@ #include #include -#include +#include +#include + +#include + +#include + #include +#include #include // std::shared_ptr #include // std::string -#include "Common/CCDB/EventSelectionParams.h" -#include "Common/CCDB/RCTSelectionFlags.h" -#include "EventFiltering/Zorro.h" -#include "EventFiltering/ZorroSummary.h" - -#include "PWGHF/Core/CentralityEstimation.h" - namespace o2::hf_occupancy { // centrality selection estimators @@ -103,15 +105,17 @@ enum EventRejection { NoSameBunchPileup, Occupancy, NContrib, - Chi2, - PositionZ, NoCollInTimeRangeNarrow, NoCollInTimeRangeStandard, NoCollInRofStandard, + UpcEventCut, + Chi2, + PositionZ, NEventRejection }; o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""}; +o2::framework::AxisSpec axisUpcEvents = {o2::aod::sgselector::DoubleGap + 1, -0.5f, +o2::aod::sgselector::DoubleGap + 0.5f, ""}; /// \brief Function to put labels on monitoring histogram /// \param hRejection monitoring histogram @@ -128,6 +132,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel hRejection->GetXaxis()->SetBinLabel(EventRejection::TvxTrigger + 1, "TVX Trigger"); hRejection->GetXaxis()->SetBinLabel(EventRejection::TimeFrameBorderCut + 1, "TF border"); hRejection->GetXaxis()->SetBinLabel(EventRejection::ItsRofBorderCut + 1, "ITS ROF border"); + hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event"); hRejection->GetXaxis()->SetBinLabel(EventRejection::IsGoodZvtxFT0vsPV + 1, "PV #it{z} consistency FT0 timing"); hRejection->GetXaxis()->SetBinLabel(EventRejection::NoSameBunchPileup + 1, "No same-bunch pile-up"); // POTENTIALLY BAD FOR BEAUTY ANALYSES hRejection->GetXaxis()->SetBinLabel(EventRejection::Occupancy + 1, "Occupancy"); @@ -172,6 +177,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::Configurable rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"}; o2::framework::Configurable rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"}; + // SG selector + SGSelector sgSelector; + // histogram names static constexpr char NameHistCollisions[] = "hCollisions"; static constexpr char NameHistSelCollisionsCent[] = "hSelCollisionsCent"; @@ -181,8 +189,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { static constexpr char NameHistPosYAfterEvSel[] = "hPosYAfterEvSel"; static constexpr char NameHistNumPvContributorsAfterSel[] = "hNumPvContributorsAfterSel"; static constexpr char NameHistCollisionsCentOcc[] = "hCollisionsCentOcc"; + static constexpr char NameHistUpCollisions[] = "hUpCollisions"; - std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel; + std::shared_ptr hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel, hUpCollisions; std::shared_ptr hCollisionsCentOcc; // util to retrieve the RCT info from CCDB @@ -193,6 +202,21 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { o2::framework::OutputObj zorroSummary{"zorroSummary"}; int currentRun{-1}; + /// Set standard preselection gap trigger (values taken from UD group) + SGCutParHolder setSgPreselection() + { + SGCutParHolder sgCuts; + sgCuts.SetNDtcoll(1); // Minimum number of sigma around the collision + sgCuts.SetMinNBCs(2); // Minimum number of bunch crossings + sgCuts.SetNTracks(2, 1000); // Minimum and maximum number of PV contributors + sgCuts.SetMaxFITtime(34.f); // Maximum FIT time in ns + + // Set FIT amplitudes: FV0, FT0A, FT0C, FDDA, FDDC + sgCuts.SetFITAmpLimits({-1.f, 150.f, 50.f, -1.f, -1.f}); + + return sgCuts; + } + /// \brief Adds collision monitoring histograms in the histogram registry. /// \param registry reference to the histogram registry void addHistograms(o2::framework::HistogramRegistry& registry) @@ -205,7 +229,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { hPosYAfterEvSel = registry.add(NameHistPosYAfterEvSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{200, -0.5, 0.5}}}); hNumPvContributorsAfterSel = registry.add(NameHistNumPvContributorsAfterSel, "selected events;#it{y}_{prim. vtx.} (cm);entries", {o2::framework::HistType::kTH1D, {{500, -0.5, 499.5}}}); setEventRejectionLabels(hCollisions, softwareTrigger); - + hUpCollisions = registry.add(NameHistUpCollisions, "HF UPC counter;;# of UPC events", {o2::framework::HistType::kTH1D, {axisUpcEvents}}); const o2::framework::AxisSpec th2AxisCent{th2ConfigAxisCent, "Centrality"}; const o2::framework::AxisSpec th2AxisOccupancy{th2ConfigAxisOccupancy, "Occupancy"}; hCollisionsCentOcc = registry.add(NameHistCollisionsCentOcc, "selected events;Centrality; Occupancy", {o2::framework::HistType::kTH2D, {th2AxisCent, th2AxisOccupancy}}); @@ -237,10 +261,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { /// \param ccdb ccdb service needed to retrieve the needed info for zorro /// \param registry reference to the histogram registry needed for zorro /// \return bitmask with the event selection criteria not satisfied by the collision - template - uint16_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) + template + uint32_t getHfCollisionRejectionMask(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry) { - uint16_t rejectionMask{0}; // 16 bits, in case new ev. selections will be added + uint32_t rejectionMask{0}; // 32 bits, in case new ev. selections will be added if constexpr (centEstimator != o2::hf_centrality::CentralityEstimator::None) { centrality = o2::hf_centrality::getCentralityColl(collision, centEstimator); @@ -316,7 +340,7 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { if (softwareTrigger.value != "") { // we might have to update it from CCDB - auto bc = collision.template bc_as(); + auto bc = collision.template bc_as(); int runNumber = bc.runNumber(); if (runNumber != currentRun) { // We might need to update Zorro from CCDB if the run number changes @@ -341,11 +365,32 @@ struct HfEventSelection : o2::framework::ConfigurableGroup { return rejectionMask; } + template + uint32_t getHfCollisionRejectionMaskWithUpc(const Coll& collision, float& centrality, o2::framework::Service const& ccdb, o2::framework::HistogramRegistry& registry, const BCsType& bcs) + { + auto rejectionMaskWithUpc = getHfCollisionRejectionMask(collision, centrality, ccdb, registry); + + if (useEvSel) { + SGCutParHolder sgCuts = setSgPreselection(); + auto bc = collision.template foundBC_as(); + auto bcRange = udhelpers::compatibleBCs(collision, sgCuts.NDtcoll(), bcs, sgCuts.minNBCs()); + auto sgSelectionResult = sgSelector.IsSelected(sgCuts, collision, bcRange, bc); + int upcEventType = sgSelectionResult.value; + if (upcEventType > o2::aod::sgselector::DoubleGap) { + SETBIT(rejectionMaskWithUpc, EventRejection::UpcEventCut); + } else { + hUpCollisions->Fill(upcEventType); + } + } + + return rejectionMaskWithUpc; + } + /// \brief Fills histograms for monitoring event selections satisfied by the collision. /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision template - void fillHistograms(Coll const& collision, const uint16_t rejectionMask, float& centrality, float occupancy = -1) + void fillHistograms(Coll const& collision, const uint32_t rejectionMask, float& centrality, float occupancy = -1) { hCollisions->Fill(EventRejection::None); const float posZ = collision.posZ(); @@ -464,9 +509,9 @@ struct HfEventSelectionMc { /// \param centrality centrality variable to be set in this function /// \return a bitmask with the event selections not satisfied by the analysed collision template - uint16_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision, CCs const& collSlice, float& centrality) + uint32_t getHfMcCollisionRejectionMask(TMcColl const& mcCollision, CCs const& collSlice, float& centrality) { - uint16_t rejectionMask{0}; + uint32_t rejectionMask{0}; float zPv = mcCollision.posZ(); auto bc = mcCollision.template bc_as(); @@ -515,7 +560,7 @@ struct HfEventSelectionMc { /// \param collision analysed collision /// \param rejectionMask bitmask storing the info about which ev. selections are not satisfied by the collision template - void fillHistograms(Coll const& mcCollision, const uint16_t rejectionMask, int nSplitColl = 0) + void fillHistograms(Coll const& mcCollision, const uint32_t rejectionMask, int nSplitColl = 0) { hParticles->Fill(EventRejection::None);