Skip to content

Commit 0abc944

Browse files
authored
PWGCF: Adding swapping to the MC Truth task (track-track) (#3859)
* Adding swaping to same and mixed events in the MCTruth track-track * Add swapping to the MC Truth track track task
1 parent ed52264 commit 0abc944

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackTrackMcTruth.cxx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/// \author Zuzanna Chochulska, WUT Warsaw, zuzanna.chochulska.stud@pw.edu.pl
1616

1717
#include <vector>
18+
#include <random>
1819
#include "Framework/AnalysisTask.h"
1920
#include "Framework/runDataProcessing.h"
2021
#include "Framework/HistogramRegistry.h"
@@ -115,6 +116,9 @@ struct femtoUniversePairTaskTrackTrackMcTruth {
115116
HistogramRegistry resultRegistry{"Correlations", {}, OutputObjHandlingPolicy::AnalysisObject};
116117
HistogramRegistry MixQaRegistry{"MixQaRegistry", {}, OutputObjHandlingPolicy::AnalysisObject};
117118

119+
/// @brief Counter for particle swapping
120+
int fNeventsProcessed = 0;
121+
118122
void init(InitContext&)
119123
{
120124

@@ -154,6 +158,8 @@ struct femtoUniversePairTaskTrackTrackMcTruth {
154158
template <bool isMC, typename PartitionType, typename PartType>
155159
void doSameEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartType parts, float magFieldTesla, int multCol)
156160
{
161+
bool swpart = fNeventsProcessed % 2;
162+
fNeventsProcessed++;
157163

158164
/// Histogramming same event
159165
for (auto& part : groupPartsOne) {
@@ -169,12 +175,16 @@ struct femtoUniversePairTaskTrackTrackMcTruth {
169175
}
170176
/// Now build the combinations
171177
for (auto& [p1, p2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsOne, groupPartsTwo))) {
172-
173178
// track cleaning
174179
if (!pairCleaner.isCleanPair(p1, p2, parts)) {
175180
continue;
176181
}
177-
sameEventCont.setPair<isMC>(p1, p2, multCol, ConfUse3D);
182+
if (swpart)
183+
sameEventCont.setPair<isMC>(p1, p2, multCol, ConfUse3D);
184+
else
185+
sameEventCont.setPair<isMC>(p2, p1, multCol, ConfUse3D);
186+
187+
swpart = !swpart;
178188
}
179189
}
180190

@@ -206,10 +216,16 @@ struct femtoUniversePairTaskTrackTrackMcTruth {
206216
template <bool isMC, typename PartitionType, typename PartType>
207217
void doMixedEvent(PartitionType groupPartsOne, PartitionType groupPartsTwo, PartType parts, float magFieldTesla, int multCol)
208218
{
219+
bool swpart = fNeventsProcessed % 2;
220+
fNeventsProcessed++;
209221

210222
for (auto& [p1, p2] : combinations(CombinationsFullIndexPolicy(groupPartsOne, groupPartsTwo))) {
223+
if (swpart)
224+
mixedEventCont.setPair<isMC>(p1, p2, multCol, ConfUse3D);
225+
else
226+
mixedEventCont.setPair<isMC>(p2, p1, multCol, ConfUse3D);
211227

212-
mixedEventCont.setPair<isMC>(p1, p2, multCol, ConfUse3D);
228+
swpart = !swpart;
213229
}
214230
}
215231

0 commit comments

Comments
 (0)