diff --git a/ALICE3/DataModel/tracksAlice3.h b/ALICE3/DataModel/tracksAlice3.h index 327d0587b64..d398267a54b 100644 --- a/ALICE3/DataModel/tracksAlice3.h +++ b/ALICE3/DataModel/tracksAlice3.h @@ -26,6 +26,7 @@ namespace o2::aod { namespace track_alice3 { +<<<<<<< Updated upstream DECLARE_SOA_COLUMN(IsReconstructed, isReconstructed, bool); //! is reconstructed or not DECLARE_SOA_COLUMN(NSiliconHits, nSiliconHits, int); //! number of silicon hits DECLARE_SOA_COLUMN(NTPCHits, nTPCHits, int); //! number of tpc hits @@ -34,6 +35,19 @@ DECLARE_SOA_COLUMN(TrackType, trackType, int); //! Type of the trac DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Has track contributed to the PV fit? DECLARE_SOA_COLUMN(TrackIU, trackIU, float); //! Innermost update: radius (cm) of the innermost hit assigned to the track DECLARE_SOA_COLUMN(TrackOU, trackOU, float); //! Outermost update: radius (cm) of the outermost hit assigned to the track +======= +DECLARE_SOA_COLUMN(IsReconstructed, isReconstructed, bool); //! is reconstructed or not +DECLARE_SOA_COLUMN(NSiliconHits, nSiliconHits, int); //! number of silicon hits +DECLARE_SOA_COLUMN(NTPCHits, nTPCHits, int); //! number of tpc hits +DECLARE_SOA_COLUMN(PdgCode, pdgCode, int); //! PDG code of the linked truth MC particle +DECLARE_SOA_COLUMN(TrackType, trackType, int); //! Type of the track +DECLARE_SOA_COLUMN(IsPVContributor, isPVContributor, bool); //! Has track contributed to the PV fit? +DECLARE_SOA_COLUMN(SecondaryVertexRadius, secondaryVertexRadius, float); //! Radius of the secondary vertex associated with the track +DECLARE_SOA_COLUMN(SecondaryVertexX, secondaryVertexX, float); //! X position of the secondary vertex associated with the track +DECLARE_SOA_COLUMN(SecondaryVertexY, secondaryVertexY, float); //! Y position of the secondary vertex associated with the track +DECLARE_SOA_COLUMN(SecondaryVertexZ, secondaryVertexZ, float); //! Z position of the secondary vertex associated with the track + +>>>>>>> Stashed changes } // namespace track_alice3 DECLARE_SOA_TABLE(TracksAlice3, "AOD", "TRACKSALICE3", track_alice3::IsReconstructed, @@ -45,23 +59,40 @@ DECLARE_SOA_TABLE(TracksAlice3Pdg, "AOD", "TRACKSALICE3PDG", track_alice3::PdgCode); using TrackAlice3Pdg = TracksAlice3Pdg::iterator; -DECLARE_SOA_TABLE(TracksExtraA3, "AOD", "TracksExtraA3", +DECLARE_SOA_TABLE(TracksExtraA3_000, "AOD", "TracksExtraA3", track_alice3::NSiliconHits, track_alice3::NTPCHits, track_alice3::TrackType, track_alice3::IsPVContributor); +DECLARE_SOA_TABLE_VERSIONED(TracksExtraA3_001, "AOD", "TracksExtraA3", 1, + track_alice3::NSiliconHits, + track_alice3::NTPCHits, + track_alice3::TrackType, + track_alice3::IsPVContributor, + track_alice3::SecondaryVertexRadius, + track_alice3::SecondaryVertexX, + track_alice3::SecondaryVertexY, + track_alice3::SecondaryVertexZ); +using TracksExtraA3 = TracksExtraA3_001; using TrackExtraA3 = TracksExtraA3::iterator; - namespace mcparticle_alice3 { +<<<<<<< Updated upstream DECLARE_SOA_COLUMN(NHits, nHits, int); //! number of silicon hits DECLARE_SOA_COLUMN(Charge, charge, float); //! particle charge DECLARE_SOA_COLUMN(DecayRadius, decayRadius, float); //! Radius for decayed particle produced by decayer (-1 if not decayed) DECLARE_SOA_BITMAP_COLUMN(DecayerBits, decayerBits, 8); //! Bit mask for particle produced by the OTF decayer +======= +DECLARE_SOA_COLUMN(NHits, nHits, int); //! number of silicon hits +DECLARE_SOA_COLUMN(Charge, charge, float); //! particle charge +DECLARE_SOA_BITMAP_COLUMN(DecayerBits, decayerBits, 8); //! Bit mask for particle produced by the OTF decayer +DECLARE_SOA_COLUMN(SecondaryVertexRadius, secondaryVertexRadius, float); //! Radius of the secondary vertex associated with the track +>>>>>>> Stashed changes } // namespace mcparticle_alice3 DECLARE_SOA_TABLE(MCParticlesExtraA3, "AOD", "MCParticlesExtraA3", mcparticle_alice3::NHits, - mcparticle_alice3::Charge); + mcparticle_alice3::Charge, + mcparticle_alice3::SecondaryVertexRadius); using MCParticleExtraA3 = MCParticlesExtraA3::iterator; DECLARE_SOA_TABLE(OTFParticleExtras, "AOD", "OTFPARTICLEEXTRA", diff --git a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx index 7e84ec9c223..f0299537531 100644 --- a/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx +++ b/ALICE3/TableProducer/OTF/onTheFlyTracker.cxx @@ -1817,7 +1817,7 @@ struct OnTheFlyTracker { trackParCov.getSigmaTgl2(), trackParCov.getSigma1PtY(), trackParCov.getSigma1PtZ(), trackParCov.getSigma1PtSnp(), trackParCov.getSigma1PtTgl(), trackParCov.getSigma1Pt2()); tableMcTrackLabels(trackParCov.mcLabel, 0); - tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits, trackParCov.trackType, trackParCov.isPVContributor); + tableTracksExtraA3(trackParCov.nSiliconHits, trackParCov.nTPCHits, trackParCov.trackType, trackParCov.isPVContributor, -1, -1, -1, -1); // populate extra tables if required to do so if (populateTracksExtra) { diff --git a/ALICE3/TableProducer/alice3TrackingTranslator.cxx b/ALICE3/TableProducer/alice3TrackingTranslator.cxx index e0e742fc9d0..ffb0a77cab5 100644 --- a/ALICE3/TableProducer/alice3TrackingTranslator.cxx +++ b/ALICE3/TableProducer/alice3TrackingTranslator.cxx @@ -239,7 +239,7 @@ struct Alice3TrackingTranslator { SETADDRESS("ePY_fit", m_ePY_fit); SETADDRESS("ePZ_fit", m_ePZ_fit); SETADDRESS("cov_eX_eX", m_cov_eX_eX); - // SETADDRESS("cov_eY_eY", m_cov_eY_eY); + SETADDRESS("cov_eY_eY", m_cov_eY_eY); SETADDRESS("cov_eZ_eZ", m_cov_eZ_eZ); SETADDRESS("cov_ePX_ePX", m_cov_ePX_ePX); SETADDRESS("cov_ePY_ePY", m_cov_ePY_ePY); @@ -278,8 +278,8 @@ struct Alice3TrackingTranslator { std::vector* m_ePZ_fit = nullptr; // global momentum pz // covariance matrices for fitted track parameters (if available) - std::vector* m_cov_eX_eX = nullptr; // covariance of global position x - // std::vector* m_cov_eY_eY = nullptr; // covariance of global position y + std::vector* m_cov_eX_eX = nullptr; // covariance of global position x + std::vector* m_cov_eY_eY = nullptr; // covariance of global position y std::vector* m_cov_eZ_eZ = nullptr; // covariance of global position z std::vector* m_cov_ePX_ePX = nullptr; // covariance of global momentum px std::vector* m_cov_ePY_ePY = nullptr; // covariance of global momentum py @@ -326,7 +326,7 @@ struct Alice3TrackingTranslator { } std::vector* barcode = nullptr; }; - void addMCParticle(int collIndex, ParticleStruct& fileParticles, int iParticle, uint8_t flags, int firstMother, int firstDaughter, int secondDaughter, int numberOfHits) + void addMCParticle(int collIndex, ParticleStruct& fileParticles, int iParticle, uint8_t flags, int firstMother, int firstDaughter, int secondDaughter, int numberOfHits, float secondaryVertexRadius) { int mothers[2] = {firstMother, firstMother}; int daughters[2] = {firstDaughter, secondDaughter}; @@ -341,12 +341,13 @@ struct Alice3TrackingTranslator { fileParticles.m_py->at(iParticle), // m_py fileParticles.m_pz->at(iParticle), // m_pz std::hypot(fileParticles.m_p->at(iParticle), fileParticles.m_m->at(iParticle)), // e - fileParticles.m_vx->at(iParticle), // m_vx - fileParticles.m_vy->at(iParticle), // m_vy - fileParticles.m_vz->at(iParticle), // m_vz - fileParticles.m_vt->at(iParticle)); // m_vt + fileParticles.m_vx->at(iParticle) * 0.1, // m_vx + fileParticles.m_vy->at(iParticle) * 0.1, // m_vy + fileParticles.m_vz->at(iParticle) * 0.1, // m_vz + fileParticles.m_vt->at(iParticle) * 0.1); // m_vt tableMCParticlesExtraA3(numberOfHits, // number_of_hits - fileParticles.m_q->at(iParticle)); // charge + fileParticles.m_q->at(iParticle), // charge + secondaryVertexRadius); // secondary_vertex_radius }; void process(o2::aod::BCs const&) @@ -426,11 +427,13 @@ struct Alice3TrackingTranslator { // barcode -> global AO2D index (used later for track labels) std::map barcodeToGlobalIdx; - std::map> barcodeToVertexPosition; + std::map> globalToVertexPosition; std::map GlobalIdxToMotherIdx; + std::map GlobalIdxSecVertexRadiusIncoming; std::map GlobalIdxToPDGCode; std::map GlobalToLocalIdx; std::map> GlobalIdxToDaughterIdxs; + for (size_t iPart = 0; iPart < nParticlesSim; ++iPart) { Key key = keyOf( fileParticlesSim.m_vertex_primary->at(iPart), @@ -465,6 +468,7 @@ struct Alice3TrackingTranslator { auto iteratorMother = barcodeToGlobalIdx.find(kd); if (iteratorMother != barcodeToGlobalIdx.end()) { int motherIdx = iteratorMother->second; + GlobalIdxSecVertexRadiusIncoming[motherIdx] = std::hypot(fileVertices.m_x->at(j) * 0.1, fileVertices.m_y->at(j) * 0.1); for (size_t d2 = 0; d2 < (*fileVertices.m_outgoing_particles_vertex_secondary)[j].size(); ++d2) { Key kd2 = keyOf( (*fileVertices.m_outgoing_particles_vertex_primary)[j][d2], @@ -472,12 +476,12 @@ struct Alice3TrackingTranslator { (*fileVertices.m_outgoing_particles_particle)[j][d2], (*fileVertices.m_outgoing_particles_generation)[j][d2], (*fileVertices.m_outgoing_particles_sub_particle)[j][d2]); - barcodeToVertexPosition[kd2].push_back(fileVertices.m_x->at(j)); - barcodeToVertexPosition[kd2].push_back(fileVertices.m_y->at(j)); - barcodeToVertexPosition[kd2].push_back(fileVertices.m_z->at(j)); auto iteratorDaughter = barcodeToGlobalIdx.find(kd2); if (iteratorDaughter != barcodeToGlobalIdx.end()) { int daughterIdx = iteratorDaughter->second; + globalToVertexPosition[daughterIdx].push_back(fileVertices.m_x->at(j)); + globalToVertexPosition[daughterIdx].push_back(fileVertices.m_y->at(j)); + globalToVertexPosition[daughterIdx].push_back(fileVertices.m_z->at(j)); GlobalIdxToMotherIdx[daughterIdx] = motherIdx; GlobalIdxToDaughterIdxs[motherIdx].push_back(daughterIdx); } @@ -486,7 +490,8 @@ struct Alice3TrackingTranslator { } } for (size_t iPart = 0; iPart < nParticlesSim; ++iPart) { - int globalIdx = firstIdxThisEvent + static_cast(iPart); + float secondaryVertexRadius = -1.0f; + int globalIdx = firstIdxThisEvent + (int)iPart; int motherIdx = -1; if (GlobalIdxToMotherIdx.find(globalIdx) != GlobalIdxToMotherIdx.end()) { motherIdx = GlobalIdxToMotherIdx[globalIdx]; @@ -501,6 +506,13 @@ struct Alice3TrackingTranslator { if (daughters.size() > 1) { secondDaughter = daughters[1]; } + if (globalToVertexPosition.find(globalIdx) != globalToVertexPosition.end()) { + const auto& vertexPos = globalToVertexPosition[globalIdx]; + secondaryVertexRadius = std::hypot(vertexPos[0] * 0.1, vertexPos[1] * 0.1); + } + if (secondaryVertexRadius == -1) { + secondaryVertexRadius = GlobalIdxSecVertexRadiusIncoming[globalIdx]; + } } // Determine flags for the MC particle // TODO: For now primary are only those without mother, but all based on PhysicalPrimary definition should be considered. @@ -513,24 +525,24 @@ struct Alice3TrackingTranslator { } GlobalIdxToPDGCode[globalIdx] = fileParticlesSim.m_particle_type->at(iPart); GlobalToLocalIdx[globalIdx] = iPart; - addMCParticle(tableMcCollisions.lastIndex(), fileParticlesSim, iPart, flags, motherIdx, firstDaughter, secondDaughter, fileParticlesSim.m_number_of_hits->at(iPart)); + addMCParticle(tableMcCollisions.lastIndex(), fileParticlesSim, iPart, flags, motherIdx, firstDaughter, secondDaughter, fileParticlesSim.m_number_of_hits->at(iPart), secondaryVertexRadius); } - - tableCollisions(0, // bcId - collisionX, // posX - collisionY, // posY - collisionZ, // posZ - 0.0f, // covXX - 0.0f, // covXY - 0.0f, // covXZ - 0.0f, // covYY - 0.0f, // covYZ - 0.0f, // covZZ - 0, // flags - 0.0f, // m_chi2Sum - 0, // numContrib - 0.0f, // collisionTime - 0.0f); // collisionTimeRes + const float scale = 0.1f; + tableCollisions(0, // bcId + collisionX * scale, // posX + collisionY * scale, // posY + collisionZ * scale, // posZ + 0.0f, // covXX + 0.0f, // covXY + 0.0f, // covXZ + 0.0f, // covYY + 0.0f, // covYZ + 0.0f, // covZZ + 0, // flags + 0.0f, // m_chi2Sum + 0, // numContrib + 0.0f, // collisionTime + 0.0f); // collisionTimeRes tableMcCollisionLabels(iEvent, // mcCollisionId 0); // mcMask @@ -585,7 +597,7 @@ struct Alice3TrackingTranslator { // Fill covariance matrices float cxx = fileTracksummary.m_cov_eX_eX->at(iTrack); - float cyy = cxx; // fileTracksummary.cov_eY_eY->at(iTrack); + float cyy = fileTracksummary.m_cov_eY_eY->at(iTrack); float czz = fileTracksummary.m_cov_eZ_eZ->at(iTrack); float cxy = fileTracksummary.m_cov_eX_eY->at(iTrack); float cxz = fileTracksummary.m_cov_eX_eZ->at(iTrack); @@ -606,7 +618,8 @@ struct Alice3TrackingTranslator { float czpy = fileTracksummary.m_cov_eZ_ePY->at(iTrack); float czpz = fileTracksummary.m_cov_eZ_ePZ->at(iTrack); // Create TrackParCov object with covariance matrix - std::array position = {x, y, z}; + + std::array position = {x * scale, y * scale, z * scale}; std::array momentum = {px, py, pz}; std::array trackCov = {cxx, cxy, cyy, cxz, cyz, czz, cxpx, cypx, czpx, cpxpx, cxpy, cypy, czpy, cpxpy, cpypy, cxpz, cypz, czpz, cpxpz, cpypz, cpzpz}; o2::track::TrackParCov trackParCov(position, momentum, trackCov, charge); @@ -669,15 +682,28 @@ struct Alice3TrackingTranslator { tableTracksAlice3(true, // isReconstructed -1.f, // todo: track innermost update -1.f); // todo: track outermost update - if (mcParticleIdx > 0) + if (mcParticleIdx > 0) { tableTracksAlice3Pdg(GlobalIdxToPDGCode[mcParticleIdx]); // PdgCode to the linked MC truth particle - else + } else { tableTracksAlice3Pdg(0); // No linked MC truth particle + } - tableTracksExtraA3(m_nMeasurements, // nSiliconHits (using m_nMeasurements as proxy) - 0, // nTPCHits - 0, // trackType - false); // isPVContributor + float secondaryVertexRadius = 0; + std::array vertexPos = {0.0, 0.0, 0.0}; + if (mcParticleIdx > 0) { + vertexPos[0] = fileParticlesSim.m_vx->at(GlobalToLocalIdx[mcParticleIdx]) * 0.1; + vertexPos[1] = fileParticlesSim.m_vy->at(GlobalToLocalIdx[mcParticleIdx]) * 0.1; + vertexPos[2] = fileParticlesSim.m_vz->at(GlobalToLocalIdx[mcParticleIdx]) * 0.1; + secondaryVertexRadius = std::hypot(vertexPos[0], vertexPos[1]); + } + tableTracksExtraA3(m_nMeasurements, // nSiliconHits (using m_nMeasurements as proxy) + 0, // nTPCHits + 0, // trackType + false, // isPVContributor + secondaryVertexRadius, // secondaryVertexRadius + vertexPos[0], + vertexPos[1], + vertexPos[2]); // Fill extra track info tableStoredTracksExtra(0.f, // TPCInnerParam static_cast(0), // Flags