From e609a9c218ce043f07137eaf83af5489ef3e9d7e Mon Sep 17 00:00:00 2001 From: Mattia Faggin Date: Wed, 21 Feb 2024 09:35:06 +0100 Subject: [PATCH 1/2] Add centrality selection for 3-prong creator. --- .../TableProducer/candidateCreator3Prong.cxx | 164 +++++++++++++++++- 1 file changed, 156 insertions(+), 8 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 9d9f0947abc..019e35ae2b4 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -34,10 +34,23 @@ using namespace o2::aod::hf_cand_3prong; using namespace o2::constants::physics; using namespace o2::framework; +// event rejection types +enum CentralityEstimator { + None = 0, + FT0A, + FT0C, + FT0M, + FV0A, + NCentralityEstimators +}; + /// Reconstruction of heavy-flavour 3-prong decay candidates struct HfCandidateCreator3Prong { Produces rowCandidateBase; + // centrality + Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; + Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; Configurable useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"}; @@ -92,12 +105,15 @@ struct HfCandidateCreator3Prong { runNumber = 0; } - template - void runCreator3Prong(aod::Collisions const& collisions, + template + void runCreator3Prong(Coll const& collisions, Cand const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { + + + // 3-prong vertex fitter o2::vertexing::DCAFitterN<3> df; // df.setBz(bz); @@ -111,13 +127,33 @@ struct HfCandidateCreator3Prong { // loop over triplets of track indices for (const auto& rowTrackIndexProng3 : rowsTrackIndexProng3) { + + // reject candidates in collisions outside the centrality range + auto collision = rowTrackIndexProng3.template collision_as(); + float centrality = -1.; + if constexpr (centEstimator != CentralityEstimator::None) { + if constexpr (centEstimator == CentralityEstimator::FT0A) { + centrality = collision.centFT0A(); + } else if constexpr (centEstimator == CentralityEstimator::FT0C) { + centrality = collision.centFT0C(); + } else if constexpr (centEstimator == CentralityEstimator::FT0M) { + centrality = collision.centFT0M(); + } else if constexpr (centEstimator == CentralityEstimator::FV0A) { + centrality = collision.centFV0A(); + } else { + LOGP(fatal, "Centrality estimator not set!"); + } + if (centrality < centralityMin || centrality > centralityMax) { + continue; + } + } + auto track0 = rowTrackIndexProng3.template prong0_as(); auto track1 = rowTrackIndexProng3.template prong1_as(); auto track2 = rowTrackIndexProng3.template prong2_as(); auto trackParVar0 = getTrackParCov(track0); auto trackParVar1 = getTrackParCov(track1); auto trackParVar2 = getTrackParCov(track2); - auto collision = rowTrackIndexProng3.collision(); /// Set the magnetic field from ccdb. /// The static instance of the propagator was already modified in the HFTrackIndexSkimCreator, @@ -235,25 +271,137 @@ struct HfCandidateCreator3Prong { } } + + /////////////////////////////////// + /// /// + /// No centrality selection /// + /// /// + /////////////////////////////////// + + /// @brief process function w/ PV refit and w/o centrality selections void processPvRefit(aod::Collisions const& collisions, soa::Join const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefit, "Run candidate creator with PV refit and w/o centrality selections", false); - PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefit, "Run candidate creator with PV refit", false); - + /// @brief process function w/o PV refit and w/o centrality selections void processNoPvRefit(aod::Collisions const& collisions, aod::Hf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) { - runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefit, "Run candidate creator without PV refit and w/o centrality selections", true); + + ///////////////////////////////////////////// + /// /// + /// with centrality selection on FT0A /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function w/ PV refit and w/ centrality selection on FT0A + void processPvRefitCentFT0A(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitCentFT0A, "Run candidate creator with PV refit and w/ centrality selection on FT0A", false); + + /// @brief process function w/o PV refit and w/ centrality selection on FT0A + void processNoPvRefitCentFT0A(soa::Join const& collisions, + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitCentFT0A, "Run candidate creator without PV refit and w/ centrality selection on FT0A", false); + + ///////////////////////////////////////////// + /// /// + /// with centrality selection on FT0C /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function w/ PV refit and w/ centrality selection on FT0C + void processPvRefitCentFT0C(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitCentFT0C, "Run candidate creator with PV refit and w/ centrality selection on FT0C", false); + + /// @brief process function w/o PV refit and w/ centrality selection on FT0C + void processNoPvRefitCentFT0C(soa::Join const& collisions, + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitCentFT0C, "Run candidate creator without PV refit and w/ centrality selection on FT0C", false); + + ///////////////////////////////////////////// + /// /// + /// with centrality selection on FT0M /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function w/ PV refit and w/ centrality selection on FT0M + void processPvRefitCentFT0M(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitCentFT0M, "Run candidate creator with PV refit and w/ centrality selection on FT0M", false); + + /// @brief process function w/o PV refit and w/ centrality selection on FT0M + void processNoPvRefitCentFT0M(soa::Join const& collisions, + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitCentFT0M, "Run candidate creator without PV refit and w/ centrality selection on FT0M", false); + + ///////////////////////////////////////////// + /// /// + /// with centrality selection on FV0A /// + /// /// + ///////////////////////////////////////////// + + /// @brief process function w/ PV refit and w/ centrality selection on FV0A + void processPvRefitCentFV0A(soa::Join const& collisions, + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); + } + PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefitCentFV0A, "Run candidate creator with PV refit and w/ centrality selection on FV0A", false); + + /// @brief process function w/o PV refit and w/ centrality selection on FV0A + void processNoPvRefitCentFV0A(soa::Join const& collisions, + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) + { + runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } + PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitCentFV0A, "Run candidate creator without PV refit and w/ centrality selection on FV0A", false); - PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefit, "Run candidate creator without PV refit", true); }; /// Extends the base table with expression columns. From ed068712b47227e3d8fd97537d645061a0deb22e Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Wed, 21 Feb 2024 08:37:03 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- .../TableProducer/candidateCreator3Prong.cxx | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 019e35ae2b4..a386a13f928 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -112,8 +112,6 @@ struct HfCandidateCreator3Prong { aod::BCsWithTimestamps const& bcWithTimeStamps) { - - // 3-prong vertex fitter o2::vertexing::DCAFitterN<3> df; // df.setBz(bz); @@ -271,7 +269,6 @@ struct HfCandidateCreator3Prong { } } - /////////////////////////////////// /// /// /// No centrality selection /// @@ -306,9 +303,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/ PV refit and w/ centrality selection on FT0A void processPvRefitCentFT0A(soa::Join const& collisions, - soa::Join const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -316,9 +313,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/o PV refit and w/ centrality selection on FT0A void processNoPvRefitCentFT0A(soa::Join const& collisions, - aod::Hf3Prongs const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -332,9 +329,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/ PV refit and w/ centrality selection on FT0C void processPvRefitCentFT0C(soa::Join const& collisions, - soa::Join const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -342,9 +339,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/o PV refit and w/ centrality selection on FT0C void processNoPvRefitCentFT0C(soa::Join const& collisions, - aod::Hf3Prongs const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -358,9 +355,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/ PV refit and w/ centrality selection on FT0M void processPvRefitCentFT0M(soa::Join const& collisions, - soa::Join const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -368,9 +365,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/o PV refit and w/ centrality selection on FT0M void processNoPvRefitCentFT0M(soa::Join const& collisions, - aod::Hf3Prongs const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -384,9 +381,9 @@ struct HfCandidateCreator3Prong { /// @brief process function w/ PV refit and w/ centrality selection on FV0A void processPvRefitCentFV0A(soa::Join const& collisions, - soa::Join const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + soa::Join const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } @@ -394,14 +391,13 @@ struct HfCandidateCreator3Prong { /// @brief process function w/o PV refit and w/ centrality selection on FV0A void processNoPvRefitCentFV0A(soa::Join const& collisions, - aod::Hf3Prongs const& rowsTrackIndexProng3, - aod::TracksWCovExtra const& tracks, - aod::BCsWithTimestamps const& bcWithTimeStamps) + aod::Hf3Prongs const& rowsTrackIndexProng3, + aod::TracksWCovExtra const& tracks, + aod::BCsWithTimestamps const& bcWithTimeStamps) { runCreator3Prong(collisions, rowsTrackIndexProng3, tracks, bcWithTimeStamps); } PROCESS_SWITCH(HfCandidateCreator3Prong, processNoPvRefitCentFV0A, "Run candidate creator without PV refit and w/ centrality selection on FV0A", false); - }; /// Extends the base table with expression columns.