23 ATH_MSG_ERROR(
"No TruthParticle collection with name " <<
"TruthGen" <<
" found in StoreGate!");
24 return StatusCode::FAILURE;
29 int N_quark_t_all = 0;
30 int N_quark_tbar_all = 0;
31 int N_pt_above_cut = 0;
32 int N_pt_above_cut_plus = 0;
33 int N_pt_above_cut_minus = 0;
35 int foundlepton[6] = {0, 0, 0, 0, 0, 0};
36 int count_found_leptons = 1;
38 count_found_leptons = 2;
41 unsigned int nPart = xTruthParticleContainer->
size();
42 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
44 if (std::abs(pitr->
pdgId()) != 6)
46 if (pitr->
pdgId() == 6)
48 if (pitr->
pdgId() == -6)
55 if (decayVtx->nOutgoingParticles() < 2)
58 for (
size_t thisChild_id = 0; thisChild_id < pitr->
decayVtx()->nOutgoingParticles(); thisChild_id++)
62 if (std::abs(child_mcpart->pdgId()) != 24)
64 if (pitr->
pdgId() == 6)
66 if (pitr->
pdgId() == -6)
69 bool useNextVertex =
false;
70 auto w_decayVtx = child_mcpart->
decayVtx();
73 useNextVertex =
false;
74 for (
size_t w_thisChild_id = 0; w_thisChild_id < w_decayVtx->nOutgoingParticles(); w_thisChild_id++)
78 int grandchild_pid = grandchild_mcpart->
pdgId();
79 ATH_MSG_DEBUG(
"W (t/tbar) has " << w_decayVtx->nOutgoingParticles() <<
" children and the pdgId of the next is " << grandchild_pid);
81 if (std::abs(grandchild_pid) == 24)
83 w_decayVtx = grandchild_mcpart->decayVtx();
95 if (grandchild_pid == -11 && foundlepton[0] < count_found_leptons)
97 if (grandchild_mcpart->pt() >=
m_Ptmin)
101 N_pt_above_cut_minus++;
104 if (grandchild_pid == 11 && foundlepton[1] < count_found_leptons)
106 if (grandchild_mcpart->pt() >=
m_Ptmin)
110 N_pt_above_cut_plus++;
113 if (grandchild_pid == -13 && foundlepton[2] < count_found_leptons)
115 if (grandchild_mcpart->pt() >=
m_Ptmin)
119 N_pt_above_cut_minus++;
122 if (grandchild_pid == 13 && foundlepton[3] < count_found_leptons)
124 if (grandchild_mcpart->pt() >=
m_Ptmin)
128 N_pt_above_cut_plus++;
131 if (grandchild_pid == -15 && foundlepton[4] < count_found_leptons)
133 if (grandchild_mcpart->pt() >=
m_Ptmin)
137 N_pt_above_cut_minus++;
140 if (grandchild_pid == 15 && foundlepton[5] < count_found_leptons)
142 if (grandchild_mcpart->pt() >=
m_Ptmin)
146 N_pt_above_cut_plus++;
158 ATH_MSG_INFO(
"Found " << N_quark_t_all <<
" t quarks in event record");
159 ATH_MSG_INFO(
"Found " << N_quark_tbar_all <<
" tbar quarks in event record");
160 ATH_MSG_INFO(
"Found " << N_quark_t <<
" t -> W X decays");
161 ATH_MSG_INFO(
"Found " << N_quark_tbar <<
" tbar -> W X decays");
162 ATH_MSG_INFO(
"Num leptons from W decays from tops with lepton pt above " <<
m_Ptmin / 1000.0 <<
" Gaudi::Units::GeV/c = " << N_pt_above_cut);
167 if (N_quark_t_all < count_tops || N_quark_tbar_all < count_tops)
170 ATH_MSG_ERROR(
"No t or tbar quarks were found in a (presumably) ttbar event! Event is rejected.");
171 setFilterPassed(
false);
172 return StatusCode::SUCCESS;
175 if (N_quark_t < count_tops || N_quark_tbar < count_tops)
178 ATH_MSG_ERROR(
"No t or tbar quarks were found decaying to W in a (presumably) ttbar event! Event is rejected. Event dump follows.");
181 unsigned int nPart = xTruthParticleContainer->
size();
182 for (
unsigned int iPart = 0; iPart < nPart; ++iPart) {
193 for (
size_t thisChild_id = 0; thisChild_id < mcpart->
decayVtx()->nOutgoingParticles(); thisChild_id++)
197 int child_pid = child_mcpart->
pdgId();
198 ATH_MSG_ERROR(
" child " << part_child <<
" with pdgId = " << child_pid);
202 setFilterPassed(
false);
203 return StatusCode::SUCCESS;
211 ATH_MSG_WARNING(
"More than one t -> W X or tbar -> W X decays found. Event is accepted anyway.");
215 ATH_MSG_WARNING(
"More than one t -> W X or tbar -> W X decays found. Event is accepted anyway.");
217 setFilterPassed(N_pt_above_cut > 0);
224 setFilterPassed((N_pt_above_cut >=
m_numLeptons) && (N_pt_above_cut_plus >= 2 || N_pt_above_cut_minus >= 2));
232 return StatusCode::SUCCESS;