@@ -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