Skip to content

Commit af75c9a

Browse files
committed
Do not reset table counters after TF, add Collision counter
1 parent a234384 commit af75c9a

2 files changed

Lines changed: 37 additions & 19 deletions

File tree

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ using MFTTracksTable = o2::soa::Table<o2::aod::fwdtrack::CollisionId,
108108
o2::aod::fwdtrack::Tgl,
109109
o2::aod::fwdtrack::Signed1Pt,
110110
o2::aod::fwdtrack::NClusters,
111-
o2::aod::fwdtrack::Chi2>;
111+
o2::aod::fwdtrack::Chi2,
112+
o2::aod::fwdtrack::TrackTime,
113+
o2::aod::fwdtrack::TrackTimeRes>;
112114

113115
using FwdTracksTable = o2::soa::Table<o2::aod::fwdtrack::CollisionId,
114116
o2::aod::fwdtrack::TrackType,
@@ -238,6 +240,12 @@ class AODProducerWorkflowDPL : public Task
238240
// unordered map connects global indices and table indices of MFT tracks
239241
std::unordered_map<GIndex, int> mGIDToTableMFTID;
240242
int mTableTrMFTID{0};
243+
// unordered map connects global indices and table indices of vertices
244+
std::unordered_map<GIndex, int> mVtxToTableCollID;
245+
int mTableCollID{0};
246+
// unordered map connects global indices and table indices of V0s (needed for cascades references)
247+
std::unordered_map<GIndex, int> mV0ToTableID;
248+
int mTableV0ID{0};
241249

242250
// zdc helper maps to avoid a number of "if" statements
243251
// when filling ZDC table

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,9 @@ void AODProducerWorkflowDPL::addToMFTTracksTable(mftTracksCursorType& mftTracksC
274274
track.getTanl(),
275275
track.getInvQPt(),
276276
track.getNumberOfPoints(),
277-
track.getTrackChi2() /*, // RS FIXME
278-
truncateFloatFraction(trackTime, mTrackTime),
279-
truncateFloatFraction(trackTimeRes, mTrackTimeError)*/
280-
);
277+
track.getTrackChi2(),
278+
truncateFloatFraction(trackTime, mTrackTime),
279+
truncateFloatFraction(trackTimeRes, mTrackTimeError));
281280
if (needBCSlice) {
282281
ambigMFTTracksCursor(0, mTableTrMFTID, bcSlice);
283282
}
@@ -839,13 +838,11 @@ void AODProducerWorkflowDPL::fillSecondaryVertices(const o2::globaltracking::Rec
839838
auto cascades = recoData.getCascades();
840839

841840
// filling v0s table
842-
std::vector<bool> v0rej(v0s.size());
843-
for (size_t i = 0; i < v0s.size(); i++) {
844-
const auto& v0 = v0s[i];
841+
for (size_t iv0 = 0; iv0 < v0s.size(); iv0++) {
842+
const auto& v0 = v0s[iv0];
845843
auto trPosID = v0.getProngID(0);
846844
auto trNegID = v0.getProngID(1);
847-
int posTableIdx = -1;
848-
int negTableIdx = -1;
845+
int posTableIdx = -1, negTableIdx = -1, collID = -1;
849846
auto item = mGIDToTableID.find(trPosID);
850847
if (item != mGIDToTableID.end()) {
851848
posTableIdx = item->second;
@@ -858,27 +855,41 @@ void AODProducerWorkflowDPL::fillSecondaryVertices(const o2::globaltracking::Rec
858855
} else {
859856
LOG(warn) << "Could not find a negative track index for prong ID " << trNegID;
860857
}
861-
if (posTableIdx != -1 and negTableIdx != -1) {
862-
v0Cursor(0, v0.getVertexID(), posTableIdx, negTableIdx);
858+
auto itemV = mVtxToTableCollID.find(v0.getVertexID());
859+
if (itemV == mVtxToTableCollID.end()) {
860+
LOG(warn) << "Could not find V0 collisionID for the vertex ID " << v0.getVertexID();
863861
} else {
864-
v0rej[i] = true;
862+
collID = itemV->second;
863+
}
864+
if (posTableIdx != -1 and negTableIdx != -1 and collID != -1) {
865+
v0Cursor(0, collID, posTableIdx, negTableIdx);
866+
mV0ToTableID[int(iv0)] = mTableV0ID++;
865867
}
866868
}
867869

868870
// filling cascades table
869871
for (auto& cascade : cascades) {
870-
if (v0rej[cascade.getV0ID()]) {
872+
auto itemV0 = mV0ToTableID.find(cascade.getV0ID());
873+
if (itemV0 == mV0ToTableID.end()) {
871874
continue;
872875
}
876+
int v0tableID = itemV0->second, bachTableIdx = -1, collID = -1;
873877
auto bachelorID = cascade.getBachelorID();
874-
int bachTableIdx = -1;
875878
auto item = mGIDToTableID.find(bachelorID);
876879
if (item != mGIDToTableID.end()) {
877880
bachTableIdx = item->second;
878881
} else {
879882
LOG(warn) << "Could not find a bachelor track index";
883+
continue;
880884
}
881-
cascadeCursor(0, cascade.getVertexID(), cascade.getV0ID(), bachTableIdx);
885+
auto itemV = mVtxToTableCollID.find(cascade.getVertexID());
886+
if (itemV != mVtxToTableCollID.end()) {
887+
collID = itemV->second;
888+
} else {
889+
LOG(warn) << "Could not find cascade collisionID for the vertex ID " << cascade.getVertexID();
890+
continue;
891+
}
892+
cascadeCursor(0, collID, v0tableID, bachTableIdx);
882893
}
883894
}
884895

@@ -1498,6 +1509,8 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
14981509
vertex.getNContributors(),
14991510
truncateFloatFraction(relInteractionTime, mCollisionPosition),
15001511
truncateFloatFraction(timeStamp.getTimeStampError() * 1E3, mCollisionPositionCov));
1512+
mVtxToTableCollID[collisionID] = mTableCollID++;
1513+
15011514
auto& trackRef = primVer2TRefs[collisionID];
15021515
// passing interaction time in [ps]
15031516
fillTrackTablesPerCollision(collisionID, globalBC, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, ambigTracksCursor,
@@ -1508,11 +1521,8 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
15081521

15091522
fillSecondaryVertices(recoData, v0sCursor, cascadesCursor);
15101523

1511-
mTableTrID = 0;
15121524
mGIDToTableID.clear();
1513-
mTableTrFwdID = 0;
15141525
mGIDToTableFwdID.clear();
1515-
mTableTrMFTID = 0;
15161526
mGIDToTableMFTID.clear();
15171527
// helper map for fast search of a corresponding class mask for a bc
15181528
std::unordered_map<uint64_t, uint64_t> bcToClassMask;

0 commit comments

Comments
 (0)