Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions PWGDQ/Core/VarManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,8 @@
static void FillGlobalMuonRefitCov(T1 const& muontrack, T2 const& mfttrack, const C& collision, C2 const& mftcov, float* values = nullptr);
template <int pairType, uint32_t fillMap, typename T1, typename T2>
static void FillPair(T1 const& t1, T2 const& t2, float* values = nullptr);
template <int pairType, uint32_t fillMap, typename T1, typename T2>
static void FillPairRotation(T1 const& t1, T2 const& t2, float* values = nullptr);
template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2>
static void FillPairCollision(C const& collision, T1 const& t1, T2 const& t2, float* values = nullptr);
template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2, typename M, typename P>
Expand Down Expand Up @@ -1840,9 +1842,9 @@
o2::dataformats::GlobalFwdTrack globalRefit = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft);
values[kX] = globalRefit.getX();
values[kY] = globalRefit.getY();
values[kZ] = globalRefit.getZ();

Check failure on line 1845 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[kTgl] = globalRefit.getTgl();

Check failure on line 1846 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[kPt] = globalRefit.getPt();

Check failure on line 1847 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[kPz] = globalRefit.getPz();
values[kEta] = globalRefit.getEta();
values[kPhi] = globalRefit.getPhi();
Expand Down Expand Up @@ -3711,6 +3713,68 @@
}
}

// change_start: rotation pair
template <int pairType, uint32_t fillMap, typename T1, typename T2>
void VarManager::FillPairRotation(T1 const& t1, T2 const& t2, float* values)
{
if (!values) {
values = fgValues;
}

float m1 = o2::constants::physics::MassElectron;
float m2 = o2::constants::physics::MassElectron;
if constexpr (pairType == kDecayToMuMu) {
m1 = o2::constants::physics::MassMuon;
m2 = o2::constants::physics::MassMuon;
}

if constexpr (pairType == kDecayToPiPi) {
m1 = o2::constants::physics::MassPionCharged;
m2 = o2::constants::physics::MassPionCharged;
}

if constexpr (pairType == kDecayToKPi) {
m1 = o2::constants::physics::MassKaonCharged;
m2 = o2::constants::physics::MassPionCharged;
// Make the TPC information of the kaon available for pair histograms
values[kPin_leg1] = t1.tpcInnerParam();
values[kTPCnSigmaKa_leg1] = t1.tpcNSigmaKa();
}

if constexpr (pairType == kElectronMuon) {
m2 = o2::constants::physics::MassMuon;
}

double dphi = gRandom->Uniform(0., 2. * TMath::Pi());
double rotationphi2 = t2.phi() + dphi;

if (rotationphi2 > 2. * TMath::Pi())
rotationphi2 -= 2. * TMath::Pi();

values[kCharge] = t1.sign() + t2.sign();
values[kCharge1] = t1.sign();
values[kCharge2] = t2.sign();
ROOT::Math::PtEtaPhiMVector v1(t1.pt(), t1.eta(), t1.phi(), m1);
ROOT::Math::PtEtaPhiMVector v2(t2.pt(), t2.eta(), rotationphi2, m2);
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
values[kMass] = v12.M();
values[kPt] = v12.Pt();
values[kEta] = v12.Eta();
// values[kPhi] = v12.Phi();
values[kPhi] = v12.Phi() > 0 ? v12.Phi() : v12.Phi() + 2. * M_PI;
values[kRap] = -v12.Rapidity();
double Ptot1 = TMath::Sqrt(v1.Px() * v1.Px() + v1.Py() * v1.Py() + v1.Pz() * v1.Pz());
double Ptot2 = TMath::Sqrt(v2.Px() * v2.Px() + v2.Py() * v2.Py() + v2.Pz() * v2.Pz());
values[kDeltaPtotTracks] = Ptot1 - Ptot2;

values[kPt1] = t1.pt();
values[kEta1] = t1.eta();
values[kPhi1] = t1.phi();
values[kPt2] = t2.pt();
values[kEta2] = t2.eta();
values[kPhi2] = rotationphi2;
}

template <int pairType, uint32_t fillMap, typename C, typename T1, typename T2>
void VarManager::FillPairCollision(const C& collision, T1 const& t1, T2 const& t2, float* values)
{
Expand Down Expand Up @@ -4707,13 +4771,13 @@
auto geoMan2 = o2::base::GeometryManager::meanMaterialBudget(t2.x(), t2.y(), t2.z(), KFGeoTwoProng.GetX(), KFGeoTwoProng.GetY(), KFGeoTwoProng.GetZ());
auto x2x01 = static_cast<float>(geoMan1.meanX2X0);
auto x2x02 = static_cast<float>(geoMan2.meanX2X0);
float B[3];

Check failure on line 4774 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
float xyz[3] = {0, 0, 0};
KFGeoTwoProng.GetFieldValue(xyz, B);
// TODO: find better soluton to handle cases where KF outputs negative variances

Check failure on line 4777 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
/*float covXX = 0.1;
float covYY = 0.1;
if (KFGeoTwoProng.GetCovariance(0, 0) > 0) {

Check failure on line 4780 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
covXX = KFGeoTwoProng.GetCovariance(0, 0);
}
if (KFGeoTwoProng.GetCovariance(1, 1) > 0) {
Expand Down Expand Up @@ -5117,13 +5181,13 @@
ROOT::Math::PtEtaPhiMVector vdilepton(v12.pt(), v12.eta(), v12.phi(), v12.M());
ROOT::Math::PtEtaPhiMVector v123 = vdilepton + v3;
values[VarManager::kPairMass] = v123.M();
values[VarManager::kMassDau] = mtrack;

Check failure on line 5184 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[VarManager::kDeltaMass] = v123.M() - v12.M();
values[VarManager::kPairPt] = v123.Pt();
values[VarManager::kPairRap] = -v123.Rapidity();

Check failure on line 5187 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[VarManager::kPairEta] = v123.Eta();
if (fgUsedVars[kPairMassDau] || fgUsedVars[kPairPtDau]) {
values[VarManager::kPairMassDau] = v12.M();

Check failure on line 5190 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[VarManager::kPairPtDau] = v12.Pt();
}
values[VarManager::kPt] = track.pt();
Expand Down Expand Up @@ -5374,7 +5438,7 @@

// Fill necessary quantities for cumulant calculations with weighted Q-vectors
values[kM11REF] = S21A - S12A;
values[kM1111REF] = S41A - 6. * S12A * S21A + 8. * S13A * S11A + 3. * S22A - 6. * S14A;

Check failure on line 5441 in PWGDQ/Core/VarManager.h

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
values[kCORR2REF] = (norm(compA21) - S12A) / values[kM11REF];
values[kCORR4REF] = (pow(norm(compA21), 2) + norm(compA42) - 2. * (compA42 * conj(compA21) * conj(compA21)).real() + 8. * (compA23 * conj(compA21)).real() - 4. * S12A * norm(compA21) - 6. * S14A + 2. * S22A) / values[kM1111REF];
values[kCORR2REF] = std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kCORR2REF];
Expand Down
74 changes: 70 additions & 4 deletions PWGDQ/Tasks/tableReader_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1469,19 +1469,22 @@ struct AnalysisSameEventPairing {

if (fEnableBarrelHistos) {
names = {
// change define histname
Form("PairsBarrelSEPM_%s", objArray->At(icut)->GetName()),
Form("PairsBarrelSEPP_%s", objArray->At(icut)->GetName()),
Form("PairsBarrelSEMM_%s", objArray->At(icut)->GetName())};
histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data());
Form("PairsBarrelSEMM_%s", objArray->At(icut)->GetName()),
Form("PairsBarrelTRPM_%s", objArray->At(icut)->GetName())};
histNames += Form("%s;%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data(), names[3].Data());
names.push_back(Form("PairsBarrelSEPM_ambiguousextra_%s", objArray->At(icut)->GetName()));
names.push_back(Form("PairsBarrelSEPP_ambiguousextra_%s", objArray->At(icut)->GetName()));
names.push_back(Form("PairsBarrelSEMM_ambiguousextra_%s", objArray->At(icut)->GetName()));
histNames += Form("%s;%s;%s;", names[3].Data(), names[4].Data(), names[5].Data());
names.push_back(Form("PairsBarrelTRPM_ambiguousextra_%s", objArray->At(icut)->GetName()));
histNames += Form("%s;%s;%s;%s;", names[4].Data(), names[5].Data(), names[6].Data(), names[7].Data());
if (fEnableBarrelMixingHistos) {
names.push_back(Form("PairsBarrelMEPM_%s", objArray->At(icut)->GetName()));
names.push_back(Form("PairsBarrelMEPP_%s", objArray->At(icut)->GetName()));
names.push_back(Form("PairsBarrelMEMM_%s", objArray->At(icut)->GetName()));
histNames += Form("%s;%s;%s;", names[6].Data(), names[7].Data(), names[8].Data());
histNames += Form("%s;%s;%s;", names[8].Data(), names[9].Data(), names[10].Data());
}
fTrackHistNames[icut] = names;

Expand Down Expand Up @@ -2127,6 +2130,69 @@ struct AnalysisSameEventPairing {
} // end loop (pair cuts)
}
} // end loop (cuts)

// edit
// rotation 20 times
if constexpr (TPairType == VarManager::kDecayToEE) {
twoTrackFilter = a1.isBarrelSelected_raw() & a2.isBarrelSelected_raw() & a1.isBarrelSelectedPrefilter_raw() & a2.isBarrelSelectedPrefilter_raw() & fTrackFilterMask;

if (!twoTrackFilter) { // the tracks must have at least one filter bit in common to continue
continue;
}

auto t1 = a1.template reducedtrack_as<TTracks>();
auto t2 = a2.template reducedtrack_as<TTracks>();
sign1 = t1.sign();
sign2 = t2.sign();
if (t1.barrelAmbiguityInBunch() > 1) {
twoTrackFilter |= (static_cast<uint32_t>(1) << 28);
}
if (t2.barrelAmbiguityInBunch() > 1) {
twoTrackFilter |= (static_cast<uint32_t>(1) << 29);
}
if (t1.barrelAmbiguityOutOfBunch() > 1) {
twoTrackFilter |= (static_cast<uint32_t>(1) << 30);
}
if (t2.barrelAmbiguityOutOfBunch() > 1) {
twoTrackFilter |= (static_cast<uint32_t>(1) << 31);
}

for (int icut = 0; icut < ncuts; icut++) {
if (twoTrackFilter & (static_cast<uint32_t>(1) << icut)) {
isAmbiInBunch = (twoTrackFilter & (static_cast<uint32_t>(1) << 28)) || (twoTrackFilter & (static_cast<uint32_t>(1) << 29));
isAmbiOutOfBunch = (twoTrackFilter & (static_cast<uint32_t>(1) << 30)) || (twoTrackFilter & (static_cast<uint32_t>(1) << 31));
isUnambiguous = !(isAmbiInBunch || isAmbiOutOfBunch);
isLeg1Ambi = (twoTrackFilter & (static_cast<uint32_t>(1) << 28) || (twoTrackFilter & (static_cast<uint32_t>(1) << 30)));
isLeg2Ambi = (twoTrackFilter & (static_cast<uint32_t>(1) << 29) || (twoTrackFilter & (static_cast<uint32_t>(1) << 31)));
if constexpr (TPairType == VarManager::kDecayToEE) {
if (isLeg1Ambi && isLeg2Ambi) {
std::pair<uint32_t, uint32_t> iPair(a1.reducedtrackId(), a2.reducedtrackId());
if (fAmbiguousPairs.find(iPair) != fAmbiguousPairs.end()) {
if (fAmbiguousPairs[iPair] & (static_cast<uint32_t>(1) << icut)) { // if this pair is already stored with this cut
isAmbiExtra = true;
} else {
fAmbiguousPairs[iPair] |= static_cast<uint32_t>(1) << icut;
}
} else {
fAmbiguousPairs[iPair] = static_cast<uint32_t>(1) << icut;
}
}
}
if (sign1 * sign2 < 0) {
for (int i = 0; i < 20; i++) {
VarManager::FillPairRotation<TPairType, TTrackFillMap>(t1, t2);
if constexpr (TPairType == VarManager::kDecayToEE) {
fHistMan->FillHistClass(Form("PairsBarrelTRPM_%s", fTrackCuts[icut].Data()), VarManager::fgValues);
if (isAmbiExtra) {
fHistMan->FillHistClass(Form("PairsBarrelTRPM_ambiguousextra_%s", fTrackCuts[icut].Data()), VarManager::fgValues);
}
}
}
}
}
}
}
// end
} // end loop over pairs of track associations
VarManager::fgValues[VarManager::kNPairsPerEvent] = fNPairPerEvent;
if (fEnableBarrelHistos && fConfigQA) {
Expand Down
Loading