From 4291d7b1ed630febc42584038a5e1f30a0619f65 Mon Sep 17 00:00:00 2001 From: nzardosh Date: Mon, 14 Sep 2026 14:59:19 +0200 Subject: [PATCH] adding zdc info for upc and adding proper hf matching --- PWGJE/Core/JetCandidateUtilities.h | 6 +- PWGJE/Core/JetDQUtilities.h | 146 +++++----- PWGJE/Core/JetHFUtilities.h | 280 +++++++++----------- PWGJE/DataModel/JetReducedData.h | 10 +- PWGJE/TableProducer/derivedDataProducer.cxx | 86 ++++-- PWGJE/TableProducer/derivedDataWriter.cxx | 2 +- 6 files changed, 271 insertions(+), 259 deletions(-) diff --git a/PWGJE/Core/JetCandidateUtilities.h b/PWGJE/Core/JetCandidateUtilities.h index c9cde2b206d..de6b7faf8f9 100644 --- a/PWGJE/Core/JetCandidateUtilities.h +++ b/PWGJE/Core/JetCandidateUtilities.h @@ -188,15 +188,13 @@ template auto matchedParticle(const T& candidate, const U& tracks, const V& particles) { if constexpr (jethfutilities::isHFCandidate()) { - bool isMatched = false; - return jethfutilities::matchedHFParticle(candidate, tracks, particles, isMatched); + return jethfutilities::matchedHFParticle(candidate, tracks, particles); } else if constexpr (jetv0utilities::isV0Candidate()) { return jetv0utilities::matchedV0Particle(candidate, tracks, particles); } else if constexpr (jetdqutilities::isDielectronCandidate()) { return jetdqutilities::matchedDielectronParticle(candidate, tracks, particles); } else { - bool isMatched = false; - return jethfutilities::matchedHFParticle(candidate, tracks, particles, isMatched); // this is a dummy output which should never be triggered + return jethfutilities::matchedHFParticle(candidate, tracks, particles); // this is a dummy output which should never be triggered } } diff --git a/PWGJE/Core/JetDQUtilities.h b/PWGJE/Core/JetDQUtilities.h index 690e2cef0cb..5ce3e0e1d9f 100644 --- a/PWGJE/Core/JetDQUtilities.h +++ b/PWGJE/Core/JetDQUtilities.h @@ -72,6 +72,74 @@ constexpr bool isDielectronMcTable() return isDielectronMcCandidate() || isDielectronMcCandidate(); } +/** + * returns the PDG of the candidate based on Dielectron Table + * + * @param candidate dielectron candidate that is being checked + */ +template +int getDielectronCandidatePDG(T const& /*candidate*/) +{ + if constexpr (isDielectronCandidate() || isDielectronMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kJPsi); + } else { + return 0; + } +} + +/** + * returns the PDG of the candidates in the table type + */ +template +int getDielectronTablePDG() +{ + if constexpr (isDielectronTable() || isDielectronMcTable()) { + return static_cast(o2::constants::physics::Pdg::kJPsi); + } else { + return 0; + } +} + +/** + * returns the mass of the candidate based on Dielectron Table + * + * @param candidate dielectron candidate that is being checked + */ +template +float getDielectronCandidatePDGMass(T const& /*candidate*/) +{ + if constexpr (isDielectronCandidate() || isDielectronMcCandidate()) { + return static_cast(o2::constants::physics::MassJPsi); + } else { + return -1.0; + } +} + +/** + * returns the mass of the candidates in the table type + * + */ +template +float getDielectronTablePDGMass() +{ + if constexpr (isDielectronTable() || isDielectronMcTable()) { + return static_cast(o2::constants::physics::MassJPsi); + } else { + return -1.0; + } +} + +/** + * returns the mass of the candidate based on Dielectron Table + * + * @param candidate dielectron candidate that is being checked + */ +template +float getDielectronCandidateInvariantMass(T const& candidate) +{ + return candidate.mass(); +} + /** * returns true if the candidate is matched to a reconstructed level candidate with the correct decay * * @param candidate candidate that is being checked @@ -117,10 +185,9 @@ bool isDielectronDaughterTrack(T& track, U& candidate) * @param particles particle table */ template -auto matchedDielectronParticleId(const T& candidate, const U& /*tracks*/, const V& /*particles*/) +auto matchedDielectronParticleId(const T& candidate, const U& /*tracks*/, const V& particles) { - const auto candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); - return candidateDaughterParticle.template mothers_first_as().globalIndex(); // can we get the Id directly? + return RecoDecay::getMother(particles, candidate.template prong0_as().template mcParticle_as(), getDielectronCandidatePDG(candidate), true); } /** @@ -131,10 +198,9 @@ auto matchedDielectronParticleId(const T& candidate, const U& /*tracks*/, const * @param particles particle table */ template -auto matchedDielectronParticle(const T& candidate, const U& /*tracks*/, const V& /*particles*/) +auto matchedDielectronParticle(const T& candidate, const U& /*tracks*/, const V& particles) { - const auto candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); - return candidateDaughterParticle.template mothers_first_as(); + return particles.iteratorAt(RecoDecay::getMother(particles, candidate.template prong0_as().template mcParticle_as(), getDielectronCandidatePDG(candidate), true)); } /** @@ -195,74 +261,6 @@ int getDielectronMcCandidateCollisionId(T const& candidate) } } -/** - * returns the PDG of the candidate based on Dielectron Table - * - * @param candidate dielectron candidate that is being checked - */ -template -int getDielectronCandidatePDG(T const& /*candidate*/) -{ - if constexpr (isDielectronCandidate() || isDielectronMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kJPsi); - } else { - return 0; - } -} - -/** - * returns the PDG of the candidates in the table type - */ -template -int getDielectronTablePDG() -{ - if constexpr (isDielectronTable() || isDielectronMcTable()) { - return static_cast(o2::constants::physics::Pdg::kJPsi); - } else { - return 0; - } -} - -/** - * returns the mass of the candidate based on Dielectron Table - * - * @param candidate dielectron candidate that is being checked - */ -template -float getDielectronCandidatePDGMass(T const& /*candidate*/) -{ - if constexpr (isDielectronCandidate() || isDielectronMcCandidate()) { - return static_cast(o2::constants::physics::MassJPsi); - } else { - return -1.0; - } -} - -/** - * returns the mass of the candidates in the table type - * - */ -template -float getDielectronTablePDGMass() -{ - if constexpr (isDielectronTable() || isDielectronMcTable()) { - return static_cast(o2::constants::physics::MassJPsi); - } else { - return -1.0; - } -} - -/** - * returns the mass of the candidate based on Dielectron Table - * - * @param candidate dielectron candidate that is being checked - */ -template -float getDielectronCandidateInvariantMass(T const& candidate) -{ - return candidate.mass(); -} - template bool isDielectronParticle(T const& particles, U const& particle) { diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index 1a52ba5019c..2ffb20bf36a 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -21,6 +21,8 @@ #include "PWGHF/Core/DecayChannelsLegacy.h" #include "PWGJE/DataModel/Jet.h" +#include "Common/Core/RecoDecay.h" + #include #include @@ -431,6 +433,130 @@ constexpr bool isHFMcTable() } } +/** + * returns the PDG of the candidate based on HF Table + * + * @param candidate HF candidate that is being checked + */ +template +int getHFCandidatePDG(T const& /*candidate*/) +{ + if constexpr (isD0Candidate() || isD0McCandidate()) { + return static_cast(o2::constants::physics::Pdg::kD0); + } else if constexpr (isDplusCandidate() || isDplusMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kDPlus); + } else if constexpr (isDsCandidate() || isDsMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kDS); + } else if constexpr (isDstarCandidate() || isDstarMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kDStar); + } else if constexpr (isLcCandidate() || isLcMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); + } else if constexpr (isB0Candidate() || isB0McCandidate()) { + return static_cast(o2::constants::physics::Pdg::kB0); + } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kBPlus); + } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kXiCPlus); + } else { + return 0; + } +} + +/** + * returns the PDG of the candidates in the table type + */ +template +int getHFTablePDG() +{ + if constexpr (isD0Table() || isD0McTable()) { + return static_cast(o2::constants::physics::Pdg::kD0); + } else if constexpr (isDplusTable() || isDplusMcTable()) { + return static_cast(o2::constants::physics::Pdg::kDPlus); + } else if constexpr (isDsTable() || isDsMcTable()) { + return static_cast(o2::constants::physics::Pdg::kDS); + } else if constexpr (isDstarTable() || isDstarMcTable()) { + return static_cast(o2::constants::physics::Pdg::kDStar); + } else if constexpr (isLcTable() || isLcMcTable()) { + return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); + } else if constexpr (isB0Table() || isB0McTable()) { + return static_cast(o2::constants::physics::Pdg::kB0); + } else if constexpr (isBplusTable() || isBplusMcTable()) { + return static_cast(o2::constants::physics::Pdg::kBPlus); + } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { + return static_cast(o2::constants::physics::Pdg::kXiCPlus); + } else { + return 0; + } +} + +/** + * returns the mass of the candidate based on HF Table + * + * @param candidate HF candidate that is being checked + */ +template +float getHFCandidatePDGMass(T const& /*candidate*/) +{ + if constexpr (isD0Candidate() || isD0McCandidate()) { + return static_cast(o2::constants::physics::MassD0); + } else if constexpr (isDplusCandidate() || isDplusMcCandidate()) { + return static_cast(o2::constants::physics::MassDPlus); + } else if constexpr (isDsCandidate() || isDsMcCandidate()) { + return static_cast(o2::constants::physics::MassDS); + } else if constexpr (isDstarCandidate() || isDstarMcCandidate()) { + return static_cast(o2::constants::physics::MassDStar); + } else if constexpr (isLcCandidate() || isLcMcCandidate()) { + return static_cast(o2::constants::physics::MassLambdaCPlus); + } else if constexpr (isB0Candidate() || isB0McCandidate()) { + return static_cast(o2::constants::physics::MassB0); + } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { + return static_cast(o2::constants::physics::MassBPlus); + } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiMcCandidate()) { + return static_cast(o2::constants::physics::MassXiCPlus); + } else { + return -1.0; + } +} + +/** + * returns the mass of the candidates in the table type + * + */ +template +float getHFTablePDGMass() +{ + if constexpr (isD0Table() || isD0McTable()) { + return static_cast(o2::constants::physics::MassD0); + } else if constexpr (isDplusTable() || isDplusMcTable()) { + return static_cast(o2::constants::physics::MassDPlus); + } else if constexpr (isDsTable() || isDsMcTable()) { + return static_cast(o2::constants::physics::MassDS); + } else if constexpr (isDstarTable() || isDstarMcTable()) { + return static_cast(o2::constants::physics::MassDStar); + } else if constexpr (isLcTable() || isLcMcTable()) { + return static_cast(o2::constants::physics::MassLambdaCPlus); + } else if constexpr (isB0Table() || isB0McTable()) { + return static_cast(o2::constants::physics::MassB0); + } else if constexpr (isBplusTable() || isBplusMcTable()) { + return static_cast(o2::constants::physics::MassBPlus); + } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { + return static_cast(o2::constants::physics::MassXiCPlus); + } else { + return -1.0; + } +} + +/** + * returns the mass of the candidate based on HF Table + * + * @param candidate HF candidate that is being checked + */ +template +float getHFCandidateInvariantMass(T const& candidate) +{ + return candidate.m(); +} + /** * returns true if the candidate is matched to a reconstructed level candidate with the correct decay * * @param candidate candidate that is being checked @@ -609,35 +735,9 @@ bool isHFDaughterTrack(T& track, U& candidate) * @param particles particle table */ template -auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& /*particles*/) +auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& particles) { - - typename V::iterator candidateDaughterParticle; - if constexpr (isD0Candidate()) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - } - if constexpr (isDplusCandidate()) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - } - if constexpr (isDsCandidate()) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - } - if constexpr (isDstarCandidate()) { - candidateDaughterParticle = candidate.template prong2_as().template mcParticle_as(); - } - if constexpr (isLcCandidate()) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - } - if constexpr (isB0Candidate()) { - candidateDaughterParticle = candidate.template prong3_as().template mcParticle_as(); - } - if constexpr (isBplusCandidate()) { - candidateDaughterParticle = candidate.template prong2_as().template mcParticle_as(); - } - if constexpr (isXicToXiPiPiCandidate()) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - } - return candidateDaughterParticle.template mothers_first_as(); + return particles.iteratorAt(RecoDecay::getMother(particles, candidate.template prong0_as().template mcParticle_as(), getHFCandidatePDG(candidate), true)); } /** @@ -737,130 +837,6 @@ int getHFMcCandidateCollisionId(T const& candidate) return candidate.hfMcCollBaseId(); } -/** - * returns the PDG of the candidate based on HF Table - * - * @param candidate HF candidate that is being checked - */ -template -int getHFCandidatePDG(T const& /*candidate*/) -{ - if constexpr (isD0Candidate() || isD0McCandidate()) { - return static_cast(o2::constants::physics::Pdg::kD0); - } else if constexpr (isDplusCandidate() || isDplusMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kDPlus); - } else if constexpr (isDsCandidate() || isDsMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kDS); - } else if constexpr (isDstarCandidate() || isDstarMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kDStar); - } else if constexpr (isLcCandidate() || isLcMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); - } else if constexpr (isB0Candidate() || isB0McCandidate()) { - return static_cast(o2::constants::physics::Pdg::kB0); - } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kBPlus); - } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiMcCandidate()) { - return static_cast(o2::constants::physics::Pdg::kXiCPlus); - } else { - return 0; - } -} - -/** - * returns the PDG of the candidates in the table type - */ -template -int getHFTablePDG() -{ - if constexpr (isD0Table() || isD0McTable()) { - return static_cast(o2::constants::physics::Pdg::kD0); - } else if constexpr (isDplusTable() || isDplusMcTable()) { - return static_cast(o2::constants::physics::Pdg::kDPlus); - } else if constexpr (isDsTable() || isDsMcTable()) { - return static_cast(o2::constants::physics::Pdg::kDS); - } else if constexpr (isDstarTable() || isDstarMcTable()) { - return static_cast(o2::constants::physics::Pdg::kDStar); - } else if constexpr (isLcTable() || isLcMcTable()) { - return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); - } else if constexpr (isB0Table() || isB0McTable()) { - return static_cast(o2::constants::physics::Pdg::kB0); - } else if constexpr (isBplusTable() || isBplusMcTable()) { - return static_cast(o2::constants::physics::Pdg::kBPlus); - } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { - return static_cast(o2::constants::physics::Pdg::kXiCPlus); - } else { - return 0; - } -} - -/** - * returns the mass of the candidate based on HF Table - * - * @param candidate HF candidate that is being checked - */ -template -float getHFCandidatePDGMass(T const& /*candidate*/) -{ - if constexpr (isD0Candidate() || isD0McCandidate()) { - return static_cast(o2::constants::physics::MassD0); - } else if constexpr (isDplusCandidate() || isDplusMcCandidate()) { - return static_cast(o2::constants::physics::MassDPlus); - } else if constexpr (isDsCandidate() || isDsMcCandidate()) { - return static_cast(o2::constants::physics::MassDS); - } else if constexpr (isDstarCandidate() || isDstarMcCandidate()) { - return static_cast(o2::constants::physics::MassDStar); - } else if constexpr (isLcCandidate() || isLcMcCandidate()) { - return static_cast(o2::constants::physics::MassLambdaCPlus); - } else if constexpr (isB0Candidate() || isB0McCandidate()) { - return static_cast(o2::constants::physics::MassB0); - } else if constexpr (isBplusCandidate() || isBplusMcCandidate()) { - return static_cast(o2::constants::physics::MassBPlus); - } else if constexpr (isXicToXiPiPiCandidate() || isXicToXiPiPiMcCandidate()) { - return static_cast(o2::constants::physics::MassXiCPlus); - } else { - return -1.0; - } -} - -/** - * returns the mass of the candidates in the table type - * - */ -template -float getHFTablePDGMass() -{ - if constexpr (isD0Table() || isD0McTable()) { - return static_cast(o2::constants::physics::MassD0); - } else if constexpr (isDplusTable() || isDplusMcTable()) { - return static_cast(o2::constants::physics::MassDPlus); - } else if constexpr (isDsTable() || isDsMcTable()) { - return static_cast(o2::constants::physics::MassDS); - } else if constexpr (isDstarTable() || isDstarMcTable()) { - return static_cast(o2::constants::physics::MassDStar); - } else if constexpr (isLcTable() || isLcMcTable()) { - return static_cast(o2::constants::physics::MassLambdaCPlus); - } else if constexpr (isB0Table() || isB0McTable()) { - return static_cast(o2::constants::physics::MassB0); - } else if constexpr (isBplusTable() || isBplusMcTable()) { - return static_cast(o2::constants::physics::MassBPlus); - } else if constexpr (isXicToXiPiPiTable() || isXicToXiPiPiMcTable()) { - return static_cast(o2::constants::physics::MassXiCPlus); - } else { - return -1.0; - } -} - -/** - * returns the mass of the candidate based on HF Table - * - * @param candidate HF candidate that is being checked - */ -template -float getHFCandidateInvariantMass(T const& candidate) -{ - return candidate.m(); -} - template void fillHFCollisionTable(T const& collision, U& HFCollisionTable) { diff --git a/PWGJE/DataModel/JetReducedData.h b/PWGJE/DataModel/JetReducedData.h index 9f79d867083..66bb38bce86 100644 --- a/PWGJE/DataModel/JetReducedData.h +++ b/PWGJE/DataModel/JetReducedData.h @@ -97,6 +97,10 @@ DECLARE_SOA_COLUMN(AmplitudesFT0A, amplitudesFT0A, std::vector); DECLARE_SOA_COLUMN(AmplitudesFT0C, amplitudesFT0C, std::vector); DECLARE_SOA_COLUMN(AmplitudesFDDA, amplitudesFDDA, std::vector); DECLARE_SOA_COLUMN(AmplitudesFDDC, amplitudesFDDC, std::vector); +DECLARE_SOA_COLUMN(EnergyCommonZNA, energyCommonZNA, float); +DECLARE_SOA_COLUMN(EnergyCommonZNC, energyCommonZNC, float); +DECLARE_SOA_COLUMN(TimeZNA, timeZNA, float); +DECLARE_SOA_COLUMN(TimeZNC, timeZNC, float); DECLARE_SOA_COLUMN(HadronicRate, hadronicRate, float); DECLARE_SOA_COLUMN(Weight, weight, float); DECLARE_SOA_COLUMN(GetSubGeneratorId, getSubGeneratorId, int); @@ -160,7 +164,11 @@ DECLARE_SOA_TABLE_STAGED(JCollisionUPCs, "JCOLLISIONUPC", jcollision::AmplitudesFT0A, jcollision::AmplitudesFT0C, jcollision::AmplitudesFDDA, - jcollision::AmplitudesFDDC); + jcollision::AmplitudesFDDC, + jcollision::EnergyCommonZNA, + jcollision::EnergyCommonZNC, + jcollision::TimeZNA, + jcollision::TimeZNC); DECLARE_SOA_TABLE_STAGED(JCollisionMcInfos, "JCOLLISIONMCINFO", jcollision::Weight, diff --git a/PWGJE/TableProducer/derivedDataProducer.cxx b/PWGJE/TableProducer/derivedDataProducer.cxx index d2a9e5a54c9..80bb8fecb6a 100644 --- a/PWGJE/TableProducer/derivedDataProducer.cxx +++ b/PWGJE/TableProducer/derivedDataProducer.cxx @@ -164,7 +164,6 @@ struct JetDerivedDataProducerTask { Configurable includeTriggers{"includeTriggers", false, "fill the collision information with software trigger decisions"}; Configurable includeHadronicRate{"includeHadronicRate", true, "fill the collision information with the hadronic rate"}; - Configurable includeUpcs{"includeUpcs", true, "include option to identify UPC events"}; Configurable v0ChargedDecaysOnly{"v0ChargedDecaysOnly", true, "store V0s (at particle-level) only if they decay to charged particles"}; Configurable isMCGenOnly{"isMCGenOnly", false, "analysis is run over mcGen only"}; @@ -221,11 +220,13 @@ struct JetDerivedDataProducerTask { } } - upcCuts.SetNDtcoll(config.upcBCRangeTimeWindow); - upcCuts.SetMinNBCs(config.upcMinNBCs); - upcCuts.SetNTracks(config.upcMinNTracks, config.upcMaxNTracks); - upcCuts.SetMaxFITtime(config.upcMaxFITTime); - upcCuts.SetFITAmpLimits({config.upcMaxFV0AAmplitude, config.upcMaxFT0AAmplitude, config.upcMaxFT0CAmplitude, config.upcMaxFDDAAmplitude, config.upcMaxFDDCAmplitude}); + if (doprocessCollisionsUPC) { + upcCuts.SetNDtcoll(config.upcBCRangeTimeWindow); + upcCuts.SetMinNBCs(config.upcMinNBCs); + upcCuts.SetNTracks(config.upcMinNTracks, config.upcMaxNTracks); + upcCuts.SetMaxFITtime(config.upcMaxFITTime); + upcCuts.SetFITAmpLimits({config.upcMaxFV0AAmplitude, config.upcMaxFT0AAmplitude, config.upcMaxFT0CAmplitude, config.upcMaxFDDAAmplitude, config.upcMaxFDDCAmplitude}); + } if (config.applyTrackingEfficiency) { trackingEfficiencyRandomNumber.SetSeed(0); @@ -297,7 +298,7 @@ struct JetDerivedDataProducerTask { } PROCESS_SWITCH(JetDerivedDataProducerTask, processBunchCrossingsWithoutSels, "produces derived bunch crossing table with bunch crossing selections", false); - void processCollisions(soa::Join::iterator const& collision, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&) + void processCollisions(soa::Join::iterator const& collision, soa::Join const&, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&) { auto bc = collision.bc_as>(); if (config.includeHadronicRate) { @@ -313,32 +314,63 @@ struct JetDerivedDataProducerTask { } int upcGapResult = o2::aod::sgselector::NoGap; - if (config.includeUpcs) { - amplitudesFV0.clear(); - amplitudesFT0A.clear(); - amplitudesFT0C.clear(); - amplitudesFDDA.clear(); - amplitudesFDDC.clear(); - if (collision.has_foundBC()) { - auto const upcBC = collision.foundBC_as>(); - auto const upcBCRange = udhelpers::compatibleBCs(collision, upcCuts.NDtcoll(), bcs, upcCuts.minNBCs()); - auto const upcResult = upcSelector.IsSelected(upcCuts, collision, upcBCRange, upcBC, &litudesFV0, &litudesFT0A, &litudesFT0C, &litudesFDDA, &litudesFDDC); - upcGapResult = upcResult.value; - if (upcGapResult != o2::aod::sgselector::SingleGapA && upcGapResult != o2::aod::sgselector::SingleGapC && upcGapResult != o2::aod::sgselector::DoubleGap) { - amplitudesFV0.clear(); - amplitudesFT0A.clear(); - amplitudesFT0C.clear(); - amplitudesFDDA.clear(); - amplitudesFDDC.clear(); - } + + products.jCollisionsTable(collision.bcId(), collision.posX(), collision.posY(), collision.posZ(), collision.collisionTime(), collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), collision.centFV0A(), -1.0, collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFT0CVariant1(), hadronicRate, collision.trackOccupancyInTimeRange(), collision.alias_raw(), jetderiveddatautilities::setEventSelectionBit(collision, upcGapResult), collision.rct_raw(), triggerBit); // note change multFT0C to multFT0M when problems with multFT0A are fixed + products.jCollisionsParentIndexTable(collision.globalIndex()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisions, "produces derived collision tables", true); + + void processCollisionsUPC(soa::Join::iterator const& collision, soa::Join const& bcs, aod::FT0s const&, aod::FV0As const&, aod::FDDs const&, aod::Zdcs const&) + { + auto bc = collision.bc_as>(); + if (config.includeHadronicRate) { + if (runNumber != bc.runNumber()) { + runNumber = bc.runNumber(); + hadronicRate = rateFetcher.fetch(ccdb.service, bc.timestamp(), runNumber, "ZNC hadronic") * 0.001; + } + } + uint64_t triggerBit = 0; + if (config.includeTriggers) { + triggerDecider.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), jetderiveddatautilities::JTriggerMasks); + triggerBit = jetderiveddatautilities::setTriggerSelectionBit(triggerDecider.getTriggerOfInterestResults(bc.globalBC())); + } + + int upcGapResult = o2::aod::sgselector::NoGap; + amplitudesFV0.clear(); + amplitudesFT0A.clear(); + amplitudesFT0C.clear(); + amplitudesFDDA.clear(); + amplitudesFDDC.clear(); + if (collision.has_foundBC()) { + auto const upcBC = collision.foundBC_as>(); + auto const upcBCRange = udhelpers::compatibleBCs(collision, upcCuts.NDtcoll(), bcs, upcCuts.minNBCs()); + auto const upcResult = upcSelector.IsSelected(upcCuts, collision, upcBCRange, upcBC, &litudesFV0, &litudesFT0A, &litudesFT0C, &litudesFDDA, &litudesFDDC); + upcGapResult = upcResult.value; + if (upcGapResult != o2::aod::sgselector::SingleGapA && upcGapResult != o2::aod::sgselector::SingleGapC && upcGapResult != o2::aod::sgselector::DoubleGap) { + amplitudesFV0.clear(); + amplitudesFT0A.clear(); + amplitudesFT0C.clear(); + amplitudesFDDA.clear(); + amplitudesFDDC.clear(); } - products.jCollisionUPCsTable(amplitudesFV0, amplitudesFT0A, amplitudesFT0C, amplitudesFDDA, amplitudesFDDC); } + float energyCommonZNA = -1.0; + float energyCommonZNC = -1.0; + float timeZNA = -1.0; + float timeZNC = -1.0; + if (bc.has_zdc()) { + auto const& zdc = bc.zdc_as(); + energyCommonZNA = zdc.energyCommonZNA(); + energyCommonZNC = zdc.energyCommonZNC(); + timeZNA = zdc.timeZNA(); + timeZNC = zdc.timeZNC(); + } + products.jCollisionUPCsTable(amplitudesFV0, amplitudesFT0A, amplitudesFT0C, amplitudesFDDA, amplitudesFDDC, energyCommonZNA, energyCommonZNC, timeZNA, timeZNC); products.jCollisionsTable(collision.bcId(), collision.posX(), collision.posY(), collision.posZ(), collision.collisionTime(), collision.multFV0A(), collision.multFV0C(), collision.multFT0A(), collision.multFT0C(), collision.centFV0A(), -1.0, collision.centFT0A(), collision.centFT0C(), collision.centFT0M(), collision.centFT0CVariant1(), hadronicRate, collision.trackOccupancyInTimeRange(), collision.alias_raw(), jetderiveddatautilities::setEventSelectionBit(collision, upcGapResult), collision.rct_raw(), triggerBit); // note change multFT0C to multFT0M when problems with multFT0A are fixed products.jCollisionsParentIndexTable(collision.globalIndex()); } - PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisions, "produces derived collision tables", true); + PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisionsUPC, "produces derived collision tables with UPC information", false); void processCollisionsWithoutCentralityAndMultiplicity(soa::Join::iterator const& collision, soa::Join const&) { diff --git a/PWGJE/TableProducer/derivedDataWriter.cxx b/PWGJE/TableProducer/derivedDataWriter.cxx index 67f76d1c62e..eefb501eaa0 100644 --- a/PWGJE/TableProducer/derivedDataWriter.cxx +++ b/PWGJE/TableProducer/derivedDataWriter.cxx @@ -521,7 +521,7 @@ struct JetDerivedDataWriter { std::copy(amplitudesFT0CSpan.begin(), amplitudesFT0CSpan.end(), std::back_inserter(amplitudesFT0C)); std::copy(amplitudesFDDASpan.begin(), amplitudesFDDASpan.end(), std::back_inserter(amplitudesFDDA)); std::copy(amplitudesFDDCSpan.begin(), amplitudesFDDCSpan.end(), std::back_inserter(amplitudesFDDC)); - products.storedJCollisionUPCsTable(amplitudesFV0, amplitudesFT0A, amplitudesFT0C, amplitudesFDDA, amplitudesFDDC); + products.storedJCollisionUPCsTable(amplitudesFV0, amplitudesFT0A, amplitudesFT0C, amplitudesFDDA, amplitudesFDDC, collision.energyCommonZNA(), collision.energyCommonZNC(), collision.timeZNA(), collision.timeZNC()); } } }