Skip to content

Commit 3e65e30

Browse files
author
Stefanie Mrozinski
committed
Bug fix: e+/e- assignement in efficiency correctly implemented
1 parent 3373a98 commit 3e65e30

1 file changed

Lines changed: 51 additions & 53 deletions

File tree

PWGEM/PhotonMeson/Tasks/photonhbt.cxx

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ struct Photonhbt {
302302
Configurable<float> cfgMaxAsymmetry{"cfgMaxAsymmetry", -1.f, "max |p_{T, 1} - p_{T, 2}|/(p_{T, 1} + p_{T, 2}) asymmetry cut"};
303303
} ggpaircuts;
304304

305-
306-
307305
EMPhotonEventCut fEMEventCut;
308306
struct : ConfigurableGroup {
309307
std::string prefix = "eventcut_group";
@@ -601,19 +599,19 @@ struct Photonhbt {
601599
};
602600

603601
struct PhotonWithLegs {
604-
float fPt{0}, fEta{0}, fPhi{0};
605-
float fVx{0}, fVy{0}, fVz{0};
606-
std::array<float, 2> fLegPt{}, fLegEta{}, fLegPhi{}; // [0] = e+, [1] = e-
607-
float pt() const { return fPt; }
608-
float eta() const { return fEta; }
609-
float phi() const { return fPhi; }
610-
float vx() const { return fVx; }
611-
float vy() const { return fVy; }
612-
float vz() const { return fVz; }
613-
float legEta(int i) const { return fLegEta[i]; }
614-
float legPhi(int i) const { return fLegPhi[i]; }
615-
float legPt(int i) const { return fLegPt[i]; }
616-
};
602+
float fPt{0}, fEta{0}, fPhi{0};
603+
float fVx{0}, fVy{0}, fVz{0};
604+
std::array<float, 2> fLegPt{}, fLegEta{}, fLegPhi{}; // [0] = e+, [1] = e-
605+
float pt() const { return fPt; }
606+
float eta() const { return fEta; }
607+
float phi() const { return fPhi; }
608+
float vx() const { return fVx; }
609+
float vy() const { return fVy; }
610+
float vz() const { return fVz; }
611+
float legEta(int i) const { return fLegEta[i]; }
612+
float legPhi(int i) const { return fLegPhi[i]; }
613+
float legPt(int i) const { return fLegPt[i]; }
614+
};
617615

618616
std::map<std::tuple<int, int, int, int>, std::deque<std::vector<TruthGamma>>> truthGammaPool;
619617

@@ -1842,23 +1840,23 @@ struct Photonhbt {
18421840
pos1.eta(), ele1.eta(),
18431841
pos2.eta(), ele2.eta()),
18441842
obs.deta, obs.dphi, obs.kt);
1845-
auto addToPool = [&](auto const& g, auto const& pos, auto const& ele) {
1846-
if (usedPhotonIdsPerCol.insert(g.globalIndex()).second) {
1847-
PhotonWithLegs p;
1848-
p.fPt = g.pt();
1849-
p.fEta = g.eta();
1850-
p.fPhi = g.phi();
1851-
p.fVx = g.vx();
1852-
p.fVy = g.vy();
1853-
p.fVz = g.vz();
1854-
p.fLegPt = {static_cast<float>(pos.pt()), static_cast<float>(ele.pt())};
1855-
p.fLegEta = {static_cast<float>(pos.eta()), static_cast<float>(ele.eta())};
1856-
p.fLegPhi = {static_cast<float>(pos.phi()), static_cast<float>(ele.phi())};
1857-
emh1->AddTrackToEventPool(keyDFCollision, p);
1858-
}
1859-
};
1860-
addToPool(g1, pos1, ele1);
1861-
addToPool(g2, pos2, ele2);
1843+
auto addToPool = [&](auto const& g, auto const& pos, auto const& ele) {
1844+
if (usedPhotonIdsPerCol.insert(g.globalIndex()).second) {
1845+
PhotonWithLegs p;
1846+
p.fPt = g.pt();
1847+
p.fEta = g.eta();
1848+
p.fPhi = g.phi();
1849+
p.fVx = g.vx();
1850+
p.fVy = g.vy();
1851+
p.fVz = g.vz();
1852+
p.fLegPt = {static_cast<float>(pos.pt()), static_cast<float>(ele.pt())};
1853+
p.fLegEta = {static_cast<float>(pos.eta()), static_cast<float>(ele.eta())};
1854+
p.fLegPhi = {static_cast<float>(pos.phi()), static_cast<float>(ele.phi())};
1855+
emh1->AddTrackToEventPool(keyDFCollision, p);
1856+
}
1857+
};
1858+
addToPool(g1, pos1, ele1);
1859+
addToPool(g2, pos2, ele2);
18621860
}
18631861
if (qaflags.doSinglePhotonQa) {
18641862
for (const auto& g : photons1Coll) {
@@ -2077,23 +2075,23 @@ addToPool(g2, pos2, ele2);
20772075
}
20782076
}
20792077

2080-
auto addToPool = [&](auto const& g, auto const& pos, auto const& ele) {
2081-
if (usedPhotonIdsPerCol.insert(g.globalIndex()).second) {
2082-
PhotonWithLegs p;
2083-
p.fPt = g.pt();
2084-
p.fEta = g.eta();
2085-
p.fPhi = g.phi();
2086-
p.fVx = g.vx();
2087-
p.fVy = g.vy();
2088-
p.fVz = g.vz();
2089-
p.fLegPt = {static_cast<float>(pos.pt()), static_cast<float>(ele.pt())};
2090-
p.fLegEta = {static_cast<float>(pos.eta()), static_cast<float>(ele.eta())};
2091-
p.fLegPhi = {static_cast<float>(pos.phi()), static_cast<float>(ele.phi())};
2092-
emh1->AddTrackToEventPool(keyDFCollision, p);
2093-
}
2094-
};
2095-
addToPool(g1, pos1, ele1);
2096-
addToPool(g2, pos2, ele2);
2078+
auto addToPool = [&](auto const& g, auto const& pos, auto const& ele) {
2079+
if (usedPhotonIdsPerCol.insert(g.globalIndex()).second) {
2080+
PhotonWithLegs p;
2081+
p.fPt = g.pt();
2082+
p.fEta = g.eta();
2083+
p.fPhi = g.phi();
2084+
p.fVx = g.vx();
2085+
p.fVy = g.vy();
2086+
p.fVz = g.vz();
2087+
p.fLegPt = {static_cast<float>(pos.pt()), static_cast<float>(ele.pt())};
2088+
p.fLegEta = {static_cast<float>(pos.eta()), static_cast<float>(ele.eta())};
2089+
p.fLegPhi = {static_cast<float>(pos.phi()), static_cast<float>(ele.phi())};
2090+
emh1->AddTrackToEventPool(keyDFCollision, p);
2091+
}
2092+
};
2093+
addToPool(g1, pos1, ele1);
2094+
addToPool(g2, pos2, ele2);
20972095
}
20982096
if (qaflags.doSinglePhotonQa) {
20992097
for (const auto& g : photonsColl) {
@@ -2276,10 +2274,10 @@ addToPool(g2, pos2, ele2);
22762274
continue;
22772275
}
22782276
const auto d = emmcParticles.iteratorAt(dId);
2279-
if (d.pdgCode() == kElectron) {
2277+
if (d.pdgCode() == kPositron) {
22802278
posId = dId;
22812279
rTrue = std::sqrt(d.vx() * d.vx() + d.vy() * d.vy());
2282-
} else if (d.pdgCode() == kPositron) {
2280+
} else if (d.pdgCode() == kElectron) {
22832281
negId = dId;
22842282
}
22852283
}
@@ -2537,8 +2535,8 @@ addToPool(g2, pos2, ele2);
25372535
poolBin.pop_front();
25382536
}
25392537
} // end cfgDoTruthMix
2540-
} // end collision loop
2541-
} // end runTruthEfficiency
2538+
} // end collision loop
2539+
} // end runTruthEfficiency
25422540

25432541
using MyEMH = o2::aod::pwgem::dilepton::utils::EventMixingHandler<
25442542
std::tuple<int, int, int, int>, std::pair<int, int>, PhotonWithLegs>;

0 commit comments

Comments
 (0)