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 @@ -1841,9 +1843,9 @@
values[kX] = globalRefit.getX();
values[kY] = globalRefit.getY();
values[kZ] = globalRefit.getZ();
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();

Check failure on line 1848 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[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 @@ -4708,13 +4772,13 @@
auto x2x01 = static_cast<float>(geoMan1.meanX2X0);
auto x2x02 = static_cast<float>(geoMan2.meanX2X0);
float B[3];
float xyz[3] = {0, 0, 0};

Check failure on line 4775 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.
KFGeoTwoProng.GetFieldValue(xyz, B);
// TODO: find better soluton to handle cases where KF outputs negative variances
/*float covXX = 0.1;

Check failure on line 4778 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 covYY = 0.1;
if (KFGeoTwoProng.GetCovariance(0, 0) > 0) {
covXX = KFGeoTwoProng.GetCovariance(0, 0);

Check failure on line 4781 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.
}
if (KFGeoTwoProng.GetCovariance(1, 1) > 0) {
covYY = KFGeoTwoProng.GetCovariance(0, 0);
Expand Down Expand Up @@ -5118,13 +5182,13 @@
ROOT::Math::PtEtaPhiMVector v123 = vdilepton + v3;
values[VarManager::kPairMass] = v123.M();
values[VarManager::kMassDau] = mtrack;
values[VarManager::kDeltaMass] = v123.M() - v12.M();

Check failure on line 5185 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::kPairPt] = v123.Pt();
values[VarManager::kPairRap] = -v123.Rapidity();
values[VarManager::kPairEta] = v123.Eta();

Check failure on line 5188 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.
if (fgUsedVars[kPairMassDau] || fgUsedVars[kPairPtDau]) {
values[VarManager::kPairMassDau] = v12.M();
values[VarManager::kPairPtDau] = v12.Pt();

Check failure on line 5191 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::kPt] = track.pt();
values[kS12] = (v1 + v2).M2();
Expand Down Expand Up @@ -5375,7 +5439,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;
values[kCORR2REF] = (norm(compA21) - S12A) / values[kM11REF];

Check failure on line 5442 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[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];
values[kM11REF] = std::isnan(values[kM11REF]) || std::isinf(values[kM11REF]) || std::isnan(values[kCORR2REF]) || std::isinf(values[kCORR2REF]) ? 0 : values[kM11REF];
Expand Down
80 changes: 76 additions & 4 deletions PWGDQ/Tasks/tableReader_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,10 @@
Configurable<std::string> fConfigAddJSONHistograms{"cfgAddJSONHistograms", "", "Histograms in JSON format"};
Configurable<bool> fConfigQA{"cfgQA", true, "If true, fill output histograms"};
Configurable<bool> fConfigAmbiguousMuonHistograms{"cfgAmbiguousMuonHistograms", true, "If true, fill ambiguous histograms"};

Check failure on line 1283 in PWGDQ/Tasks/tableReader_withAssoc.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
//option for TR pair fill
Configurable<bool> fConfigTRPairs{"cfgFillTRPairs", false, "If true, fill Track rotation pairs"};
Configurable<int> fConfigNRotations{"cfgNRotations", 20, "Number of rotations for track rotation method"};

struct : ConfigurableGroup {
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Expand Down Expand Up @@ -1469,19 +1473,22 @@

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 +2134,71 @@
} // end loop (pair cuts)
}
} // end loop (cuts)

// edit
// rotation 20 times
if (fConfigTRPairs) {
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 < fConfigNRotations.value; 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