@@ -510,8 +510,8 @@ struct Dilepton {
510510 delete emh_neg;
511511 emh_neg = 0x0 ;
512512
513- used_trackIds .clear ();
514- used_trackIds .shrink_to_fit ();
513+ used_trackIds_per_col .clear ();
514+ used_trackIds_per_col .shrink_to_fit ();
515515
516516 delete h2sp_resolution;
517517 }
@@ -819,8 +819,8 @@ struct Dilepton {
819819 {
820820 if constexpr (ev_id == 1 ) {
821821 if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDielectron ) {
822- // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); //this does not work.
823- // bool is_found2 = std::find(t1.ambiguousElectronsIds.begin(), t1.ambiguousElectronsIds.end(), t2.globalIndex()) != t1.ambiguousElectronsIds.end(); //this does not work.
822+ // bool is_found1 = std::find(t2.ambiguousElectronsIds.begin(), t2.ambiguousElectronsIds.end(), t1.globalIndex()) != t2.ambiguousElectronsIds.end(); // this does not work.
823+ // bool is_found2 = std::find(t1.ambiguousElectronsIds.begin(), t1.ambiguousElectronsIds.end(), t2.globalIndex()) != t1.ambiguousElectronsIds.end(); // this does not work.
824824 auto v1ambIds = t1.ambiguousElectronsIds ();
825825 auto v2ambIds = t2.ambiguousElectronsIds ();
826826
@@ -829,8 +829,8 @@ struct Dilepton {
829829 return false ; // this is protection against pairing 2 identical tracks. This happens, when TTCA is used. TTCA can assign a track to several possible collisions.
830830 }
831831 } else if constexpr (pairtype == o2::aod::pwgem::dilepton::utils::pairutil::DileptonPairType::kDimuon ) {
832- // bool is_found1 = std::find(t2.ambiguousMuonsIds.begin(), t2.ambiguousMuonsIds.end(), t1.globalIndex()) != t2.ambiguousMuonsIds.end(); //this does not work.
833- // bool is_found2 = std::find(t1.ambiguousMuonsIds.begin(), t1.ambiguousMuonsIds.end(), t2.globalIndex()) != t1.ambiguousMuonsIds.end(); //this does not work.
832+ // bool is_found1 = std::find(t2.ambiguousMuonsIds.begin(), t2.ambiguousMuonsIds.end(), t1.globalIndex()) != t2.ambiguousMuonsIds.end(); // this does not work.
833+ // bool is_found2 = std::find(t1.ambiguousMuonsIds.begin(), t1.ambiguousMuonsIds.end(), t2.globalIndex()) != t1.ambiguousMuonsIds.end(); // this does not work.
834834 auto v1ambIds = t1.ambiguousMuonsIds ();
835835 auto v2ambIds = t2.ambiguousMuonsIds ();
836836
@@ -1066,8 +1066,6 @@ struct Dilepton {
10661066 // store tracks for event mixing without double counting
10671067 if constexpr (ev_id == 0 ) {
10681068 std::pair<int , int > key_df_collision = std::make_pair (ndf, collision.globalIndex ());
1069- std::pair<int , int > pair_tmp_id1 = std::make_pair (ndf, t1.globalIndex ());
1070- std::pair<int , int > pair_tmp_id2 = std::make_pair (ndf, t2.globalIndex ());
10711069
10721070 std::vector<int > possibleIds1;
10731071 std::vector<int > possibleIds2;
@@ -1076,8 +1074,8 @@ struct Dilepton {
10761074 std::copy (t1.ambiguousElectronsIds ().begin (), t1.ambiguousElectronsIds ().end (), std::back_inserter (possibleIds1));
10771075 std::copy (t2.ambiguousElectronsIds ().begin (), t2.ambiguousElectronsIds ().end (), std::back_inserter (possibleIds2));
10781076
1079- if (std::find (used_trackIds .begin (), used_trackIds .end (), pair_tmp_id1) == used_trackIds .end ()) {
1080- used_trackIds .emplace_back (pair_tmp_id1 );
1077+ if (std::find (used_trackIds_per_col .begin (), used_trackIds_per_col .end (), t1. globalIndex ()) == used_trackIds_per_col .end ()) {
1078+ used_trackIds_per_col .emplace_back (t1. globalIndex () );
10811079 if (cfgDoMix) {
10821080 if (t1.sign () > 0 ) {
10831081 emh_pos->AddTrackToEventPool (key_df_collision, EMTrack (ndf, t1.globalIndex (), collision.globalIndex (), t1.trackId (), t1.pt (), t1.eta (), t1.phi (), leptonM1, t1.sign (), t1.dcaXY (), t1.dcaZ (), possibleIds1, t1.cYY (), t1.cZY (), t1.cZZ ()));
@@ -1086,8 +1084,8 @@ struct Dilepton {
10861084 }
10871085 }
10881086 }
1089- if (std::find (used_trackIds .begin (), used_trackIds .end (), pair_tmp_id2) == used_trackIds .end ()) {
1090- used_trackIds .emplace_back (pair_tmp_id2 );
1087+ if (std::find (used_trackIds_per_col .begin (), used_trackIds_per_col .end (), t2. globalIndex ()) == used_trackIds_per_col .end ()) {
1088+ used_trackIds_per_col .emplace_back (t2. globalIndex () );
10911089 if (cfgDoMix) {
10921090 if (t2.sign () > 0 ) {
10931091 emh_pos->AddTrackToEventPool (key_df_collision, EMTrack (ndf, t2.globalIndex (), collision.globalIndex (), t2.trackId (), t2.pt (), t2.eta (), t2.phi (), leptonM2, t2.sign (), t2.dcaXY (), t2.dcaZ (), possibleIds2, t2.cYY (), t2.cZY (), t2.cZZ ()));
@@ -1100,8 +1098,8 @@ struct Dilepton {
11001098 std::copy (t1.ambiguousMuonsIds ().begin (), t1.ambiguousMuonsIds ().end (), std::back_inserter (possibleIds1));
11011099 std::copy (t2.ambiguousMuonsIds ().begin (), t2.ambiguousMuonsIds ().end (), std::back_inserter (possibleIds2));
11021100
1103- if (std::find (used_trackIds .begin (), used_trackIds .end (), pair_tmp_id1) == used_trackIds .end ()) {
1104- used_trackIds .emplace_back (pair_tmp_id1 );
1101+ if (std::find (used_trackIds_per_col .begin (), used_trackIds_per_col .end (), t1. globalIndex ()) == used_trackIds_per_col .end ()) {
1102+ used_trackIds_per_col .emplace_back (t1. globalIndex () );
11051103 if (cfgDoMix) {
11061104 if (t1.sign () > 0 ) {
11071105 emh_pos->AddTrackToEventPool (key_df_collision, EMFwdTrack (ndf, t1.globalIndex (), collision.globalIndex (), t1.fwdtrackId (), t1.pt (), t1.eta (), t1.phi (), leptonM1, t1.sign (), t1.fwdDcaX (), t1.fwdDcaY (), possibleIds1,
@@ -1112,8 +1110,8 @@ struct Dilepton {
11121110 }
11131111 }
11141112 }
1115- if (std::find (used_trackIds .begin (), used_trackIds .end (), pair_tmp_id2) == used_trackIds .end ()) {
1116- used_trackIds .emplace_back (pair_tmp_id2 );
1113+ if (std::find (used_trackIds_per_col .begin (), used_trackIds_per_col .end (), t2. globalIndex ()) == used_trackIds_per_col .end ()) {
1114+ used_trackIds_per_col .emplace_back (t2. globalIndex () );
11171115 if (cfgDoMix) {
11181116 if (t2.sign () > 0 ) {
11191117 emh_pos->AddTrackToEventPool (key_df_collision, EMFwdTrack (ndf, t2.globalIndex (), collision.globalIndex (), t2.fwdtrackId (), t2.pt (), t2.eta (), t2.phi (), leptonM2, t2.sign (), t2.fwdDcaX (), t2.fwdDcaY (), possibleIds2,
@@ -1170,7 +1168,7 @@ struct Dilepton {
11701168 TEMH* emh_neg = nullptr ;
11711169 std::map<std::pair<int , int >, uint64_t > map_mixed_eventId_to_globalBC;
11721170
1173- std::vector<std::pair< int , int >> used_trackIds ;
1171+ std::vector<int > used_trackIds_per_col ;
11741172 int ndf = 0 ;
11751173
11761174 template <bool isTriggerAnalysis, typename TCollisions, typename TLeptons, typename TPresilce, typename TCut, typename TAllTracks>
@@ -1252,6 +1250,7 @@ struct Dilepton {
12521250 auto negTracks_per_coll = negTracks.sliceByCached (perCollision, collision.globalIndex (), cache);
12531251 // LOGF(info, "collision.globalIndex() = %d , collision.posZ() = %f , collision.numContrib() = %d, centrality = %f , posTracks_per_coll.size() = %d, negTracks_per_coll.size() = %d", collision.globalIndex(), collision.posZ(), collision.numContrib(), centralities[cfgCentEstimator], posTracks_per_coll.size(), negTracks_per_coll.size());
12541252
1253+ used_trackIds_per_col.reserve (posTracks_per_coll.size () + negTracks_per_coll.size ());
12551254 int nuls = 0 , nlspp = 0 , nlsmm = 0 ;
12561255 for (const auto & [pos, neg] : combinations (CombinationsFullIndexPolicy (posTracks_per_coll, negTracks_per_coll))) { // ULS
12571256 bool is_pair_ok = fillPairInfo<0 >(collision, pos, neg, cut, tracks);
@@ -1271,6 +1270,8 @@ struct Dilepton {
12711270 nlsmm++;
12721271 }
12731272 }
1273+ used_trackIds_per_col.clear ();
1274+ used_trackIds_per_col.shrink_to_fit ();
12741275
12751276 if (!cfgDoMix || !(nuls > 0 || nlspp > 0 || nlsmm > 0 )) {
12761277 continue ;
0 commit comments