@@ -60,8 +60,26 @@ DECLARE_SOA_COLUMN(D0CollisionIdx, d0CollisionIdx, int);
6060DECLARE_SOA_COLUMN (D0Reflection, d0Reflection, int );
6161} // namespace d0s
6262
63+ namespace jets
64+ {
65+ // Jet
66+ DECLARE_SOA_COLUMN (JetPt, jetPt, float );
67+ DECLARE_SOA_COLUMN (JetEta, jetEta, float );
68+ DECLARE_SOA_COLUMN (JetPhi, jetPhi, float );
69+ DECLARE_SOA_COLUMN (CollID, jetCollID, int );
70+ // D0-jet
71+ DECLARE_SOA_COLUMN (D0JetDeltaPhi, d0JetDeltaPhi, float );
72+ } // namespace jets
73+
74+ DECLARE_SOA_TABLE (CollisionTables, " AOD" , " COLLISIONINFOTABLE" ,
75+ o2::soa::Index<>,
76+ collision::PosZ);
77+
78+ DECLARE_SOA_INDEX_COLUMN (CollisionTable, collisionTable);
79+
6380DECLARE_SOA_TABLE (D0DataTables, " AOD" , " D0DATATABLE" ,
64- d0s::D0CollisionIdx,
81+ o2::soa::Index<>,
82+ CollisionTableId,
6583 d0s::D0PromptBDT,
6684 d0s::D0NonPromptBDT,
6785 d0s::D0BkgBDT,
@@ -71,56 +89,48 @@ DECLARE_SOA_TABLE(D0DataTables, "AOD", "D0DATATABLE",
7189 d0s::D0Phi);
7290
7391DECLARE_SOA_TABLE (D0McPTables, " AOD" , " D0MCPARTICLELEVELTABLE" ,
74- d0s::D0CollisionIdx,
92+ o2::soa::Index<>,
93+ CollisionTableId,
7594 d0s::D0McOrigin,
7695 d0s::D0Pt,
7796 d0s::D0Eta,
7897 d0s::D0Phi);
7998
8099DECLARE_SOA_TABLE (D0McMatchedTables, " AOD" , " D0MCMATCHEDTABLE" ,
81- d0s::D0CollisionIdx,
100+ o2::soa::Index<>,
101+ CollisionTableId,
82102 d0s::D0Pt,
83103 d0s::D0Eta,
84104 d0s::D0Phi,
85105 d0s::D0McOrigin,
86106 d0s::D0Reflection);
87107
88- namespace jets
89- {
90- // Jet
91108DECLARE_SOA_INDEX_COLUMN (D0DataTable, d0Data);
92109DECLARE_SOA_INDEX_COLUMN (D0McPTable, d0MCP);
93110DECLARE_SOA_INDEX_COLUMN (D0McMatchedTable, d0MCMatched);
94- DECLARE_SOA_COLUMN (JetPt, jetPt, float );
95- DECLARE_SOA_COLUMN (JetEta, jetEta, float );
96- DECLARE_SOA_COLUMN (JetPhi, jetPhi, float );
97- DECLARE_SOA_COLUMN (CollID, jetCollID, int );
98- // D0-jet
99- DECLARE_SOA_COLUMN (D0JetDeltaPhi, d0JetDeltaPhi, float );
100- } // namespace jets
101111
102112DECLARE_SOA_TABLE_STAGED (JetDataTables, " JETDATATABLE" ,
103113 o2::soa::Index<>,
104- jets::D0DataTableId ,
105- jets::CollID, // change to index column
114+ CollisionTableId ,
115+ D0DataTableId,
106116 jets::JetPt,
107117 jets::JetEta,
108118 jets::JetPhi,
109119 jets::D0JetDeltaPhi);
110120
111121DECLARE_SOA_TABLE_STAGED (JetMCPTables, " JETMCPARTICLELEVELTABLE" ,
112122 o2::soa::Index<>,
113- jets::D0McPTableId ,
114- jets::CollID, // change to index column
123+ CollisionTableId ,
124+ D0McPTableId,
115125 jets::JetPt,
116126 jets::JetEta,
117127 jets::JetPhi,
118128 jets::D0JetDeltaPhi);
119129
120130DECLARE_SOA_TABLE_STAGED (JetMCMatchedTables, " JETMCMATCHEDTABLE" ,
121131 o2::soa::Index<>,
122- jets::D0McMatchedTableId ,
123- jets::CollID, // change to index column
132+ CollisionTableId ,
133+ D0McMatchedTableId,
124134 jets::JetPt,
125135 jets::JetEta,
126136 jets::JetPhi,
@@ -129,6 +139,7 @@ DECLARE_SOA_TABLE_STAGED(JetMCMatchedTables, "JETMCMATCHEDTABLE",
129139
130140struct JetCorrelationD0 {
131141 // Define new table
142+ Produces<aod::CollisionTables> tableCollision;
132143 Produces<aod::D0DataTables> tableD0;
133144 Produces<aod::D0McPTables> tableD0MCParticle;
134145 Produces<aod::D0McMatchedTables> tableD0MCMatched;
@@ -261,11 +272,12 @@ struct JetCorrelationD0 {
261272 soa::Join<aod::ChargedJets, aod::ChargedJetConstituents> const & jets)
262273 {
263274 applyCollisionSelections (collision, eventSelectionBits);
275+ tableCollision (collision.posZ ());
276+
264277 for (const auto & d0DataCandidate : d0DataCandidates) {
265278 const auto scores = d0DataCandidate.mlScores ();
266279 fillD0Histograms (d0DataCandidate, scores);
267- const auto collIdx = collision.globalIndex ();
268- tableD0 (collIdx,
280+ tableD0 (tableCollision.lastIndex (),
269281 scores[2 ],
270282 scores[1 ],
271283 scores[0 ],
@@ -277,8 +289,8 @@ struct JetCorrelationD0 {
277289 for (const auto & jet : jets) {
278290 float dphi = RecoDecay::constrainAngle (jet.phi () - d0DataCandidate.phi ());
279291 fillJetHistograms (jet, dphi);
280- tableJet (tableD0 .lastIndex (),
281- jet. collisionId (),
292+ tableJet (tableCollision .lastIndex (),
293+ tableD0. lastIndex (),
282294 jet.pt (),
283295 jet.eta (),
284296 jet.phi (),
@@ -300,10 +312,11 @@ struct JetCorrelationD0 {
300312 registry.fill (HIST (" hCollisions" ), 1.5 ); // Selected collisions
301313 registry.fill (HIST (" hZvtxSelected" ), collision.posZ ());
302314
303- const auto collIdx = collision.globalIndex ();
315+ applyCollisionSelections (collision, eventSelectionBits);
316+ tableCollision (collision.posZ ());
304317
305318 for (const auto & d0MCPCandidate : d0MCPCandidates) {
306- tableD0MCParticle (collIdx ,
319+ tableD0MCParticle (tableCollision. lastIndex () ,
307320 d0MCPCandidate.originMcGen (),
308321 d0MCPCandidate.pt (),
309322 d0MCPCandidate.eta (),
@@ -312,8 +325,8 @@ struct JetCorrelationD0 {
312325 for (const auto & jet : jets) {
313326 float dphi = RecoDecay::constrainAngle (jet.phi () - d0MCPCandidate.phi ());
314327 fillJetHistograms (jet, dphi);
315- tableJetMCParticle (tableD0MCParticle .lastIndex (),
316- collIdx, // check collIdx equals collIdx
328+ tableJetMCParticle (tableCollision .lastIndex (),
329+ tableD0MCParticle. lastIndex (),
317330 jet.pt (),
318331 jet.eta (),
319332 jet.phi (),
@@ -338,7 +351,7 @@ struct JetCorrelationD0 {
338351
339352 for (const auto & d0MCDCandidate : d0MCDCandidates) {
340353 // Loop over d0 detector level candidates, apply d0 matching logic, fill d0 particle level that has been matched;
341- // Loop over jet decetor level, apply jet matching logic (jet finder QA task), fill jet particle level that has been matched.
354+ // Loop over jet detector level, apply jet matching logic (similar to jet finder QA task), fill jet particle level that has been matched.
342355
343356 // D or D bar?
344357 int matchedFrom = 0 ;
0 commit comments