diff --git a/PWGHF/TableProducer/candidateCreator2Prong.cxx b/PWGHF/TableProducer/candidateCreator2Prong.cxx index 78eab6edfb5..bd4e292e513 100644 --- a/PWGHF/TableProducer/candidateCreator2Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator2Prong.cxx @@ -39,6 +39,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::analysis; @@ -55,6 +56,10 @@ struct HfCandidateCreator2Prong { // centrality Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; + // event selection + Configurable useSel8Trigger{"useSel8Trigger", true, "apply the sel8 event selection"}; + Configurable maxPvPosZ{"maxPvPosZ", 10.f, "max. PV posZ (cm)"}; + Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "apply TF border cut"}; // vertexing Configurable constrainKfToPv{"constrainKfToPv", true, "constraint KFParticle to PV"}; Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; @@ -161,6 +166,11 @@ struct HfCandidateCreator2Prong { } } + /// event selection: sel8, PV posZ, TF border cut + if (!isHfCollisionSelected(collision, useSel8Trigger, maxPvPosZ, useTimeFrameBorderCut)) { + continue; + } + auto track0 = rowTrackIndexProng2.template prong0_as(); auto track1 = rowTrackIndexProng2.template prong1_as(); auto trackParVarPos1 = getTrackParCov(track0); @@ -427,7 +437,7 @@ struct HfCandidateCreator2Prong { /////////////////////////////////// /// @brief process function using DCA fitter w/ PV refit and w/o centrality selections - void processPvRefitWithDCAFitterN(aod::Collisions const& collisions, + void processPvRefitWithDCAFitterN(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -437,7 +447,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter w/ PV refit and w/o centrality selections", false); /// @brief process function using DCA fitter w/o PV refit and w/o centrality selections - void processNoPvRefitWithDCAFitterN(aod::Collisions const& collisions, + void processNoPvRefitWithDCAFitterN(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -447,7 +457,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterN, "Run candidate creator using DCA fitter w/o PV refit and w/o centrality selections", true); /// @brief process function using KFParticle package w/ PV refit and w/o centrality selections - void processPvRefitWithKFParticle(aod::Collisions const& collisions, + void processPvRefitWithKFParticle(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -457,7 +467,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticle, "Run candidate creator using KFParticle package w/ PV refit and w/o centrality selections", false); /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections - void processNoPvRefitWithKFParticle(aod::Collisions const& collisions, + void processNoPvRefitWithKFParticle(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -473,7 +483,7 @@ struct HfCandidateCreator2Prong { ///////////////////////////////////////////// /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on FT0C - void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, + void processPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -483,7 +493,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on FT0C", false); /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection FT0C - void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, + void processNoPvRefitWithDCAFitterNCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -493,7 +503,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNCentFT0C, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection FT0C", false); /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on FT0C - void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, + void processPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -503,7 +513,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleCentFT0C, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on FT0C", false); /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections - void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, + void processNoPvRefitWithKFParticleCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -519,7 +529,7 @@ struct HfCandidateCreator2Prong { ///////////////////////////////////////////// /// @brief process function using DCA fitter w/ PV refit and w/ centrality selection on FT0M - void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, + void processPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -529,7 +539,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter w/ PV refit and w/ centrality selection on FT0M", false); /// @brief process function using DCA fitter w/o PV refit and w/ centrality selection FT0M - void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, + void processNoPvRefitWithDCAFitterNCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -539,7 +549,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processNoPvRefitWithDCAFitterNCentFT0M, "Run candidate creator using DCA fitter w/o PV refit and w/ centrality selection FT0M", false); /// @brief process function using KFParticle package w/ PV refit and w/ centrality selection on FT0M - void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, + void processPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, soa::Join const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -549,7 +559,7 @@ struct HfCandidateCreator2Prong { PROCESS_SWITCH(HfCandidateCreator2Prong, processPvRefitWithKFParticleCentFT0M, "Run candidate creator using KFParticle package w/ PV refit and w/ centrality selection on FT0M", false); /// @brief process function using KFParticle package w/o PV refit and w/o centrality selections - void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, + void processNoPvRefitWithKFParticleCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexProng2, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index 62592028761..ccfa9451593 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -28,6 +28,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::analysis; @@ -44,6 +45,10 @@ struct HfCandidateCreator3Prong { // centrality Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; + // event selection + Configurable useSel8Trigger{"useSel8Trigger", true, "apply the sel8 event selection"}; + Configurable maxPvPosZ{"maxPvPosZ", 10.f, "max. PV posZ (cm)"}; + Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "apply TF border cut"}; // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; Configurable useAbsDCA{"useAbsDCA", false, "Minimise abs. distance rather than chi2"}; @@ -154,6 +159,11 @@ struct HfCandidateCreator3Prong { } } + /// event selection: sel8, PV posZ, TF border cut + if (!isHfCollisionSelected(collision, useSel8Trigger, maxPvPosZ, useTimeFrameBorderCut)) { + continue; + } + auto track0 = rowTrackIndexProng3.template prong0_as(); auto track1 = rowTrackIndexProng3.template prong1_as(); auto track2 = rowTrackIndexProng3.template prong2_as(); @@ -284,7 +294,7 @@ struct HfCandidateCreator3Prong { /////////////////////////////////// /// @brief process function w/ PV refit and w/o centrality selections - void processPvRefit(aod::Collisions const& collisions, + void processPvRefit(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -294,7 +304,7 @@ struct HfCandidateCreator3Prong { PROCESS_SWITCH(HfCandidateCreator3Prong, processPvRefit, "Run candidate creator with PV refit and w/o centrality selections", false); /// @brief process function w/o PV refit and w/o centrality selections - void processNoPvRefit(aod::Collisions const& collisions, + void processNoPvRefit(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -310,7 +320,7 @@ struct HfCandidateCreator3Prong { ///////////////////////////////////////////// /// @brief process function w/ PV refit and w/ centrality selection on FT0C - void processPvRefitCentFT0C(soa::Join const& collisions, + void processPvRefitCentFT0C(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -320,7 +330,7 @@ struct HfCandidateCreator3Prong { 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, + void processNoPvRefitCentFT0C(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -336,7 +346,7 @@ struct HfCandidateCreator3Prong { ///////////////////////////////////////////// /// @brief process function w/ PV refit and w/ centrality selection on FT0M - void processPvRefitCentFT0M(soa::Join const& collisions, + void processPvRefitCentFT0M(soa::Join const& collisions, FilteredPvRefitHf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) @@ -346,7 +356,7 @@ struct HfCandidateCreator3Prong { 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, + void processNoPvRefitCentFT0M(soa::Join const& collisions, FilteredHf3Prongs const& rowsTrackIndexProng3, aod::TracksWCovExtra const& tracks, aod::BCsWithTimestamps const& bcWithTimeStamps) diff --git a/PWGHF/TableProducer/candidateCreatorCascade.cxx b/PWGHF/TableProducer/candidateCreatorCascade.cxx index 96735fa9838..9c08adb124d 100644 --- a/PWGHF/TableProducer/candidateCreatorCascade.cxx +++ b/PWGHF/TableProducer/candidateCreatorCascade.cxx @@ -28,6 +28,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::analysis; @@ -42,6 +43,10 @@ struct HfCandidateCreatorCascade { // centrality Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; + // event selection + Configurable useSel8Trigger{"useSel8Trigger", true, "apply the sel8 event selection"}; + Configurable maxPvPosZ{"maxPvPosZ", 10.f, "max. PV posZ (cm)"}; + Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "apply TF border cut"}; // vertexing // Configurable bz{"bz", 5., "magnetic field"}; Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; @@ -133,6 +138,11 @@ struct HfCandidateCreatorCascade { } } + /// event selection: sel8, PV posZ, TF border cut + if (!isHfCollisionSelected(collision, useSel8Trigger, maxPvPosZ, useTimeFrameBorderCut)) { + continue; + } + const auto& bach = casc.prong0_as(); LOGF(debug, "V0 %d in HF cascade %d.", casc.v0Id(), casc.globalIndex()); if (!casc.has_v0()) { @@ -297,7 +307,7 @@ struct HfCandidateCreatorCascade { } /// @brief process function w/o centrality selections - void processNoCent(aod::Collisions const& collisions, + void processNoCent(soa::Join const& collisions, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, aod::V0Datas const& v0Data, @@ -310,7 +320,7 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processNoCent, " Run candidate creator w/o centrality selections", true); /// @brief process function w/ centrality selection on FT0C - void processCentFT0C(soa::Join const& collisions, + void processCentFT0C(soa::Join const& collisions, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, aod::V0Datas const& v0Data, @@ -323,7 +333,7 @@ struct HfCandidateCreatorCascade { PROCESS_SWITCH(HfCandidateCreatorCascade, processCentFT0C, " Run candidate creator w/ centrality selection on FT0C", false); /// @brief process function w/ centrality selection on FT0M - void processCentFT0M(soa::Join const& collisions, + void processCentFT0M(soa::Join const& collisions, aod::HfCascades const& rowsTrackIndexCasc, aod::V0sLinked const& v0sLinked, aod::V0Datas const& v0Data, diff --git a/PWGHF/TableProducer/candidateCreatorDstar.cxx b/PWGHF/TableProducer/candidateCreatorDstar.cxx index 2c0c75b348b..c7322121e98 100644 --- a/PWGHF/TableProducer/candidateCreatorDstar.cxx +++ b/PWGHF/TableProducer/candidateCreatorDstar.cxx @@ -29,6 +29,7 @@ // PWGHF #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/Utils/utilsBfieldCCDB.h" +#include "PWGHF/Utils/utilsEvSelHf.h" using namespace o2; using namespace o2::aod::hf_collision_centrality; @@ -58,6 +59,11 @@ struct HfCandidateCreatorDstar { Configurable centralityMin{"centralityMin", 0., "Minimum centrality"}; Configurable centralityMax{"centralityMax", 100., "Maximum centrality"}; + // event selection + Configurable useSel8Trigger{"useSel8Trigger", true, "apply the sel8 event selection"}; + Configurable maxPvPosZ{"maxPvPosZ", 10.f, "max. PV posZ (cm)"}; + Configurable useTimeFrameBorderCut{"useTimeFrameBorderCut", true, "apply TF border cut"}; + // vertexing Configurable propagateToPCA{"propagateToPCA", true, "create tracks version propagated to PCA"}; Configurable maxR{"maxR", 200., "reject PCA's above this radius"}; // ........... what is unit of this? @@ -167,6 +173,11 @@ struct HfCandidateCreatorDstar { } } + /// event selection: sel8, PV posZ, TF border cut + if (!isHfCollisionSelected(collision, useSel8Trigger, maxPvPosZ, useTimeFrameBorderCut)) { + continue; + } + auto trackPi = rowTrackIndexDstar.template prong0_as(); auto prongD0 = rowTrackIndexDstar.template prongD0_as(); auto trackD0Prong0 = prongD0.template prong0_as(); @@ -326,7 +337,7 @@ struct HfCandidateCreatorDstar { /////////////////////////////////// /// @brief process function w/ PV refit and w/o centrality selections - void processPvRefit(aod::Collisions const& collisions, + void processPvRefit(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, aod::TracksWCov const& tracks, @@ -337,7 +348,7 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefit, " Run candidate creator with PV refit and w/o centrality selections", false); /// @brief process function w/o PV refit and w/o centrality selections - void processNoPvRefit(aod::Collisions const& collisions, + void processNoPvRefit(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, aod::TracksWCov const& tracks, @@ -354,7 +365,7 @@ struct HfCandidateCreatorDstar { ///////////////////////////////////////////// /// @brief process function w/ PV refit and w/ centrality selection on FT0C - void processPvRefitCentFT0C(soa::Join const& collisions, + void processPvRefitCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, aod::TracksWCov const& tracks, @@ -365,7 +376,7 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefitCentFT0C, " Run candidate creator with PV refit nad 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, + void processNoPvRefitCentFT0C(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, aod::TracksWCov const& tracks, @@ -382,7 +393,7 @@ struct HfCandidateCreatorDstar { ///////////////////////////////////////////// /// @brief process function w/ PV refit and w/ centrality selection on FT0M - void processPvRefitCentFT0M(soa::Join const& collisions, + void processPvRefitCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstarsWithPvRefitInfo const& rowsTrackIndexDstar, aod::TracksWCov const& tracks, @@ -393,7 +404,7 @@ struct HfCandidateCreatorDstar { PROCESS_SWITCH(HfCandidateCreatorDstar, processPvRefitCentFT0M, " Run candidate creator with PV refit nad 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, + void processNoPvRefitCentFT0M(soa::Join const& collisions, aod::Hf2Prongs const& rowsTrackIndexD0, aod::HfDstars const& rowsTrackIndexDstar, aod::TracksWCov const& tracks, diff --git a/PWGHF/Utils/utilsEvSelHf.h b/PWGHF/Utils/utilsEvSelHf.h new file mode 100644 index 00000000000..0b87373377c --- /dev/null +++ b/PWGHF/Utils/utilsEvSelHf.h @@ -0,0 +1,47 @@ +// 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 utilsEvSelHf.h +/// \brief Utility set the event selections for HF analyses +/// \author Mattia Faggin , CERN + +#ifndef PWGHF_UTILS_UTILSEVSELHF_H_ +#define PWGHF_UTILS_UTILSEVSELHF_H_ + +/// \brief Function to apply event selections in HF analyses +/// \param collision collision that has to satisfy the selection criteria +/// \param useSel8Trigger switch to activate the sel8() event selection +/// \param zPvPosMax maximum primary-vertex z +/// \param useTimeFrameBorderCut switch to activate the time frame border cut +/// \return true if collision satisfies all criteria, false otherwise +template +bool isHfCollisionSelected(const Coll& collision, bool useSel8Trigger, float maxPvPosZ, bool useTimeFrameBorderCut) +{ + + /// sel8() condition + if (useSel8Trigger && !collision.sel8()) { + return false; + } + + /// primary vertex z + if (std::fabs(collision.posZ()) > maxPvPosZ) { + return false; + } + + /// time frame border cut + if (useTimeFrameBorderCut && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) { + return false; + } + + /// all conditions satisfied + return true; +} +#endif // PWGHF_UTILS_UTILSEVSELHF_H_