@@ -1626,6 +1626,10 @@ struct AntinucleiInJets {
16261626 // Event counter
16271627 int eventCounter = 0 ;
16281628
1629+ // Jet and area definitions
1630+ fastjet::JetDefinition jetDef (fastjet::antikt_algorithm, rJet);
1631+ fastjet::AreaDefinition areaDef (fastjet::active_area, fastjet::GhostedAreaSpec (1.0 ));
1632+
16291633 // Loop over all simulated collisions
16301634 for (const auto & collision : collisions) {
16311635
@@ -1675,8 +1679,6 @@ struct AntinucleiInJets {
16751679 registryMC.fill (HIST (" genEvents" ), 2.5 );
16761680
16771681 // Cluster MC particles into jets using anti-kt algorithm
1678- fastjet::JetDefinition jetDef (fastjet::antikt_algorithm, rJet);
1679- fastjet::AreaDefinition areaDef (fastjet::active_area, fastjet::GhostedAreaSpec (1.0 ));
16801682 fastjet::ClusterSequenceArea cs (fjParticles, jetDef, areaDef);
16811683 std::vector<fastjet::PseudoJet> jets = fastjet::sorted_by_pt (cs.inclusive_jets ());
16821684 auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone (fjParticles, jets);
@@ -1772,8 +1774,8 @@ struct AntinucleiInJets {
17721774
17731775 // Shrink large vectors
17741776 if (eventCounter % shrinkInterval == 0 ) {
1775- fjParticles. shrink_to_fit ( );
1776- protonMomentum. shrink_to_fit ( );
1777+ std::vector<fastjet::PseudoJet>(). swap (fjParticles );
1778+ std::vector<TVector3>(). swap (protonMomentum );
17771779 }
17781780 }
17791781 }
@@ -1786,6 +1788,10 @@ struct AntinucleiInJets {
17861788 std::vector<fastjet::PseudoJet> fjParticles;
17871789 std::vector<int > antiprotonTrackIndex;
17881790
1791+ // Jet and area definitions
1792+ fastjet::JetDefinition jetDef (fastjet::antikt_algorithm, rJet);
1793+ fastjet::AreaDefinition areaDef (fastjet::active_area, fastjet::GhostedAreaSpec (1.0 ));
1794+
17891795 // Event counter
17901796 int eventCounter = 0 ;
17911797
@@ -1870,8 +1876,6 @@ struct AntinucleiInJets {
18701876 registryMC.fill (HIST (" recEvents" ), 8.5 );
18711877
18721878 // Cluster particles using the anti-kt algorithm
1873- fastjet::JetDefinition jetDef (fastjet::antikt_algorithm, rJet);
1874- fastjet::AreaDefinition areaDef (fastjet::active_area, fastjet::GhostedAreaSpec (1.0 ));
18751879 fastjet::ClusterSequenceArea cs (fjParticles, jetDef, areaDef);
18761880 std::vector<fastjet::PseudoJet> jets = fastjet::sorted_by_pt (cs.inclusive_jets ());
18771881 auto [rhoPerp, rhoMPerp] = backgroundSub.estimateRhoPerpCone (fjParticles, jets);
@@ -2064,8 +2068,8 @@ struct AntinucleiInJets {
20642068
20652069 // Shrink large vectors
20662070 if (eventCounter % shrinkInterval == 0 ) {
2067- fjParticles. shrink_to_fit ( );
2068- antiprotonTrackIndex. shrink_to_fit ( );
2071+ std::vector<fastjet::PseudoJet>(). swap (fjParticles );
2072+ std::vector< int >(). swap (antiprotonTrackIndex );
20692073 }
20702074 }
20712075 }
0 commit comments