Skip to content

Commit 88b57fa

Browse files
authored
Refactor collision index handling in diffWakeTreeProducer
Ci is added, because the produced tree is used out of an O2 analysis framework (bare root) and a direct correspondence between collisions and tracks is needed
1 parent 0ed3576 commit 88b57fa

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

PWGJE/TableProducer/diffWakeTreeProducer.cxx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@
2222
#include "Common/DataModel/TrackSelectionTables.h"
2323

2424
#include <Framework/ASoA.h>
25-
#include <Framework/AnalysisDataModel.h>
2625
#include <Framework/AnalysisHelpers.h>
2726
#include <Framework/AnalysisTask.h>
2827
#include <Framework/HistogramRegistry.h>
2928
#include <Framework/HistogramSpec.h>
3029
#include <Framework/InitContext.h>
31-
#include <Framework/OutputObjHeader.h>
3230
#include <Framework/runDataProcessing.h>
3331

3432
// Event selection: Only events that contain track above some threshold
@@ -67,7 +65,7 @@ namespace o2::aod
6765
namespace testcol
6866
{
6967
// Event properties
70-
// DECLARE_SOA_COLUMN(Gi, gi, int64_t);
68+
DECLARE_SOA_COLUMN(Ci, ci, int64_t); // Collision index - needed because is used as tree
7169
DECLARE_SOA_COLUMN(Rn, rn, int32_t); // run number
7270
DECLARE_SOA_COLUMN(Cent, cent, float); // FT0C centrality
7371
DECLARE_SOA_COLUMN(Mult, mult, int32_t); // TPC multiplicity
@@ -82,6 +80,7 @@ DECLARE_SOA_COLUMN(Psi3, psi3, int16_t);
8280

8381
DECLARE_SOA_TABLE(TableCols, "AOD", "TABLECOL",
8482
o2::soa::Index<>,
83+
testcol::Ci,
8584
testcol::Rn,
8685
testcol::Cent,
8786
testcol::Mult,
@@ -99,6 +98,7 @@ namespace testtrack
9998

10099
// Track properties
101100
DECLARE_SOA_INDEX_COLUMN(TableCol, tableCol);
101+
DECLARE_SOA_COLUMN(Ci, ci, int64_t); // is needed to link to collision when used as tree
102102
DECLARE_SOA_COLUMN(Charge, charge, int16_t);
103103
DECLARE_SOA_COLUMN(P, p, uint64_t);
104104
DECLARE_SOA_COLUMN(Dedx, dedx, uint16_t);
@@ -109,6 +109,7 @@ DECLARE_SOA_COLUMN(Dcaz, dcaz, int16_t);
109109
DECLARE_SOA_TABLE(TableTrack, "AOD", "TABLETRACK",
110110
o2::soa::Index<>,
111111
testtrack::TableColId,
112+
testtrack::Ci,
112113
testtrack::Charge,
113114
testtrack::P,
114115
testtrack::Dedx,
@@ -196,7 +197,8 @@ struct DiffWakeTreeProducer {
196197
int16_t substituteEp2 = static_cast<int16_t>(ep2 * 1000);
197198
int16_t substituteEp3 = static_cast<int16_t>(ep3 * 1000);
198199

199-
testcol(run,
200+
testcol(collisionCounter,
201+
run,
200202
col.centFT0C(),
201203
col.multTPC(),
202204
col.trackOccupancyInTimeRange(),
@@ -232,27 +234,30 @@ struct DiffWakeTreeProducer {
232234

233235
int64_t particlePx = (track.px() * 6000);
234236
if (particlePx < 0)
237+
{
235238
substituteP |= static_cast<uint64_t>(1) << uppermostBit;
236-
if (particlePx < 0)
237239
particlePx = (-1) * particlePx;
240+
}
238241
substituteP |= (particlePx & bitmask20Bits) << lowermostBit;
239242

240243
uppermostBit = 41;
241244
lowermostBit = 21;
242245
int64_t particlePy = (track.py() * 6000);
243246
if (particlePy < 0)
247+
{
244248
substituteP |= static_cast<uint64_t>(1) << uppermostBit;
245-
if (particlePy < 0)
246249
particlePy = (-1) * particlePy;
250+
}
247251
substituteP |= (particlePy & bitmask20Bits) << lowermostBit;
248252

249253
uppermostBit = 62;
250254
lowermostBit = 42;
251255
int64_t particlePz = (track.pz() * 6000);
252256
if (particlePz < 0)
257+
{
253258
substituteP |= static_cast<uint64_t>(1) << uppermostBit;
254-
if (particlePz < 0)
255259
particlePz = (-1) * particlePz;
260+
}
256261
substituteP |= (particlePz & bitmask20Bits) << lowermostBit;
257262

258263
// dEdx
@@ -263,7 +268,8 @@ struct DiffWakeTreeProducer {
263268
int16_t substituteDCAZ = static_cast<int16_t>(track.dcaZ() * 100);
264269

265270
//--------------- Fill track table ------------------
266-
testtrack(collisionCounter,
271+
testtrack(testcol.lastIndex(),
272+
collisionCounter,
267273
track.sign(),
268274
substituteP,
269275
substituteDEDX,

0 commit comments

Comments
 (0)