Skip to content

Commit 557052e

Browse files
author
Lucia Anna Tarasovicova
committed
Adjusments in the Tracking Translator to the updated actso2 output
1 parent 95f0c85 commit 557052e

3 files changed

Lines changed: 100 additions & 43 deletions

File tree

‎ALICE3/DataModel/tracksAlice3.h‎

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace o2::aod
2626
{
2727
namespace track_alice3
2828
{
29+
<<<<<<< Updated upstream
2930
DECLARE_SOA_COLUMN(IsReconstructed, isReconstructed, bool); //! is reconstructed or not
3031
DECLARE_SOA_COLUMN(NSiliconHits, nSiliconHits, int); //! number of silicon hits
3132
DECLARE_SOA_COLUMN(NTPCHits, nTPCHits, int); //! number of tpc hits
@@ -34,6 +35,19 @@ DECLARE_SOA_COLUMN(TrackType, trackType, int); //! Type of the trac
3435
DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Has track contributed to the PV fit?
3536
DECLARE_SOA_COLUMN(TrackIU, trackIU, float); //! Innermost update: radius (cm) of the innermost hit assigned to the track
3637
DECLARE_SOA_COLUMN(TrackOU, trackOU, float); //! Outermost update: radius (cm) of the outermost hit assigned to the track
38+
=======
39+
DECLARE_SOA_COLUMN(IsReconstructed, isReconstructed, bool); //! is reconstructed or not
40+
DECLARE_SOA_COLUMN(NSiliconHits, nSiliconHits, int); //! number of silicon hits
41+
DECLARE_SOA_COLUMN(NTPCHits, nTPCHits, int); //! number of tpc hits
42+
DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); //! PDG code of the linked truth MC particle
43+
DECLARE_SOA_COLUMN(TrackType, trackType, int); //! Type of the track
44+
DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Has track contributed to the PV fit?
45+
DECLARE_SOA_COLUMN(SecondaryVertexRadius, secondaryVertexRadius, float); //! Radius of the secondary vertex associated with the track
46+
DECLARE_SOA_COLUMN(SecondaryVertexX, secondaryVertexX, float); //! X position of the secondary vertex associated with the track
47+
DECLARE_SOA_COLUMN(SecondaryVertexY, secondaryVertexY, float); //! Y position of the secondary vertex associated with the track
48+
DECLARE_SOA_COLUMN(SecondaryVertexZ, secondaryVertexZ, float); //! Z position of the secondary vertex associated with the track
49+
50+
>>>>>>> Stashed changes
3751
} // namespace track_alice3
3852
DECLARE_SOA_TABLE(TracksAlice3, "AOD", "TRACKSALICE3",
3953
track_alice3::IsReconstructed,
@@ -45,23 +59,40 @@ DECLARE_SOA_TABLE(TracksAlice3Pdg, "AOD", "TRACKSALICE3PDG",
4559
track_alice3::PdgCode);
4660
using TrackAlice3Pdg = TracksAlice3Pdg::iterator;
4761

48-
DECLARE_SOA_TABLE(TracksExtraA3, "AOD", "TracksExtraA3",
62+
DECLARE_SOA_TABLE(TracksExtraA3_000, "AOD", "TracksExtraA3",
4963
track_alice3::NSiliconHits,
5064
track_alice3::NTPCHits,
5165
track_alice3::TrackType,
5266
track_alice3::IsPVContributor);
67+
DECLARE_SOA_TABLE_VERSIONED(TracksExtraA3_001, "AOD", "TracksExtraA3", 1,
68+
track_alice3::NSiliconHits,
69+
track_alice3::NTPCHits,
70+
track_alice3::TrackType,
71+
track_alice3::IsPVContributor,
72+
track_alice3::SecondaryVertexRadius,
73+
track_alice3::SecondaryVertexX,
74+
track_alice3::SecondaryVertexY,
75+
track_alice3::SecondaryVertexZ);
76+
using TracksExtraA3 = TracksExtraA3_001;
5377
using TrackExtraA3 = TracksExtraA3::iterator;
54-
5578
namespace mcparticle_alice3
5679
{
80+
<<<<<<< Updated upstream
5781
DECLARE_SOA_COLUMN(NHits, nHits, int); //! number of silicon hits
5882
DECLARE_SOA_COLUMN(Charge, charge, float); //! particle charge
5983
DECLARE_SOA_COLUMN(DecayRadius, decayRadius, float); //! Radius for decayed particle produced by decayer (-1 if not decayed)
6084
DECLARE_SOA_BITMAP_COLUMN(DecayerBits, decayerBits, 8); //! Bit mask for particle produced by the OTF decayer
85+
=======
86+
DECLARE_SOA_COLUMN(NHits, nHits, int); //! number of silicon hits
87+
DECLARE_SOA_COLUMN(Charge, charge, float); //! particle charge
88+
DECLARE_SOA_BITMAP_COLUMN(DecayerBits, decayerBits, 8); //! Bit mask for particle produced by the OTF decayer
89+
DECLARE_SOA_COLUMN(SecondaryVertexRadius, secondaryVertexRadius, float); //! Radius of the secondary vertex associated with the track
90+
>>>>>>> Stashed changes
6191
} // namespace mcparticle_alice3
6292
DECLARE_SOA_TABLE(MCParticlesExtraA3, "AOD", "MCParticlesExtraA3",
6393
mcparticle_alice3::NHits,
64-
mcparticle_alice3::Charge);
94+
mcparticle_alice3::Charge,
95+
mcparticle_alice3::SecondaryVertexRadius);
6596
using MCParticleExtraA3 = MCParticlesExtraA3::iterator;
6697

6798
DECLARE_SOA_TABLE(OTFParticleExtras, "AOD", "OTFPARTICLEEXTRA",

‎ALICE3/TableProducer/OTF/onTheFlyTracker.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ struct OnTheFlyTracker {
18171817
trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(),
18181818
trackParCov.getSigma1Pt2());
18191819
tableMcTrackLabels(trackParCov.mcLabel, 0);
1820-
tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits, trackParCov.trackType, trackParCov.isPVContributor);
1820+
tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits, trackParCov.trackType, trackParCov.isPVContributor, -1, -1, -1, -1);
18211821

18221822
// populate extra tables if required to do so
18231823
if (populateTracksExtra) {

‎ALICE3/TableProducer/alice3TrackingTranslator.cxx‎

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ struct Alice3TrackingTranslator {
239239
SETADDRESS("ePY_fit", m_ePY_fit);
240240
SETADDRESS("ePZ_fit", m_ePZ_fit);
241241
SETADDRESS("cov_eX_eX", m_cov_eX_eX);
242-
// SETADDRESS("cov_eY_eY", m_cov_eY_eY);
242+
SETADDRESS("cov_eY_eY", m_cov_eY_eY);
243243
SETADDRESS("cov_eZ_eZ", m_cov_eZ_eZ);
244244
SETADDRESS("cov_ePX_ePX", m_cov_ePX_ePX);
245245
SETADDRESS("cov_ePY_ePY", m_cov_ePY_ePY);
@@ -278,8 +278,8 @@ struct Alice3TrackingTranslator {
278278
std::vector<float>* m_ePZ_fit = nullptr; // global momentum pz
279279

280280
// covariance matrices for fitted track parameters (if available)
281-
std::vector<float>* m_cov_eX_eX = nullptr; // covariance of global position x
282-
// std::vector<float>* m_cov_eY_eY = nullptr; // covariance of global position y
281+
std::vector<float>* m_cov_eX_eX = nullptr; // covariance of global position x
282+
std::vector<float>* m_cov_eY_eY = nullptr; // covariance of global position y
283283
std::vector<float>* m_cov_eZ_eZ = nullptr; // covariance of global position z
284284
std::vector<float>* m_cov_ePX_ePX = nullptr; // covariance of global momentum px
285285
std::vector<float>* m_cov_ePY_ePY = nullptr; // covariance of global momentum py
@@ -326,7 +326,7 @@ struct Alice3TrackingTranslator {
326326
}
327327
std::vector<unsigned int>* barcode = nullptr;
328328
};
329-
void addMCParticle(int collIndex, ParticleStruct& fileParticles, int iParticle, uint8_t flags, int firstMother, int firstDaughter, int secondDaughter, int numberOfHits)
329+
void addMCParticle(int collIndex, ParticleStruct& fileParticles, int iParticle, uint8_t flags, int firstMother, int firstDaughter, int secondDaughter, int numberOfHits, float secondaryVertexRadius)
330330
{
331331
int mothers[2] = {firstMother, firstMother};
332332
int daughters[2] = {firstDaughter, secondDaughter};
@@ -341,12 +341,13 @@ struct Alice3TrackingTranslator {
341341
fileParticles.m_py->at(iParticle), // m_py
342342
fileParticles.m_pz->at(iParticle), // m_pz
343343
std::hypot(fileParticles.m_p->at(iParticle), fileParticles.m_m->at(iParticle)), // e
344-
fileParticles.m_vx->at(iParticle), // m_vx
345-
fileParticles.m_vy->at(iParticle), // m_vy
346-
fileParticles.m_vz->at(iParticle), // m_vz
347-
fileParticles.m_vt->at(iParticle)); // m_vt
344+
fileParticles.m_vx->at(iParticle) * 0.1, // m_vx
345+
fileParticles.m_vy->at(iParticle) * 0.1, // m_vy
346+
fileParticles.m_vz->at(iParticle) * 0.1, // m_vz
347+
fileParticles.m_vt->at(iParticle) * 0.1); // m_vt
348348
tableMCParticlesExtraA3(numberOfHits, // number_of_hits
349-
fileParticles.m_q->at(iParticle)); // charge
349+
fileParticles.m_q->at(iParticle), // charge
350+
secondaryVertexRadius); // secondary_vertex_radius
350351
};
351352

352353
void process(o2::aod::BCs const&)
@@ -426,11 +427,13 @@ struct Alice3TrackingTranslator {
426427

427428
// barcode -> global AO2D index (used later for track labels)
428429
std::map<Key, int> barcodeToGlobalIdx;
429-
std::map<Key, std::vector<float>> barcodeToVertexPosition;
430+
std::map<int, std::vector<float>> globalToVertexPosition;
430431
std::map<int, int> GlobalIdxToMotherIdx;
432+
std::map<int, int> GlobalIdxSecVertexRadiusIncoming;
431433
std::map<int, int> GlobalIdxToPDGCode;
432434
std::map<int, int> GlobalToLocalIdx;
433435
std::map<int, std::vector<int>> GlobalIdxToDaughterIdxs;
436+
434437
for (size_t iPart = 0; iPart < nParticlesSim; ++iPart) {
435438
Key key = keyOf(
436439
fileParticlesSim.m_vertex_primary->at(iPart),
@@ -465,19 +468,20 @@ struct Alice3TrackingTranslator {
465468
auto iteratorMother = barcodeToGlobalIdx.find(kd);
466469
if (iteratorMother != barcodeToGlobalIdx.end()) {
467470
int motherIdx = iteratorMother->second;
471+
GlobalIdxSecVertexRadiusIncoming[motherIdx] = std::hypot(fileVertices.m_x->at(j) * 0.1, fileVertices.m_y->at(j) * 0.1);
468472
for (size_t d2 = 0; d2 < (*fileVertices.m_outgoing_particles_vertex_secondary)[j].size(); ++d2) {
469473
Key kd2 = keyOf(
470474
(*fileVertices.m_outgoing_particles_vertex_primary)[j][d2],
471475
(*fileVertices.m_outgoing_particles_vertex_secondary)[j][d2],
472476
(*fileVertices.m_outgoing_particles_particle)[j][d2],
473477
(*fileVertices.m_outgoing_particles_generation)[j][d2],
474478
(*fileVertices.m_outgoing_particles_sub_particle)[j][d2]);
475-
barcodeToVertexPosition[kd2].push_back(fileVertices.m_x->at(j));
476-
barcodeToVertexPosition[kd2].push_back(fileVertices.m_y->at(j));
477-
barcodeToVertexPosition[kd2].push_back(fileVertices.m_z->at(j));
478479
auto iteratorDaughter = barcodeToGlobalIdx.find(kd2);
479480
if (iteratorDaughter != barcodeToGlobalIdx.end()) {
480481
int daughterIdx = iteratorDaughter->second;
482+
globalToVertexPosition[daughterIdx].push_back(fileVertices.m_x->at(j));
483+
globalToVertexPosition[daughterIdx].push_back(fileVertices.m_y->at(j));
484+
globalToVertexPosition[daughterIdx].push_back(fileVertices.m_z->at(j));
481485
GlobalIdxToMotherIdx[daughterIdx] = motherIdx;
482486
GlobalIdxToDaughterIdxs[motherIdx].push_back(daughterIdx);
483487
}
@@ -486,7 +490,8 @@ struct Alice3TrackingTranslator {
486490
}
487491
}
488492
for (size_t iPart = 0; iPart < nParticlesSim; ++iPart) {
489-
int globalIdx = firstIdxThisEvent + static_cast<int>(iPart);
493+
float secondaryVertexRadius = -1.0f;
494+
int globalIdx = firstIdxThisEvent + (int)iPart;
490495
int motherIdx = -1;
491496
if (GlobalIdxToMotherIdx.find(globalIdx) != GlobalIdxToMotherIdx.end()) {
492497
motherIdx = GlobalIdxToMotherIdx[globalIdx];
@@ -501,6 +506,13 @@ struct Alice3TrackingTranslator {
501506
if (daughters.size() > 1) {
502507
secondDaughter = daughters[1];
503508
}
509+
if (globalToVertexPosition.find(globalIdx) != globalToVertexPosition.end()) {
510+
const auto& vertexPos = globalToVertexPosition[globalIdx];
511+
secondaryVertexRadius = std::hypot(vertexPos[0] * 0.1, vertexPos[1] * 0.1);
512+
}
513+
if (secondaryVertexRadius == -1) {
514+
secondaryVertexRadius = GlobalIdxSecVertexRadiusIncoming[globalIdx];
515+
}
504516
}
505517
// Determine flags for the MC particle
506518
// TODO: For now primary are only those without mother, but all based on PhysicalPrimary definition should be considered.
@@ -513,24 +525,24 @@ struct Alice3TrackingTranslator {
513525
}
514526
GlobalIdxToPDGCode[globalIdx] = fileParticlesSim.m_particle_type->at(iPart);
515527
GlobalToLocalIdx[globalIdx] = iPart;
516-
addMCParticle(tableMcCollisions.lastIndex(), fileParticlesSim, iPart, flags, motherIdx, firstDaughter, secondDaughter, fileParticlesSim.m_number_of_hits->at(iPart));
528+
addMCParticle(tableMcCollisions.lastIndex(), fileParticlesSim, iPart, flags, motherIdx, firstDaughter, secondDaughter, fileParticlesSim.m_number_of_hits->at(iPart), secondaryVertexRadius);
517529
}
518-
519-
tableCollisions(0, // bcId
520-
collisionX, // posX
521-
collisionY, // posY
522-
collisionZ, // posZ
523-
0.0f, // covXX
524-
0.0f, // covXY
525-
0.0f, // covXZ
526-
0.0f, // covYY
527-
0.0f, // covYZ
528-
0.0f, // covZZ
529-
0, // flags
530-
0.0f, // m_chi2Sum
531-
0, // numContrib
532-
0.0f, // collisionTime
533-
0.0f); // collisionTimeRes
530+
const float scale = 0.1f;
531+
tableCollisions(0, // bcId
532+
collisionX * scale, // posX
533+
collisionY * scale, // posY
534+
collisionZ * scale, // posZ
535+
0.0f, // covXX
536+
0.0f, // covXY
537+
0.0f, // covXZ
538+
0.0f, // covYY
539+
0.0f, // covYZ
540+
0.0f, // covZZ
541+
0, // flags
542+
0.0f, // m_chi2Sum
543+
0, // numContrib
544+
0.0f, // collisionTime
545+
0.0f); // collisionTimeRes
534546

535547
tableMcCollisionLabels(iEvent, // mcCollisionId
536548
0); // mcMask
@@ -585,7 +597,7 @@ struct Alice3TrackingTranslator {
585597

586598
// Fill covariance matrices
587599
float cxx = fileTracksummary.m_cov_eX_eX->at(iTrack);
588-
float cyy = cxx; // fileTracksummary.cov_eY_eY->at(iTrack);
600+
float cyy = fileTracksummary.m_cov_eY_eY->at(iTrack);
589601
float czz = fileTracksummary.m_cov_eZ_eZ->at(iTrack);
590602
float cxy = fileTracksummary.m_cov_eX_eY->at(iTrack);
591603
float cxz = fileTracksummary.m_cov_eX_eZ->at(iTrack);
@@ -606,7 +618,8 @@ struct Alice3TrackingTranslator {
606618
float czpy = fileTracksummary.m_cov_eZ_ePY->at(iTrack);
607619
float czpz = fileTracksummary.m_cov_eZ_ePZ->at(iTrack);
608620
// Create TrackParCov object with covariance matrix
609-
std::array<float, 3> position = {x, y, z};
621+
622+
std::array<float, 3> position = {x * scale, y * scale, z * scale};
610623
std::array<float, 3> momentum = {px, py, pz};
611624
std::array<float, 21> trackCov = {cxx, cxy, cyy, cxz, cyz, czz, cxpx, cypx, czpx, cpxpx, cxpy, cypy, czpy, cpxpy, cpypy, cxpz, cypz, czpz, cpxpz, cpypz, cpzpz};
612625
o2::track::TrackParCov trackParCov(position, momentum, trackCov, charge);
@@ -669,15 +682,28 @@ struct Alice3TrackingTranslator {
669682
tableTracksAlice3(true, // isReconstructed
670683
-1.f, // todo: track innermost update
671684
-1.f); // todo: track outermost update
672-
if (mcParticleIdx > 0)
685+
if (mcParticleIdx > 0) {
673686
tableTracksAlice3Pdg(GlobalIdxToPDGCode[mcParticleIdx]); // PdgCode to the linked MC truth particle
674-
else
687+
} else {
675688
tableTracksAlice3Pdg(0); // No linked MC truth particle
689+
}
676690

677-
tableTracksExtraA3(m_nMeasurements, // nSiliconHits (using m_nMeasurements as proxy)
678-
0, // nTPCHits
679-
0, // trackType
680-
false); // isPVContributor
691+
float secondaryVertexRadius = 0;
692+
std::array<float, 3> vertexPos = {0.0, 0.0, 0.0};
693+
if (mcParticleIdx > 0) {
694+
vertexPos[0] = fileParticlesSim.m_vx->at(GlobalToLocalIdx[mcParticleIdx]) * 0.1;
695+
vertexPos[1] = fileParticlesSim.m_vy->at(GlobalToLocalIdx[mcParticleIdx]) * 0.1;
696+
vertexPos[2] = fileParticlesSim.m_vz->at(GlobalToLocalIdx[mcParticleIdx]) * 0.1;
697+
secondaryVertexRadius = std::hypot(vertexPos[0], vertexPos[1]);
698+
}
699+
tableTracksExtraA3(m_nMeasurements, // nSiliconHits (using m_nMeasurements as proxy)
700+
0, // nTPCHits
701+
0, // trackType
702+
false, // isPVContributor
703+
secondaryVertexRadius, // secondaryVertexRadius
704+
vertexPos[0],
705+
vertexPos[1],
706+
vertexPos[2]);
681707
// Fill extra track info
682708
tableStoredTracksExtra(0.f, // TPCInnerParam
683709
static_cast<uint32_t>(0), // Flags

0 commit comments

Comments
 (0)