You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- current deduplication relies on nested for-loop of a map with 30000 elements. This makes computation slow
- New mode ranks all V0 candidates with a score, based on their cosPA and PCA
- V0s are accepted starting from V0s with the best score. A new V0 is only added if its daughter tracks have not yet been included in another V0 that has been accepted already
Configurable<int> modeTrackPropagation{"modeTrackPropagation", 0, "0: use real track propagation, including material, 1: use fast approximation using only geometry, 2: Use real track propagation and make comparison to fast propagation (only for debugging and testing)"};
167
+
Configurable<int> deduplicationMode{"deduplicationMode", 0, "0: Pairwise deduplication, 1: Based on Greedy matching (best score wins)"};
168
+
Configurable<float> deduplicationScoreWeight{"deduplicationScoreWeight", 0.5f, "0.:only pca goes into the score, 1: only cosPA goes itno score, any number in between is a mix of pca and cosPA"};
std::vector<V0CandidateHelper> vecV0Dedup; // vector with all V0Candidates that is used to sort them by score (see struct V0CandidateHelper for more details of content)
stored_fullv0Ids.reserve(pca_map.size()); // number of photon candidates per DF
998
1054
999
1055
// find minimal pca
1000
-
for (constauto& [key, value] : pca_map) {
1001
-
auto v0Id = std::get<0>(key);
1002
-
auto collisionId = std::get<1>(key);
1003
-
auto posId = std::get<2>(key);
1004
-
auto eleId = std::get<3>(key);
1005
-
float v0pca = value;
1006
-
float cospa = cospa_map[key];
1007
-
bool is_closest_v0 = true;
1008
-
bool is_most_aligned_v0 = true;
1009
-
1010
-
for (constauto& [key_tmp, value_tmp] : pca_map) {
1011
-
auto v0Id_tmp = std::get<0>(key_tmp);
1012
-
auto collisionId_tmp = std::get<1>(key_tmp);
1013
-
auto posId_tmp = std::get<2>(key_tmp);
1014
-
auto eleId_tmp = std::get<3>(key_tmp);
1015
-
float v0pca_tmp = value_tmp;
1016
-
float cospa_tmp = cospa_map[key_tmp];
1017
-
1018
-
if (v0Id == v0Id_tmp) { // skip exactly the same v0
1056
+
if (deduplicationMode == V0DeduplicationMode::Pairwise) {
1057
+
for (constauto& [key, value] : pca_map) {
1058
+
auto v0Id = std::get<0>(key);
1059
+
auto collisionId = std::get<1>(key);
1060
+
auto posId = std::get<2>(key);
1061
+
auto eleId = std::get<3>(key);
1062
+
float v0pca = value;
1063
+
float cospa = cospa_map[key];
1064
+
bool is_closest_v0 = true;
1065
+
bool is_most_aligned_v0 = true;
1066
+
1067
+
for (constauto& [key_tmp, value_tmp] : pca_map) {
1068
+
auto v0Id_tmp = std::get<0>(key_tmp);
1069
+
auto collisionId_tmp = std::get<1>(key_tmp);
1070
+
auto posId_tmp = std::get<2>(key_tmp);
1071
+
auto eleId_tmp = std::get<3>(key_tmp);
1072
+
float v0pca_tmp = value_tmp;
1073
+
float cospa_tmp = cospa_map[key_tmp];
1074
+
1075
+
if (v0Id == v0Id_tmp) { // skip exactly the same v0
1076
+
continue;
1077
+
}
1078
+
1079
+
if (collisionId != collisionId_tmp && eleId == eleId_tmp && posId == posId_tmp && cospa < cospa_tmp) { // same ele and pos, but attached to different collision
// containers to keep track of which electron and positron tracks have already been used
1111
+
std::unordered_set<int> usedPositrons;
1112
+
std::unordered_set<int> usedElectrons;
1113
+
1114
+
// clear output containers
1115
+
stored_v0Ids.clear();
1116
+
stored_fullv0Ids.clear();
1117
+
nv0_map.clear();
1118
+
1119
+
// Loop over all v0s, starting with the one with the best score
1120
+
// If a v0 contains a track that is already in another (better) V0 candidate, skip V0
1121
+
for (constauto& v0Cand : vecV0Dedup) {
1122
+
// Skip if one of the tracks is already used
1123
+
if (usedPositrons.contains(v0Cand.posID)) {
1019
1124
continue;
1020
1125
}
1021
-
1022
-
if (collisionId != collisionId_tmp && eleId == eleId_tmp && posId == posId_tmp && cospa < cospa_tmp) { // same ele and pos, but attached to different collision
//! type of V0. 0: built solely for cascades (does not pass standard V0 cuts), 1: standard 2, 3: photon-like with TPC-only use. Regular analysis should always use type 1 or 3.
0 commit comments