Skip to content

Commit 4b8aa65

Browse files
ayatsujiringoayatsuji
andauthored
[PWGDQ] Track rotation ep preserving mepm rotated legs (#17983)
Co-authored-by: ayatsuji <13807650+asakuratou@user.noreply.gitee.com>
1 parent 91be96c commit 4b8aa65

2 files changed

Lines changed: 82 additions & 3 deletions

File tree

PWGDQ/Core/VarManager.h

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,8 @@ class VarManager : public TObject
14951495
static void FillPair(T1 const& t1, T2 const& t2, float* values = nullptr);
14961496
template <int pairType, uint32_t fillMap, typename T1, typename T2>
14971497
static void FillPairRotation(T1 const& t1, T2 const& t2, int rotation, float* values = nullptr);
1498+
template <typename T>
1499+
static void FillPairRotation_ME(T const& t1, T const& t2, int rotation, float* values = nullptr);
14981500
template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2>
14991501
static void FillPairCollision(C const& collision, T1 const& t1, T2 const& t2, float* values = nullptr);
15001502
template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2, typename M, typename P>
@@ -4084,7 +4086,11 @@ void VarManager::FillPairRotation(T1 const& t1, T2 const& t2, int rotation, floa
40844086
rotationphi2 = 2 * values[kPsi2A] - t2.phi() + o2::constants::math::PI;
40854087
}
40864088

4087-
rotationphi2 = RecoDecay::constrainAngle(rotationphi2);
4089+
if (rotationphi2 >= o2::constants::math::TwoPI) {
4090+
rotationphi2 -= o2::constants::math::TwoPI;
4091+
} else if (rotationphi2 < 0) {
4092+
rotationphi2 += o2::constants::math::TwoPI;
4093+
}
40884094

40894095
values[kCharge] = t1.sign() + t2.sign();
40904096
values[kCharge1] = t1.sign();
@@ -4547,6 +4553,51 @@ void VarManager::FillPairME(T1 const& t1, T2 const& t2, float* values)
45474553
}
45484554
}
45494555

4556+
template <typename T>
4557+
void VarManager::FillPairRotation_ME(T const& t1, T const& t2, int rotation, float* values)
4558+
{
4559+
if (!values) {
4560+
values = fgValues;
4561+
}
4562+
4563+
float m1 = o2::constants::physics::MassElectron;
4564+
double rotationphi2 = t2.phi;
4565+
4566+
if (rotation == 1) {
4567+
rotationphi2 = t2.phi + o2::constants::math::PI;
4568+
} else if (rotation == 2) {
4569+
rotationphi2 = 2 * values[kPsi2A] - t2.phi;
4570+
} else if (rotation == 3) {
4571+
rotationphi2 = 2 * values[kPsi2A] - t2.phi + o2::constants::math::PI;
4572+
}
4573+
4574+
if (rotationphi2 >= o2::constants::math::TwoPI) {
4575+
rotationphi2 -= o2::constants::math::TwoPI;
4576+
} else if (rotationphi2 < 0) {
4577+
rotationphi2 += o2::constants::math::TwoPI;
4578+
}
4579+
4580+
ROOT::Math::PtEtaPhiMVector v1(t1.pt, t1.eta, t1.phi, m1);
4581+
ROOT::Math::PtEtaPhiMVector v2(t2.pt, t2.eta, rotationphi2, m1);
4582+
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
4583+
values[kMass] = v12.M();
4584+
values[kPt] = v12.Pt();
4585+
values[kEta] = v12.Eta();
4586+
// values[kPhi] = v12.Phi();
4587+
values[kPhi] = RecoDecay::constrainAngle(v12.Phi());
4588+
values[kRap] = -v12.Rapidity();
4589+
double Ptot1 = TMath::Sqrt(v1.Px() * v1.Px() + v1.Py() * v1.Py() + v1.Pz() * v1.Pz());
4590+
double Ptot2 = TMath::Sqrt(v2.Px() * v2.Px() + v2.Py() * v2.Py() + v2.Pz() * v2.Pz());
4591+
values[kDeltaPtotTracks] = Ptot1 - Ptot2;
4592+
4593+
values[kPt1] = t1.pt;
4594+
values[kEta1] = t1.eta;
4595+
values[kPhi1] = t1.phi;
4596+
values[kPt2] = t2.pt;
4597+
values[kEta2] = t2.eta;
4598+
values[kPhi2] = rotationphi2;
4599+
}
4600+
45504601
template <typename T>
45514602
void VarManager::FillPairMEAcrossTFs(T const& t1, T const& t2, float* values)
45524603
{

PWGDQ/Tasks/tableReader_withAssoc.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,13 +1608,14 @@ struct AnalysisSameEventPairing {
16081608
if (fConfigTRPairs) {
16091609
names.push_back(Form("PairsBarrelTRPM_%s", objArray->At(icut)->GetName()));
16101610
names.push_back(Form("PairsBarrelTRPM_ambiguousextra_%s", objArray->At(icut)->GetName()));
1611-
histNames += Form("%s;%s;", names[6].Data(), names[7].Data());
1611+
names.push_back(Form("PairsBarrelTR_MEPM_%s", objArray->At(icut)->GetName()));
1612+
histNames += Form("%s;%s;%s;", names[6].Data(), names[7].Data(), names[8].Data());
16121613
}
16131614
if (fEnableBarrelMixingHistos) {
16141615
names.push_back(Form("PairsBarrelMEPM_%s", objArray->At(icut)->GetName()));
16151616
names.push_back(Form("PairsBarrelMEPP_%s", objArray->At(icut)->GetName()));
16161617
names.push_back(Form("PairsBarrelMEMM_%s", objArray->At(icut)->GetName()));
1617-
histNames += Form("%s;%s;%s;", names[(fConfigTRPairs ? 8 : 6)].Data(), names[(fConfigTRPairs ? 9 : 7)].Data(), names[(fConfigTRPairs ? 10 : 8)].Data());
1618+
histNames += Form("%s;%s;%s;", names[(fConfigTRPairs ? 9 : 6)].Data(), names[(fConfigTRPairs ? 10 : 7)].Data(), names[(fConfigTRPairs ? 11 : 8)].Data());
16181619
}
16191620
fTrackHistNames[icut] = names;
16201621

@@ -2534,6 +2535,20 @@ struct AnalysisSameEventPairing {
25342535
fHistMan->FillHistClass(Form("PairsBarrelMEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
25352536
}
25362537
}
2538+
if (fConfigTRPairs) {
2539+
// mixing event track should be rotated, so second parameter
2540+
if (fConfigNRotations.value != 1 && fConfigNRotations.value != 3) {
2541+
LOGF(fatal, "Unsupported number of rotations: %d, only 1 and 3 are supported", fConfigNRotations.value);
2542+
}
2543+
for (int irot = 1; irot <= fConfigNRotations.value; ++irot) {
2544+
VarManager::FillPairRotation_ME(t2, t1, irot);
2545+
for (int icut = 0; icut < ncuts; icut++) {
2546+
if (mixedTwoTrackFilter & (static_cast<uint32_t>(1) << icut)) {
2547+
fHistMan->FillHistClass(Form("PairsBarrelTR_MEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
2548+
}
2549+
}
2550+
}
2551+
}
25372552
}
25382553
// run ++ pairing
25392554
for (auto const& t2 : poolEvent.tracks1) {
@@ -2564,6 +2579,19 @@ struct AnalysisSameEventPairing {
25642579
fHistMan->FillHistClass(Form("PairsBarrelMEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
25652580
}
25662581
}
2582+
if (fConfigTRPairs) {
2583+
if (fConfigNRotations.value != 1 && fConfigNRotations.value != 3) {
2584+
LOGF(fatal, "Unsupported number of rotations: %d, only 1 and 3 are supported", fConfigNRotations.value);
2585+
}
2586+
for (int irot = 1; irot <= fConfigNRotations.value; ++irot) {
2587+
VarManager::FillPairRotation_ME(t2, t1, irot);
2588+
for (int icut = 0; icut < ncuts; icut++) {
2589+
if (mixedTwoTrackFilter & (static_cast<uint32_t>(1) << icut)) {
2590+
fHistMan->FillHistClass(Form("PairsBarrelTR_MEPM_%s", fTrackCuts[icut].Data()), dqtablereader_helpers::varValues());
2591+
}
2592+
}
2593+
}
2594+
}
25672595
}
25682596
// run -- pairing
25692597
for (auto const& t2 : poolEvent.tracks2) {

0 commit comments

Comments
 (0)