@@ -514,34 +514,34 @@ void VertexerTraits<nLayers>::addTruthSeedingVertices()
514514 bounded_vector<int > events;
515515 };
516516 std::map<int , VertInfo> vertices;
517- for (int iSrc{0 }; iSrc < mcReader.getNSources (); ++iSrc) {
518- auto eveId2colId = dc->getCollisionIndicesForSource (iSrc);
519- for (int iEve{0 }; iEve < mcReader.getNEvents (iSrc); ++iEve) {
520- const auto & ir = irs[eveId2colId[iEve]];
521- if (!ir.isDummy ()) { // do we need this, is this for diffractive events?
522- const auto & eve = mcReader.getMCEventHeader (iSrc, iEve);
523- int rofId = ((ir - raw::HBFUtils::Instance ().getFirstSampledTFIR ()).toLong () - roFrameBiasInBC) / roFrameLengthInBC;
524- if (!vertices.contains (rofId)) {
525- vertices[rofId] = {
526- .vertices = bounded_vector<Vertex>(mMemoryPool .get ()),
527- .srcs = bounded_vector<int >(mMemoryPool .get ()),
528- .events = bounded_vector<int >(mMemoryPool .get ()),
529- };
530- }
531- Vertex vert;
532- vert.setTimeStamp (rofId);
533- vert.setNContributors (std::ranges::count_if (mcReader.getTracks (iSrc, iEve), [](const auto & trk) {
534- return trk.isPrimary () && trk.GetPt () > 0.2 && std::abs (trk.GetEta ()) < 1.3 ;
535- }));
536- vert.setXYZ ((float )eve.GetX (), (float )eve.GetY (), (float )eve.GetZ ());
537- vert.setChi2 (1 );
538- constexpr float cov = 50e-9 ;
539- vert.setCov (cov, cov, cov, cov, cov, cov);
540- vertices[rofId].vertices .push_back (vert);
541- vertices[rofId].srcs .push_back (iSrc);
542- vertices[rofId].events .push_back (iEve);
517+ const int iSrc = 0 ; // take only events from collision generator
518+ auto eveId2colId = dc->getCollisionIndicesForSource (iSrc);
519+ for (int iEve{0 }; iEve < mcReader.getNEvents (iSrc); ++iEve) {
520+ const auto & ir = irs[eveId2colId[iEve]];
521+ if (!ir.isDummy ()) { // do we need this, is this for diffractive events?
522+ const auto & eve = mcReader.getMCEventHeader (iSrc, iEve);
523+ int rofId = ((ir - raw::HBFUtils::Instance ().getFirstSampledTFIR ()).toLong () - roFrameBiasInBC) / roFrameLengthInBC;
524+ if (!vertices.contains (rofId)) {
525+ vertices[rofId] = {
526+ .vertices = bounded_vector<Vertex>(mMemoryPool .get ()),
527+ .srcs = bounded_vector<int >(mMemoryPool .get ()),
528+ .events = bounded_vector<int >(mMemoryPool .get ()),
529+ };
543530 }
531+ Vertex vert;
532+ vert.setTimeStamp (rofId);
533+ vert.setNContributors (std::ranges::count_if (mcReader.getTracks (iSrc, iEve), [](const auto & trk) {
534+ return trk.isPrimary () && trk.GetPt () > 0.2 && std::abs (trk.GetEta ()) < 1.3 ;
535+ }));
536+ vert.setXYZ ((float )eve.GetX (), (float )eve.GetY (), (float )eve.GetZ ());
537+ vert.setChi2 (1 );
538+ constexpr float cov = 50e-9 ;
539+ vert.setCov (cov, cov, cov, cov, cov, cov);
540+ vertices[rofId].vertices .push_back (vert);
541+ vertices[rofId].srcs .push_back (iSrc);
542+ vertices[rofId].events .push_back (iEve);
544543 }
544+ mcReader.releaseTracksForSourceAndEvent (iSrc, iEve);
545545 }
546546 size_t nVerts{0 };
547547 for (int iROF{0 }; iROF < mTimeFrame ->getNrof (); ++iROF) {
0 commit comments