43 return StatusCode::FAILURE;
48 auto jets = std::make_unique<xAOD::JetContainer>();
49 auto jetsAux = std::make_unique<xAOD::JetAuxContainer>();
50 jets->setStore(jetsAux.get());
52 TLorentzVector lj, slj, tlj;
54 double jet_radius = 0.4;
57 std::vector<TLorentzVector> ttbarDecayProducts;
58 std::vector<int> decayProduct_pdgID;
60 for(
const auto* p : *truth){
65 if(abs(pdg) != 5 && abs(pdg) != 24)
71 for(
unsigned int ip = 0; ip < p->nParents(); ++ip){
74 if(parent && parent->absPdgId() == 6){
80 if(!fromTop)
continue;
82 vec.SetPtEtaPhiM(p->pt(), p->eta(), p->phi(), p->m());
84 ttbarDecayProducts.push_back(
vec);
85 decayProduct_pdgID.push_back(pdg);
88 bool ok =
extrajet(truth.
cptr(), lj, slj, tlj, ttbarDecayProducts, decayProduct_pdgID, jet_radius, min_pT);
91 auto saveJet = [&](
const TLorentzVector& v) {
92 if(v.Pt() <= 0)
return;
112 return StatusCode::SUCCESS;
159 const std::vector<TLorentzVector>& ttbarDecayProducts,
160 const std::vector<int>& decayProduct_pdgID,
162 double pt_min)
const {
165 const bool exclude_topdecay =
true;
166 std::vector<fastjet::PseudoJet> vec_status62;
172 if (particle->absPdgId() > 80 || (particle->absPdgId() > 22 && particle->absPdgId() < 38))
continue;
176 if((particle->status()==11 || particle->status()==71) && particle->absPdgId()!=6 ){
187 if (exclude_topdecay)
191 topParent = topParent->
parent(0);
203 fastjet::PseudoJet tmp(particle->px(), particle->py(), particle->pz(), particle->e());
204 vec_status62.push_back(tmp);
211 fastjet::JetDefinition jetDef(fastjet::antikt_algorithm, Rparam, fastjet::E_scheme, fastjet::Best);
213 std::vector <fastjet::PseudoJet> inclusivePertJet62, sortedPertJet62;
215 fastjet::ClusterSequence clustSeqPertJet62(vec_status62, jetDef);
217 inclusivePertJet62 = clustSeqPertJet62.inclusive_jets(pt_min * 1000.);
218 sortedPertJet62 = fastjet::sorted_by_pt(inclusivePertJet62);
221 if(inclusivePertJet62.size()==0){
226 if (inclusivePertJet62.size()!=0)
229 for (
long unsigned int i = 0; i < ttbarDecayProducts.size(); ++i)
231 for (
long unsigned int j = 0; j < sortedPertJet62.size(); ++j)
233 if (sortedPertJet62[j].delta_R(ttbarDecayProducts[i]) <= 0.4
234 && abs(decayProduct_pdgID[i]) != 11
235 && abs(decayProduct_pdgID[i]) != 12
236 && abs(decayProduct_pdgID[i]) != 13
237 && abs(decayProduct_pdgID[i]) != 14
239 && abs(decayProduct_pdgID[i]) != 16
243 sortedPertJet62.erase(sortedPertJet62.begin() + j);
251 bool leading_jet_found =
false;
252 bool subleading_jet_found =
false;
253 bool third_jet_found =
false;
255 for (std::vector<fastjet::PseudoJet>::iterator
jet = sortedPertJet62.begin();
jet != sortedPertJet62.end(); ++
jet)
257 if(!leading_jet_found){
259 leading_jet_found =
true;
261 else if(leading_jet_found && !subleading_jet_found){
263 subleading_jet_found =
true;
266 else if(leading_jet_found && subleading_jet_found && !third_jet_found){
268 third_jet_found =
true;
275 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.