From d47cb1a40ee5e959e9a5a9e3133175256ace5eff Mon Sep 17 00:00:00 2001 From: fmazzasc Date: Wed, 17 Jan 2024 16:46:26 +0100 Subject: [PATCH 1/8] Add flow information --- PWGLF/DataModel/LFHypernucleiTables.h | 53 ++++++++++++++++++++------ PWGLF/TableProducer/hyperRecoTask.cxx | 54 +++++++++++++++++++-------- 2 files changed, 81 insertions(+), 26 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 026235d67bd..e78d3dae328 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -24,10 +24,20 @@ namespace o2::aod { namespace hyperrec { +DECLARE_SOA_COLUMN(CentralityFT0A, centralityFT0A, float); // centrality with FT0A estimator +DECLARE_SOA_COLUMN(CentralityFT0C, centralityFT0C, float); // centrality with FT0C estimator +DECLARE_SOA_COLUMN(CentralityFT0M, centralityFT0M, float); // centrality with FT0M estimator +DECLARE_SOA_COLUMN(QVecXFT0A, qVecXFT0A, float); // Q vector x component with FT0A estimator +DECLARE_SOA_COLUMN(QVecYFT0A, qVecYFT0A, float); // Q vector y component with FT0A estimator +DECLARE_SOA_COLUMN(QVecAmpFT0A, qVecAmpFT0A, float); // Q vector amplitude with FT0A estimator +DECLARE_SOA_COLUMN(QVecXFT0C, qVecXFT0C, float); // Q vector x component with FT0C estimator +DECLARE_SOA_COLUMN(QVecYFT0C, qVecYFT0C, float); // Q vector y component with FT0C estimator +DECLARE_SOA_COLUMN(QVecAmpFT0C, qVecAmpFT0C, float); // Q vector amplitude with FT0C estimator +DECLARE_SOA_COLUMN(QVecXFT0M, qVecXFT0M, float); // Q vector x component with FT0M estimator +DECLARE_SOA_COLUMN(QVecYFT0M, qVecYFT0M, float); // Q vector y component with FT0M estimator +DECLARE_SOA_COLUMN(QVecAmpFT0M, qVecAmpFT0M, float); // Q vector amplitude with FT0M estimator + DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter -DECLARE_SOA_COLUMN(CentralityFT0A, centralityFT0A, float); // centrality with FT0A estimator -DECLARE_SOA_COLUMN(CentralityFT0C, centralityFT0C, float); // centrality with FT0C estimator -DECLARE_SOA_COLUMN(CentralityFT0M, centralityFT0M, float); // centrality with FT0M estimator DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter DECLARE_SOA_COLUMN(EtaHe3, etaHe3, float); // Eta of the He daughter @@ -69,19 +79,29 @@ DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: tru DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", o2::soa::Index<>, - hyperrec::IsMatter, hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, + hyperrec::QVecXFT0A, + hyperrec::QVecYFT0A, + hyperrec::QVecAmpFT0A, + hyperrec::QVecXFT0C, + hyperrec::QVecYFT0C, + hyperrec::QVecAmpFT0C, + hyperrec::QVecXFT0M, + hyperrec::QVecYFT0M, + hyperrec::QVecAmpFT0M, + hyperrec::XPrimVtx, + hyperrec::YPrimVtx, + hyperrec::ZPrimVtx, + + hyperrec::IsMatter, hyperrec::PtHe3, hyperrec::PhiHe3, hyperrec::EtaHe3, hyperrec::PtPi, hyperrec::PhiPi, hyperrec::EtaPi, - hyperrec::XPrimVtx, - hyperrec::YPrimVtx, - hyperrec::ZPrimVtx, hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, @@ -101,19 +121,30 @@ DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", o2::soa::Index<>, - hyperrec::IsMatter, hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, + hyperrec::QVecXFT0A, + hyperrec::QVecYFT0A, + hyperrec::QVecAmpFT0A, + hyperrec::QVecXFT0C, + hyperrec::QVecYFT0C, + hyperrec::QVecAmpFT0C, + hyperrec::QVecXFT0M, + hyperrec::QVecYFT0M, + hyperrec::QVecAmpFT0M, + hyperrec::XPrimVtx, + hyperrec::YPrimVtx, + hyperrec::ZPrimVtx, + + hyperrec::IsMatter, hyperrec::PtHe3, hyperrec::PhiHe3, hyperrec::EtaHe3, hyperrec::PtPi, hyperrec::PhiPi, hyperrec::EtaPi, - hyperrec::XPrimVtx, - hyperrec::YPrimVtx, - hyperrec::ZPrimVtx, + hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index c1500cc3fa2..60e772feec6 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -32,6 +32,7 @@ #include "Common/Core/PID/TPCPIDResponse.h" #include "DataFormatsTPC/BetheBlochAleph.h" #include "DCAFitter/DCAFitterN.h" +#include "Common/DataModel/Qvectors.h" #include "PWGLF/DataModel/LFHypernucleiTables.h" @@ -40,6 +41,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; using TracksFull = soa::Join; +using CollisionsFull = soa::Join; namespace { @@ -68,6 +70,20 @@ struct hyperCandidate { float genPhi() const { return std::atan2(gMom[1], gMom[0]); } float genEta() const { return std::asinh(gMom[2] / genPt()); } + float centralityFT0A = -1; + float centralityFT0C = -1; + float centralityFT0M = -1; + float qVecXFT0A = -1; + float qVecYFT0A = -1; + float qVecAmpFT0A = -1; + float qVecXFT0C = -1; + float qVecYFT0C = -1; + float qVecAmpFT0C = -1; + float qVecXFT0M = -1; + float qVecYFT0M = -1; + float qVecAmpFT0M = -1; + std::array primVtx; + int posTrackID; int negTrackID; float dcaV0dau = -10; @@ -79,10 +95,6 @@ struct hyperCandidate { float momPiTPC = -10.f; std::array momHe3; std::array momPi; - std::array primVtx; - float centralityFT0A = -1; - float centralityFT0C = -1; - float centralityFT0M = -1; std::array decVtx; std::array gMom; std::array gMomHe3; @@ -250,7 +262,7 @@ struct hyperRecoTask { } template - void fillCandidateData(soa::Join::iterator const& collision, aod::V0s const& V0s) + void fillCandidateData(CollisionsFull::iterator const& collision, aod::V0s const& V0s) { if (mBBparamsHe[5] < 0) { LOG(fatal) << "Bethe-Bloch parameters for He3 not set, please check your CCDB and configuration"; @@ -337,6 +349,16 @@ struct hyperRecoTask { hypCand.centralityFT0A = collision.centFT0A(); hypCand.centralityFT0C = collision.centFT0C(); hypCand.centralityFT0M = collision.centFT0M(); + hypCand.qVecXFT0A = collision.qvecFT0ARe(); + hypCand.qVecYFT0A = collision.qvecFT0AIm(); + hypCand.qVecAmpFT0A = collision.sumAmplFT0A(); + hypCand.qVecXFT0C = collision.qvecFT0CRe(); + hypCand.qVecYFT0C = collision.qvecFT0CIm(); + hypCand.qVecAmpFT0C = collision.sumAmplFT0C(); + hypCand.qVecXFT0M = collision.qvecFT0MRe(); + hypCand.qVecYFT0M = collision.qvecFT0MIm(); + hypCand.qVecAmpFT0M = collision.sumAmplFT0M(); + std::array hypMom; const auto& vtx = fitter.getPCACandidate(); for (int i = 0; i < 3; i++) { @@ -476,7 +498,7 @@ struct hyperRecoTask { } } - void processData(soa::Join const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) + void processData(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) { hyperCandidates.clear(); @@ -505,10 +527,11 @@ struct hyperRecoTask { } for (auto& hypCand : hyperCandidates) { - outputDataTable(hypCand.isMatter, - hypCand.centralityFT0A, - hypCand.centralityFT0C, - hypCand.centralityFT0M, + outputDataTable(hypCand.centralityFT0A, hypCand.centralityFT0C, hypCand.centralityFT0M, + hypCand.qVecXFT0A, hypCand.qVecYFT0A, hypCand.qVecAmpFT0A, + hypCand.qVecXFT0C, hypCand.qVecYFT0C, hypCand.qVecAmpFT0C, + hypCand.qVecXFT0M, hypCand.qVecYFT0M, hypCand.qVecAmpFT0M, + hypCand.isMatter, hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), hypCand.primVtx[0], hypCand.primVtx[1], hypCand.primVtx[2], @@ -521,7 +544,7 @@ struct hyperRecoTask { } PROCESS_SWITCH(hyperRecoTask, processData, "Data analysis", true); - void processMC(soa::Join const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) + void processMC(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { hyperCandidates.clear(); @@ -551,10 +574,11 @@ struct hyperRecoTask { if (!hypCand.isSignal && mcSignalOnly) continue; int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); - outputMCTable(hypCand.isMatter, - hypCand.centralityFT0A, - hypCand.centralityFT0C, - hypCand.centralityFT0M, + outputMCTable(hypCand.centralityFT0A, hypCand.centralityFT0C, hypCand.centralityFT0M, + hypCand.qVecXFT0A, hypCand.qVecYFT0A, hypCand.qVecAmpFT0A, + hypCand.qVecXFT0C, hypCand.qVecYFT0C, hypCand.qVecAmpFT0C, + hypCand.qVecXFT0M, hypCand.qVecYFT0M, hypCand.qVecAmpFT0M, + hypCand.isMatter, hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), hypCand.primVtx[0], hypCand.primVtx[1], hypCand.primVtx[2], From d7b52d5f53b1ef9a8a963b4d81fe97582b90af95 Mon Sep 17 00:00:00 2001 From: Chiara Pinto Date: Thu, 18 Jan 2024 13:44:17 +0100 Subject: [PATCH 2/8] q vector in data --- PWGLF/DataModel/LFHypernucleiTables.h | 114 +++++++++----------------- PWGLF/TableProducer/hyperRecoTask.cxx | 97 ++++++++++++++-------- 2 files changed, 106 insertions(+), 105 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index e78d3dae328..aa591529ff1 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -36,6 +36,10 @@ DECLARE_SOA_COLUMN(QVecAmpFT0C, qVecAmpFT0C, float); // Q vector amplitude DECLARE_SOA_COLUMN(QVecXFT0M, qVecXFT0M, float); // Q vector x component with FT0M estimator DECLARE_SOA_COLUMN(QVecYFT0M, qVecYFT0M, float); // Q vector y component with FT0M estimator DECLARE_SOA_COLUMN(QVecAmpFT0M, qVecAmpFT0M, float); // Q vector amplitude with FT0M estimator +DECLARE_SOA_COLUMN(QVecXFV0A, qVecXFV0A, float); // Q vector x component with FV0A estimator +DECLARE_SOA_COLUMN(QVecYFV0A, qVecYFV0A, float); // Q vector y component with FV0A estimator +DECLARE_SOA_COLUMN(QVecAmpFV0A, qVecAmpFV0A, float); // Q vector amplitude with FV0A estimator + DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter @@ -79,87 +83,51 @@ DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: tru DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", o2::soa::Index<>, - hyperrec::CentralityFT0A, - hyperrec::CentralityFT0C, - hyperrec::CentralityFT0M, - hyperrec::QVecXFT0A, - hyperrec::QVecYFT0A, - hyperrec::QVecAmpFT0A, - hyperrec::QVecXFT0C, - hyperrec::QVecYFT0C, - hyperrec::QVecAmpFT0C, - hyperrec::QVecXFT0M, - hyperrec::QVecYFT0M, - hyperrec::QVecAmpFT0M, - hyperrec::XPrimVtx, - hyperrec::YPrimVtx, - hyperrec::ZPrimVtx, + hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, + hyperrec::XPrimVtx, hyperrec::YPrimVtx, hyperrec::ZPrimVtx, hyperrec::IsMatter, - hyperrec::PtHe3, - hyperrec::PhiHe3, - hyperrec::EtaHe3, - hyperrec::PtPi, - hyperrec::PhiPi, - hyperrec::EtaPi, - hyperrec::XDecVtx, - hyperrec::YDecVtx, - hyperrec::ZDecVtx, - hyperrec::DcaV0Daug, - hyperrec::DcaHe, - hyperrec::DcaPi, - hyperrec::NSigmaHe, - hyperrec::NTPCclusHe, - hyperrec::NTPCclusPi, - hyperrec::TPCmomHe, - hyperrec::TPCmomPi, - hyperrec::TPCsignalHe, - hyperrec::TPCsignalPi, - hyperrec::ITSclusterSizesHe, - hyperrec::ITSclusterSizesPi, + hyperrec::PtHe3, hyperrec::PhiHe3, hyperrec::EtaHe3, + hyperrec::PtPi, hyperrec::PhiPi, hyperrec::EtaPi, + hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, + hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, + hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, + hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags); -DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", +DECLARE_SOA_TABLE(DataHypCandsFlow, "AOD", "DATAHYPCANDSFLOW", o2::soa::Index<>, - hyperrec::CentralityFT0A, - hyperrec::CentralityFT0C, - hyperrec::CentralityFT0M, - hyperrec::QVecXFT0A, - hyperrec::QVecYFT0A, - hyperrec::QVecAmpFT0A, - hyperrec::QVecXFT0C, - hyperrec::QVecYFT0C, - hyperrec::QVecAmpFT0C, - hyperrec::QVecXFT0M, - hyperrec::QVecYFT0M, - hyperrec::QVecAmpFT0M, - hyperrec::XPrimVtx, - hyperrec::YPrimVtx, - hyperrec::ZPrimVtx, + hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, + hyperrec::QVecXFT0A, hyperrec::QVecYFT0A, hyperrec::QVecAmpFT0A, + hyperrec::QVecXFT0C, hyperrec::QVecYFT0C, hyperrec::QVecAmpFT0C, + hyperrec::QVecXFT0M, hyperrec::QVecYFT0M, hyperrec::QVecAmpFT0M, + hyperrec::QVecXFV0A, hyperrec::QVecYFV0A, hyperrec::QVecAmpFV0A, + hyperrec::XPrimVtx, hyperrec::YPrimVtx, hyperrec::ZPrimVtx, hyperrec::IsMatter, - hyperrec::PtHe3, - hyperrec::PhiHe3, - hyperrec::EtaHe3, - hyperrec::PtPi, - hyperrec::PhiPi, - hyperrec::EtaPi, + hyperrec::PtHe3, hyperrec::PhiHe3, hyperrec::EtaHe3, + hyperrec::PtPi, hyperrec::PhiPi, hyperrec::EtaPi, + hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, + hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, + hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, + hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, + hyperrec::Flags); - hyperrec::XDecVtx, - hyperrec::YDecVtx, - hyperrec::ZDecVtx, - hyperrec::DcaV0Daug, - hyperrec::DcaHe, - hyperrec::DcaPi, - hyperrec::NSigmaHe, - hyperrec::NTPCclusHe, - hyperrec::NTPCclusPi, - hyperrec::TPCmomHe, - hyperrec::TPCmomPi, - hyperrec::TPCsignalHe, - hyperrec::TPCsignalPi, - hyperrec::ITSclusterSizesHe, - hyperrec::ITSclusterSizesPi, +DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", + o2::soa::Index<>, + hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, + hyperrec::XPrimVtx, hyperrec::YPrimVtx, hyperrec::ZPrimVtx, + + hyperrec::IsMatter, + hyperrec::PtHe3, hyperrec::PhiHe3, hyperrec::EtaHe3, + hyperrec::PtPi, hyperrec::PhiPi, hyperrec::EtaPi, + hyperrec::XDecVtx, hyperrec::YDecVtx, hyperrec::ZDecVtx, + hyperrec::DcaV0Daug, hyperrec::DcaHe, hyperrec::DcaPi, + hyperrec::NSigmaHe, hyperrec::NTPCclusHe, hyperrec::NTPCclusPi, + hyperrec::TPCmomHe, hyperrec::TPCmomPi, hyperrec::TPCsignalHe, hyperrec::TPCsignalPi, + hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags, hyperrec::GenPt, hyperrec::GenPhi, diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 60e772feec6..3dcc9a6621d 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -41,7 +41,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; using std::array; using TracksFull = soa::Join; -using CollisionsFull = soa::Join; +using CollisionsFull = soa::Join; +using CollisionsFullWithFlow = soa::Join; namespace { @@ -82,6 +83,9 @@ struct hyperCandidate { float qVecXFT0M = -1; float qVecYFT0M = -1; float qVecAmpFT0M = -1; + float qVecXFV0A = -1; + float qVecYFV0A = -1; + float qVecAmpFV0A = -1; std::array primVtx; int posTrackID; @@ -261,8 +265,8 @@ struct hyperRecoTask { mRunNumber = bc.runNumber(); } - template - void fillCandidateData(CollisionsFull::iterator const& collision, aod::V0s const& V0s) + template + void fillCandidateData(Tcoll::iterator const& collision, aod::V0s const& V0s) { if (mBBparamsHe[5] < 0) { LOG(fatal) << "Bethe-Bloch parameters for He3 not set, please check your CCDB and configuration"; @@ -332,7 +336,7 @@ struct hyperRecoTask { hePropTrack.getPxPyPzGlo(hypCand.momHe3); piPropTrack.getPxPyPzGlo(hypCand.momPi); - // he momentum has to be multiplied by 2 (charge) + // the momentum has to be multiplied by 2 (charge) for (int i = 0; i < 3; i++) { hypCand.momHe3[i] *= 2; } @@ -344,21 +348,7 @@ struct hyperRecoTask { float piE = std::sqrt(piP2 + piMass * piMass); float h3lE = he3E + piE; float h4lE = he4E + piE; - - hypCand.primVtx = array{collision.posX(), collision.posY(), collision.posZ()}; - hypCand.centralityFT0A = collision.centFT0A(); - hypCand.centralityFT0C = collision.centFT0C(); - hypCand.centralityFT0M = collision.centFT0M(); - hypCand.qVecXFT0A = collision.qvecFT0ARe(); - hypCand.qVecYFT0A = collision.qvecFT0AIm(); - hypCand.qVecAmpFT0A = collision.sumAmplFT0A(); - hypCand.qVecXFT0C = collision.qvecFT0CRe(); - hypCand.qVecYFT0C = collision.qvecFT0CIm(); - hypCand.qVecAmpFT0C = collision.sumAmplFT0C(); - hypCand.qVecXFT0M = collision.qvecFT0MRe(); - hypCand.qVecYFT0M = collision.qvecFT0MIm(); - hypCand.qVecAmpFT0M = collision.sumAmplFT0M(); - + } std::array hypMom; const auto& vtx = fitter.getPCACandidate(); for (int i = 0; i < 3; i++) { @@ -380,14 +370,16 @@ struct hyperRecoTask { if (hypCand.dcaV0dau > dcav0dau) { continue; } + + std::array primVtx = {collision.posX(), collision.posY(), collision.posZ()}; - double cosPA = RecoDecay::cpa(hypCand.primVtx, array{hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2]}, array{hypMom[0], hypMom[1], hypMom[2]}); + double cosPA = RecoDecay::cpa(primVtx, hypCand.decVtx, hypMom); if (cosPA < v0cospa) { continue; } for (int i = 0; i < 3; i++) { - hypCand.decVtx[i] = hypCand.decVtx[i] - hypCand.primVtx[i]; + hypCand.decVtx[i] = hypCand.decVtx[i] - primVtx[i]; } // if survived all selections, propagate decay daughters to PV @@ -500,9 +492,9 @@ struct hyperRecoTask { void processData(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) { - hyperCandidates.clear(); for (const auto& collision : collisions) { + hyperCandidates.clear(); auto bc = collision.bc_as(); initCCDB(bc); @@ -524,26 +516,70 @@ struct hyperRecoTask { V0Table_thisCollision.bindExternalIndices(&tracks); fillCandidateData(collision, V0Table_thisCollision); - } - for (auto& hypCand : hyperCandidates) { - outputDataTable(hypCand.centralityFT0A, hypCand.centralityFT0C, hypCand.centralityFT0M, - hypCand.qVecXFT0A, hypCand.qVecYFT0A, hypCand.qVecAmpFT0A, - hypCand.qVecXFT0C, hypCand.qVecYFT0C, hypCand.qVecAmpFT0C, - hypCand.qVecXFT0M, hypCand.qVecYFT0M, hypCand.qVecAmpFT0M, + for (auto& hypCand : hyperCandidates) { + outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + collision.posX(), collision.posY(), collision.posZ(), hypCand.isMatter, hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - hypCand.primVtx[0], hypCand.primVtx[1], hypCand.primVtx[2], hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); } + } } PROCESS_SWITCH(hyperRecoTask, processData, "Data analysis", true); + void processDataWithFlow(CollisionsFullWithFlow const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) + { + hyperCandidates.clear(); + + for (const auto& collision : collisions) { + + auto bc = collision.bc_as(); + initCCDB(bc); + + hEvents->Fill(0.); + if (!collision.sel8()) + continue; + + hEvents->Fill(1.); + + if (std::abs(collision.posZ()) > 10.f) + continue; + + hEvents->Fill(2.); + hZvtx->Fill(collision.posZ()); + + const uint64_t collIdx = collision.globalIndex(); + auto V0Table_thisCollision = V0s.sliceBy(perCollision, collIdx); + V0Table_thisCollision.bindExternalIndices(&tracks); + + fillCandidateData(collision, V0Table_thisCollision); + + for (auto& hypCand : hyperCandidates) { + outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), + collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), + collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), + collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); + } + } + } + PROCESS_SWITCH(hyperRecoTask, processDataWithFlow, "Data analysis with flow", false); + void processMC(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { hyperCandidates.clear(); @@ -575,9 +611,6 @@ struct hyperRecoTask { continue; int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); outputMCTable(hypCand.centralityFT0A, hypCand.centralityFT0C, hypCand.centralityFT0M, - hypCand.qVecXFT0A, hypCand.qVecYFT0A, hypCand.qVecAmpFT0A, - hypCand.qVecXFT0C, hypCand.qVecYFT0C, hypCand.qVecAmpFT0C, - hypCand.qVecXFT0M, hypCand.qVecYFT0M, hypCand.qVecAmpFT0M, hypCand.isMatter, hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), From feeb02a875baa7489d6601dc38cb4afad8aec712 Mon Sep 17 00:00:00 2001 From: fmazzasc Date: Thu, 18 Jan 2024 14:50:32 +0100 Subject: [PATCH 3/8] Add flow table producer --- PWGLF/DataModel/LFHypernucleiTables.h | 5 +- PWGLF/TableProducer/hyperRecoTask.cxx | 73 ++++++++++++++------------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index aa591529ff1..695f913f9c1 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -81,7 +81,7 @@ DECLARE_SOA_COLUMN(IsReco, isReco, bool); // bool: tru DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); // bool: true for signal } // namespace hyperrec -DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", +DECLARE_SOA_TABLE(DataHypCands, "AOD", "HYPCANDS", o2::soa::Index<>, hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, hyperrec::XPrimVtx, hyperrec::YPrimVtx, hyperrec::ZPrimVtx, @@ -96,7 +96,7 @@ DECLARE_SOA_TABLE(DataHypCands, "AOD", "DATAHYPCANDS", hyperrec::ITSclusterSizesHe, hyperrec::ITSclusterSizesPi, hyperrec::Flags); -DECLARE_SOA_TABLE(DataHypCandsFlow, "AOD", "DATAHYPCANDSFLOW", +DECLARE_SOA_TABLE(DataHypCandsFlow, "AOD", "HYPCANDSFLOW", o2::soa::Index<>, hyperrec::CentralityFT0A, hyperrec::CentralityFT0C, hyperrec::CentralityFT0M, hyperrec::QVecXFT0A, hyperrec::QVecYFT0A, hyperrec::QVecAmpFT0A, @@ -140,6 +140,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS", hyperrec::IsSignal); using DataHypCand = DataHypCands::iterator; +using DataHypCandFlow = DataHypCandsFlow::iterator; using MCHypCand = MCHypCands::iterator; } // namespace o2::aod diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 3dcc9a6621d..5ffa176a0fb 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -119,6 +119,7 @@ struct hyperCandidate { struct hyperRecoTask { Produces outputDataTable; + Produces outputDataTableWithFlow; Produces outputMCTable; Service ccdb; @@ -265,16 +266,16 @@ struct hyperRecoTask { mRunNumber = bc.runNumber(); } - template - void fillCandidateData(Tcoll::iterator const& collision, aod::V0s const& V0s) + template + void fillCandidateData(Tcoll const& collision, aod::V0s const& V0s) { if (mBBparamsHe[5] < 0) { LOG(fatal) << "Bethe-Bloch parameters for He3 not set, please check your CCDB and configuration"; } for (auto& v0 : V0s) { - auto posTrack = v0.posTrack_as(); - auto negTrack = v0.negTrack_as(); + auto posTrack = v0.posTrack_as(); + auto negTrack = v0.negTrack_as(); if (std::abs(posTrack.eta()) > etaMax || std::abs(negTrack.eta()) > etaMax) continue; @@ -348,7 +349,7 @@ struct hyperRecoTask { float piE = std::sqrt(piP2 + piMass * piMass); float h3lE = he3E + piE; float h4lE = he4E + piE; - } + std::array hypMom; const auto& vtx = fitter.getPCACandidate(); for (int i = 0; i < 3; i++) { @@ -370,7 +371,7 @@ struct hyperRecoTask { if (hypCand.dcaV0dau > dcav0dau) { continue; } - + std::array primVtx = {collision.posX(), collision.posY(), collision.posZ()}; double cosPA = RecoDecay::cpa(primVtx, hypCand.decVtx, hypMom); @@ -494,7 +495,7 @@ struct hyperRecoTask { { for (const auto& collision : collisions) { - hyperCandidates.clear(); + hyperCandidates.clear(); auto bc = collision.bc_as(); initCCDB(bc); @@ -515,20 +516,20 @@ struct hyperRecoTask { auto V0Table_thisCollision = V0s.sliceBy(perCollision, collIdx); V0Table_thisCollision.bindExternalIndices(&tracks); - fillCandidateData(collision, V0Table_thisCollision); + fillCandidateData(collision, V0Table_thisCollision); for (auto& hypCand : hyperCandidates) { - outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), - collision.posX(), collision.posY(), collision.posZ(), - hypCand.isMatter, - hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), - hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], - hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, - hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, - hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); - } + outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); + } } } PROCESS_SWITCH(hyperRecoTask, processData, "Data analysis", true); @@ -558,24 +559,24 @@ struct hyperRecoTask { auto V0Table_thisCollision = V0s.sliceBy(perCollision, collIdx); V0Table_thisCollision.bindExternalIndices(&tracks); - fillCandidateData(collision, V0Table_thisCollision); + fillCandidateData(collision, V0Table_thisCollision); for (auto& hypCand : hyperCandidates) { - outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), - collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), - collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), - collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), - collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), - collision.posX(), collision.posY(), collision.posZ(), - hypCand.isMatter, - hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), - hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], - hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, - hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, - hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); - } + outputDataTableWithFlow(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), + collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), + collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), + collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); + } } } PROCESS_SWITCH(hyperRecoTask, processDataWithFlow, "Data analysis with flow", false); @@ -602,7 +603,7 @@ struct hyperRecoTask { auto V0Table_thisCollision = V0s.sliceBy(perCollision, collIdx); V0Table_thisCollision.bindExternalIndices(&tracks); - fillCandidateData(collision, V0Table_thisCollision); + fillCandidateData(collision, V0Table_thisCollision); } fillMCinfo(trackLabelsMC, particlesMC); From 3ee5d76fb8949a2a262332299eec2513f5663a8d Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 18 Jan 2024 13:53:00 +0000 Subject: [PATCH 4/8] Please consider the following formatting changes --- PWGLF/DataModel/LFHypernucleiTables.h | 1 - PWGLF/TableProducer/hyperRecoTask.cxx | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/PWGLF/DataModel/LFHypernucleiTables.h b/PWGLF/DataModel/LFHypernucleiTables.h index 695f913f9c1..049b93ebb79 100644 --- a/PWGLF/DataModel/LFHypernucleiTables.h +++ b/PWGLF/DataModel/LFHypernucleiTables.h @@ -40,7 +40,6 @@ DECLARE_SOA_COLUMN(QVecXFV0A, qVecXFV0A, float); // Q vector x compone DECLARE_SOA_COLUMN(QVecYFV0A, qVecYFV0A, float); // Q vector y component with FV0A estimator DECLARE_SOA_COLUMN(QVecAmpFV0A, qVecAmpFV0A, float); // Q vector amplitude with FV0A estimator - DECLARE_SOA_COLUMN(IsMatter, isMatter, bool); // bool: true for matter DECLARE_SOA_COLUMN(PtHe3, ptHe3, float); // Pt of the He daughter DECLARE_SOA_COLUMN(PhiHe3, phiHe3, float); // Phi of the He daughter diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 5ffa176a0fb..e11355ca09f 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -563,19 +563,19 @@ struct hyperRecoTask { for (auto& hypCand : hyperCandidates) { outputDataTableWithFlow(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), - collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), - collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), - collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), - collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), - collision.posX(), collision.posY(), collision.posZ(), - hypCand.isMatter, - hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), - hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], - hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, - hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, - hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); + collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), + collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), + collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), + collision.qvecFV0ARe(), collision.qvecFV0AIm(), collision.sumAmplFV0A(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags); } } } From feb9248851b1d591d72e085c3d74ce97c3e73b64 Mon Sep 17 00:00:00 2001 From: fmazzasc Date: Thu, 18 Jan 2024 15:11:07 +0100 Subject: [PATCH 5/8] Clear flow vector at the beginning of the loop --- PWGLF/TableProducer/hyperRecoTask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index e11355ca09f..4bb788474cc 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -536,9 +536,9 @@ struct hyperRecoTask { void processDataWithFlow(CollisionsFullWithFlow const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) { - hyperCandidates.clear(); for (const auto& collision : collisions) { + hyperCandidates.clear(); auto bc = collision.bc_as(); initCCDB(bc); From bee79b2f205365c50af671b952d0d1c849a49a7c Mon Sep 17 00:00:00 2001 From: fmazzasc Date: Thu, 18 Jan 2024 15:41:40 +0100 Subject: [PATCH 6/8] Uniform mc to data processing --- PWGLF/TableProducer/hyperRecoTask.cxx | 141 ++++++++++++++------------ 1 file changed, 77 insertions(+), 64 deletions(-) diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 4bb788474cc..37d44670ee7 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -165,6 +165,8 @@ struct hyperRecoTask { // std vector of candidates std::vector hyperCandidates; + // vector to keep track of MC mothers already filled + std::vector filledMothers; Preslice perCollision = o2::aod::v0::collisionId; @@ -408,7 +410,6 @@ struct hyperRecoTask { void fillMCinfo(aod::McTrackLabels const& trackLabels, aod::McParticles const& particlesMC) { - std::vector filledMothers; for (auto& hypCand : hyperCandidates) { auto mcLabPos = trackLabels.rawIteratorAt(hypCand.posTrackID); auto mcLabNeg = trackLabels.rawIteratorAt(hypCand.negTrackID); @@ -441,54 +442,6 @@ struct hyperRecoTask { } } } - - for (auto& mcPart : particlesMC) { - - if (std::abs(mcPart.pdgCode()) != hyperPdg) - continue; - std::array secVtx; - std::array primVtx = {mcPart.vx(), mcPart.vy(), mcPart.vz()}; - std::array momMother = {mcPart.px(), mcPart.py(), mcPart.pz()}; - std::array momHe3; - bool isHeFound = false; - for (auto& mcDaught : mcPart.daughters_as()) { - if (std::abs(mcDaught.pdgCode()) == heDauPdg) { - secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()}; - momHe3 = {mcDaught.px(), mcDaught.py(), mcDaught.pz()}; - isHeFound = true; - break; - } - } - if (mcPart.pdgCode() > 0) { - hIsMatterGen->Fill(0.); - } else { - hIsMatterGen->Fill(1.); - } - if (!isHeFound) { - hDecayChannel->Fill(1.); - continue; - } - hDecayChannel->Fill(0.); - if (mcPart.pdgCode() > 0) { - hIsMatterGenTwoBody->Fill(0.); - } else { - hIsMatterGenTwoBody->Fill(1.); - } - if (std::find(filledMothers.begin(), filledMothers.end(), mcPart.globalIndex()) != std::end(filledMothers)) { - continue; - } - hyperCandidate hypCand; - for (int i = 0; i < 3; i++) { - hypCand.gDecVtx[i] = secVtx[i] - primVtx[i]; - hypCand.gMom[i] = momMother[i]; - hypCand.gMomHe3[i] = momHe3[i]; - } - hypCand.posTrackID = -1; - hypCand.negTrackID = -1; - hypCand.isSignal = true; - hypCand.pdgCode = mcPart.pdgCode(); - hyperCandidates.push_back(hypCand); - } } void processData(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&) @@ -583,10 +536,9 @@ struct hyperRecoTask { void processMC(CollisionsFull const& collisions, aod::V0s const& V0s, TracksFull const& tracks, aod::BCsWithTimestamps const&, aod::McTrackLabels const& trackLabelsMC, aod::McParticles const& particlesMC) { - hyperCandidates.clear(); for (const auto& collision : collisions) { - + hyperCandidates.clear(); auto bc = collision.bc_as(); initCCDB(bc); @@ -604,23 +556,84 @@ struct hyperRecoTask { V0Table_thisCollision.bindExternalIndices(&tracks); fillCandidateData(collision, V0Table_thisCollision); + fillMCinfo(trackLabelsMC, particlesMC); + + for (auto& hypCand : hyperCandidates) { + if (!hypCand.isSignal && mcSignalOnly) + continue; + int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); + outputMCTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + hypCand.isMatter, + hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), + hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), + collision.posX(), collision.posY(), collision.posZ(), + hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], + hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, + hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, + hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, + hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, + chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), + hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], hypCand.isReco, hypCand.isSignal); + } } - fillMCinfo(trackLabelsMC, particlesMC); - for (auto& hypCand : hyperCandidates) { - if (!hypCand.isSignal && mcSignalOnly) + // now we fill only the signal candidates that were not reconstructed + for (auto& mcPart : particlesMC) { + + if (std::abs(mcPart.pdgCode()) != hyperPdg) continue; + std::array secVtx; + std::array primVtx = {mcPart.vx(), mcPart.vy(), mcPart.vz()}; + std::array momMother = {mcPart.px(), mcPart.py(), mcPart.pz()}; + std::array momHe3; + bool isHeFound = false; + for (auto& mcDaught : mcPart.daughters_as()) { + if (std::abs(mcDaught.pdgCode()) == heDauPdg) { + secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()}; + momHe3 = {mcDaught.px(), mcDaught.py(), mcDaught.pz()}; + isHeFound = true; + break; + } + } + if (mcPart.pdgCode() > 0) { + hIsMatterGen->Fill(0.); + } else { + hIsMatterGen->Fill(1.); + } + if (!isHeFound) { + hDecayChannel->Fill(1.); + continue; + } + hDecayChannel->Fill(0.); + if (mcPart.pdgCode() > 0) { + hIsMatterGenTwoBody->Fill(0.); + } else { + hIsMatterGenTwoBody->Fill(1.); + } + if (std::find(filledMothers.begin(), filledMothers.end(), mcPart.globalIndex()) != std::end(filledMothers)) { + continue; + } + hyperCandidate hypCand; int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); - outputMCTable(hypCand.centralityFT0A, hypCand.centralityFT0C, hypCand.centralityFT0M, - hypCand.isMatter, - hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), - hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - hypCand.primVtx[0], hypCand.primVtx[1], hypCand.primVtx[2], - hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], - hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, - hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi, - hypCand.momHe3TPC, hypCand.momPiTPC, hypCand.tpcSignalHe3, hypCand.tpcSignalPi, - hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, + for (int i = 0; i < 3; i++) { + hypCand.gDecVtx[i] = secVtx[i] - primVtx[i]; + hypCand.gMom[i] = momMother[i]; + hypCand.gMomHe3[i] = momHe3[i]; + } + hypCand.posTrackID = -1; + hypCand.negTrackID = -1; + hypCand.isSignal = true; + hypCand.pdgCode = mcPart.pdgCode(); + outputMCTable(-1, -1, -1, + 0, + -1, -1, -1, + -1, -1, -1, + -1, -1, -1, + -1, -1, -1, + -1, -1, -1, + -1, -1, -1, + -1, -1, -1, -1, + -1, -1, -1, chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(), hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2], hypCand.isReco, hypCand.isSignal); } From 3f9490d1a509ff627f7a9e51aa004579a32b871d Mon Sep 17 00:00:00 2001 From: fmazzasc Date: Thu, 18 Jan 2024 15:58:15 +0100 Subject: [PATCH 7/8] Delete unused variables --- PWGLF/TableProducer/hyperRecoTask.cxx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 37d44670ee7..2495bbf5eb4 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -71,23 +71,6 @@ struct hyperCandidate { float genPhi() const { return std::atan2(gMom[1], gMom[0]); } float genEta() const { return std::asinh(gMom[2] / genPt()); } - float centralityFT0A = -1; - float centralityFT0C = -1; - float centralityFT0M = -1; - float qVecXFT0A = -1; - float qVecYFT0A = -1; - float qVecAmpFT0A = -1; - float qVecXFT0C = -1; - float qVecYFT0C = -1; - float qVecAmpFT0C = -1; - float qVecXFT0M = -1; - float qVecYFT0M = -1; - float qVecAmpFT0M = -1; - float qVecXFV0A = -1; - float qVecYFV0A = -1; - float qVecAmpFV0A = -1; - std::array primVtx; - int posTrackID; int negTrackID; float dcaV0dau = -10; From 7af9edd121a3de09a5b0d5948f9079b12c6c40ba Mon Sep 17 00:00:00 2001 From: fmazzasc Date: Thu, 18 Jan 2024 16:03:02 +0100 Subject: [PATCH 8/8] Fix bug --- PWGLF/TableProducer/hyperRecoTask.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/hyperRecoTask.cxx b/PWGLF/TableProducer/hyperRecoTask.cxx index 2495bbf5eb4..fc3a8454346 100644 --- a/PWGLF/TableProducer/hyperRecoTask.cxx +++ b/PWGLF/TableProducer/hyperRecoTask.cxx @@ -546,10 +546,10 @@ struct hyperRecoTask { continue; int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0); outputMCTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), + collision.posX(), collision.posY(), collision.posZ(), hypCand.isMatter, hypCand.recoPtHe3(), hypCand.recoPhiHe3(), hypCand.recoEtaHe3(), hypCand.recoPtPi(), hypCand.recoPhiPi(), hypCand.recoEtaPi(), - collision.posX(), collision.posY(), collision.posZ(), hypCand.decVtx[0], hypCand.decVtx[1], hypCand.decVtx[2], hypCand.dcaV0dau, hypCand.he3DCAXY, hypCand.piDCAXY, hypCand.nSigmaHe3, hypCand.nTPCClustersHe3, hypCand.nTPCClustersPi,