Skip to content

Commit 6a00bf3

Browse files
authored
[PWGUD] addition of MC and code cleanup (#8654)
1 parent 9e4be94 commit 6a00bf3

File tree

2 files changed

+455
-359
lines changed

2 files changed

+455
-359
lines changed

PWGUD/Core/UPCJpsiCentralBarrelCorrHelper.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@
1616
#ifndef PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_
1717
#define PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_
1818

19+
#include <vector>
1920
#include <algorithm>
2021
#include "CommonConstants/MathConstants.h"
22+
#include "random"
2123

2224
using namespace o2;
2325
using namespace o2::framework;
2426
using namespace o2::framework::expressions;
2527
using namespace std;
2628

27-
enum ParticleType {
29+
/*enum ParticleType {
2830
P_ELECTRON = 0,
2931
P_MUON = 1,
3032
P_PROTON = 2
31-
};
33+
};*/
3234

33-
template <typename T>
35+
/*template <typename T>
3436
int testPIDhypoTPC(T trackPID)
3537
{
3638
float nSigmaTPC[3];
@@ -71,7 +73,7 @@ int testPIDhypo(T trackPID)
7173
} else {
7274
return -1;
7375
}
74-
}
76+
}*/
7577

7678
float* correlation(TLorentzVector* lv1, TLorentzVector* lv2, TLorentzVector* lv)
7779
{
@@ -217,4 +219,19 @@ double DeltaPhi(TLorentzVector lv1, TLorentzVector lv2)
217219
return dp;
218220
}
219221

222+
double DeltaPhiRandom(TLorentzVector lv1, TLorentzVector lv2)
223+
{
224+
std::vector<int> indices = {0, 1};
225+
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
226+
std::shuffle(indices.begin(), indices.end(), std::default_random_engine(seed));
227+
std::array<TLorentzVector, 2> arrayLorentz = {lv1, lv2};
228+
TLorentzVector lv_sum = arrayLorentz[indices[0]] + arrayLorentz[indices[1]];
229+
TLorentzVector lv_diff = arrayLorentz[indices[0]] - arrayLorentz[indices[1]];
230+
;
231+
232+
double dp = lv_sum.DeltaPhi(lv_diff);
233+
234+
return dp;
235+
}
236+
220237
#endif // PWGUD_CORE_UPCJPSICENTRALBARRELCORRHELPER_H_

0 commit comments

Comments
 (0)