Skip to content

Commit 99c6855

Browse files
author
ayatsuji
committed
add MEPM rotated legs
1 parent 4896ea8 commit 99c6855

2 files changed

Lines changed: 77 additions & 2 deletions

File tree

‎PWGDQ/Core/VarManager.h‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,8 @@ class VarManager : public TObject
14611461
static void FillPair(T1 const& t1, T2 const& t2, float* values = nullptr);
14621462
template <int pairType, uint32_t fillMap, typename T1, typename T2>
14631463
static void FillPairRotation(T1 const& t1, T2 const& t2, int rotation, float* values = nullptr);
1464+
template <typename T>
1465+
static void FillPairRotation_ME(T const& t1, T const& t2, int rotation, float* values = nullptr);
14641466
template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2>
14651467
static void FillPairCollision(C const& collision, T1 const& t1, T2 const& t2, float* values = nullptr);
14661468
template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2, typename M, typename P>
@@ -4511,6 +4513,51 @@ void VarManager::FillPairME(T1 const& t1, T2 const& t2, float* values)
45114513
}
45124514
}
45134515

4516+
template <typename T>
4517+
void VarManager::FillPairRotation_ME(T const& t1, T const& t2, int rotation, float* values)
4518+
{
4519+
if (!values) {
4520+
values = fgValues;
4521+
}
4522+
4523+
float m1 = o2::constants::physics::MassElectron;
4524+
double rotationphi2 = t2.phi;
4525+
4526+
if (rotation == 1) {
4527+
rotationphi2 = t2.phi + o2::constants::math::PI;
4528+
} else if (rotation == 2) {
4529+
rotationphi2 = 2 * values[kPsi2A] - t2.phi;
4530+
} else if (rotation == 3) {
4531+
rotationphi2 = 2 * values[kPsi2A] - t2.phi + o2::constants::math::PI;
4532+
}
4533+
4534+
if (rotationphi2 >= o2::constants::math::TwoPI) {
4535+
rotationphi2 -= o2::constants::math::TwoPI;
4536+
} else if (rotationphi2 < 0) {
4537+
rotationphi2 += o2::constants::math::TwoPI;
4538+
}
4539+
4540+
ROOT::Math::PtEtaPhiMVector v1(t1.pt, t1.eta, t1.phi, m1);
4541+
ROOT::Math::PtEtaPhiMVector v2(t2.pt, t2.eta, rotationphi2, m1);
4542+
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
4543+
values[kMass] = v12.M();
4544+
values[kPt] = v12.Pt();
4545+
values[kEta] = v12.Eta();
4546+
// values[kPhi] = v12.Phi();
4547+
values[kPhi] = RecoDecay::constrainAngle(v12.Phi());
4548+
values[kRap] = -v12.Rapidity();
4549+
double Ptot1 = TMath::Sqrt(v1.Px() * v1.Px() + v1.Py() * v1.Py() + v1.Pz() * v1.Pz());
4550+
double Ptot2 = TMath::Sqrt(v2.Px() * v2.Px() + v2.Py() * v2.Py() + v2.Pz() * v2.Pz());
4551+
values[kDeltaPtotTracks] = Ptot1 - Ptot2;
4552+
4553+
values[kPt1] = t1.pt;
4554+
values[kEta1] = t1.eta;
4555+
values[kPhi1] = t1.phi;
4556+
values[kPt2] = t2.pt;
4557+
values[kEta2] = t2.eta;
4558+
values[kPhi2] = rotationphi2;
4559+
}
4560+
45144561
template <typename T>
45154562
void VarManager::FillPairMEAcrossTFs(T const& t1, T const& t2, float* values)
45164563
{

‎PWGDQ/Tasks/tableReader_withAssoc.cxx‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,13 +1610,14 @@ struct AnalysisSameEventPairing {
16101610
if (fConfigTRPairs) {
16111611
names.push_back(Form("PairsBarrelTRPM_%s", objArray->At(icut)->GetName()));
16121612
names.push_back(Form("PairsBarrelTRPM_ambiguousextra_%s", objArray->At(icut)->GetName()));
1613-
histNames += Form("%s;%s;", names[6].Data(), names[7].Data());
1613+
names.push_back(Form("PairsBarrelTR_MEPM_%s", objArray->At(icut)->GetName()));
1614+
histNames += Form("%s;%s;%s;", names[6].Data(), names[7].Data(), names[8].Data());
16141615
}
16151616
if (fEnableBarrelMixingHistos) {
16161617
names.push_back(Form("PairsBarrelMEPM_%s", objArray->At(icut)->GetName()));
16171618
names.push_back(Form("PairsBarrelMEPP_%s", objArray->At(icut)->GetName()));
16181619
names.push_back(Form("PairsBarrelMEMM_%s", objArray->At(icut)->GetName()));
1619-
histNames += Form("%s;%s;%s;", names[(fConfigTRPairs ? 8 : 6)].Data(), names[(fConfigTRPairs ? 9 : 7)].Data(), names[(fConfigTRPairs ? 10 : 8)].Data());
1620+
histNames += Form("%s;%s;%s;", names[(fConfigTRPairs ? 9 : 6)].Data(), names[(fConfigTRPairs ? 10 : 7)].Data(), names[(fConfigTRPairs ? 11 : 8)].Data());
16201621
}
16211622
fTrackHistNames[icut] = names;
16221623

@@ -2519,6 +2520,20 @@ struct AnalysisSameEventPairing {
25192520
fHistMan->FillHistClass(Form("PairsBarrelMEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
25202521
}
25212522
}
2523+
if (fConfigTRPairs) {
2524+
// mixing event track should be rotated, so second parameter
2525+
if (fConfigNRotations.value != 1 && fConfigNRotations.value != 3) {
2526+
LOGF(fatal, "Unsupported number of rotations: %d, only 1 and 3 are supported", fConfigNRotations.value);
2527+
}
2528+
for (int irot = 1; irot <= fConfigNRotations.value; ++irot) {
2529+
VarManager::FillPairRotation_ME(t2, t1, irot);
2530+
for (int icut = 0; icut < ncuts; icut++) {
2531+
if (mixedTwoTrackFilter & (static_cast<uint32_t>(1) << icut)) {
2532+
fHistMan->FillHistClass(Form("PairsBarrelTR_MEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
2533+
}
2534+
}
2535+
}
2536+
}
25222537
}
25232538
// run ++ pairing
25242539
for (auto const& t2 : poolEvent.tracks1) {
@@ -2549,6 +2564,19 @@ struct AnalysisSameEventPairing {
25492564
fHistMan->FillHistClass(Form("PairsBarrelMEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
25502565
}
25512566
}
2567+
if (fConfigTRPairs) {
2568+
if (fConfigNRotations.value != 1 && fConfigNRotations.value != 3) {
2569+
LOGF(fatal, "Unsupported number of rotations: %d, only 1 and 3 are supported", fConfigNRotations.value);
2570+
}
2571+
for (int irot = 1; irot <= fConfigNRotations.value; ++irot) {
2572+
VarManager::FillPairRotation_ME(t2, t1, irot);
2573+
for (int icut = 0; icut < ncuts; icut++) {
2574+
if (mixedTwoTrackFilter & (static_cast<uint32_t>(1) << icut)) {
2575+
fHistMan->FillHistClass(Form("PairsBarrelTR_MEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
2576+
}
2577+
}
2578+
}
2579+
}
25522580
}
25532581
// run -- pairing
25542582
for (auto const& t2 : poolEvent.tracks2) {

0 commit comments

Comments
 (0)