From 25bb661507b83a38606071cd75c0828ac5dcea33 Mon Sep 17 00:00:00 2001 From: Lucia Anna Tarasovicova Date: Thu, 3 Sep 2026 13:51:40 +0200 Subject: [PATCH] adjust the translator to the new ACTS output --- .../alice3TrackingTranslator.cxx | 436 +++++------------- 1 file changed, 114 insertions(+), 322 deletions(-) diff --git a/ALICE3/TableProducer/alice3TrackingTranslator.cxx b/ALICE3/TableProducer/alice3TrackingTranslator.cxx index ccdcbcf2ac0..26302be182b 100644 --- a/ALICE3/TableProducer/alice3TrackingTranslator.cxx +++ b/ALICE3/TableProducer/alice3TrackingTranslator.cxx @@ -65,8 +65,6 @@ namespace using Key = std::array; // barcode (vp, vs, particle, gen, sub) Key keyOf(std::uint32_t vp, std::uint32_t vs, std::uint32_t pa, std::uint32_t ge, std::uint32_t sp) { return Key{vp, vs, pa, ge, sp}; } -// struct ParticleTruthInfo { int pdg; float px, py, pz, m; }; -// struct Seg { double px, py, pz, p; }; } // namespace struct Alice3TrackingTranslator { @@ -101,10 +99,6 @@ struct Alice3TrackingTranslator { { // Initialization if needed LOG(info) << "Alice3TrackingTranslator init called"; - - histos.add("hPx", "Px distribution;Px [GeV/c];Entries", kTH1F, {{100, -5.0, 5.0}}); - histos.add("hPy", "Py distribution;Py [GeV/c];Entries", kTH1F, {{100, -5.0, 5.0}}); - histos.add("hPz", "Pz distribution;Pz [GeV/c];Entries", kTH1F, {{100, -5.0, 5.0}}); } #define SETADDRESS(branchname, branchvar) \ @@ -225,30 +219,47 @@ struct Alice3TrackingTranslator { SETADDRESS("nHoles", m_nHoles); SETADDRESS("chi2Sum", m_chi2Sum); SETADDRESS("NDF", m_NDF); - SETADDRESS("eLOC0_fit", m_eLOC0_fit); - SETADDRESS("eLOC1_fit", m_eLOC1_fit); - SETADDRESS("ePHI_fit", m_ePHI_fit); - SETADDRESS("eTHETA_fit", m_eTHETA_fit); - SETADDRESS("eQOP_fit", m_eQOP_fit); - SETADDRESS("eT_fit", m_eT_fit); SETADDRESS("nMajorityHits", m_nMajorityHits); SETADDRESS("t_charge", m_t_charge); SETADDRESS("t_vx", m_t_vx); SETADDRESS("t_vy", m_t_vy); SETADDRESS("t_vz", m_t_vz); - SETADDRESS("t_time", m_t_time); SETADDRESS("t_px", m_t_px); SETADDRESS("t_py", m_t_py); SETADDRESS("t_pz", m_t_pz); - SETADDRESS("t_theta", m_t_theta); - SETADDRESS("t_phi", m_t_phi); - SETADDRESS("t_pT", m_t_pT); - SETADDRESS("t_eta", m_t_eta); SETADDRESS("majorityParticleId_vertex_primary", m_majorityParticleId_vertex_primary); SETADDRESS("majorityParticleId_vertex_secondary", m_majorityParticleId_vertex_secondary); SETADDRESS("majorityParticleId_generation", m_majorityParticleId_generation); SETADDRESS("majorityParticleId_sub_particle", m_majorityParticleId_sub_particle); SETADDRESS("majorityParticleId_particle", m_majorityParticleId_particle); + SETADDRESS("eQOP_fit", m_eQOP_fit); + SETADDRESS("eX_fit", m_eX_fit); + SETADDRESS("eY_fit", m_eY_fit); + SETADDRESS("eZ_fit", m_eZ_fit); + SETADDRESS("ePX_fit", m_ePX_fit); + 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_eZ_eZ", m_cov_eZ_eZ); + SETADDRESS("cov_ePX_ePX", m_cov_ePX_ePX); + SETADDRESS("cov_ePY_ePY", m_cov_ePY_ePY); + SETADDRESS("cov_ePZ_ePZ", m_cov_ePZ_ePZ); + SETADDRESS("cov_eX_ePX", m_cov_eX_ePX); + SETADDRESS("cov_eY_ePY", m_cov_eY_ePY); + SETADDRESS("cov_eZ_ePZ", m_cov_eZ_ePZ); + SETADDRESS("cov_eX_eY", m_cov_eX_eY); + SETADDRESS("cov_eX_eZ", m_cov_eX_eZ); + SETADDRESS("cov_eY_eZ", m_cov_eY_eZ); + SETADDRESS("cov_ePX_ePY", m_cov_ePX_ePY); + SETADDRESS("cov_ePX_ePZ", m_cov_ePX_ePZ); + SETADDRESS("cov_ePY_ePZ", m_cov_ePY_ePZ); + SETADDRESS("cov_eX_ePY", m_cov_eX_ePY); + SETADDRESS("cov_eX_ePZ", m_cov_eX_ePZ); + SETADDRESS("cov_eY_ePX", m_cov_eY_ePX); + SETADDRESS("cov_eY_ePZ", m_cov_eY_ePZ); + SETADDRESS("cov_eZ_ePX", m_cov_eZ_ePX); + SETADDRESS("cov_eZ_ePY", m_cov_eZ_ePY); } // Define track-related members here UInt_t* m_event_nr = nullptr; @@ -258,12 +269,37 @@ struct Alice3TrackingTranslator { std::vector* m_chi2Sum = nullptr; std::vector* m_NDF = nullptr; // Fitted track parameters - std::vector* m_eLOC0_fit = nullptr; // local position 0 (typically y in local frame) - std::vector* m_eLOC1_fit = nullptr; // local position 1 (typically z in local frame) - std::vector* m_ePHI_fit = nullptr; // azimuthal angle - std::vector* m_eTHETA_fit = nullptr; // polar angle - std::vector* m_eQOP_fit = nullptr; // q/m_p (charge over momentum) - std::vector* m_eT_fit = nullptr; // time + std::vector* m_eQOP_fit = nullptr; // q/m_p (charge over momentum) + + std::vector* m_eX_fit = nullptr; // global position x + std::vector* m_eY_fit = nullptr; // global position y + std::vector* m_eZ_fit = nullptr; // global position z + std::vector* m_ePX_fit = nullptr; // global momentum px + std::vector* m_ePY_fit = nullptr; // global momentum py + 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_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 + std::vector* m_cov_ePZ_ePZ = nullptr; // covariance of global momentum pz + std::vector* m_cov_eX_ePX = nullptr; // covariance between global position x and momentum px + std::vector* m_cov_eY_ePY = nullptr; // covariance between global position y and momentum py + std::vector* m_cov_eZ_ePZ = nullptr; // covariance between global position z and momentum pz + std::vector* m_cov_eX_eY = nullptr; // covariance between global position x and y + std::vector* m_cov_eX_eZ = nullptr; // covariance between global position x and z + std::vector* m_cov_eY_eZ = nullptr; // covariance between global position y and z + std::vector* m_cov_ePX_ePY = nullptr; // covariance between global momentum px and py + std::vector* m_cov_ePX_ePZ = nullptr; // covariance between global momentum px and pz + std::vector* m_cov_ePY_ePZ = nullptr; // covariance between global momentum py and pz + std::vector* m_cov_eX_ePY = nullptr; // covariance between global position x and momentum py + std::vector* m_cov_eX_ePZ = nullptr; // covariance between global position x and momentum pz + std::vector* m_cov_eY_ePX = nullptr; // covariance between global position y and momentum px + std::vector* m_cov_eY_ePZ = nullptr; // covariance between global position y and momentum pz + std::vector* m_cov_eZ_ePX = nullptr; // covariance between global position z and momentum px + std::vector* m_cov_eZ_ePY = nullptr; // covariance between global position z and momentum py // The majority truth particle info std::vector* m_nMajorityHits = nullptr; /// The number of hits from majority particle @@ -275,10 +311,6 @@ struct Alice3TrackingTranslator { std::vector* m_t_px = nullptr; /// Initial momenta m_px of majority particle std::vector* m_t_py = nullptr; /// Initial momenta m_py of majority particle std::vector* m_t_pz = nullptr; /// Initial momenta m_pz of majority particle - std::vector* m_t_theta = nullptr; /// Initial momenta theta of majority particle - std::vector* m_t_phi = nullptr; /// Initial momenta phi of majority particle - std::vector* m_t_pT = nullptr; /// Initial momenta pT of majority particle - std::vector* m_t_eta = nullptr; /// Initial momenta eta of majority particle std::vector* m_majorityParticleId_vertex_primary = nullptr; std::vector* m_majorityParticleId_vertex_secondary = nullptr; @@ -353,33 +385,21 @@ struct Alice3TrackingTranslator { files[justFilename.Data()] = filename; } LOG(info) << "All files loaded successfully"; - // Now open the files to translate and read the trees - // ParticleStruct fileParticles(files["particles.root"], "particles"); - // LOG(info) << "Particles loaded successfully"; ParticleStruct fileParticlesSim(files["particles_simulation.root"], "particles"); LOG(info) << "Particles Sim loaded successfully"; - // std::string daughterFileName = addDaughterInfo ? "particles_decay.root" : "particles_simulation.root"; - // ParticleStruct fileDaughterParticles(files[daughterFileName], "particles"); - // LOG(info) << "Daughter particles loaded successfully from file " << daughterFileName; // FileStruct fileVertices(files["performance_vertexing.root"], "vertexing"); TrackStruct fileTracksummary(files["tracksummary_ambi-tracks-merged.root"], "tracksummary"); - // HitsStruct fileHits(files["hits.root"], "hits"); VertexStruct fileVertices(files["vertices_gen_and_geant.root"], "vertices"); LOG(info) << "Tracks loaded successfully"; const Long64_t kEvents = fileParticlesSim.getEntries(); - // int indexOfLastParticleAfterEvent = -1; for (Long64_t iEvent = 0; iEvent < kEvents; ++iEvent) { if (iEvent > 0 && maxCollisions.value > 0 && (iEvent % maxCollisions) == 0) { LOG(info) << "Stopping at event " << iEvent << "/" << kEvents; break; } - // fileParticles.setEventEntry(iEvent); fileVertices.setEventEntry(iEvent); fileTracksummary.setEventEntry(iEvent); - // fileHits.setEventEntry(iEvent); - // if (addDaughterInfo) - // fileDaughterParticles.setEventEntry(iEvent); fileParticlesSim.setEventEntry(iEvent); LOG(info) << "Processing event " << iEvent << "/" << kEvents; @@ -398,10 +418,8 @@ struct Alice3TrackingTranslator { int collisionId = tableCollisions.lastIndex() + 1; // Convert tracks from ACTS to ALICE format - // const size_t nParticlesGen = fileParticles.m_vx->size(); const size_t nParticlesSim = fileParticlesSim.m_vx->size(); - // const size_t nDaughterParticles = fileDaughterParticles.m_vx->size(); - const size_t nTracks = fileTracksummary.m_eLOC0_fit->size(); + const size_t nTracks = fileTracksummary.m_ePX_fit->size(); std::vector idMCparticles; // local index k within this event -> global AO2D index @@ -468,7 +486,6 @@ struct Alice3TrackingTranslator { } } } - // int idPrimary = -1; for (size_t iPart = 0; iPart < nParticlesSim; ++iPart) { int globalIdx = firstIdxThisEvent + (int)iPart; int motherIdx = -1; @@ -494,20 +511,7 @@ struct Alice3TrackingTranslator { collisionY = fileVertices.m_y->at(iPart); collisionZ = fileVertices.m_z->at(iPart); flags |= o2::aod::mcparticle::enums::PhysicalPrimary; - // idPrimary += 1; } - // if(motherIdx==-1 && std::abs(fileParticlesSim.m_particle_type->at(iPart)) == 211) { - std::cout << "Adding MC particle " << iPart << ", with globalIdx " << globalIdx << ", with motherIdx " << motherIdx << ", firstDaughter " << firstDaughter << ", secondDaughter " << secondDaughter << ", pdg " << fileParticlesSim.m_particle_type->at(iPart) << std::endl; - // std::cout << "PV: " << fileVertices.m_x->at(iPart) << ", " << fileVertices.m_y->at(iPart) << ", " << fileVertices.m_z->at(iPart) << std::endl; - // std::cout << "Daughter info: "; - // if(firstDaughter != -1){ - // std::cout << "firstDaughter pdg " << fileParticlesSim.m_particle_type->at(firstDaughter) << " "; - // } - // if(secondDaughter != -1){ - // std::cout << "secondDaughter pdg " << fileParticlesSim.m_particle_type->at(secondDaughter) << " "; - // } - // std::cout << std::endl; - // } 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)); @@ -549,65 +553,30 @@ struct Alice3TrackingTranslator { if (iterator != barcodeToGlobalIdx.end()) { mcParticleIdx = iterator->second; } - std::cout << "Track " << iTrack << " is associated with MC particle index " << mcParticleIdx << std::endl; // Extract ACTS track parameters - float phi = fileTracksummary.m_ePHI_fit->at(iTrack); - float theta = fileTracksummary.m_eTHETA_fit->at(iTrack); float qOverP = fileTracksummary.m_eQOP_fit->at(iTrack); - float loc0 = fileTracksummary.m_eLOC0_fit->at(iTrack); - float loc1 = fileTracksummary.m_eLOC1_fit->at(iTrack); - float vx = loc0; - float vy = loc1; - float vz = 0.0f; - // auto iteratorVz = barcodeToVertexPosition.find(key); - // if (iteratorVz != barcodeToVertexPosition.end()){ - // vx = iteratorVz->second[0]; - // vy = iteratorVz->second[1]; - // vz = iteratorVz->second[2]; - // } + float x = fileTracksummary.m_eX_fit->at(iTrack); + float y = fileTracksummary.m_eY_fit->at(iTrack); + float z = fileTracksummary.m_eZ_fit->at(iTrack); + float px = fileTracksummary.m_ePX_fit->at(iTrack); + float py = fileTracksummary.m_ePY_fit->at(iTrack); + float pz = fileTracksummary.m_ePZ_fit->at(iTrack); + int localIdx = GlobalToLocalIdx[mcParticleIdx]; if (useTrueInfoForRecoTracks) { if (mcParticleIdx != -1) { - int localIdx = GlobalToLocalIdx[mcParticleIdx]; - float p = fileParticlesSim.m_p->at(localIdx); - // float m = fileParticlesSim.m_m->at(localIdx); - float pt = std::hypot(fileParticlesSim.m_px->at(localIdx), fileParticlesSim.m_py->at(localIdx)); - phi = std::acos(fileParticlesSim.m_px->at(localIdx) / pt); - theta = std::acos(fileParticlesSim.m_pz->at(localIdx) / p); - qOverP = (fileParticlesSim.m_q->at(localIdx) != 0) ? (fileParticlesSim.m_q->at(localIdx) / p) : 0.0f; - loc0 = fileParticlesSim.m_vx->at(localIdx); - loc1 = fileParticlesSim.m_vy->at(localIdx); + px = fileParticlesSim.m_px->at(localIdx); + py = fileParticlesSim.m_py->at(localIdx); + pz = fileParticlesSim.m_pz->at(localIdx); + x = fileParticlesSim.m_vx->at(localIdx); + y = fileParticlesSim.m_vy->at(localIdx); + z = fileParticlesSim.m_vz->at(localIdx); } } - - std::cout << "Track parameters: phi=" << phi << ", theta=" << theta << ", qOverP=" << qOverP << ", loc0=" << loc0 << ", loc1=" << loc1 << std::endl; - std::cout << "vx= " << vx << ", vy= " << vy << ", vz= " << vz << std::endl; // Convert to ALICE track parameters - // ALICE uses: alpha, x, y, z, snp, tgl, signed1Pt - float alpha = phi - M_PI / 2; // Track angle in global frame - float x = vx; // Local x position - float y = vy; // Local y position - float z = vz; // Will be set from DCA or collision vertex - - // Calculate snp (sin of track momentum azimuthal angle) - float snp = o2::constants::math::Almost1; // std::sin(phi);// - - // Calculate tgl (tangent of track momentum dip angle) - float tgl = 1.0f / std::tan(theta); - - // Calculate signed1Pt (charge/pt) - const float m_p = (qOverP != 0) ? std::abs(1.0f / qOverP) : 0.0f; - const float px = m_p * std::cos(phi) * std::sin(theta); - const float py = m_p * std::sin(phi) * std::sin(theta); - const float pz = m_p * std::cos(theta); - const float pt = m_p * std::sin(theta); int8_t charge = (qOverP > 0) ? 1 : -1; - const float signed1Pt = (pt != 0) ? charge / pt : 0.0f; - - if (charge > 0) { - histos.fill(HIST("hPx"), px); - histos.fill(HIST("hPy"), py); - histos.fill(HIST("hPz"), pz); + if (qOverP == 0) { + charge = 0; } // Track quality @@ -615,30 +584,34 @@ struct Alice3TrackingTranslator { uint32_t m_nMeasurements = fileTracksummary.m_nMeasurements->at(iTrack); uint32_t m_NDF = fileTracksummary.m_NDF->at(iTrack); - // Fill covariance matrices (simplified - should be extracted from ACTS if available) - float cYY = 0.1f; - float cZY = 0.0f; - float cZZ = 0.1f; - float cSnpY = 0.0f; - float cSnpZ = 0.0f; - float cSnpSnp = 0.001f; - float cTglY = 0.0f; - float cTglZ = 0.0f; - float cTglSnp = 0.0f; - float cTglTgl = 0.001f; - float c1PtY = 0.0f; - float c1PtZ = 0.0f; - float c1PtSnp = 0.0f; - float c1PtTgl = 0.0f; - float c1Pt21Pt2 = 0.001f * signed1Pt * signed1Pt; - - // Create TrackParCov object with dummy covariance matrix - std::array trackParams = {y, z, snp, tgl, signed1Pt}; - std::array trackCov = {cYY, cZY, cZZ, cSnpY, cSnpZ, cSnpSnp, - cTglY, cTglZ, cTglSnp, cTglTgl, - c1PtY, c1PtZ, c1PtSnp, c1PtTgl, c1Pt21Pt2}; - o2::track::TrackParCov trackParCov(x, alpha, trackParams, trackCov, charge); - std::cout << "TrackParCov created with parameters:" << std::endl; + // Fill covariance matrices + float cxx = fileTracksummary.m_cov_eX_eX->at(iTrack); + float cyy = cxx; // fileTracksummary.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); + float cyz = fileTracksummary.m_cov_eY_eZ->at(iTrack); + float cpxpx = fileTracksummary.m_cov_ePX_ePX->at(iTrack); + float cpypy = fileTracksummary.m_cov_ePY_ePY->at(iTrack); + float cpzpz = fileTracksummary.m_cov_ePZ_ePZ->at(iTrack); + float cpxpy = fileTracksummary.m_cov_ePX_ePY->at(iTrack); + float cpxpz = fileTracksummary.m_cov_ePX_ePZ->at(iTrack); + float cpypz = fileTracksummary.m_cov_ePY_ePZ->at(iTrack); + float cxpx = fileTracksummary.m_cov_eX_ePX->at(iTrack); + float cxpy = fileTracksummary.m_cov_eX_ePY->at(iTrack); + float cxpz = fileTracksummary.m_cov_eX_ePZ->at(iTrack); + float cypx = fileTracksummary.m_cov_eY_ePX->at(iTrack); + float cypy = fileTracksummary.m_cov_eY_ePY->at(iTrack); + float cypz = fileTracksummary.m_cov_eY_ePZ->at(iTrack); + float czpx = fileTracksummary.m_cov_eZ_ePX->at(iTrack); + 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 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); + // Fill StoredTracks table (basic track parameters) tableStoredTracks(collisionId, // collisionId o2::aod::track::TrackTypeEnum::Track, // trackType @@ -649,13 +622,11 @@ struct Alice3TrackingTranslator { trackParCov.getSnp(), // snp trackParCov.getTgl(), // tgl trackParCov.getQ2Pt()); // signed1Pt - std::cout << "Filling StoredTracks table" << std::endl; // Fill TracksExtension table tableTracksExtension(trackParCov.getPt(), trackParCov.getP(), trackParCov.getEta(), trackParCov.getPhi()); - std::cout << "Filling TracksExtension table" << std::endl; tableStoredTracksCov(std::sqrt(trackParCov.getSigmaY2()), // SigmaY std::sqrt(trackParCov.getSigmaZ2()), // SigmaZ std::sqrt(trackParCov.getSigmaSnp2()), // SigmaSnp @@ -671,7 +642,6 @@ struct Alice3TrackingTranslator { 0, // Rho1PtZ 0, // Rho1PtSnp 0); // Rho1PtTgl - std::cout << "Filling StoredTracksCov table" << std::endl; // covariance matrix at collision vertex tableTracksCovExtension(trackParCov.getSigmaY2(), // sigmaY2 trackParCov.getSigmaZY(), // sigmaZY @@ -688,31 +658,25 @@ struct Alice3TrackingTranslator { trackParCov.getSigma1PtSnp(), // sigma1PtSnp trackParCov.getSigma1PtTgl(), // sigma1PtTgl trackParCov.getSigma1Pt2()); // sigma1Pt - std::cout << "Filling TracksCovExtension table" << std::endl; // Fill MC label tableMcTrackLabels(mcParticleIdx, // McParticleId 0); // mcMask - std::cout << "Filling McTrackLabels table" << std::endl; - // Fill DCA info (simplified - should be calculated properly) - tableTracksDCA(0.0f, // dcaXY - 0.0f); // dcaZ - std::cout << "Filling TracksDCA table" << std::endl; + // Fill DCA info TODO: should be calculated properly + tableTracksDCA(0.0f, // dcaXY + 0.0f); // dcaZ tableTracksDCACov(0.0f, // sigmaDcaXY2 0.0f); // sigmaDcaZ2 - std::cout << "Filling TracksDCACov table" << std::endl; // Fill ALICE3 specific tables tableTracksAlice3(true); // isReconstructed - std::cout << GlobalIdxToPDGCode[mcParticleIdx] << std::endl; if (mcParticleIdx > 0) tableTracksAlice3Pdg(GlobalIdxToPDGCode[mcParticleIdx]); // PdgCode to the linked MC truth particle else tableTracksAlice3Pdg(0); // No linked MC truth particle - std::cout << "Filling TracksAlice3 and TracksAlice3Pdg tables" << std::endl; + tableTracksExtraA3(m_nMeasurements, // nSiliconHits (using m_nMeasurements as proxy) 0, // nTPCHits 0, // trackType false); // isPVContributor - std::cout << "Filling TracksExtraA3 table" << std::endl; // Fill extra track info tableStoredTracksExtra(0.f, // TPCInnerParam static_cast(0), // Flags @@ -735,16 +699,14 @@ struct Alice3TrackingTranslator { 0.f, // TrackPhiEMCAL 0.f, // TrackTime 0.f); // TrackTimeRes - std::cout << "Filling StoredTracksExtra table" << std::endl; // Fill track selection - tableTrackSelection(false, // IsGlobalTrackSDD, - false, // TrackCutFlag, - false, // TrackCutFlagFb1, - false, // TrackCutFlagFb2, - false, // TrackCutFlagFb3, - false, // TrackCutFlagFb4, - false); // TrackCutFlagFb5, - std::cout << "Filling TrackSelection table" << std::endl; + tableTrackSelection(false, // IsGlobalTrackSDD, + false, // TrackCutFlag, + false, // TrackCutFlagFb1, + false, // TrackCutFlagFb2, + false, // TrackCutFlagFb3, + false, // TrackCutFlagFb4, + false); // TrackCutFlagFb5, tableTrackSelectionExtension(false, // PassedTrackType, false, // PassedPtRange, false, // PassedEtaRange, @@ -762,177 +724,7 @@ struct Alice3TrackingTranslator { false, // PassedDCAz, false, // PassedITSHitsFB1, false); // PassedITSHitsFB2 - std::cout << "Filling TrackSelectionExtension table" << std::endl; } - - // for (size_t iTrack = 0; iTrack < nTracks; ++iTrack) { - // LOG(info) << "Processing track " << iTrack << "/" << nTracks << " (nParticlesSim=" << nParticlesSim << ") nParticlesGen=" << nParticlesGen; - // const size_t iParticle = iTrack; - - // if (iParticle == 0) { - // tableMcCollisions(0, // mccollision::BCId, - // 0, // mccollision::GeneratorsID, - // fileParticles.m_vx->at(iParticle), // mccollision::PosX, - // fileParticles.m_vy->at(iParticle), // mccollision::PosY, - // fileParticles.m_vz->at(iParticle), // mccollision::PosZ - // fileParticles.m_vt->at(iParticle), // mccollision::T - // 1.0f, // mccollision::Weight - // 0.0f, // mccollision::ImpactParameter, - // 0.f); // mccollision::EventPlaneAngle, - // } - // uint8_t flags = 0; - - // Key majorityVertexInfo = keyOf(fileTracksummary.m_majorityParticleId_vertex_primary->at(iTrack), fileTracksummary.m_majorityParticleId_vertex_secondary->at(iTrack), (*ouPa)[j][d], - // (*ouGe)[j][d], (*ouSp)[j][d]); - - // // ULong64_t idMCTrueParticle = fileTracksummary.m_majorityParticleId->at(iParticle); - // // int32_t mcParticleId = -1; - // // int pdgCode = -1; - - // // for (size_t iMC = 0; iMC < nParticlesGen; ++iMC) { - // // if (fileParticles.m_particleId->at(iMC) == idMCTrueParticle) { - // // if (count(idMCparticles.begin(), idMCparticles.end(), fileParticles.m_particleId->at(iMC)) > 0) { - // // continue; - // // } - // // idMCparticles.push_back(fileParticles.m_particleId->at(iMC)); - // // flags |= o2::aod::mcparticle::enums::PhysicalPrimary; - // // int nHits = 0; - // // for (size_t iPartSim = 0; iPartSim < nParticlesSim; ++iPartSim) { - // // if (fileParticlesSim.m_particleId->at(iPartSim) == fileParticles.m_particleId->at(iMC)) { - // // nHits = fileParticlesSim.m_number_of_hits->at(iPartSim); - // // break; - // // } - // // } - // // addMCParticle(tableMcCollisions.lastIndex(), fileParticles, iMC, flags, -1, -1, nHits); - // // mcParticleId = tableStoredMcParticles.lastIndex(); - // // pdgCode = fileParticles.m_particle_type->at(iMC); - // // break; - // // } - // // } - // // if (addDaughterInfo) { - // // for (size_t iMC = 0; iMC < nParticlesSim; ++iMC) { - // // if (fileDaughterParticles.m_particleId->at(iMC) == idMCTrueParticle) { - // // if (count(idMCparticles.begin(), idMCparticles.end(), fileDaughterParticles.m_particleId->at(iMC)) > 0) { - // // break; - // // } - - // // int nHits = 0; - // // for (size_t iPartSim = 0; iPartSim < nParticlesSim; ++iPartSim) { - // // if (fileParticlesSim.m_particleId->at(iPartSim) == fileDaughterParticles.m_particleId->at(iMC)) { - // // nHits = fileParticlesSim.m_number_of_hits->at(iPartSim); - // // break; - // // } - // // } - // // for (size_t iMother = 0; iMother < nParticlesGen; ++iMother) { - // // if (fileDaughterParticles.m_motherId->at(iMC) == fileParticles.m_particleId->at(iMother)) { - // // if (count(idMCparticles.begin(), idMCparticles.end(), fileParticles.m_particleId->at(iMother)) > 0) { - // // break; - // // } - // // idMCparticles.push_back(fileParticles.m_particleId->at(iMother)); - // // uint8_t flagsMother = o2::aod::mcparticle::enums::PhysicalPrimary; - // // addMCParticle(tableMcCollisions.lastIndex(), fileParticles, iMother, flagsMother, -1, tableStoredMcParticles.lastIndex() + 2, 0); - // // break; - // // } - // // } - // // int motherId = -1; - // // if (count(idMCparticles.begin(), idMCparticles.end(), fileDaughterParticles.m_motherId->at(iMC)) > 0) { - // // auto it = find(idMCparticles.begin(), idMCparticles.end(), fileDaughterParticles.m_motherId->at(iMC)); - // // motherId = it - idMCparticles.begin() + indexOfLastParticleAfterEvent + 1; - // // } - // // idMCparticles.push_back(fileDaughterParticles.m_particleId->at(iMC)); - // // addMCParticle(tableMcCollisions.lastIndex(), fileDaughterParticles, iMC, flags, motherId, -1, nHits); - // // mcParticleId = tableStoredMcParticles.lastIndex(); - // // pdgCode = fileDaughterParticles.m_particle_type->at(iMC); - // // break; - // // } - // // } - // // } - // - - // - - // - - // // Fill MC track labels - // // Get particle linkage from hits using the majority hit index - // // if (fileTracksummary.nMajorityHits && iTrack < fileTracksummary.nMajorityHits->size()) { - // // unsigned int hitIndex = fileTracksummary.nMajorityHits->at(iTrack); - // // if (fileHits.barcode && hitIndex < fileHits.barcode->size()) { - // // mcParticleId = static_cast(fileHits.barcode->at(hitIndex)); - // // LOG(debug) << "Track " << iTrack << " linked to MC particle " << mcParticleId - // // << " via hit index " << hitIndex; - // // } else { - // // LOG(warning) << "Hit index " << hitIndex << " out of range for track " << iTrack - // // << " (barcode vector size: " << (fileHits.barcode ? fileHits.barcode->size() : 0) << ")"; - // // } - // // } else { - // // LOG(warning) << "No majority hit information available for track " << iTrack; - // // } - // // for ( const auto &vv : fileTracksummary.majorityParticleId->at(iTrack) ){ - // // LOG(info) << vv; - // // } - // - // } - - // for (size_t iParticle = 0; iParticle < nParticlesGen; ++iParticle) { - // if (iParticle == 0 && nTracks == 0) { - // tableMcCollisions(0, // mccollision::BCId, - // 0, // mccollision::GeneratorsID, - // fileParticles.m_vx->at(iParticle), // mccollision::PosX, - // fileParticles.m_vy->at(iParticle), // mccollision::PosY, - // fileParticles.m_vz->at(iParticle), // mccollision::PosZ - // fileParticles.m_vt->at(iParticle), // mccollision::T - // 1.0f, // mccollision::Weight - // 0.0f, // mccollision::ImpactParameter, - // 0.f); // mccollision::EventPlaneAngle, - // } - // if (idMCparticles.end() != std::find(idMCparticles.begin(), idMCparticles.end(), fileParticles.m_particleId->at(iParticle))) { - // // Already added via track - // continue; - // } - // uint8_t flags = 0; - // flags |= o2::aod::mcparticle::enums::PhysicalPrimary; - - // int nHits = 0; - // for (size_t iPartSim = 0; iPartSim < nParticlesSim; ++iPartSim) { - // if (fileParticlesSim.m_particleId->at(iPartSim) == fileParticles.m_particleId->at(iParticle)) { - // nHits = fileParticlesSim.m_number_of_hits->at(iPartSim); - // break; - // } - // } - // addMCParticle(tableMcCollisions.lastIndex(), fileParticles, iParticle, flags, -1, -1, nHits); - // idMCparticles.push_back(fileParticles.m_particleId->at(iParticle)); - // } - // // if (addDaughterInfo) { - // // for (size_t iParticle = 0; iParticle < nDaughterParticles; ++iParticle) { - // // if (idMCparticles.end() != std::find(idMCparticles.begin(), idMCparticles.end(), fileDaughterParticles.m_particleId->at(iParticle))) { - // // // Already added via track - // // continue; - // // } - // // uint8_t flags = 0; - // // int nHits = 0; - // // for (size_t iPartSim = 0; iPartSim < nParticlesSim; ++iPartSim) { - // // if (fileParticlesSim.m_particleId->at(iPartSim) == fileDaughterParticles.m_particleId->at(iParticle)) { - // // nHits = fileParticlesSim.m_number_of_hits->at(iPartSim); - // // break; - // // } - // // } - // // int motherId = -1; - // // for (size_t iMother = 0; iMother < nParticlesGen; ++iMother) { - // // if (fileDaughterParticles.m_motherId->at(iParticle) == fileParticles.m_particleId->at(iMother)) { - // // if (count(idMCparticles.begin(), idMCparticles.end(), fileDaughterParticles.m_motherId->at(iParticle)) > 0) { - // // auto it = find(idMCparticles.begin(), idMCparticles.end(), fileDaughterParticles.m_motherId->at(iParticle)); - // // motherId = it - idMCparticles.begin() + indexOfLastParticleAfterEvent + 1; - // // } - // // } - // // } - // // addMCParticle(tableMcCollisions.lastIndex(), fileDaughterParticles, iParticle, flags, motherId, -1, nHits); - // // } - // // } - - // LOG(info) << "Event " << iEvent << ": has " << nTracks << " tracks, " << nParticlesGen << " particles " << nDaughterParticles << " daughter particles, " << nParticlesSim << " propagated particles."; - // LOG(info) << "Total numbers of stored MC particles: " << tableStoredMcParticles.lastIndex() + 1; - // indexOfLastParticleAfterEvent = tableStoredMcParticles.lastIndex(); } } };