7 #include "GaudiKernel/PhysicalConstants.h"
14 ISvcLocator* pSvcLocator)
26 return StatusCode::SUCCESS;
32 const EventContext& context = Gaudi::Hive::currentContext();
34 xTruthParticleContainerReadHandle(
36 if (!xTruthParticleContainerReadHandle.
isValid()) {
37 ATH_MSG_ERROR(
"Could not retrieve xAOD::TruthParticleContainer with key:"
40 return StatusCode::FAILURE;
43 unsigned int nParticles = xTruthParticleContainerReadHandle->
size();
45 for (
unsigned int iPart = 0; iPart < nParticles; ++iPart) {
47 (*xTruthParticleContainerReadHandle)[iPart];
48 int pdgId1 = lightLeptonParticle->
pdgId();
54 if (lightLeptonParticle->
pt() <
m_minPt ||
59 for (
unsigned int iPart2 = iPart + 1; iPart2 < nParticles; ++iPart2) {
61 (*xTruthParticleContainerReadHandle)[iPart2];
62 int pdgId2 = lightLeptonParticle2->
pdgId();
63 if ( !
MC::isStable(lightLeptonParticle) || iPart == iPart2)
67 lightLeptonParticle2->
isMuon()))
69 if (lightLeptonParticle2->
pt() <
m_minPt ||
73 for (
unsigned int iPart3 = iPart2 + 1; iPart3 < nParticles; ++iPart3) {
75 (*xTruthParticleContainerReadHandle)[iPart3];
76 int pdgId3 = lightLeptonParticle3->
pdgId();
77 if (!
MC::isStable(lightLeptonParticle) || iPart == iPart3 ||
82 lightLeptonParticle3->
isMuon()))
84 if (lightLeptonParticle3->
pt() <
m_minPt ||
88 for (
unsigned int iPart4 = iPart3 + 1; iPart4 < nParticles; ++iPart4) {
90 (*xTruthParticleContainerReadHandle)[iPart4];
91 int pdgId4 = lightLeptonParticle4->
pdgId();
92 if (!
MC::isStable(lightLeptonParticle) || iPart == iPart4 ||
93 iPart2 == iPart4 || iPart3 == iPart4)
97 lightLeptonParticle4->
isMuon()))
99 if (lightLeptonParticle4->
pt() <
m_minPt ||
102 decltype(lightLeptonParticle) apitr[4] = {
103 lightLeptonParticle, lightLeptonParticle2, lightLeptonParticle3,
104 lightLeptonParticle4};
105 int pdgIds[4] = {pdgId1, pdgId2, pdgId3, pdgId4};
106 for (
int ii = 0; ii < 4; ii++) {
107 for (
int jj = 0; jj < 4; jj++) {
110 for (
int kk = 0;
kk < 4;
kk++) {
111 if (
kk == jj ||
kk == ii)
113 for (
int ll = 0;
ll < 4;
ll++) {
114 if (
ll ==
kk ||
ll == jj ||
ll == ii)
117 (std::abs(pdgIds[ii]) != std::abs(pdgIds[jj]) ||
118 std::abs(pdgIds[
kk]) != std::abs(pdgIds[
ll])))
121 pdgIds[
kk] * pdgIds[
ll] > 0.))
124 HepMC::FourVector
vec(
125 ((apitr[ii]))->
px() + ((apitr[jj]))->
px(),
126 ((apitr[ii]))->
py() + ((apitr[jj]))->
py(),
127 ((apitr[ii]))->
pz() + ((apitr[jj]))->
pz(),
128 ((apitr[ii]))->
e() + ((apitr[jj]))->
e());
129 double invMass1 =
vec.m();
130 if (invMass1 < m_minMass1 || invMass1 >
m_maxMass1)
134 HepMC::FourVector
vec2(
135 ((apitr[
kk]))->
px() + ((apitr[
ll]))->
px(),
136 ((apitr[
kk]))->
py() + ((apitr[
ll]))->
py(),
137 ((apitr[
kk]))->
pz() + ((apitr[
ll]))->
pz(),
138 ((apitr[
kk]))->
e() + ((apitr[
ll]))->
e());
139 double invMass2 =
vec2.m();
140 if (invMass2 < m_minMass2 || invMass2 >
m_maxMass2)
143 return StatusCode::SUCCESS;
152 setFilterPassed(
false);
153 return StatusCode::SUCCESS;