44 return StatusCode::FAILURE;
49 auto jets = std::make_unique<xAOD::JetContainer>();
50 auto jetsAux = std::make_unique<xAOD::JetAuxContainer>();
51 jets->setStore(jetsAux.get());
53 TLorentzVector lj, slj, tlj;
55 double jet_radius = 0.4;
58 std::vector<TLorentzVector> ttbarDecayProducts;
59 std::vector<int> decayProduct_pdgID;
61 for(
const auto* p : *truth){
66 if(std::abs(pdg) != 5 && std::abs(pdg) != 24)
72 for(
unsigned int ip = 0; ip < p->nParents(); ++ip){
75 if(parent && parent->absPdgId() == 6){
81 if(!fromTop)
continue;
83 vec.SetPtEtaPhiM(p->pt(), p->eta(), p->phi(), p->m());
85 ttbarDecayProducts.push_back(
vec);
86 decayProduct_pdgID.push_back(pdg);
89 bool ok =
extrajet(truth.
cptr(), lj, slj, tlj, ttbarDecayProducts, decayProduct_pdgID, jet_radius, min_pT);
92 auto saveJet = [&](
const TLorentzVector& v) {
93 if(v.Pt() <= 0)
return;
113 return StatusCode::SUCCESS;
160 const std::vector<TLorentzVector>& ttbarDecayProducts,
161 const std::vector<int>& decayProduct_pdgID,
163 double pt_min)
const {
166 const bool exclude_topdecay =
true;
167 std::vector<fastjet::PseudoJet> vec_status62;
173 if (particle->absPdgId() > 80 || (particle->absPdgId() > 22 && particle->absPdgId() < 38))
continue;
177 if((particle->status()==11 || particle->status()==71) && particle->absPdgId()!=6 ){
188 if (exclude_topdecay)
192 topParent = topParent->
parent(0);
204 fastjet::PseudoJet tmp(particle->px(), particle->py(), particle->pz(), particle->e());
205 vec_status62.push_back(tmp);
212 fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, Rparam, fastjet::E_scheme, fastjet::Best);
214 std::vector <fastjet::PseudoJet> inclusivePertJet62, sortedPertJet62;
216 fastjet::ClusterSequence clustSeqPertJet62(vec_status62, jetDef);
218 inclusivePertJet62 = clustSeqPertJet62.inclusive_jets(pt_min * 1000.);
219 sortedPertJet62 = fastjet::sorted_by_pt(inclusivePertJet62);
222 if(inclusivePertJet62.size()==0){
227 if (inclusivePertJet62.size()!=0)
230 for (
long unsigned int i = 0; i < ttbarDecayProducts.size(); ++i)
232 for (
long unsigned int j = 0; j < sortedPertJet62.size(); ++j)
234 if (sortedPertJet62.at(j).delta_R(ttbarDecayProducts[i]) <= 0.4
235 && std::abs(decayProduct_pdgID[i]) != 11
236 && std::abs(decayProduct_pdgID[i]) != 12
237 && std::abs(decayProduct_pdgID[i]) != 13
238 && std::abs(decayProduct_pdgID[i]) != 14
240 && std::abs(decayProduct_pdgID[i]) != 16
244 sortedPertJet62.erase(sortedPertJet62.begin() + j);
252 bool leading_jet_found =
false;
260 for (std::vector<fastjet::PseudoJet>::iterator
jet = sortedPertJet62.begin();
jet != sortedPertJet62.end(); ++
jet)
262 if(!leading_jet_found){
264 leading_jet_found =
true;
284 if (lj.Pt() >= pt_min*1000.)
return true;
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
int absPdgId() const
Absolute PDG ID code (often useful).
size_t nParents() const
Number of parents of this particle.
size_t nChildren() const
Number of children of this particle.