From 377dd15ee68463b79dd8b0832ac2eb3a4dd85ca2 Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 23 Mar 2023 15:26:18 +0100 Subject: [PATCH 01/12] Update jet tables --- PWGJE/DataModel/Jet.h | 28 ++++++- PWGJE/DataModel/JetHF.h | 175 ++++++++++++++++++++-------------------- 2 files changed, 116 insertions(+), 87 deletions(-) diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index c23fb136b19..2e1ad44cec4 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -57,7 +57,15 @@ } \ DECLARE_SOA_TABLE(Matched##_jet_type_##s, "AOD", _description_ "MATCH", \ _name_##matching::_jet_type_##Id, \ - _name_##matching::MatchedJetIndex); + _name_##matching::MatchedJetIndex); \ + namespace _name_##matchingGeo \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetGeo); \ + } \ + namespace _name_##matchingCand \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetCand); \ + } // Defines the jet constituent table #define JET_CONSTITUENTS_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_) \ @@ -105,6 +113,24 @@ constituentssub::Pz, \ constituentssub::P); +// combine definition of tables for jets, constituents, and substructure +#define JET_TABLES_DEF(_collision_name_, _jet_type_, _const_type_, _hfcand_type_) \ + JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, #_jet_type_ "JET"); \ + using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ + using Matched##_jet_type_##Jet = Matched##_jet_type_##Jet##s::iterator; \ + JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_, _const_type_, _hfcand_type_); \ + using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ + JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_); \ + using _jet_type_##Jet##ConstituentSub = _jet_type_##Jet##ConstituentsSub::iterator; + +// generate tables for data, generator- and detector-level jets +#define JET_TABLES_LEVELS_DEF(_jet_type_, _hfcand_type_) \ + JET_TABLES_DEF(Collision, _jet_type_, Track, _hfcand_type_); \ + JET_TABLES_DEF(Collision, _jet_type_##MCD, Track, _hfcand_type_); \ + JET_TABLES_DEF(McCollision, _jet_type_##MCP, McParticle, McParticles); \ + DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCPJets, "AOD", #_jet_type_ "JETMATCH", _jet_type_##MCDjetmatchingGeo::_jet_type_##MCDJetId, _jet_type_##MCDjetmatchingCand::_jet_type_##MCDJetId); \ + DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCDJets, "AOD", #_jet_type_ "JETMATCH", _jet_type_##MCPjetmatchingGeo::_jet_type_##MCPJetId, _jet_type_##MCPjetmatchingCand::_jet_type_##MCPJetId); + namespace o2::aod { namespace jet diff --git a/PWGJE/DataModel/JetHF.h b/PWGJE/DataModel/JetHF.h index ce9dd873c23..395fdfb43c5 100644 --- a/PWGJE/DataModel/JetHF.h +++ b/PWGJE/DataModel/JetHF.h @@ -28,98 +28,101 @@ namespace o2::aod // HF jets // D0 tagged jets -JET_TABLE_DEF(Collision, D0Jet, D0jet, "D0JET"); -using D0Jet = D0Jets::iterator; -using MatchedD0Jet = MatchedD0Jets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(D0Jet, D0jet, "D0", Track, HfCand2Prong); -using D0JetConstituent = D0JetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(D0Jet, D0jet, "D0"); -using D0JetConstituentSub = D0JetConstituentsSub::iterator; - -// Lc tagged jets -JET_TABLE_DEF(Collision, LcJet, Lcjet, "LcJET"); -using LcJet = LcJets::iterator; -using MatchedLcJet = MatchedLcJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(LcJet, Lcjet, "Lc", Track, HfCand3Prong); -using LcJetConstituent = LcJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(LcJet, Lcjet, "Lc"); -using LcJetConstituentSub = LcJetConstituentsSub::iterator; - -// B+ tagged jets -JET_TABLE_DEF(Collision, BPlusJet, BPlusjet, "BPlJET"); -using BPlusJet = BPlusJets::iterator; -using MatchedBPlusJet = MatchedBPlusJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(BPlusJet, BPlusjet, "BPl", Track, HfCandBplus); -using BPlusJetConstituent = BPlusJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(BPlusJet, BPlusjet, "BPl"); -using BPlusJetConstituentSub = BPlusJetConstituentsSub::iterator; +JET_TABLES_LEVELS_DEF(D0, HfCand2Prong); +JET_TABLES_LEVELS_DEF(Lc, HfCand3Prong); +JET_TABLES_LEVELS_DEF(BPl, HfCandBplus); + +// using D0Jet = D0Jets::iterator; +// using MatchedD0Jet = MatchedD0Jets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(D0Jet, D0jet, "D0", Track, HfCand2Prong); +// using D0JetConstituent = D0JetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(D0Jet, D0jet, "D0"); +// using D0JetConstituentSub = D0JetConstituentsSub::iterator; + +// // Lc tagged jets +// JET_TABLE_DEF(Collision, LcJet, Lcjet, "LcJET"); +// using LcJet = LcJets::iterator; +// using MatchedLcJet = MatchedLcJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(LcJet, Lcjet, "Lc", Track, HfCand3Prong); +// using LcJetConstituent = LcJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(LcJet, Lcjet, "Lc"); +// using LcJetConstituentSub = LcJetConstituentsSub::iterator; + +// // B+ tagged jets +// JET_TABLE_DEF(Collision, BPlusJet, BPlusjet, "BPlJET"); +// using BPlusJet = BPlusJets::iterator; +// using MatchedBPlusJet = MatchedBPlusJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(BPlusJet, BPlusjet, "BPl", Track, HfCandBplus); +// using BPlusJetConstituent = BPlusJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(BPlusJet, BPlusjet, "BPl"); +// using BPlusJetConstituentSub = BPlusJetConstituentsSub::iterator; // HF jets (MC detector level) // D0 tagged jets -JET_TABLE_DEF(Collision, MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0JETMCD"); -using MCDetectorLevelD0Jet = MCDetectorLevelD0Jets::iterator; -using MatchedMCDetectorLevelD0Jet = MatchedMCDetectorLevelD0Jets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0MCD", Track, HfCand2Prong); -using MCDetectorLevelD0JetConstituent = MCDetectorLevelD0JetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0MCD"); -using MCDetectorLevelD0JetConstituentSub = MCDetectorLevelD0JetConstituentsSub::iterator; - -// Lc tagged jets -JET_TABLE_DEF(Collision, MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcJETMCD"); -using MCDetectorLevelLcJet = MCDetectorLevelLcJets::iterator; -using MatchedMCDetectorLevelLcJet = MatchedMCDetectorLevelLcJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcMCD", Track, HfCand3Prong); -using MCDetectorLevelLcJetConstituent = MCDetectorLevelLcJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcMCD"); -using MCDetectorLevelLcJetConstituentSub = MCDetectorLevelLcJetConstituentsSub::iterator; - -// B+ tagged jets -JET_TABLE_DEF(Collision, MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlJETMCD"); -using MCDetectorLevelBPlusJet = MCDetectorLevelBPlusJets::iterator; -using MatchedMCDetectorLevelBPlusJet = MatchedMCDetectorLevelBPlusJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlMCD", Track, HfCandBplus); -using MCDetectorLevelBPlusJetConstituent = MCDetectorLevelBPlusJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlMCD"); -using MCDetectorLevelBPlusJetConstituentSub = MCDetectorLevelBPlusJetConstituentsSub::iterator; +// JET_TABLE_DEF(Collision, MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0JETMCD"); +// using MCDetectorLevelD0Jet = MCDetectorLevelD0Jets::iterator; +// using MatchedMCDetectorLevelD0Jet = MatchedMCDetectorLevelD0Jets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0MCD", Track, HfCand2Prong); +// using MCDetectorLevelD0JetConstituent = MCDetectorLevelD0JetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0MCD"); +// using MCDetectorLevelD0JetConstituentSub = MCDetectorLevelD0JetConstituentsSub::iterator; + +// // Lc tagged jets +// JET_TABLE_DEF(Collision, MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcJETMCD"); +// using MCDetectorLevelLcJet = MCDetectorLevelLcJets::iterator; +// using MatchedMCDetectorLevelLcJet = MatchedMCDetectorLevelLcJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcMCD", Track, HfCand3Prong); +// using MCDetectorLevelLcJetConstituent = MCDetectorLevelLcJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcMCD"); +// using MCDetectorLevelLcJetConstituentSub = MCDetectorLevelLcJetConstituentsSub::iterator; + +// // B+ tagged jets +// JET_TABLE_DEF(Collision, MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlJETMCD"); +// using MCDetectorLevelBPlusJet = MCDetectorLevelBPlusJets::iterator; +// using MatchedMCDetectorLevelBPlusJet = MatchedMCDetectorLevelBPlusJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlMCD", Track, HfCandBplus); +// using MCDetectorLevelBPlusJetConstituent = MCDetectorLevelBPlusJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlMCD"); +// using MCDetectorLevelBPlusJetConstituentSub = MCDetectorLevelBPlusJetConstituentsSub::iterator; // HF jets (MC particle level) // D0 tagged jets -JET_TABLE_DEF(McCollision, MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0JETMCP"); -using MCParticleLevelD0Jet = MCParticleLevelD0Jets::iterator; -using MatchedMCParticleLevelD0Jet = MatchedMCParticleLevelD0Jets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0MCP", McParticle, McParticles); -using MCParticleLevelD0JetConstituent = MCParticleLevelD0JetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0MCP"); -using MCParticleLevelD0JetConstituentSub = MCParticleLevelD0JetConstituentsSub::iterator; - -// Lc tagged jets -JET_TABLE_DEF(McCollision, MCParticleLevelLcJet, mcparticlelevelLcjet, "LcJETMCP"); -using MCParticleLevelLcJet = MCParticleLevelLcJets::iterator; -using MatchedMCParticleLevelLcJet = MatchedMCParticleLevelLcJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcMCP", McParticle, McParticles); -using MCParticleLevelLcJetConstituent = MCParticleLevelLcJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcMCP"); -using MCParticleLevelLcJetConstituentSub = MCParticleLevelLcJetConstituentsSub::iterator; - -// B+ tagged jets -JET_TABLE_DEF(McCollision, MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlJETMCP"); -using MCParticleLevelBPlusJet = MCParticleLevelBPlusJets::iterator; -using MatchedMCParticleLevelBPlusJet = MatchedMCParticleLevelBPlusJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlMCP", McParticle, McParticles); -using MCParticleLevelBPlusJetConstituent = MCParticleLevelBPlusJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlMCP"); -using MCParticleLevelBPlusJetConstituentSub = MCParticleLevelBPlusJetConstituentsSub::iterator; - -namespace mcdetectorlevelD0jetmatching2 -{ -DECLARE_SOA_INDEX_COLUMN(MCDetectorLevelD0Jet, matchedJet); -} -namespace mcparticlelevelD0jetmatching2 -{ -DECLARE_SOA_INDEX_COLUMN(MCParticleLevelD0Jet, matchedJet); -} -DECLARE_SOA_TABLE(MatchedMCParticleDetectorLevelD0Jets, "AOD", "D0JETMCPDMATCH", mcdetectorlevelD0jetmatching2::MCDetectorLevelD0JetId); -DECLARE_SOA_TABLE(MatchedMCDetectorParticleLevelD0Jets, "AOD", "D0JETMCDPMATCH", mcparticlelevelD0jetmatching2::MCParticleLevelD0JetId); +// JET_TABLE_DEF(McCollision, MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0JETMCP"); +// using MCParticleLevelD0Jet = MCParticleLevelD0Jets::iterator; +// using MatchedMCParticleLevelD0Jet = MatchedMCParticleLevelD0Jets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0MCP", McParticle, McParticles); +// using MCParticleLevelD0JetConstituent = MCParticleLevelD0JetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0MCP"); +// using MCParticleLevelD0JetConstituentSub = MCParticleLevelD0JetConstituentsSub::iterator; + +// // Lc tagged jets +// JET_TABLE_DEF(McCollision, MCParticleLevelLcJet, mcparticlelevelLcjet, "LcJETMCP"); +// using MCParticleLevelLcJet = MCParticleLevelLcJets::iterator; +// using MatchedMCParticleLevelLcJet = MatchedMCParticleLevelLcJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcMCP", McParticle, McParticles); +// using MCParticleLevelLcJetConstituent = MCParticleLevelLcJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcMCP"); +// using MCParticleLevelLcJetConstituentSub = MCParticleLevelLcJetConstituentsSub::iterator; + +// // B+ tagged jets +// JET_TABLE_DEF(McCollision, MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlJETMCP"); +// using MCParticleLevelBPlusJet = MCParticleLevelBPlusJets::iterator; +// using MatchedMCParticleLevelBPlusJet = MatchedMCParticleLevelBPlusJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlMCP", McParticle, McParticles); +// using MCParticleLevelBPlusJetConstituent = MCParticleLevelBPlusJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlMCP"); +// using MCParticleLevelBPlusJetConstituentSub = MCParticleLevelBPlusJetConstituentsSub::iterator; + +// namespace mcdetectorlevelD0jetmatching2 +// { +// DECLARE_SOA_INDEX_COLUMN(MCDetectorLevelD0Jet, matchedJet); +// } +// namespace mcparticlelevelD0jetmatching2 +// { +// DECLARE_SOA_INDEX_COLUMN(MCParticleLevelD0Jet, matchedJet); +// } +// DECLARE_SOA_TABLE(MatchedMCParticleDetectorLevelD0Jets, "AOD", "D0JETMCPDMATCH", mcdetectorlevelD0jetmatching2::MCDetectorLevelD0JetId); +// DECLARE_SOA_TABLE(MatchedMCDetectorParticleLevelD0Jets, "AOD", "D0JETMCDPMATCH", mcparticlelevelD0jetmatching2::MCParticleLevelD0JetId); } // namespace o2::aod From a0dda402cfbf3ff169f6e1a60a9eb6a85f54b2e3 Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Fri, 24 Mar 2023 16:10:25 +0100 Subject: [PATCH 02/12] Adapt tasks to updated jet tables --- PWGJE/DataModel/JetSubstructure.h | 28 ++++++++++++------------- PWGJE/TableProducer/jetfinderhf.cxx | 14 ++++++------- PWGJE/TableProducer/jetmatchinghf.cxx | 14 ++++++------- PWGJE/Tasks/jetmatchinghfqa.cxx | 16 +++++++------- PWGJE/Tasks/jetsubstructurehf.cxx | 28 ++++++++++++------------- PWGJE/Tasks/jetsubstructurehfoutput.cxx | 28 ++++++++++++------------- 6 files changed, 64 insertions(+), 64 deletions(-) diff --git a/PWGJE/DataModel/JetSubstructure.h b/PWGJE/DataModel/JetSubstructure.h index 7da9d301d6b..01379672a5f 100644 --- a/PWGJE/DataModel/JetSubstructure.h +++ b/PWGJE/DataModel/JetSubstructure.h @@ -103,29 +103,29 @@ JETSUBSTRUCTUREOUTPUT_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "JETMCPA JETSUBSTRUCTURE_TABLE_DEF(D0Jet, D0jet, "D0JETSS"); JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(D0Jet, D0jet, "D0JETSSO"); -JETSUBSTRUCTURE_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0JETMCDETSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0JETMCDETSSO"); +JETSUBSTRUCTURE_TABLE_DEF(D0MCDJet, D0mcdjet, "D0JETMCDETSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(D0MCDJet, D0mcdjet, "D0JETMCDETSSO"); -JETSUBSTRUCTURE_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0JETMCPARTSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0JETMCPARTSSO"); +JETSUBSTRUCTURE_TABLE_DEF(D0MCPJet, D0mcpjet, "D0JETMCPARTSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(D0MCPJet, D0mcpjet, "D0JETMCPARTSSO"); JETSUBSTRUCTURE_TABLE_DEF(LcJet, Lcjet, "LcJETSS"); JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(LcJet, Lcjet, "LcJETSSO"); -JETSUBSTRUCTURE_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcJETMCDETSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcJETMCDETSSO"); +JETSUBSTRUCTURE_TABLE_DEF(LcMCDJet, Lcmcdjet, "LcJETMCDETSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(LcMCDJet, Lcmcdjet, "LcJETMCDETSSO"); -JETSUBSTRUCTURE_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcJETMCPARTSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcJETMCPARTSSO"); +JETSUBSTRUCTURE_TABLE_DEF(LcMCPJet, Lcmcpjet, "LcJETMCPARTSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(LcMCPJet, Lcmcpjet, "LcJETMCPARTSSO"); -JETSUBSTRUCTURE_TABLE_DEF(BPlusJet, BPlusjet, "BPLJETSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(BPlusJet, BPlusjet, "BPLJETOut"); +JETSUBSTRUCTURE_TABLE_DEF(BPlJet, BPljet, "BPLJETSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(BPlJet, BPljet, "BPLJETOut"); -JETSUBSTRUCTURE_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPLJETMCDETSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPLJETMCDETSSO"); +JETSUBSTRUCTURE_TABLE_DEF(BPlMCDJet, BPlMCDjet, "BPLJETMCDETSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(BPlMCDJet, BPlmcdjet, "BPLJETMCDETSSO"); -JETSUBSTRUCTURE_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPLJETMCPARTSS"); -JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPLJETMCPARTSSO"); +JETSUBSTRUCTURE_TABLE_DEF(BPlMCPJet, BPlmcpjet, "BPLJETMCPARTSS"); +JETSUBSTRUCTUREOUTPUTHF_TABLE_DEF(BPlMCPJet, BPlmcpjet, "BPLJETMCPARTSSO"); } // namespace o2::aod diff --git a/PWGJE/TableProducer/jetfinderhf.cxx b/PWGJE/TableProducer/jetfinderhf.cxx index 1d278c0fe6d..c99db5061f9 100644 --- a/PWGJE/TableProducer/jetfinderhf.cxx +++ b/PWGJE/TableProducer/jetfinderhf.cxx @@ -612,16 +612,16 @@ struct JetFinderHFTask { }; using JetFinderD0 = JetFinderHFTask; -using MCDetectorLevelJetFinderD0 = JetFinderHFTask; -using MCParticleLevelJetFinderD0 = JetFinderHFTask; +using MCDetectorLevelJetFinderD0 = JetFinderHFTask; +using MCParticleLevelJetFinderD0 = JetFinderHFTask; -using JetFinderBPlus = JetFinderHFTask; -using MCDetectorLevelJetFinderBPlus = JetFinderHFTask; -using MCParticleLevelJetFinderBPlus = JetFinderHFTask; +using JetFinderBPlus = JetFinderHFTask; +using MCDetectorLevelJetFinderBPlus = JetFinderHFTask; +using MCParticleLevelJetFinderBPlus = JetFinderHFTask; using JetFinderLc = JetFinderHFTask; -using MCDetectorLevelJetFinderLc = JetFinderHFTask; -using MCParticleLevelJetFinderLc = JetFinderHFTask; +using MCDetectorLevelJetFinderLc = JetFinderHFTask; +using MCParticleLevelJetFinderLc = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatchinghf.cxx index c4d5b4c7044..cc337889726 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatchinghf.cxx @@ -35,11 +35,11 @@ struct JetMatchingHF { using Tracks = soa::Join; using HfCandidates = soa::Join; using McParticles = soa::Join; - using DetectorLevelJets = soa::Join; - using ParticleLevelJets = soa::Join; + using DetectorLevelJets = soa::Join; + using ParticleLevelJets = soa::Join; - Produces jetsPartToDetMatching; - Produces jetsDetToPartMatching; + Produces jetsPartToDetMatching; + Produces jetsDetToPartMatching; Preslice ParticleLevelJetsPerMcCollision = aod::jet::mcCollisionId; @@ -62,7 +62,7 @@ struct JetMatchingHF { const auto& cands = jet.hfcandidates_as(); int matchedIdx = -1; if ((cands.front().flagMcMatchRec() & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) == 0) { - jetsDetToPartMatching(matchedIdx); + jetsDetToPartMatching(matchedIdx, -1); continue; } for (const auto& cand : cands) { @@ -92,7 +92,7 @@ struct JetMatchingHF { } } } - jetsDetToPartMatching(matchedIdx); + jetsDetToPartMatching(matchedIdx, -1); } // match MC to rec @@ -138,7 +138,7 @@ struct JetMatchingHF { } } } - jetsPartToDetMatching(matchedIdx); + jetsPartToDetMatching(matchedIdx, -1); } } }; diff --git a/PWGJE/Tasks/jetmatchinghfqa.cxx b/PWGJE/Tasks/jetmatchinghfqa.cxx index a42dad45e1b..3ddd2f59fb8 100644 --- a/PWGJE/Tasks/jetmatchinghfqa.cxx +++ b/PWGJE/Tasks/jetmatchinghfqa.cxx @@ -27,8 +27,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct JetMatchingHFQA { - using DetectorLevelJets = soa::Join; - using ParticleLevelJets = soa::Join; + using DetectorLevelJets = soa::Join; + using ParticleLevelJets = soa::Join; OutputObj hJetPt{"h_jet_pt"}; OutputObj hJetDetaDphi{"h_jet_deta_dphi"}; @@ -61,10 +61,10 @@ struct JetMatchingHFQA { DetectorLevelJets const& djets, ParticleLevelJets const& pjets) { for (const auto& djet : djets) { - if (djet.has_matchedJet() && djet.matchedJetId() >= 0) { - const auto& pjet = djet.matchedJet_as(); + if (djet.has_matchedJetCand() && djet.matchedJetCandId() >= 0) { + const auto& pjet = djet.matchedJetCand_as(); LOGF(info, "djet %d (pt of %g GeV/c) is matched to %d (pt of %g GeV/c)", - djet.globalIndex(), djet.pt(), djet.matchedJetId(), pjet.pt()); + djet.globalIndex(), djet.pt(), djet.matchedJetCandId(), pjet.pt()); hJetPt->Fill(pjet.pt(), djet.pt()); hJetDetPt->Fill(djet.pt()); hJetDetPhi->Fill(djet.phi()); @@ -81,10 +81,10 @@ struct JetMatchingHFQA { { LOGF(info, "analysing MC collision %d", collision.globalIndex()); for (const auto& pjet : pjets) { - if (pjet.has_matchedJet() && pjet.matchedJetId() >= 0) { - const auto& djet = pjet.matchedJet_as(); + if (pjet.has_matchedJetCand() && pjet.matchedJetCandId() >= 0) { + const auto& djet = pjet.matchedJetCand_as(); LOGF(info, "pjet %d (pt of %g GeV/c) is matched to %d (pt of %g GeV/c)", - pjet.globalIndex(), pjet.pt(), pjet.matchedJetId(), djet.pt()); + pjet.globalIndex(), pjet.pt(), pjet.matchedJetCandId(), djet.pt()); hJetGenPt->Fill(pjet.pt()); hJetGenPhi->Fill(pjet.phi()); hJetGenEta->Fill(pjet.eta()); diff --git a/PWGJE/Tasks/jetsubstructurehf.cxx b/PWGJE/Tasks/jetsubstructurehf.cxx index ab3b2d6998f..b34ff0d86e7 100644 --- a/PWGJE/Tasks/jetsubstructurehf.cxx +++ b/PWGJE/Tasks/jetsubstructurehf.cxx @@ -177,7 +177,7 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processD0Data, "D0 jet substructure on data", false); - void processD0MCD(soa::Join::iterator const& jet, + void processD0MCD(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -189,7 +189,7 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processD0MCD, "D0 jet substructure on MC detector level", false); - void processD0MCP(soa::Join::iterator const& jet, + void processD0MCP(soa::Join::iterator const& jet, aod::McParticles const& particles) { processGenLevel(jet); @@ -208,7 +208,7 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processLcData, "Lc jet substructure on data", false); - void processLcMCD(soa::Join::iterator const& jet, + void processLcMCD(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -220,14 +220,14 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processLcMCD, "Lc jet substructure on MC detector level", false); - void processLcMCP(soa::Join::iterator const& jet, + void processLcMCP(soa::Join::iterator const& jet, aod::McParticles const& particles) { processGenLevel(jet); } PROCESS_SWITCH(JetSubstructureHFTask, processLcMCP, "Lc jet substructure on MC particle level", false); - void processBPlusData(soa::Join::iterator const& jet, + void processBPlusData(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -239,7 +239,7 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processBPlusData, "BPlus jet substructure on data", false); - void processBPlusMCD(soa::Join::iterator const& jet, + void processBPlusMCD(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -251,7 +251,7 @@ struct JetSubstructureHFTask { } PROCESS_SWITCH(JetSubstructureHFTask, processBPlusMCD, "BPlus jet substructure on MC detector level", false); - void processBPlusMCP(soa::Join::iterator const& jet, + void processBPlusMCP(soa::Join::iterator const& jet, aod::McParticles const& particles) { processGenLevel(jet); @@ -259,14 +259,14 @@ struct JetSubstructureHFTask { PROCESS_SWITCH(JetSubstructureHFTask, processBPlusMCP, "BPlus jet substructure on MC particle level", false); }; using JetSubstructureD0 = JetSubstructureHFTask; -using MCDetectorLevelJetSubstructureD0 = JetSubstructureHFTask; -using MCParticleLevelJetSubstructureD0 = JetSubstructureHFTask; +using MCDetectorLevelJetSubstructureD0 = JetSubstructureHFTask; +using MCParticleLevelJetSubstructureD0 = JetSubstructureHFTask; using JetSubstructureLc = JetSubstructureHFTask; -using MCDetectorLevelJetSubstructureLc = JetSubstructureHFTask; -using MCParticleLevelJetSubstructureLc = JetSubstructureHFTask; -using JetSubstructureBPlus = JetSubstructureHFTask; -using MCDetectorLevelJetSubstructureBPlus = JetSubstructureHFTask; -using MCParticleLevelJetSubstructureBPlus = JetSubstructureHFTask; +using MCDetectorLevelJetSubstructureLc = JetSubstructureHFTask; +using MCParticleLevelJetSubstructureLc = JetSubstructureHFTask; +using JetSubstructureBPlus = JetSubstructureHFTask; +using MCDetectorLevelJetSubstructureBPlus = JetSubstructureHFTask; +using MCParticleLevelJetSubstructureBPlus = JetSubstructureHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/Tasks/jetsubstructurehfoutput.cxx b/PWGJE/Tasks/jetsubstructurehfoutput.cxx index e032e775a08..e4334ec0e12 100644 --- a/PWGJE/Tasks/jetsubstructurehfoutput.cxx +++ b/PWGJE/Tasks/jetsubstructurehfoutput.cxx @@ -76,7 +76,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processD0Data, "D0 jet substructure output on data", false); - void processD0MCD(soa::Join::iterator const& jet, + void processD0MCD(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -95,7 +95,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processD0MCD, "D0 jet substructure output on MC detector level", false); - void processD0MCP(soa::Join::iterator const& jet, + void processD0MCP(soa::Join::iterator const& jet, aod::McParticles const& particles) { @@ -127,7 +127,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processLcData, "Lc jet substructure output on data", false); - void processLcMCD(soa::Join::iterator const& jet, + void processLcMCD(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -146,7 +146,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processLcMCD, "Lc jet substructure output on MC detector level", false); - void processLcMCP(soa::Join::iterator const& jet, + void processLcMCP(soa::Join::iterator const& jet, aod::McParticles const& particles) { @@ -158,7 +158,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processLcMCP, "Lc jet substructure output on MC particle level", false); - void processBPlusData(soa::Join::iterator const& jet, // add template back + void processBPlusData(soa::Join::iterator const& jet, // add template back soa::Join const& candidates, aod::Tracks const& tracks) { @@ -174,7 +174,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processBPlusData, "B+ jet substructure output on data", false); - void processBPlusMCD(soa::Join::iterator const& jet, + void processBPlusMCD(soa::Join::iterator const& jet, soa::Join const& candidates, aod::Tracks const& tracks) { @@ -189,7 +189,7 @@ struct JetSubstructureHFOutputTask { } PROCESS_SWITCH(JetSubstructureHFOutputTask, processBPlusMCD, "B+ jet substructure output on MC detector level", false); - void processBPlusMCP(soa::Join::iterator const& jet, + void processBPlusMCP(soa::Join::iterator const& jet, aod::McParticles const& particles) { @@ -202,14 +202,14 @@ struct JetSubstructureHFOutputTask { PROCESS_SWITCH(JetSubstructureHFOutputTask, processBPlusMCP, "B+ jet substructure output on MC particle level", false); }; using JetSubstructureOutputDataD0 = JetSubstructureHFOutputTask; -using JetSubstructureOutputMCParticleLevelD0 = JetSubstructureHFOutputTask; -using JetSubstructureOutputMCDetectorLevelD0 = JetSubstructureHFOutputTask; +using JetSubstructureOutputMCParticleLevelD0 = JetSubstructureHFOutputTask; +using JetSubstructureOutputMCDetectorLevelD0 = JetSubstructureHFOutputTask; using JetSubstructureOutputDataLc = JetSubstructureHFOutputTask; -using JetSubstructureOutputMCParticleLevelLc = JetSubstructureHFOutputTask; -using JetSubstructureOutputMCDetectorLevelLc = JetSubstructureHFOutputTask; -using JetSubstructureOutputDataBPlus = JetSubstructureHFOutputTask; -using JetSubstructureOutputMCParticleLevelBPlus = JetSubstructureHFOutputTask; -using JetSubstructureOutputMCDetectorLevelBPlus = JetSubstructureHFOutputTask; +using JetSubstructureOutputMCParticleLevelLc = JetSubstructureHFOutputTask; +using JetSubstructureOutputMCDetectorLevelLc = JetSubstructureHFOutputTask; +using JetSubstructureOutputDataBPlus = JetSubstructureHFOutputTask; +using JetSubstructureOutputMCParticleLevelBPlus = JetSubstructureHFOutputTask; +using JetSubstructureOutputMCDetectorLevelBPlus = JetSubstructureHFOutputTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { From 50e61223d95049d8ba2c1d812584e07404edc85b Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 10:51:28 +0200 Subject: [PATCH 03/12] Update jet matching --- PWGJE/DataModel/Jet.h | 36 +++---- PWGJE/DataModel/JetHF.h | 6 +- PWGJE/DataModel/JetSubstructure.h | 1 - PWGJE/TableProducer/jetfinderhf.cxx | 5 +- PWGJE/TableProducer/jetmatchinghf.cxx | 121 ++++++++++++++---------- PWGJE/Tasks/jetmatchinghfqa.cxx | 2 +- PWGJE/Tasks/jetsubstructurehf.cxx | 2 +- PWGJE/Tasks/jetsubstructurehfoutput.cxx | 2 +- 8 files changed, 98 insertions(+), 77 deletions(-) diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 2e1ad44cec4..e5dc84c0cf6 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -67,20 +67,20 @@ DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetCand); \ } -// Defines the jet constituent table -#define JET_CONSTITUENTS_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_) \ - namespace _name_##constituents \ - { \ - DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ - DECLARE_SOA_INDEX_COLUMN(_track_type_, track); \ - DECLARE_SOA_INDEX_COLUMN(EMCALCluster, cluster); \ - } \ - DECLARE_SOA_TABLE(_jet_type_##TrackConstituents, "AOD", _Description_ "TRKCONSTS", \ - _name_##constituents::_jet_type_##Id, \ - _name_##constituents::_track_type_##Id); \ - DECLARE_SOA_TABLE(_jet_type_##ClusterConstituents, "AOD", _Description_ "CLSCONSTS", \ - _name_##constituents::_jet_type_##Id, \ - _name_##constituents::EMCALClusterId); +// // Defines the jet constituent table +// #define JET_CONSTITUENTS_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_) \ +// namespace _name_##constituents \ +// { \ +// DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ +// DECLARE_SOA_INDEX_COLUMN(_track_type_, track); \ +// DECLARE_SOA_INDEX_COLUMN(EMCALCluster, cluster); \ +// } \ +// DECLARE_SOA_TABLE(_jet_type_##TrackConstituents, "AOD", _Description_ "TRKCONSTS", \ +// _name_##constituents::_jet_type_##Id, \ +// _name_##constituents::_track_type_##Id); \ +// DECLARE_SOA_TABLE(_jet_type_##ClusterConstituents, "AOD", _Description_ "CLSCONSTS", \ +// _name_##constituents::_jet_type_##Id, \ +// _name_##constituents::EMCALClusterId); #define JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_, _cand_type_) \ namespace _name_##constituents \ @@ -128,8 +128,8 @@ JET_TABLES_DEF(Collision, _jet_type_, Track, _hfcand_type_); \ JET_TABLES_DEF(Collision, _jet_type_##MCD, Track, _hfcand_type_); \ JET_TABLES_DEF(McCollision, _jet_type_##MCP, McParticle, McParticles); \ - DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCPJets, "AOD", #_jet_type_ "JETMATCH", _jet_type_##MCDjetmatchingGeo::_jet_type_##MCDJetId, _jet_type_##MCDjetmatchingCand::_jet_type_##MCDJetId); \ - DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCDJets, "AOD", #_jet_type_ "JETMATCH", _jet_type_##MCPjetmatchingGeo::_jet_type_##MCPJetId, _jet_type_##MCPjetmatchingCand::_jet_type_##MCPJetId); + DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCPJets, "AOD", #_jet_type_ "JETMCHP", _jet_type_##MCDjetmatchingGeo::_jet_type_##MCDJetId, _jet_type_##MCDjetmatchingCand::_jet_type_##MCDJetId); \ + DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCDJets, "AOD", #_jet_type_ "JETMCHD", _jet_type_##MCPjetmatchingGeo::_jet_type_##MCPJetId, _jet_type_##MCPjetmatchingCand::_jet_type_##MCPJetId); namespace o2::aod { @@ -357,6 +357,10 @@ using HybridIntermediateJetConstituent = HybridIntermediateJetConstituents::iter JET_CONSTITUENTS_SUB_TABLE_DEF(HybridIntermediateJet, hybridintermediate, "HYBINT"); using HybridIntermediateJetConstituentSub = HybridIntermediateJetConstituentsSub::iterator; +JET_TABLES_LEVELS_DEF(D0, HfCand2Prong); +JET_TABLES_LEVELS_DEF(Lc, HfCand3Prong); +JET_TABLES_LEVELS_DEF(BPl, HfCandBplus); + } // namespace o2::aod #endif // PWGJE_DATAMODEL_JET_H_ diff --git a/PWGJE/DataModel/JetHF.h b/PWGJE/DataModel/JetHF.h index 395fdfb43c5..f689c7c656b 100644 --- a/PWGJE/DataModel/JetHF.h +++ b/PWGJE/DataModel/JetHF.h @@ -28,9 +28,9 @@ namespace o2::aod // HF jets // D0 tagged jets -JET_TABLES_LEVELS_DEF(D0, HfCand2Prong); -JET_TABLES_LEVELS_DEF(Lc, HfCand3Prong); -JET_TABLES_LEVELS_DEF(BPl, HfCandBplus); +// JET_TABLES_LEVELS_DEF(D0, HfCand2Prong); +// JET_TABLES_LEVELS_DEF(Lc, HfCand3Prong); +// JET_TABLES_LEVELS_DEF(BPl, HfCandBplus); // using D0Jet = D0Jets::iterator; // using MatchedD0Jet = MatchedD0Jets::iterator; diff --git a/PWGJE/DataModel/JetSubstructure.h b/PWGJE/DataModel/JetSubstructure.h index 01379672a5f..3d0a118418a 100644 --- a/PWGJE/DataModel/JetSubstructure.h +++ b/PWGJE/DataModel/JetSubstructure.h @@ -22,7 +22,6 @@ #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGJE/DataModel/Jet.h" -#include "PWGJE/DataModel/JetHF.h" using namespace o2::analysis; diff --git a/PWGJE/TableProducer/jetfinderhf.cxx b/PWGJE/TableProducer/jetfinderhf.cxx index c99db5061f9..e8d99acf5b7 100644 --- a/PWGJE/TableProducer/jetfinderhf.cxx +++ b/PWGJE/TableProducer/jetfinderhf.cxx @@ -30,7 +30,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGJE/DataModel/JetHF.h" +#include "PWGJE/DataModel/Jet.h" #include "PWGJE/Core/JetFinder.h" #include "PWGJE/Core/FastJetUtilities.h" @@ -608,7 +608,8 @@ struct JetFinderHFTask { { processHFGenBPlus(collision, particles); } - PROCESS_SWITCH(JetFinderHFTask, processBPlusMCP, "B+ HF jet finding on MC particle level", false); + // PROCESS_SWITCH(JetFinderHFTask, processBPlusMCP, "B+ HF jet finding on MC particle level", false); + PROCESS_SWITCH(JetFinderHFTask, processBPlusMCP, "B+ HF jet finding on MC particle level", (std::is_same::value ? true : false)); }; using JetFinderD0 = JetFinderHFTask; diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatchinghf.cxx index cc337889726..34cd779e341 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatchinghf.cxx @@ -21,7 +21,7 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGJE/DataModel/JetHF.h" +#include "PWGJE/DataModel/Jet.h" #include "PWGJE/Core/JetUtilities.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -30,79 +30,93 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +template struct JetMatchingHF { + Configurable maxMatchingDistance{"maxMatchingDistance", 0.4f, "Max matching distance"}; + + Produces jetsBaseToTag; + Produces jetsTagToBase; + + Preslice mcJetsPerMcCollision = aod::jet::mcCollisionId; + using Collisions = soa::Join; using Tracks = soa::Join; - using HfCandidates = soa::Join; using McParticles = soa::Join; - using DetectorLevelJets = soa::Join; - using ParticleLevelJets = soa::Join; - - Produces jetsPartToDetMatching; - Produces jetsDetToPartMatching; - - Preslice ParticleLevelJetsPerMcCollision = aod::jet::mcCollisionId; void init(InitContext const&) { } void process(Collisions::iterator const& collision, aod::McCollisions const& mcCollisions, - ParticleLevelJets const& jetsMC, DetectorLevelJets const& jetsRec, - HfCandidates const& hfcandidates, Tracks const& tracks, - McParticles const& particlesMC) + BaseJetCollection const& jetsBase, TagJetCollection const& jetsTag, + Tracks const& tracks, McParticles const& particlesMC, + HfCandidates const& hfcandidates) { - const auto jetsPL = jetsMC.sliceBy(ParticleLevelJetsPerMcCollision, collision.mcCollisionId()); + const auto jetsPL = jetsTag.sliceBy(mcJetsPerMcCollision, collision.mcCollisionId()); - // match rec to MC - for (const auto& jet : jetsRec) { + // geometric matching + std::vector jetsBasePhi(jetsBase.size()); + std::vector jetsBaseEta(jetsBase.size()); + for (auto jet : jetsBase) { + jetsBasePhi.emplace_back(jet.phi()); + jetsBaseEta.emplace_back(jet.eta()); + } + std::vector jetsTagPhi(jetsTag.size()); + std::vector jetsTagEta(jetsTag.size()); + for (auto& jet : jetsTag) { + jetsTagPhi.emplace_back(jet.phi()); + jetsTagEta.emplace_back(jet.eta()); + } + auto&& [baseToTagIndexMap, tagToBaseIndexMap] = JetUtilities::MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, maxMatchingDistance); + + // forward matching + for (const auto& jet : jetsBase) { LOGF(info, "jet index: %d (coll %d, pt %g, phi %g) with %d tracks, %d HF candidates", jet.index(), jet.collisionId(), jet.pt(), jet.phi(), jet.tracks().size(), jet.hfcandidates().size()); - const auto& cands = jet.hfcandidates_as(); + const auto& cands = jet.template hfcandidates_as(); int matchedIdx = -1; - if ((cands.front().flagMcMatchRec() & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) == 0) { - jetsDetToPartMatching(matchedIdx, -1); - continue; - } - for (const auto& cand : cands) { - const auto& daughter0 = cand.prong0_as(); - const auto& daughter1 = cand.prong1_as(); - if (!daughter0.has_mcParticle() || !daughter1.has_mcParticle()) { - LOGF(warning, "Encountered candidate daughter (%d or %d) without MC particle", daughter0.globalIndex(), daughter1.globalIndex()); - continue; - } - const auto mother0Id = daughter0.mcParticle_as().mothers_as().front().globalIndex(); - const auto mother1Id = daughter1.mcParticle_as().mothers_as().front().globalIndex(); - LOGF(debug, "MC candidate %d with prongs: %d (MC %d), %d (MC %d)", cand.globalIndex(), - daughter0.globalIndex(), daughter0.mcParticle_as().globalIndex(), - daughter1.globalIndex(), daughter1.mcParticle_as().globalIndex()); - LOGF(info, "MC ids of mothers: %d - %d", mother0Id, mother1Id); - if ((mother0Id == mother1Id) && - std::abs(daughter0.mcParticle_as().mothers_as().front().flagMcMatchGen()) & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { - LOGF(info, "D0 - looking for jet"); - for (const auto& pjet : jetsPL) { - for (const auto& cand : pjet.hfcandidates_as()) { - if (mother0Id == cand.globalIndex()) { - matchedIdx = pjet.globalIndex(); - LOGF(info, "Found match det to part: %d (pt %g) -> %d (pt %g)", - jet.globalIndex(), jet.pt(), matchedIdx, pjet.pt()); + if ((cands.front().flagMcMatchRec() & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) != 0) { + for (const auto& cand : cands) { + const auto& daughter0 = cand.template prong0_as(); + const auto& daughter1 = cand.template prong1_as(); + if (!daughter0.has_mcParticle() || !daughter1.has_mcParticle()) { + LOGF(warning, "Encountered candidate daughter (%d or %d) without MC particle", daughter0.globalIndex(), daughter1.globalIndex()); + continue; + } + const auto mother0Id = daughter0.template mcParticle_as().template mothers_as().front().globalIndex(); + const auto mother1Id = daughter1.template mcParticle_as().template mothers_as().front().globalIndex(); + LOGF(debug, "MC candidate %d with prongs: %d (MC %d), %d (MC %d)", cand.globalIndex(), + daughter0.globalIndex(), daughter0.template mcParticle_as().globalIndex(), + daughter1.globalIndex(), daughter1.template mcParticle_as().globalIndex()); + LOGF(info, "MC ids of mothers: %d - %d", mother0Id, mother1Id); + if ((mother0Id == mother1Id) && + std::abs(daughter0.template mcParticle_as().template mothers_as().front().flagMcMatchGen()) & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { + LOGF(info, "D0 - looking for jet"); + for (const auto& pjet : jetsPL) { + for (const auto& cand : pjet.template hfcandidates_as()) { + if (mother0Id == cand.globalIndex()) { + matchedIdx = pjet.globalIndex(); + LOGF(info, "Found match det to part: %d (pt %g) -> %d (pt %g)", + jet.globalIndex(), jet.pt(), matchedIdx, pjet.pt()); + } } } } } } - jetsDetToPartMatching(matchedIdx, -1); + jetsBaseToTag(matchedIdx, baseToTagIndexMap[jet.index()]); // TODO: check usage of index } - // match MC to rec + // backward matching for (const auto& jet : jetsPL) { LOGF(info, "MC jet index: %d (coll %d) with %d tracks, %d HF candidates", jet.index(), jet.mcCollisionId(), jet.tracks().size(), jet.hfcandidates().size()); int matchedIdx = -1; - for (const auto& cand : jet.hfcandidates_as()) { - const auto& daughters = cand.daughters_as(); + for (const auto& cand : jet.template hfcandidates_as()) { + const auto& daughters = cand.template daughters_as(); LOGF(info, "MC candidate %d with daughters %d, %d", cand.globalIndex(), daughters.iteratorAt(0).globalIndex(), daughters.iteratorAt(1).globalIndex()); int index0 = -1, index1 = -1; for (const auto& track : tracks) { @@ -124,21 +138,21 @@ struct JetMatchingHF { int candIdx = 0; for (const auto& prong : hfcandidates) { LOGF(info, "checking prong %d with daughters %d-%d, %d-%d", - prong.globalIndex(), prong.prong0Id(), prong.prong0_as().globalIndex(), prong.prong1Id(), prong.prong1_as().globalIndex()); - if ((prong.prong0_as().globalIndex() == index0 && prong.prong1_as().globalIndex() == index1) || + prong.globalIndex(), prong.prong0Id(), prong.template prong0_as().globalIndex(), prong.prong1Id(), prong.template prong1_as().globalIndex()); + if ((prong.template prong0_as().globalIndex() == index0 && prong.template prong1_as().globalIndex() == index1) || (prong.prong0Id() == index1 && prong.prong1Id() == index0)) { candIdx = prong.globalIndex(); LOGF(info, "Found matching 2prong candidate: %d", candIdx); } } - for (const auto& djet : jetsRec) { - if (djet.hfcandidates_as().front().globalIndex() == candIdx) { + for (const auto& djet : jetsBase) { + if (djet.template hfcandidates_as().front().globalIndex() == candIdx) { matchedIdx = djet.globalIndex(); LOGF(info, "Found match part to det: %d -> %d", jet.globalIndex(), matchedIdx); } } } - jetsPartToDetMatching(matchedIdx, -1); + jetsTagToBase(matchedIdx, tagToBaseIndexMap[jet.index()]); // TODO: check usage of index } } }; @@ -146,5 +160,8 @@ struct JetMatchingHF { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask(cfgc, TaskName{"jet-matching-hf"})}; + adaptAnalysisTask, + soa::Join, + aod::NewMatchedD0MCDJets, aod::NewMatchedD0MCPJets, + soa::Join > >(cfgc, TaskName{"jet-matching-hf"})}; } diff --git a/PWGJE/Tasks/jetmatchinghfqa.cxx b/PWGJE/Tasks/jetmatchinghfqa.cxx index 3ddd2f59fb8..d8fffe9e4d1 100644 --- a/PWGJE/Tasks/jetmatchinghfqa.cxx +++ b/PWGJE/Tasks/jetmatchinghfqa.cxx @@ -20,7 +20,7 @@ #include "Framework/runDataProcessing.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" -#include "PWGJE/DataModel/JetHF.h" +#include "PWGJE/DataModel/Jet.h" using namespace o2; using namespace o2::framework; diff --git a/PWGJE/Tasks/jetsubstructurehf.cxx b/PWGJE/Tasks/jetsubstructurehf.cxx index b34ff0d86e7..1a4b46b27ad 100644 --- a/PWGJE/Tasks/jetsubstructurehf.cxx +++ b/PWGJE/Tasks/jetsubstructurehf.cxx @@ -31,7 +31,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGJE/DataModel/JetHF.h" +#include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetSubstructure.h" #include "PWGJE/Core/JetFinder.h" #include "PWGJE/Core/FastJetUtilities.h" diff --git a/PWGJE/Tasks/jetsubstructurehfoutput.cxx b/PWGJE/Tasks/jetsubstructurehfoutput.cxx index e4334ec0e12..f6ef87c5bf6 100644 --- a/PWGJE/Tasks/jetsubstructurehfoutput.cxx +++ b/PWGJE/Tasks/jetsubstructurehfoutput.cxx @@ -28,7 +28,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" -#include "PWGJE/DataModel/JetHF.h" +#include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetSubstructure.h" #include "PWGJE/Core/JetFinder.h" From 320c0624d3a40fbba9f1868a37887126a29700a8 Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 10:53:22 +0200 Subject: [PATCH 04/12] Fix formatting --- PWGJE/DataModel/Jet.h | 20 ++++++++++---------- PWGJE/TableProducer/jetmatchinghf.cxx | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index e5dc84c0cf6..3ac06907857 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -114,20 +114,20 @@ constituentssub::P); // combine definition of tables for jets, constituents, and substructure -#define JET_TABLES_DEF(_collision_name_, _jet_type_, _const_type_, _hfcand_type_) \ - JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, #_jet_type_ "JET"); \ - using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ - using Matched##_jet_type_##Jet = Matched##_jet_type_##Jet##s::iterator; \ +#define JET_TABLES_DEF(_collision_name_, _jet_type_, _const_type_, _hfcand_type_) \ + JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, #_jet_type_ "JET"); \ + using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ + using Matched##_jet_type_##Jet = Matched##_jet_type_##Jet##s::iterator; \ JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_, _const_type_, _hfcand_type_); \ - using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ - JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_); \ + using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ + JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_); \ using _jet_type_##Jet##ConstituentSub = _jet_type_##Jet##ConstituentsSub::iterator; // generate tables for data, generator- and detector-level jets -#define JET_TABLES_LEVELS_DEF(_jet_type_, _hfcand_type_) \ - JET_TABLES_DEF(Collision, _jet_type_, Track, _hfcand_type_); \ - JET_TABLES_DEF(Collision, _jet_type_##MCD, Track, _hfcand_type_); \ - JET_TABLES_DEF(McCollision, _jet_type_##MCP, McParticle, McParticles); \ +#define JET_TABLES_LEVELS_DEF(_jet_type_, _hfcand_type_) \ + JET_TABLES_DEF(Collision, _jet_type_, Track, _hfcand_type_); \ + JET_TABLES_DEF(Collision, _jet_type_##MCD, Track, _hfcand_type_); \ + JET_TABLES_DEF(McCollision, _jet_type_##MCP, McParticle, McParticles); \ DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCPJets, "AOD", #_jet_type_ "JETMCHP", _jet_type_##MCDjetmatchingGeo::_jet_type_##MCDJetId, _jet_type_##MCDjetmatchingCand::_jet_type_##MCDJetId); \ DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCDJets, "AOD", #_jet_type_ "JETMCHD", _jet_type_##MCPjetmatchingGeo::_jet_type_##MCPJetId, _jet_type_##MCPjetmatchingCand::_jet_type_##MCPJetId); diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatchinghf.cxx index 34cd779e341..48b17b538fe 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatchinghf.cxx @@ -30,7 +30,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -template struct JetMatchingHF { Configurable maxMatchingDistance{"maxMatchingDistance", 0.4f, "Max matching distance"}; @@ -88,8 +88,8 @@ struct JetMatchingHF { const auto mother0Id = daughter0.template mcParticle_as().template mothers_as().front().globalIndex(); const auto mother1Id = daughter1.template mcParticle_as().template mothers_as().front().globalIndex(); LOGF(debug, "MC candidate %d with prongs: %d (MC %d), %d (MC %d)", cand.globalIndex(), - daughter0.globalIndex(), daughter0.template mcParticle_as().globalIndex(), - daughter1.globalIndex(), daughter1.template mcParticle_as().globalIndex()); + daughter0.globalIndex(), daughter0.template mcParticle_as().globalIndex(), + daughter1.globalIndex(), daughter1.template mcParticle_as().globalIndex()); LOGF(info, "MC ids of mothers: %d - %d", mother0Id, mother1Id); if ((mother0Id == mother1Id) && std::abs(daughter0.template mcParticle_as().template mothers_as().front().flagMcMatchGen()) & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { @@ -99,7 +99,7 @@ struct JetMatchingHF { if (mother0Id == cand.globalIndex()) { matchedIdx = pjet.globalIndex(); LOGF(info, "Found match det to part: %d (pt %g) -> %d (pt %g)", - jet.globalIndex(), jet.pt(), matchedIdx, pjet.pt()); + jet.globalIndex(), jet.pt(), matchedIdx, pjet.pt()); } } } @@ -160,8 +160,8 @@ struct JetMatchingHF { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{ - adaptAnalysisTask, - soa::Join, - aod::NewMatchedD0MCDJets, aod::NewMatchedD0MCPJets, - soa::Join > >(cfgc, TaskName{"jet-matching-hf"})}; + adaptAnalysisTask, + soa::Join, + aod::NewMatchedD0MCDJets, aod::NewMatchedD0MCPJets, + soa::Join>>(cfgc, TaskName{"jet-matching-hf"})}; } From 71a85fd3dd2d446d38557165e16642df153e2501 Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 16:06:32 +0200 Subject: [PATCH 05/12] Refactor jet tables --- PWGJE/DataModel/Jet.h | 385 +++++++++++--------------- PWGJE/TableProducer/CMakeLists.txt | 5 - PWGJE/TableProducer/jetfinder.cxx | 8 +- PWGJE/TableProducer/jetmatchinghf.cxx | 9 +- PWGJE/Tasks/jetmatchinghfqa.cxx | 4 +- 5 files changed, 168 insertions(+), 243 deletions(-) diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 3ac06907857..3c288e409f6 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -28,6 +28,52 @@ #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" +namespace o2::aod +{ +namespace jet +{ +DECLARE_SOA_INDEX_COLUMN(Collision, collision); +DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); +DECLARE_SOA_COLUMN(Pt, pt, float); //! +DECLARE_SOA_COLUMN(Eta, eta, float); //! +DECLARE_SOA_COLUMN(Phi, phi, float); //! +DECLARE_SOA_COLUMN(Energy, energy, float); //! +DECLARE_SOA_COLUMN(Mass, mass, float); //! +DECLARE_SOA_COLUMN(Area, area, float); //! +DECLARE_SOA_COLUMN(R, r, int); //! +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! + [](float pt, float phi) -> float { return pt * std::cos(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! + [](float pt, float phi) -> float { return pt * std::sin(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! + [](float pt, float eta) -> float { return pt * std::sinh(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p + [](float pt, float eta) -> float { return pt * std::cosh(eta); }); +} // namespace jet + +// The standard constituents table is more simply defined fully via macros. + +// Constituent sub +namespace constituentssub +{ +// Jet index column will be added in the macro +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Energy, energy, float); +DECLARE_SOA_COLUMN(Mass, mass, float); +DECLARE_SOA_COLUMN(Source, source, int); +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, + [](float pt, float phi) -> float { return pt * std::cos(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, + [](float pt, float phi) -> float { return pt * std::sin(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, + [](float pt, float eta) -> float { return pt * std::sinh(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, + [](float pt, float eta) -> float { return pt * std::cosh(eta); }); +} // namespace constituentssub +} // namespace o2::aod + // Defines the jet table definition #define JET_TABLE_DEF(_collision_name_, _jet_type_, _name_, _description_) \ namespace _name_##util \ @@ -67,21 +113,6 @@ DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetCand); \ } -// // Defines the jet constituent table -// #define JET_CONSTITUENTS_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_) \ -// namespace _name_##constituents \ -// { \ -// DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ -// DECLARE_SOA_INDEX_COLUMN(_track_type_, track); \ -// DECLARE_SOA_INDEX_COLUMN(EMCALCluster, cluster); \ -// } \ -// DECLARE_SOA_TABLE(_jet_type_##TrackConstituents, "AOD", _Description_ "TRKCONSTS", \ -// _name_##constituents::_jet_type_##Id, \ -// _name_##constituents::_track_type_##Id); \ -// DECLARE_SOA_TABLE(_jet_type_##ClusterConstituents, "AOD", _Description_ "CLSCONSTS", \ -// _name_##constituents::_jet_type_##Id, \ -// _name_##constituents::EMCALClusterId); - #define JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_, _cand_type_) \ namespace _name_##constituents \ { \ @@ -97,7 +128,7 @@ _name_##constituents::HfCandidatesIds); // Defines the jet constituent sub table -// NOTE: This relies on eth jet index column being defined in the constiteunts namespace. +// NOTE: This relies on the jet index column being defined in the constituents namespace. // Since these are always paired together, there's no point in redefining them. #define JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_, _name_, _Description_) \ DECLARE_SOA_TABLE(_jet_type_##ConstituentsSub, "AOD", _Description_ "CONSTSUB", \ @@ -114,239 +145,139 @@ constituentssub::P); // combine definition of tables for jets, constituents, and substructure -#define JET_TABLES_DEF(_collision_name_, _jet_type_, _const_type_, _hfcand_type_) \ - JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, #_jet_type_ "JET"); \ +#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ + JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ using Matched##_jet_type_##Jet = Matched##_jet_type_##Jet##s::iterator; \ - JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_, _const_type_, _hfcand_type_); \ + JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_, _const_type_, _hfcand_type_); \ using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ - JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, #_jet_type_); \ + JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_); \ using _jet_type_##Jet##ConstituentSub = _jet_type_##Jet##ConstituentsSub::iterator; -// generate tables for data, generator- and detector-level jets -#define JET_TABLES_LEVELS_DEF(_jet_type_, _hfcand_type_) \ - JET_TABLES_DEF(Collision, _jet_type_, Track, _hfcand_type_); \ - JET_TABLES_DEF(Collision, _jet_type_##MCD, Track, _hfcand_type_); \ - JET_TABLES_DEF(McCollision, _jet_type_##MCP, McParticle, McParticles); \ - DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCPJets, "AOD", #_jet_type_ "JETMCHP", _jet_type_##MCDjetmatchingGeo::_jet_type_##MCDJetId, _jet_type_##MCDjetmatchingCand::_jet_type_##MCDJetId); \ - DECLARE_SOA_TABLE(NewMatched##_jet_type_##MCDJets, "AOD", #_jet_type_ "JETMCHD", _jet_type_##MCPjetmatchingGeo::_jet_type_##MCPJetId, _jet_type_##MCPjetmatchingCand::_jet_type_##MCPJetId); +#define DECLARE_JETMATCHING_TABLE(_jet_type_base_, _jet_type_tag_, _description_) \ + DECLARE_SOA_TABLE(_jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets, "AOD", _description_, \ + _jet_type_tag_##jetmatchingGeo::_jet_type_tag_##JetId, \ + _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetId); -namespace o2::aod -{ -namespace jet -{ -DECLARE_SOA_INDEX_COLUMN(Collision, collision); -DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); -DECLARE_SOA_COLUMN(Pt, pt, float); //! -DECLARE_SOA_COLUMN(Eta, eta, float); //! -DECLARE_SOA_COLUMN(Phi, phi, float); //! -DECLARE_SOA_COLUMN(Energy, energy, float); //! -DECLARE_SOA_COLUMN(Mass, mass, float); //! -DECLARE_SOA_COLUMN(Area, area, float); //! -DECLARE_SOA_COLUMN(R, r, int); //! -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! - [](float pt, float phi) -> float { return pt * std::cos(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! - [](float pt, float phi) -> float { return pt * std::sin(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! - [](float pt, float eta) -> float { return pt * std::sinh(eta); }); -DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p - [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -} // namespace jet +// generate tables for data-, detector- and particle-level jets +#define DECLARE_JET_TABLES_LEVELS(_jet_type_, _hfcand_type_, _shortname_) \ + DECLARE_JET_TABLES(Collision, _jet_type_, Track, _hfcand_type_, _shortname_ "JET"); \ + DECLARE_JET_TABLES(Collision, _jet_type_##MCDetectorLevel, Track, _hfcand_type_, _shortname_ "DJET"); \ + DECLARE_JET_TABLES(McCollision, _jet_type_##MCParticleLevel, McParticle, McParticles, _shortname_ "PJET"); \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCParticleLevel, _jet_type_##MCDetectorLevel, _shortname_ "JETMP2D") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCParticleLevel, _shortname_ "JETMD2P") -// The standard constituents table is more simply defined fully via macros. +#define DECLARE_JET_TABLES_LEVELS2(_jet_type_, _hfcand_type_, _shortname_) \ + DECLARE_JET_TABLES(Collision, _jet_type_, Track, _hfcand_type_, _shortname_ "JET"); \ + DECLARE_JET_TABLES(Collision, _jet_type_##MCD, Track, _hfcand_type_, _shortname_ "DJET"); \ + DECLARE_JET_TABLES(McCollision, _jet_type_##MCP, McParticle, McParticles, _shortname_ "PJET"); \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCP, _jet_type_##MCD, _shortname_ "JETMP2D") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCD, _jet_type_##MCP, _shortname_ "JETMD2P") -// Constituent sub -namespace constituentssub +namespace o2::aod { -// Jet index column will be added in the macro -DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Energy, energy, float); -DECLARE_SOA_COLUMN(Mass, mass, float); -DECLARE_SOA_COLUMN(Source, source, int); -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, - [](float pt, float phi) -> float { return pt * std::cos(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Py, py, - [](float pt, float phi) -> float { return pt * std::sin(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, - [](float pt, float eta) -> float { return pt * std::sinh(eta); }); -DECLARE_SOA_DYNAMIC_COLUMN(P, p, - [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -} // namespace constituentssub - -// Data jets -// As an example, the expanded macros which are used to define the table is shown below. -// It represents that state of the table as of June 2021. -// -//DECLARE_SOA_TABLE(Jets, "AOD", "JET", //! -// o2::soa::Index<>, -// jet::CollisionId, -// jet::Pt, -// jet::Eta, -// jet::Phi, -// jet::Energy, -// jet::Mass, -// jet::Area, -// jet::Px, -// jet::Py, -// jet::Pz, -// jet::P); -// -//DECLARE_SOA_EXTENDED_TABLE(JetsMatched, Jets, "JETMATCHED", //! -// jet::MatchedJetIndex); -// -//using Jet = Jets::iterator; -//using JetMatched = JetsMatched::iterator; - -// And for the constituents table: -// TODO: absorb in jet table when list of references available -// -//namespace constituents -//{ -//DECLARE_SOA_INDEX_COLUMN(Jet, jet); //! -//DECLARE_SOA_INDEX_COLUMN(Track, track); //! -//DECLARE_SOA_INDEX_COLUMN(EMCALCluster, cluster); //! -//} // namespace constituents -//DECLARE_SOA_TABLE(JetTrackConstituents, "AOD", "TRKCONSTITS", //! -// constituents::JetId, -// constituents::TrackId); -//DECLARE_SOA_TABLE(JetClusterConstituents, "AOD", "CLSCONSTITS", //! -// constituents::JetId, -// constituents::EMCALClusterId); -//using JetTrackConstituent = JetTrackConstituents::iterator; -//using JetClusterConstituent = JetClusterConstituents::iterator; - -// And finally, the consitutent sub table -// -//namespace constituentssub -//{ -//DECLARE_SOA_INDEX_COLUMN(Jet, jet); //! -//DECLARE_SOA_COLUMN(Pt, pt, float); //! -//DECLARE_SOA_COLUMN(Eta, eta, float); //! -//DECLARE_SOA_COLUMN(Phi, phi, float); //! -//DECLARE_SOA_COLUMN(Energy, energy, float); //! -//DECLARE_SOA_COLUMN(Mass, mass, float); //! -//DECLARE_SOA_COLUMN(Source, source, int); //! -//DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! -// [](float pt, float phi) -> float { return pt * std::cos(phi); }); -//DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! -// [](float pt, float phi) -> float { return pt * std::sin(phi); }); -//DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! -// [](float pt, float eta) -> float { return pt * std::sinh(eta); }); -//DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p -// [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -//} //namespace constituentssub -// -//DECLARE_SOA_TABLE(JetConstituentsSub, "AOD", "CONSTITUENTSSUB", //! -// constituentssub::JetId, -// constituentssub::Pt, -// constituentssub::Eta, -// constituentssub::Phi, -// constituentssub::Energy, -// constituentssub::Mass, -// constituentssub::Source, -// constituentssub::Px, -// constituentssub::Py, -// constituentssub::Pz, -// constituentssub::P); -//using JetConstituentSub = JetConstituentsSub::iterator; +// Data jets charged +// DECLARE_JET_TABLES(Collision, , Track, HfCand2Prong); +// DECLARE_JET_TABLES(Collision, Full, Track, HfCand2Prong); +// DECLARE_JET_TABLES(Collision, Neutral, Track, HfCand2Prong); -// Defining the tables via the macors. -// The using statements are kept separate for visbility. +DECLARE_JET_TABLES_LEVELS(, HfCand2Prong, ""); +DECLARE_JET_TABLES_LEVELS(Full, HfCand2Prong, "F"); +DECLARE_JET_TABLES_LEVELS(Neutral, HfCand2Prong, "N"); +DECLARE_JET_TABLES_LEVELS2(D0, HfCand2Prong, "D0"); +DECLARE_JET_TABLES_LEVELS2(Lc, HfCand3Prong, "Lc"); +DECLARE_JET_TABLES_LEVELS2(BPl, HfCandBplus, "BPl"); -// Data jets charged -JET_TABLE_DEF(Collision, Jet, jet, "JET"); -using Jet = Jets::iterator; -using MatchedJet = MatchedJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(Jet, jet, "JET", Track, HfCand2Prong); -using JetConstituent = JetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(Jet, jet, "JET"); -using JetConstituentSub = JetConstituentsSub::iterator; +// JET_TABLE_DEF(Collision, Jet, jet, "JET"); +// using Jet = Jets::iterator; +// using MatchedJet = MatchedJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(Jet, jet, "JET", Track, HfCand2Prong); +// using JetConstituent = JetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(Jet, jet, "JET"); +// using JetConstituentSub = JetConstituentsSub::iterator; // Data jets full -JET_TABLE_DEF(Collision, FullJet, fulljet, "JETF"); -using FullJet = FullJets::iterator; -using MatchedFullJet = MatchedFullJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(FullJet, fulljet, "JETF", Track, HfCand2Prong); -using FullJetConstituent = FullJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(FullJet, fulljet, "JETF"); -using FullJetConstituentSub = FullJetConstituentsSub::iterator; +// JET_TABLE_DEF(Collision, FullJet, fulljet, "JETF"); +// using FullJet = FullJets::iterator; +// using MatchedFullJet = MatchedFullJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(FullJet, fulljet, "JETF", Track, HfCand2Prong); +// using FullJetConstituent = FullJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(FullJet, fulljet, "JETF"); +// using FullJetConstituentSub = FullJetConstituentsSub::iterator; -// Data jets neutral -JET_TABLE_DEF(Collision, NeutralJet, neutraljet, "JETN"); -using NeutralJet = NeutralJets::iterator; -using MatchedNeutralJet = MatchedNeutralJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(NeutralJet, neutraljet, "JETN", Track, HfCand2Prong); -using NeutralJetConstituent = NeutralJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(NeutralJet, neutraljet, "JETN"); -using NeutralJetConstituentSub = NeutralJetConstituentsSub::iterator; +// // Data jets neutral +// JET_TABLE_DEF(Collision, NeutralJet, neutraljet, "JETN"); +// using NeutralJet = NeutralJets::iterator; +// using MatchedNeutralJet = MatchedNeutralJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(NeutralJet, neutraljet, "JETN", Track, HfCand2Prong); +// using NeutralJetConstituent = NeutralJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(NeutralJet, neutraljet, "JETN"); +// using NeutralJetConstituentSub = NeutralJetConstituentsSub::iterator; // MC Detector Level charged Jets // NOTE: The same condition as describe for particle leve jets also applies here // to subtracted constituents. -JET_TABLE_DEF(Collision, MCDetectorLevelJet, mcdetectorleveljet, "JETMCDET"); -using MCDetectorLevelJet = MCDetectorLevelJets::iterator; -using MatchedMCDetectorLevelJet = MatchedMCDetectorLevelJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelJet, mcdetectorleveljet, "MCD", Track, HfCand2Prong); -using MCDetectorLevelJetConstituent = MCDetectorLevelJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelJet, mcdetectorleveljet, "MCD"); -using MCDetectorLevelJetConstituentSub = MCDetectorLevelJetConstituentsSub::iterator; +// JET_TABLE_DEF(Collision, MCDetectorLevelJet, mcdetectorleveljet, "JETMCDET"); +// using MCDetectorLevelJet = MCDetectorLevelJets::iterator; +// using MatchedMCDetectorLevelJet = MatchedMCDetectorLevelJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelJet, mcdetectorleveljet, "MCD", Track, HfCand2Prong); +// using MCDetectorLevelJetConstituent = MCDetectorLevelJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelJet, mcdetectorleveljet, "MCD"); +// using MCDetectorLevelJetConstituentSub = MCDetectorLevelJetConstituentsSub::iterator; -// MC Detector Level full Jets -JET_TABLE_DEF(Collision, MCDetectorLevelFullJet, mcdetectorlevelfulljet, "JETFMCDET"); -using MCDetectorLevelFullJet = MCDetectorLevelFullJets::iterator; -using MatchedMCDetectorLevelFullJet = MatchedMCDetectorLevelFullJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelFullJet, mcdetectorlevelfulljet, "MCDF", Track, HfCand2Prong); -using MCDetectorLevelFullJetConstituent = MCDetectorLevelFullJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelFullJet, mcdetectorlevelfulljet, "MCDF"); -using MCDetectorLevelFullJetConstituentSub = MCDetectorLevelFullJetConstituentsSub::iterator; +// // MC Detector Level full Jets +// JET_TABLE_DEF(Collision, MCDetectorLevelFullJet, mcdetectorlevelfulljet, "JETFMCDET"); +// using MCDetectorLevelFullJet = MCDetectorLevelFullJets::iterator; +// using MatchedMCDetectorLevelFullJet = MatchedMCDetectorLevelFullJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelFullJet, mcdetectorlevelfulljet, "MCDF", Track, HfCand2Prong); +// using MCDetectorLevelFullJetConstituent = MCDetectorLevelFullJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelFullJet, mcdetectorlevelfulljet, "MCDF"); +// using MCDetectorLevelFullJetConstituentSub = MCDetectorLevelFullJetConstituentsSub::iterator; -// MC Detector Level neutral Jets -JET_TABLE_DEF(Collision, MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "JETNMCDET"); -using MCDetectorLevelNeutralJet = MCDetectorLevelNeutralJets::iterator; -using MatchedMCDetectorLevelNeutralJet = MatchedMCDetectorLevelNeutralJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "MCDN", Track, HfCand2Prong); -using MCDetectorLevelNeutralJetConstituent = MCDetectorLevelNeutralJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "MCDN"); -using MCDetectorLevelNeutralJetConstituentSub = MCDetectorLevelNeutralJetConstituentsSub::iterator; +// // MC Detector Level neutral Jets +// JET_TABLE_DEF(Collision, MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "JETNMCDET"); +// using MCDetectorLevelNeutralJet = MCDetectorLevelNeutralJets::iterator; +// using MatchedMCDetectorLevelNeutralJet = MatchedMCDetectorLevelNeutralJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "MCDN", Track, HfCand2Prong); +// using MCDetectorLevelNeutralJetConstituent = MCDetectorLevelNeutralJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "MCDN"); +// using MCDetectorLevelNeutralJetConstituentSub = MCDetectorLevelNeutralJetConstituentsSub::iterator; -// MC Particle Level Jets -// NOTE: Cluster constituents aren't really meaningful for particle level. -// However, it's a convenient construction, as it allows everything else -// to work as it would otherwise, and it won't be filled (because there -// are no clusters and nothing that would be identified as clusters), so -// it causes no harm. Perhaps better would be making this std::optional, -// but for now, we keep it simple. -// NOTE: The same condition applies to subtracted constituents. -// MC Particle Level charged Jets -JET_TABLE_DEF(McCollision, MCParticleLevelJet, mcparticleleveljet, "JETMCPART"); -using MCParticleLevelJet = MCParticleLevelJets::iterator; -using MatchedMCParticleLevelJet = MatchedMCParticleLevelJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "MCP", McParticle, McParticles); -using MCParticleLevelJetConstituent = MCParticleLevelJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "MCP"); -using MCParticleLevelJetConstituentSub = MCParticleLevelJetConstituentsSub::iterator; +// // MC Particle Level Jets +// // NOTE: Cluster constituents aren't really meaningful for particle level. +// // However, it's a convenient construction, as it allows everything else +// // to work as it would otherwise, and it won't be filled (because there +// // are no clusters and nothing that would be identified as clusters), so +// // it causes no harm. Perhaps better would be making this std::optional, +// // but for now, we keep it simple. +// // NOTE: The same condition applies to subtracted constituents. +// // MC Particle Level charged Jets +// JET_TABLE_DEF(McCollision, MCParticleLevelJet, mcparticleleveljet, "JETMCPART"); +// using MCParticleLevelJet = MCParticleLevelJets::iterator; +// using MatchedMCParticleLevelJet = MatchedMCParticleLevelJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "MCP", McParticle, McParticles); +// using MCParticleLevelJetConstituent = MCParticleLevelJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "MCP"); +// using MCParticleLevelJetConstituentSub = MCParticleLevelJetConstituentsSub::iterator; -// MC Particle Level full -JET_TABLE_DEF(McCollision, MCParticleLevelFullJet, mcparticlelevelfulljet, "JETFMCPART"); -using MCParticleLevelFullJet = MCParticleLevelFullJets::iterator; -using MatchedMCParticleLevelFullJet = MatchedMCParticleLevelFullJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelFullJet, mcparticlelevelfulljet, "MCPF", McParticle, McParticles); -using MCParticleLevelFullJetConstituent = MCParticleLevelFullJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelFullJet, mcparticlelevelfulljet, "MCPF"); -using MCParticleLevelFullJetConstituentSub = MCParticleLevelFullJetConstituentsSub::iterator; +// // MC Particle Level full +// JET_TABLE_DEF(McCollision, MCParticleLevelFullJet, mcparticlelevelfulljet, "JETFMCPART"); +// using MCParticleLevelFullJet = MCParticleLevelFullJets::iterator; +// using MatchedMCParticleLevelFullJet = MatchedMCParticleLevelFullJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelFullJet, mcparticlelevelfulljet, "MCPF", McParticle, McParticles); +// using MCParticleLevelFullJetConstituent = MCParticleLevelFullJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelFullJet, mcparticlelevelfulljet, "MCPF"); +// using MCParticleLevelFullJetConstituentSub = MCParticleLevelFullJetConstituentsSub::iterator; -// MC Particle Level neutral Jets -JET_TABLE_DEF(McCollision, MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "JETNMCPART"); -using MCParticleLevelNeutralJet = MCParticleLevelNeutralJets::iterator; -using MatchedMCParticleLevelNeutralJet = MatchedMCParticleLevelNeutralJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "MCPN", McParticle, McParticles); -using MCParticleLevelNeutralJetConstituent = MCParticleLevelNeutralJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "MCPN"); -using MCParticleLevelNeutralJetConstituentSub = MCParticleLevelNeutralJetConstituentsSub::iterator; +// // MC Particle Level neutral Jets +// JET_TABLE_DEF(McCollision, MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "JETNMCPART"); +// using MCParticleLevelNeutralJet = MCParticleLevelNeutralJets::iterator; +// using MatchedMCParticleLevelNeutralJet = MatchedMCParticleLevelNeutralJets::iterator; +// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "MCPN", McParticle, McParticles); +// using MCParticleLevelNeutralJetConstituent = MCParticleLevelNeutralJetConstituents::iterator; +// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "MCPN"); +// using MCParticleLevelNeutralJetConstituentSub = MCParticleLevelNeutralJetConstituentsSub::iterator; // Hybrid intermediate JET_TABLE_DEF(Collision, HybridIntermediateJet, hybridintermediatejet, "JETHYBINT"); @@ -357,10 +288,6 @@ using HybridIntermediateJetConstituent = HybridIntermediateJetConstituents::iter JET_CONSTITUENTS_SUB_TABLE_DEF(HybridIntermediateJet, hybridintermediate, "HYBINT"); using HybridIntermediateJetConstituentSub = HybridIntermediateJetConstituentsSub::iterator; -JET_TABLES_LEVELS_DEF(D0, HfCand2Prong); -JET_TABLES_LEVELS_DEF(Lc, HfCand3Prong); -JET_TABLES_LEVELS_DEF(BPl, HfCandBplus); - } // namespace o2::aod #endif // PWGJE_DATAMODEL_JET_H_ diff --git a/PWGJE/TableProducer/CMakeLists.txt b/PWGJE/TableProducer/CMakeLists.txt index d928806bd88..b1d10dcbada 100644 --- a/PWGJE/TableProducer/CMakeLists.txt +++ b/PWGJE/TableProducer/CMakeLists.txt @@ -31,11 +31,6 @@ o2physics_add_dpl_workflow(jet-skimmer PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(jet-matching - SOURCES jetmatching.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore - COMPONENT_NAME Analysis) - o2physics_add_dpl_workflow(jet-matching-hf SOURCES jetmatchinghf.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore diff --git a/PWGJE/TableProducer/jetfinder.cxx b/PWGJE/TableProducer/jetfinder.cxx index 83d82bc466f..24c33ef0b5b 100644 --- a/PWGJE/TableProducer/jetfinder.cxx +++ b/PWGJE/TableProducer/jetfinder.cxx @@ -298,11 +298,11 @@ using JetFinderData = JetFinderTask; using JetFinderDataNeutral = JetFinderTask; using JetFinderMCDetectorLevel = JetFinderTask; -using JetFinderMCDetectorLevelFull = JetFinderTask; -using JetFinderMCDetectorLevelNeutral = JetFinderTask; +using JetFinderMCDetectorLevelFull = JetFinderTask; +using JetFinderMCDetectorLevelNeutral = JetFinderTask; using JetFinderMCParticleLevel = JetFinderTask; -using JetFinderMCParticleLevelFull = JetFinderTask; -using JetFinderMCParticleLevelNeutral = JetFinderTask; +using JetFinderMCParticleLevelFull = JetFinderTask; +using JetFinderMCParticleLevelNeutral = JetFinderTask; using JetFinderHybridIntermediate = JetFinderTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatchinghf.cxx index 48b17b538fe..201a6289381 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatchinghf.cxx @@ -38,7 +38,9 @@ struct JetMatchingHF { Produces jetsBaseToTag; Produces jetsTagToBase; - Preslice mcJetsPerMcCollision = aod::jet::mcCollisionId; + // soa::hasIndexTo; + Preslice baseJetsPerCollision = aod::jet::mcCollisionId; + Preslice tagJetsPerCollision = aod::jet::mcCollisionId; using Collisions = soa::Join; using Tracks = soa::Join; @@ -53,7 +55,8 @@ struct JetMatchingHF { Tracks const& tracks, McParticles const& particlesMC, HfCandidates const& hfcandidates) { - const auto jetsPL = jetsTag.sliceBy(mcJetsPerMcCollision, collision.mcCollisionId()); + const auto jetsPL = jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); + const auto jetsPL2 = jetsBase.sliceBy(baseJetsPerCollision, collision.mcCollisionId()); // geometric matching std::vector jetsBasePhi(jetsBase.size()); @@ -162,6 +165,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) return WorkflowSpec{ adaptAnalysisTask, soa::Join, - aod::NewMatchedD0MCDJets, aod::NewMatchedD0MCPJets, + aod::D0MCDJetsMatchedToD0MCPJets, aod::D0MCPJetsMatchedToD0MCDJets, soa::Join>>(cfgc, TaskName{"jet-matching-hf"})}; } diff --git a/PWGJE/Tasks/jetmatchinghfqa.cxx b/PWGJE/Tasks/jetmatchinghfqa.cxx index d8fffe9e4d1..5b624c043cb 100644 --- a/PWGJE/Tasks/jetmatchinghfqa.cxx +++ b/PWGJE/Tasks/jetmatchinghfqa.cxx @@ -27,8 +27,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct JetMatchingHFQA { - using DetectorLevelJets = soa::Join; - using ParticleLevelJets = soa::Join; + using DetectorLevelJets = soa::Join; + using ParticleLevelJets = soa::Join; OutputObj hJetPt{"h_jet_pt"}; OutputObj hJetDetaDphi{"h_jet_deta_dphi"}; From b62fe72fdbdf4b83aabb5e965261326094bea9df Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 16:39:16 +0200 Subject: [PATCH 06/12] Cleanup --- PWGJE/DataModel/Jet.h | 117 ++---------------------------------------- 1 file changed, 3 insertions(+), 114 deletions(-) diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 3c288e409f6..b012b6ecb43 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -96,14 +96,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, jet::Pz, \ jet::P, \ _name_##util::Dummy##_jet_type_##s<>); \ - namespace _name_##matching \ - { \ - DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ - DECLARE_SOA_COLUMN(MatchedJetIndex, matchedJetIndex, int); \ - } \ - DECLARE_SOA_TABLE(Matched##_jet_type_##s, "AOD", _description_ "MATCH", \ - _name_##matching::_jet_type_##Id, \ - _name_##matching::MatchedJetIndex); \ namespace _name_##matchingGeo \ { \ DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetGeo); \ @@ -148,7 +140,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, #define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ - using Matched##_jet_type_##Jet = Matched##_jet_type_##Jet##s::iterator; \ JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_, _const_type_, _hfcand_type_); \ using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_); \ @@ -157,7 +148,8 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, #define DECLARE_JETMATCHING_TABLE(_jet_type_base_, _jet_type_tag_, _description_) \ DECLARE_SOA_TABLE(_jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets, "AOD", _description_, \ _jet_type_tag_##jetmatchingGeo::_jet_type_tag_##JetId, \ - _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetId); + _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetId); \ + using _jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jet = _jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets::iterator; // generate tables for data-, detector- and particle-level jets #define DECLARE_JET_TABLES_LEVELS(_jet_type_, _hfcand_type_, _shortname_) \ @@ -176,11 +168,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, namespace o2::aod { -// Data jets charged -// DECLARE_JET_TABLES(Collision, , Track, HfCand2Prong); -// DECLARE_JET_TABLES(Collision, Full, Track, HfCand2Prong); -// DECLARE_JET_TABLES(Collision, Neutral, Track, HfCand2Prong); - DECLARE_JET_TABLES_LEVELS(, HfCand2Prong, ""); DECLARE_JET_TABLES_LEVELS(Full, HfCand2Prong, "F"); DECLARE_JET_TABLES_LEVELS(Neutral, HfCand2Prong, "N"); @@ -188,106 +175,8 @@ DECLARE_JET_TABLES_LEVELS2(D0, HfCand2Prong, "D0"); DECLARE_JET_TABLES_LEVELS2(Lc, HfCand3Prong, "Lc"); DECLARE_JET_TABLES_LEVELS2(BPl, HfCandBplus, "BPl"); -// JET_TABLE_DEF(Collision, Jet, jet, "JET"); -// using Jet = Jets::iterator; -// using MatchedJet = MatchedJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(Jet, jet, "JET", Track, HfCand2Prong); -// using JetConstituent = JetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(Jet, jet, "JET"); -// using JetConstituentSub = JetConstituentsSub::iterator; - -// Data jets full -// JET_TABLE_DEF(Collision, FullJet, fulljet, "JETF"); -// using FullJet = FullJets::iterator; -// using MatchedFullJet = MatchedFullJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(FullJet, fulljet, "JETF", Track, HfCand2Prong); -// using FullJetConstituent = FullJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(FullJet, fulljet, "JETF"); -// using FullJetConstituentSub = FullJetConstituentsSub::iterator; - -// // Data jets neutral -// JET_TABLE_DEF(Collision, NeutralJet, neutraljet, "JETN"); -// using NeutralJet = NeutralJets::iterator; -// using MatchedNeutralJet = MatchedNeutralJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(NeutralJet, neutraljet, "JETN", Track, HfCand2Prong); -// using NeutralJetConstituent = NeutralJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(NeutralJet, neutraljet, "JETN"); -// using NeutralJetConstituentSub = NeutralJetConstituentsSub::iterator; - -// MC Detector Level charged Jets -// NOTE: The same condition as describe for particle leve jets also applies here -// to subtracted constituents. - -// JET_TABLE_DEF(Collision, MCDetectorLevelJet, mcdetectorleveljet, "JETMCDET"); -// using MCDetectorLevelJet = MCDetectorLevelJets::iterator; -// using MatchedMCDetectorLevelJet = MatchedMCDetectorLevelJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelJet, mcdetectorleveljet, "MCD", Track, HfCand2Prong); -// using MCDetectorLevelJetConstituent = MCDetectorLevelJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelJet, mcdetectorleveljet, "MCD"); -// using MCDetectorLevelJetConstituentSub = MCDetectorLevelJetConstituentsSub::iterator; - -// // MC Detector Level full Jets -// JET_TABLE_DEF(Collision, MCDetectorLevelFullJet, mcdetectorlevelfulljet, "JETFMCDET"); -// using MCDetectorLevelFullJet = MCDetectorLevelFullJets::iterator; -// using MatchedMCDetectorLevelFullJet = MatchedMCDetectorLevelFullJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelFullJet, mcdetectorlevelfulljet, "MCDF", Track, HfCand2Prong); -// using MCDetectorLevelFullJetConstituent = MCDetectorLevelFullJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelFullJet, mcdetectorlevelfulljet, "MCDF"); -// using MCDetectorLevelFullJetConstituentSub = MCDetectorLevelFullJetConstituentsSub::iterator; - -// // MC Detector Level neutral Jets -// JET_TABLE_DEF(Collision, MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "JETNMCDET"); -// using MCDetectorLevelNeutralJet = MCDetectorLevelNeutralJets::iterator; -// using MatchedMCDetectorLevelNeutralJet = MatchedMCDetectorLevelNeutralJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "MCDN", Track, HfCand2Prong); -// using MCDetectorLevelNeutralJetConstituent = MCDetectorLevelNeutralJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelNeutralJet, mcdetectorlevelneutraljet, "MCDN"); -// using MCDetectorLevelNeutralJetConstituentSub = MCDetectorLevelNeutralJetConstituentsSub::iterator; - -// // MC Particle Level Jets -// // NOTE: Cluster constituents aren't really meaningful for particle level. -// // However, it's a convenient construction, as it allows everything else -// // to work as it would otherwise, and it won't be filled (because there -// // are no clusters and nothing that would be identified as clusters), so -// // it causes no harm. Perhaps better would be making this std::optional, -// // but for now, we keep it simple. -// // NOTE: The same condition applies to subtracted constituents. -// // MC Particle Level charged Jets -// JET_TABLE_DEF(McCollision, MCParticleLevelJet, mcparticleleveljet, "JETMCPART"); -// using MCParticleLevelJet = MCParticleLevelJets::iterator; -// using MatchedMCParticleLevelJet = MatchedMCParticleLevelJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "MCP", McParticle, McParticles); -// using MCParticleLevelJetConstituent = MCParticleLevelJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelJet, mcparticleleveljet, "MCP"); -// using MCParticleLevelJetConstituentSub = MCParticleLevelJetConstituentsSub::iterator; - -// // MC Particle Level full -// JET_TABLE_DEF(McCollision, MCParticleLevelFullJet, mcparticlelevelfulljet, "JETFMCPART"); -// using MCParticleLevelFullJet = MCParticleLevelFullJets::iterator; -// using MatchedMCParticleLevelFullJet = MatchedMCParticleLevelFullJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelFullJet, mcparticlelevelfulljet, "MCPF", McParticle, McParticles); -// using MCParticleLevelFullJetConstituent = MCParticleLevelFullJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelFullJet, mcparticlelevelfulljet, "MCPF"); -// using MCParticleLevelFullJetConstituentSub = MCParticleLevelFullJetConstituentsSub::iterator; - -// // MC Particle Level neutral Jets -// JET_TABLE_DEF(McCollision, MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "JETNMCPART"); -// using MCParticleLevelNeutralJet = MCParticleLevelNeutralJets::iterator; -// using MatchedMCParticleLevelNeutralJet = MatchedMCParticleLevelNeutralJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "MCPN", McParticle, McParticles); -// using MCParticleLevelNeutralJetConstituent = MCParticleLevelNeutralJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelNeutralJet, mcparticlelevelneutraljet, "MCPN"); -// using MCParticleLevelNeutralJetConstituentSub = MCParticleLevelNeutralJetConstituentsSub::iterator; - // Hybrid intermediate -JET_TABLE_DEF(Collision, HybridIntermediateJet, hybridintermediatejet, "JETHYBINT"); -using HybridIntermediateJet = HybridIntermediateJets::iterator; -using MatchedHybridIntermediateJet = MatchedHybridIntermediateJets::iterator; -JET_CONSTITUENTS_ARRAY_TABLE_DEF(HybridIntermediateJet, hybridintermediate, "HYBINT", Track, HfCand2Prong); -using HybridIntermediateJetConstituent = HybridIntermediateJetConstituents::iterator; -JET_CONSTITUENTS_SUB_TABLE_DEF(HybridIntermediateJet, hybridintermediate, "HYBINT"); -using HybridIntermediateJetConstituentSub = HybridIntermediateJetConstituentsSub::iterator; - +DECLARE_JET_TABLES(Collision, HybridIntermediate, Track, HfCand2Prong, "JEHYIN"); } // namespace o2::aod #endif // PWGJE_DATAMODEL_JET_H_ From ca65bf7a5e26ee112a207a97eefadb9b443ac26e Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 16:49:41 +0200 Subject: [PATCH 07/12] Fix formatting --- PWGJE/DataModel/Jet.h | 28 ++++----- PWGJE/DataModel/JetHF.h | 129 ---------------------------------------- 2 files changed, 14 insertions(+), 143 deletions(-) delete mode 100644 PWGJE/DataModel/JetHF.h diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index b012b6ecb43..fdabfd9dece 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -137,33 +137,33 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, constituentssub::P); // combine definition of tables for jets, constituents, and substructure -#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ - JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ - using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ +#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ + JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ + using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_, _const_type_, _hfcand_type_); \ - using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ + using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_); \ using _jet_type_##Jet##ConstituentSub = _jet_type_##Jet##ConstituentsSub::iterator; #define DECLARE_JETMATCHING_TABLE(_jet_type_base_, _jet_type_tag_, _description_) \ DECLARE_SOA_TABLE(_jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets, "AOD", _description_, \ _jet_type_tag_##jetmatchingGeo::_jet_type_tag_##JetId, \ - _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetId); \ + _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetId); \ using _jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jet = _jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets::iterator; // generate tables for data-, detector- and particle-level jets -#define DECLARE_JET_TABLES_LEVELS(_jet_type_, _hfcand_type_, _shortname_) \ - DECLARE_JET_TABLES(Collision, _jet_type_, Track, _hfcand_type_, _shortname_ "JET"); \ - DECLARE_JET_TABLES(Collision, _jet_type_##MCDetectorLevel, Track, _hfcand_type_, _shortname_ "DJET"); \ - DECLARE_JET_TABLES(McCollision, _jet_type_##MCParticleLevel, McParticle, McParticles, _shortname_ "PJET"); \ +#define DECLARE_JET_TABLES_LEVELS(_jet_type_, _hfcand_type_, _shortname_) \ + DECLARE_JET_TABLES(Collision, _jet_type_, Track, _hfcand_type_, _shortname_ "JET"); \ + DECLARE_JET_TABLES(Collision, _jet_type_##MCDetectorLevel, Track, _hfcand_type_, _shortname_ "DJET"); \ + DECLARE_JET_TABLES(McCollision, _jet_type_##MCParticleLevel, McParticle, McParticles, _shortname_ "PJET"); \ DECLARE_JETMATCHING_TABLE(_jet_type_##MCParticleLevel, _jet_type_##MCDetectorLevel, _shortname_ "JETMP2D") \ DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCParticleLevel, _shortname_ "JETMD2P") -#define DECLARE_JET_TABLES_LEVELS2(_jet_type_, _hfcand_type_, _shortname_) \ - DECLARE_JET_TABLES(Collision, _jet_type_, Track, _hfcand_type_, _shortname_ "JET"); \ - DECLARE_JET_TABLES(Collision, _jet_type_##MCD, Track, _hfcand_type_, _shortname_ "DJET"); \ - DECLARE_JET_TABLES(McCollision, _jet_type_##MCP, McParticle, McParticles, _shortname_ "PJET"); \ - DECLARE_JETMATCHING_TABLE(_jet_type_##MCP, _jet_type_##MCD, _shortname_ "JETMP2D") \ +#define DECLARE_JET_TABLES_LEVELS2(_jet_type_, _hfcand_type_, _shortname_) \ + DECLARE_JET_TABLES(Collision, _jet_type_, Track, _hfcand_type_, _shortname_ "JET"); \ + DECLARE_JET_TABLES(Collision, _jet_type_##MCD, Track, _hfcand_type_, _shortname_ "DJET"); \ + DECLARE_JET_TABLES(McCollision, _jet_type_##MCP, McParticle, McParticles, _shortname_ "PJET"); \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCP, _jet_type_##MCD, _shortname_ "JETMP2D") \ DECLARE_JETMATCHING_TABLE(_jet_type_##MCD, _jet_type_##MCP, _shortname_ "JETMD2P") namespace o2::aod diff --git a/PWGJE/DataModel/JetHF.h b/PWGJE/DataModel/JetHF.h deleted file mode 100644 index f689c7c656b..00000000000 --- a/PWGJE/DataModel/JetHF.h +++ /dev/null @@ -1,129 +0,0 @@ -// 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. - -/// -/// \brief Table definitions for jets -/// -/// Since the JE framework requires a set of nearly identical tables, most the tables are -/// generated via macros. Usually this would be avoided, but maintaining a collection of -/// (nearly) identical tables was judged to be more the larger maintenance burden. -/// -/// \author Nima Zardoshti - -#ifndef PWGJE_DATAMODEL_JETHF_H_ -#define PWGJE_DATAMODEL_JETHF_H_ - -#include "PWGJE/DataModel/Jet.h" - -namespace o2::aod -{ - -// HF jets -// D0 tagged jets -// JET_TABLES_LEVELS_DEF(D0, HfCand2Prong); -// JET_TABLES_LEVELS_DEF(Lc, HfCand3Prong); -// JET_TABLES_LEVELS_DEF(BPl, HfCandBplus); - -// using D0Jet = D0Jets::iterator; -// using MatchedD0Jet = MatchedD0Jets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(D0Jet, D0jet, "D0", Track, HfCand2Prong); -// using D0JetConstituent = D0JetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(D0Jet, D0jet, "D0"); -// using D0JetConstituentSub = D0JetConstituentsSub::iterator; - -// // Lc tagged jets -// JET_TABLE_DEF(Collision, LcJet, Lcjet, "LcJET"); -// using LcJet = LcJets::iterator; -// using MatchedLcJet = MatchedLcJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(LcJet, Lcjet, "Lc", Track, HfCand3Prong); -// using LcJetConstituent = LcJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(LcJet, Lcjet, "Lc"); -// using LcJetConstituentSub = LcJetConstituentsSub::iterator; - -// // B+ tagged jets -// JET_TABLE_DEF(Collision, BPlusJet, BPlusjet, "BPlJET"); -// using BPlusJet = BPlusJets::iterator; -// using MatchedBPlusJet = MatchedBPlusJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(BPlusJet, BPlusjet, "BPl", Track, HfCandBplus); -// using BPlusJetConstituent = BPlusJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(BPlusJet, BPlusjet, "BPl"); -// using BPlusJetConstituentSub = BPlusJetConstituentsSub::iterator; - -// HF jets (MC detector level) -// D0 tagged jets -// JET_TABLE_DEF(Collision, MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0JETMCD"); -// using MCDetectorLevelD0Jet = MCDetectorLevelD0Jets::iterator; -// using MatchedMCDetectorLevelD0Jet = MatchedMCDetectorLevelD0Jets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0MCD", Track, HfCand2Prong); -// using MCDetectorLevelD0JetConstituent = MCDetectorLevelD0JetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelD0Jet, mcdetectorlevelD0jet, "D0MCD"); -// using MCDetectorLevelD0JetConstituentSub = MCDetectorLevelD0JetConstituentsSub::iterator; - -// // Lc tagged jets -// JET_TABLE_DEF(Collision, MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcJETMCD"); -// using MCDetectorLevelLcJet = MCDetectorLevelLcJets::iterator; -// using MatchedMCDetectorLevelLcJet = MatchedMCDetectorLevelLcJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcMCD", Track, HfCand3Prong); -// using MCDetectorLevelLcJetConstituent = MCDetectorLevelLcJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelLcJet, mcdetectorlevelLcjet, "LcMCD"); -// using MCDetectorLevelLcJetConstituentSub = MCDetectorLevelLcJetConstituentsSub::iterator; - -// // B+ tagged jets -// JET_TABLE_DEF(Collision, MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlJETMCD"); -// using MCDetectorLevelBPlusJet = MCDetectorLevelBPlusJets::iterator; -// using MatchedMCDetectorLevelBPlusJet = MatchedMCDetectorLevelBPlusJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlMCD", Track, HfCandBplus); -// using MCDetectorLevelBPlusJetConstituent = MCDetectorLevelBPlusJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCDetectorLevelBPlusJet, mcdetectorlevelBPlusjet, "BPlMCD"); -// using MCDetectorLevelBPlusJetConstituentSub = MCDetectorLevelBPlusJetConstituentsSub::iterator; - -// HF jets (MC particle level) -// D0 tagged jets -// JET_TABLE_DEF(McCollision, MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0JETMCP"); -// using MCParticleLevelD0Jet = MCParticleLevelD0Jets::iterator; -// using MatchedMCParticleLevelD0Jet = MatchedMCParticleLevelD0Jets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0MCP", McParticle, McParticles); -// using MCParticleLevelD0JetConstituent = MCParticleLevelD0JetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelD0Jet, mcparticlelevelD0jet, "D0MCP"); -// using MCParticleLevelD0JetConstituentSub = MCParticleLevelD0JetConstituentsSub::iterator; - -// // Lc tagged jets -// JET_TABLE_DEF(McCollision, MCParticleLevelLcJet, mcparticlelevelLcjet, "LcJETMCP"); -// using MCParticleLevelLcJet = MCParticleLevelLcJets::iterator; -// using MatchedMCParticleLevelLcJet = MatchedMCParticleLevelLcJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcMCP", McParticle, McParticles); -// using MCParticleLevelLcJetConstituent = MCParticleLevelLcJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelLcJet, mcparticlelevelLcjet, "LcMCP"); -// using MCParticleLevelLcJetConstituentSub = MCParticleLevelLcJetConstituentsSub::iterator; - -// // B+ tagged jets -// JET_TABLE_DEF(McCollision, MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlJETMCP"); -// using MCParticleLevelBPlusJet = MCParticleLevelBPlusJets::iterator; -// using MatchedMCParticleLevelBPlusJet = MatchedMCParticleLevelBPlusJets::iterator; -// JET_CONSTITUENTS_ARRAY_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlMCP", McParticle, McParticles); -// using MCParticleLevelBPlusJetConstituent = MCParticleLevelBPlusJetConstituents::iterator; -// JET_CONSTITUENTS_SUB_TABLE_DEF(MCParticleLevelBPlusJet, mcparticlelevelBPlusjet, "BPlMCP"); -// using MCParticleLevelBPlusJetConstituentSub = MCParticleLevelBPlusJetConstituentsSub::iterator; - -// namespace mcdetectorlevelD0jetmatching2 -// { -// DECLARE_SOA_INDEX_COLUMN(MCDetectorLevelD0Jet, matchedJet); -// } -// namespace mcparticlelevelD0jetmatching2 -// { -// DECLARE_SOA_INDEX_COLUMN(MCParticleLevelD0Jet, matchedJet); -// } -// DECLARE_SOA_TABLE(MatchedMCParticleDetectorLevelD0Jets, "AOD", "D0JETMCPDMATCH", mcdetectorlevelD0jetmatching2::MCDetectorLevelD0JetId); -// DECLARE_SOA_TABLE(MatchedMCDetectorParticleLevelD0Jets, "AOD", "D0JETMCDPMATCH", mcparticlelevelD0jetmatching2::MCParticleLevelD0JetId); - -} // namespace o2::aod - -#endif // PWGJE_DATAMODEL_JETHF_H_ From 72fd1ba50f53d5d1127899c216f7c117d7103ed4 Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 17:19:20 +0200 Subject: [PATCH 08/12] Remove obsolete jet matching --- PWGJE/TableProducer/jetmatching.cxx | 133 ---------------------------- 1 file changed, 133 deletions(-) delete mode 100644 PWGJE/TableProducer/jetmatching.cxx diff --git a/PWGJE/TableProducer/jetmatching.cxx b/PWGJE/TableProducer/jetmatching.cxx deleted file mode 100644 index e0604c9af11..00000000000 --- a/PWGJE/TableProducer/jetmatching.cxx +++ /dev/null @@ -1,133 +0,0 @@ -// 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 jetmatching.cxx -/// \brief Matching jets between different jet tables -/// -/// \author Raymond Ehlers , ORNL - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoA.h" -#include "Common/DataModel/EventSelection.h" - -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/Core/JetUtilities.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -void customize(std::vector& workflowOptions) -{ - ConfigParamSpec jetMatching = {"jet-matching", - VariantType::String, - // NOTE: Even though this may not be the most sensible default, one - // must be set to avoid a segfault during compilation due to an empty workflow. - "MCDetectorLevel-MCParticleLevel", - {"Jet collections to match, separated by commas. Example: \"MCDetectorLevel-MCParticleLevel\". Possible components: MCParticleLevel, MCDetectorLevel, HybridIntermediate, Hybrid"}}; - workflowOptions.push_back(jetMatching); -} - -#include "Framework/runDataProcessing.h" - -template -struct JetMatching { - Configurable maxMatchingDistance{"maxMatchingDistance", 0.4f, "Max matching distance"}; - Produces jetsBaseMatching; - Produces jetsTagMatching; - - void init(InitContext const&) - { - } - - void process( - //soa::Filtered::iterator const& collision, - CollisionType const& collision, - //aod::Collision const& collision, - BaseJetCollection const& jetsBase, - TagJetCollection const& jetsTag) - { - std::vector jetsBasePhi(jetsBase.size()); - std::vector jetsBaseEta(jetsBase.size()); - for (auto jet : jetsBase) { - jetsBasePhi.emplace_back(jet.phi()); - jetsBaseEta.emplace_back(jet.eta()); - } - std::vector jetsTagPhi(jetsTag.size()); - std::vector jetsTagEta(jetsTag.size()); - for (auto& jet : jetsTag) { - jetsTagPhi.emplace_back(jet.phi()); - jetsTagEta.emplace_back(jet.eta()); - } - auto&& [baseToTagIndexMap, tagToBaseIndexMap] = JetUtilities::MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, maxMatchingDistance); - - unsigned int i = 0; - for (auto& jet : jetsBase) { - // Store results - jetsBaseMatching(jet.globalIndex(), baseToTagIndexMap[i]); - ++i; - } - i = 0; - for (auto& jet : jetsTag) { - // Store results - jetsTagMatching(jet.globalIndex(), tagToBaseIndexMap[i]); - ++i; - } - } -}; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - // TODO: Is there a better way to do this? - // TODO: String validation and normalization. There's too much room for error with enumerations. - auto jetMatching = cfgc.options().get("jet-matching"); - // Tokenize using stringstream - std::vector matchingOptions; - std::stringstream ss; - ss << jetMatching; - while (ss.good()) { - std::string substring; - getline(ss, substring, ','); - matchingOptions.push_back(substring); - } - std::vector tasks; - // NOTE: soa::Filtered must be applied here. It would have been nicer to apply in process, but it doesn't - // appear to get recognized as a type in that case (reason is unclear). - for (auto opt : matchingOptions) { - // If there is a hybrid subtracted jet collection. - if (opt == "Hybrid-HybridIntermediate") { - tasks.emplace_back( - adaptAnalysisTask::iterator, o2::aod::Jets, o2::aod::MatchedJets, - o2::aod::HybridIntermediateJets, o2::aod::MatchedHybridIntermediateJets>>( - cfgc, TaskName{"jet-matching-hybrid-sub-to-hybrid-intermedaite"})); - } - // If there are two classes of hybrid jets, this will match from the second class to the detector level - if (opt == "HybridIntermediate-MCDetectorLevel") { - tasks.emplace_back( - adaptAnalysisTask::iterator, o2::aod::HybridIntermediateJets, o2::aod::MatchedHybridIntermediateJets, - o2::aod::MCDetectorLevelJets, o2::aod::MatchedMCDetectorLevelJets>>(cfgc, TaskName{"jet-matching-hybrid-intermediate-to-MC-detector-level"})); - } - // If there is just a single standard hybrid jet collection, it can be matched directly to MC detector level. - if (opt == "Hybrid-MCDetectorLevel") { - tasks.emplace_back( - adaptAnalysisTask::iterator, o2::aod::Jets, - o2::aod::MatchedJets, o2::aod::MCDetectorLevelJets, o2::aod::MatchedMCDetectorLevelJets>>(cfgc, TaskName{"jet-matching-hybrid-to-MC-detector-level"})); - } - // Finally, match MC detector level to MC particle level. - if (opt == "MCDetectorLevel-MCParticleLevel") { - tasks.emplace_back( - adaptAnalysisTask>::iterator, - o2::aod::MCDetectorLevelJets, o2::aod::MatchedMCDetectorLevelJets, o2::aod::MCParticleLevelJets, o2::aod::MatchedMCParticleLevelJets>>(cfgc, TaskName{"jet-matching-MC-detector-level-to-MC-particle-level"})); - } - } - return WorkflowSpec{tasks}; -} From d7713b99b154471f02a7af28c736b34ea101413e Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 22:09:11 +0200 Subject: [PATCH 09/12] Update --- PWGJE/DataModel/Jet.h | 96 +++++++++++++-------------- PWGJE/TableProducer/jetmatchinghf.cxx | 39 ++++++++--- 2 files changed, 76 insertions(+), 59 deletions(-) diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index fdabfd9dece..676e309cea1 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -51,8 +51,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p [](float pt, float eta) -> float { return pt * std::cosh(eta); }); } // namespace jet -// The standard constituents table is more simply defined fully via macros. - // Constituent sub namespace constituentssub { @@ -75,54 +73,54 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, } // namespace o2::aod // Defines the jet table definition -#define JET_TABLE_DEF(_collision_name_, _jet_type_, _name_, _description_) \ - namespace _name_##util \ - { \ - DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_##s, dummy##_jet_type##s, \ - []() -> int { return 0; }); \ - } \ - DECLARE_SOA_TABLE(_jet_type_##s, "AOD", _description_, \ - o2::soa::Index<>, \ - jet::_collision_name_##Id, \ - jet::Pt, \ - jet::Eta, \ - jet::Phi, \ - jet::Energy, \ - jet::Mass, \ - jet::Area, \ - jet::R, \ - jet::Px, \ - jet::Py, \ - jet::Pz, \ - jet::P, \ - _name_##util::Dummy##_jet_type_##s<>); \ - namespace _name_##matchingGeo \ - { \ - DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetGeo); \ - } \ - namespace _name_##matchingCand \ - { \ - DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetCand); \ +#define DECLARE_JET_TABLE(_collision_name_, _jet_type_, _name_, _description_) \ + namespace _name_##util \ + { \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_##s, dummy##_jet_type##s, \ + []() -> int { return 0; }); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##s, "AOD", _description_, \ + o2::soa::Index<>, \ + jet::_collision_name_##Id, \ + jet::Pt, \ + jet::Eta, \ + jet::Phi, \ + jet::Energy, \ + jet::Mass, \ + jet::Area, \ + jet::R, \ + jet::Px, \ + jet::Py, \ + jet::Pz, \ + jet::P, \ + _name_##util::Dummy##_jet_type_##s<>); \ + namespace _name_##matchingGeo \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetGeo); \ + } \ + namespace _name_##matchingCand \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_, matchedJetCand); \ } -#define JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_, _name_, _Description_, _track_type_, _cand_type_) \ - namespace _name_##constituents \ - { \ - DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ - DECLARE_SOA_ARRAY_INDEX_COLUMN(_track_type_, tracks); \ - DECLARE_SOA_ARRAY_INDEX_COLUMN(EMCALCluster, clusters); \ - DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(HfCandidates, hfcandidates, int32_t, _cand_type_, "_hfcand"); \ - } \ - DECLARE_SOA_TABLE(_jet_type_##Constituents, "AOD", _Description_ "CONSTS", \ - _name_##constituents::_jet_type_##Id, \ - _name_##constituents::_track_type_##Ids, \ - _name_##constituents::EMCALClusterIds, \ +#define DECLARE_CONSTITUENTS_TABLE(_jet_type_, _name_, _Description_, _track_type_, _cand_type_) \ + namespace _name_##constituents \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ + DECLARE_SOA_ARRAY_INDEX_COLUMN(_track_type_, tracks); \ + DECLARE_SOA_ARRAY_INDEX_COLUMN(EMCALCluster, clusters); \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(HfCandidates, hfcandidates, int32_t, _cand_type_, "_hfcand"); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##Constituents, "AOD", _Description_ "CONSTS", \ + _name_##constituents::_jet_type_##Id, \ + _name_##constituents::_track_type_##Ids, \ + _name_##constituents::EMCALClusterIds, \ _name_##constituents::HfCandidatesIds); // Defines the jet constituent sub table // NOTE: This relies on the jet index column being defined in the constituents namespace. // Since these are always paired together, there's no point in redefining them. -#define JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_, _name_, _Description_) \ +#define DECLARE_CONSTITUENTS_SUB_TABLE(_jet_type_, _name_, _Description_) \ DECLARE_SOA_TABLE(_jet_type_##ConstituentsSub, "AOD", _Description_ "CONSTSUB", \ _name_##constituents::_jet_type_##Id, \ constituentssub::Pt, \ @@ -137,12 +135,12 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, constituentssub::P); // combine definition of tables for jets, constituents, and substructure -#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ - JET_TABLE_DEF(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ - using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ - JET_CONSTITUENTS_ARRAY_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_, _const_type_, _hfcand_type_); \ - using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ - JET_CONSTITUENTS_SUB_TABLE_DEF(_jet_type_##Jet, _jet_type_##jet, _description_); \ +#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ + DECLARE_JET_TABLE(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ + using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ + DECLARE_CONSTITUENTS_TABLE(_jet_type_##Jet, _jet_type_##jet, _description_, _const_type_, _hfcand_type_); \ + using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ + DECLARE_CONSTITUENTS_SUB_TABLE(_jet_type_##Jet, _jet_type_##jet, _description_); \ using _jet_type_##Jet##ConstituentSub = _jet_type_##Jet##ConstituentsSub::iterator; #define DECLARE_JETMATCHING_TABLE(_jet_type_base_, _jet_type_tag_, _description_) \ diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatchinghf.cxx index 201a6289381..ffd0887779b 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatchinghf.cxx @@ -38,8 +38,8 @@ struct JetMatchingHF { Produces jetsBaseToTag; Produces jetsTagToBase; - // soa::hasIndexTo; - Preslice baseJetsPerCollision = aod::jet::mcCollisionId; + // preslicing jet collections, only for MC-based collection + // Preslice baseJetsPerCollision = aod::jet::mcCollisionId; Preslice tagJetsPerCollision = aod::jet::mcCollisionId; using Collisions = soa::Join; @@ -55,26 +55,45 @@ struct JetMatchingHF { Tracks const& tracks, McParticles const& particlesMC, HfCandidates const& hfcandidates) { - const auto jetsPL = jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); - const auto jetsPL2 = jetsBase.sliceBy(baseJetsPerCollision, collision.mcCollisionId()); + // slicing base jets, only for MC-based collection + auto jetsBasePerColl = jetsBase; + constexpr bool jetsBaseIsMC = o2::soa::is_binding_compatible_v>(); + if constexpr (jetsBaseIsMC) { + LOGF(info, "slicing base jet collection by MC collision"); + } + else { + LOGF(info, "not slicing base jet collection by MC collision"); + } + // jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.mcCollisionId()); + + // slicing tag jets, only for MC-based collection + constexpr bool jetsTagIsMC = o2::soa::is_binding_compatible_v>(); + // decltype(jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId())) jetsTagPerColl; + if (jetsTagIsMC) { + LOGF(info, "slicing tag jet collection by MC collision"); + } + else { + LOGF(info, "not slicing tag jet collection by MC collision"); + } + const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); // geometric matching std::vector jetsBasePhi(jetsBase.size()); std::vector jetsBaseEta(jetsBase.size()); - for (auto jet : jetsBase) { + for (auto jet : jetsBasePerColl) { jetsBasePhi.emplace_back(jet.phi()); jetsBaseEta.emplace_back(jet.eta()); } std::vector jetsTagPhi(jetsTag.size()); std::vector jetsTagEta(jetsTag.size()); - for (auto& jet : jetsTag) { + for (auto& jet : jetsTagPerColl) { jetsTagPhi.emplace_back(jet.phi()); jetsTagEta.emplace_back(jet.eta()); } auto&& [baseToTagIndexMap, tagToBaseIndexMap] = JetUtilities::MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, maxMatchingDistance); // forward matching - for (const auto& jet : jetsBase) { + for (const auto& jet : jetsBasePerColl) { LOGF(info, "jet index: %d (coll %d, pt %g, phi %g) with %d tracks, %d HF candidates", jet.index(), jet.collisionId(), jet.pt(), jet.phi(), jet.tracks().size(), jet.hfcandidates().size()); @@ -97,7 +116,7 @@ struct JetMatchingHF { if ((mother0Id == mother1Id) && std::abs(daughter0.template mcParticle_as().template mothers_as().front().flagMcMatchGen()) & (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { LOGF(info, "D0 - looking for jet"); - for (const auto& pjet : jetsPL) { + for (const auto& pjet : jetsTagPerColl) { for (const auto& cand : pjet.template hfcandidates_as()) { if (mother0Id == cand.globalIndex()) { matchedIdx = pjet.globalIndex(); @@ -113,7 +132,7 @@ struct JetMatchingHF { } // backward matching - for (const auto& jet : jetsPL) { + for (const auto& jet : jetsTagPerColl) { LOGF(info, "MC jet index: %d (coll %d) with %d tracks, %d HF candidates", jet.index(), jet.mcCollisionId(), jet.tracks().size(), jet.hfcandidates().size()); @@ -148,7 +167,7 @@ struct JetMatchingHF { LOGF(info, "Found matching 2prong candidate: %d", candIdx); } } - for (const auto& djet : jetsBase) { + for (const auto& djet : jetsBasePerColl) { if (djet.template hfcandidates_as().front().globalIndex() == candIdx) { matchedIdx = djet.globalIndex(); LOGF(info, "Found match part to det: %d -> %d", jet.globalIndex(), matchedIdx); From 0d595bbbb249a41070bb120bec0f1c1155e3566f Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Thu, 20 Apr 2023 22:11:29 +0200 Subject: [PATCH 10/12] Fix formatting --- PWGJE/TableProducer/jetmatchinghf.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatchinghf.cxx index ffd0887779b..c1bfece835a 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatchinghf.cxx @@ -60,8 +60,7 @@ struct JetMatchingHF { constexpr bool jetsBaseIsMC = o2::soa::is_binding_compatible_v>(); if constexpr (jetsBaseIsMC) { LOGF(info, "slicing base jet collection by MC collision"); - } - else { + } else { LOGF(info, "not slicing base jet collection by MC collision"); } // jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.mcCollisionId()); @@ -71,8 +70,7 @@ struct JetMatchingHF { // decltype(jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId())) jetsTagPerColl; if (jetsTagIsMC) { LOGF(info, "slicing tag jet collection by MC collision"); - } - else { + } else { LOGF(info, "not slicing tag jet collection by MC collision"); } const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); From d560825811166ee5aabccac03f07446547e9b90e Mon Sep 17 00:00:00 2001 From: Jochen Klein Date: Fri, 21 Apr 2023 17:55:35 +0200 Subject: [PATCH 11/12] Update --- PWGJE/TableProducer/CMakeLists.txt | 5 ++- .../{jetmatchinghf.cxx => jetmatching.cxx} | 40 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) rename PWGJE/TableProducer/{jetmatchinghf.cxx => jetmatching.cxx} (83%) diff --git a/PWGJE/TableProducer/CMakeLists.txt b/PWGJE/TableProducer/CMakeLists.txt index b1d10dcbada..60ea2f654a6 100644 --- a/PWGJE/TableProducer/CMakeLists.txt +++ b/PWGJE/TableProducer/CMakeLists.txt @@ -31,12 +31,13 @@ o2physics_add_dpl_workflow(jet-skimmer PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(jet-matching-hf - SOURCES jetmatchinghf.cxx +o2physics_add_dpl_workflow(jet-matching + SOURCES jetmatching.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) endif() + o2physics_add_dpl_workflow(emcal-correction-task SOURCES emcalCorrectionTask.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::EMCALBase O2::EMCALReconstruction diff --git a/PWGJE/TableProducer/jetmatchinghf.cxx b/PWGJE/TableProducer/jetmatching.cxx similarity index 83% rename from PWGJE/TableProducer/jetmatchinghf.cxx rename to PWGJE/TableProducer/jetmatching.cxx index c1bfece835a..5622ff39afb 100644 --- a/PWGJE/TableProducer/jetmatchinghf.cxx +++ b/PWGJE/TableProducer/jetmatching.cxx @@ -9,9 +9,12 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file jetmatchinghf.cxx -/// \brief Match jets containing the same D0s +/// \file jetmatching.cxx +/// \brief Unified implementation of jet matching based on different criteria +/// expanding on previously separate implementations of geometric matching +/// (by Raymond Ehlers) and heavy-flavour matching /// +/// \author Raymond Ehlers , ORNL /// \author Jochen Klein #include "Framework/AnalysisTask.h" @@ -39,8 +42,9 @@ struct JetMatchingHF { Produces jetsTagToBase; // preslicing jet collections, only for MC-based collection - // Preslice baseJetsPerCollision = aod::jet::mcCollisionId; - Preslice tagJetsPerCollision = aod::jet::mcCollisionId; + + Preslice baseJetsPerCollision = []{ if constexpr (o2::soa::relatedByIndex()) return aod::jet::mcCollisionId; else return aod::jet::collisionId; }(); + Preslice tagJetsPerCollision = []{ if constexpr (o2::soa::relatedByIndex()) return aod::jet::mcCollisionId; else return aod::jet::collisionId; }(); using Collisions = soa::Join; using Tracks = soa::Join; @@ -55,25 +59,19 @@ struct JetMatchingHF { Tracks const& tracks, McParticles const& particlesMC, HfCandidates const& hfcandidates) { - // slicing base jets, only for MC-based collection - auto jetsBasePerColl = jetsBase; - constexpr bool jetsBaseIsMC = o2::soa::is_binding_compatible_v>(); - if constexpr (jetsBaseIsMC) { - LOGF(info, "slicing base jet collection by MC collision"); - } else { - LOGF(info, "not slicing base jet collection by MC collision"); - } - // jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.mcCollisionId()); + constexpr bool jetsBaseIsMC = o2::soa::relatedByIndex(); + constexpr bool jetsTagIsMC = o2::soa::relatedByIndex(); - // slicing tag jets, only for MC-based collection - constexpr bool jetsTagIsMC = o2::soa::is_binding_compatible_v>(); + // slicing jets if MC collection // decltype(jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId())) jetsTagPerColl; - if (jetsTagIsMC) { - LOGF(info, "slicing tag jet collection by MC collision"); - } else { - LOGF(info, "not slicing tag jet collection by MC collision"); - } - const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); + // std::remove_const::type jetsTagPerColl; + // const auto jetsTagPerColl = jetsTag; + // auto jetsTagPerColl = [&] -> TagJetCollection const& { if (jetsTagIsMC) return jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); else return jetsTag; }(); + // if (jetsTagIsMC) jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()); + // const auto jetsTagPerColl = jetsTagIsMC ? const jetsTag.sliceBy(tagJetsPerCollision, collision.mcCollisionId()) : jetsTag; + + const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, jetsBaseIsMC ? collision.mcCollisionId() : collision.globalIndex()); + const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, jetsTagIsMC ? collision.mcCollisionId() : collision.globalIndex()); // geometric matching std::vector jetsBasePhi(jetsBase.size()); From 1f65a1ce49448de1007defca4b3203e0b81e1b57 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 21 Apr 2023 15:56:05 +0000 Subject: [PATCH 12/12] Please consider the following formatting changes --- PWGJE/TableProducer/jetmatching.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGJE/TableProducer/jetmatching.cxx b/PWGJE/TableProducer/jetmatching.cxx index 5622ff39afb..43181efefea 100644 --- a/PWGJE/TableProducer/jetmatching.cxx +++ b/PWGJE/TableProducer/jetmatching.cxx @@ -11,7 +11,7 @@ /// \file jetmatching.cxx /// \brief Unified implementation of jet matching based on different criteria -/// expanding on previously separate implementations of geometric matching +/// expanding on previously separate implementations of geometric matching /// (by Raymond Ehlers) and heavy-flavour matching /// /// \author Raymond Ehlers , ORNL @@ -43,8 +43,8 @@ struct JetMatchingHF { // preslicing jet collections, only for MC-based collection - Preslice baseJetsPerCollision = []{ if constexpr (o2::soa::relatedByIndex()) return aod::jet::mcCollisionId; else return aod::jet::collisionId; }(); - Preslice tagJetsPerCollision = []{ if constexpr (o2::soa::relatedByIndex()) return aod::jet::mcCollisionId; else return aod::jet::collisionId; }(); + Preslice baseJetsPerCollision = [] { if constexpr (o2::soa::relatedByIndex()) return aod::jet::mcCollisionId; else return aod::jet::collisionId; }(); + Preslice tagJetsPerCollision = [] { if constexpr (o2::soa::relatedByIndex()) return aod::jet::mcCollisionId; else return aod::jet::collisionId; }(); using Collisions = soa::Join; using Tracks = soa::Join;