1 |
< |
#include "../include/Utils.h" |
1 |
> |
#include "include/Utils.h" |
2 |
> |
#include "include/JetProps.h" |
3 |
|
|
4 |
|
#include <fastjet/JetDefinition.hh> |
5 |
|
#include <fastjet/PseudoJet.hh> |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
< |
bool HepTopTagFull(TopJet topjet){ |
83 |
> |
bool HepTopTagFull(TopJet topjet, std::vector<PFParticle>* allparts){ |
84 |
|
|
85 |
|
//Transform the SFrame TopJet object in a fastjet::PseudoJet |
86 |
< |
|
87 |
< |
std::vector<fastjet::PseudoJet> jetpart; |
87 |
< |
std::vector<Particle> pfconstituents_jet; |
86 |
> |
|
87 |
> |
if (!allparts) return false; |
88 |
|
|
89 |
|
fastjet::ClusterSequence* JetFinder; |
90 |
|
fastjet::JetDefinition* JetDef ; |
91 |
|
|
92 |
< |
pfconstituents_jet=topjet.pfconstituents(); |
93 |
< |
|
94 |
< |
for(unsigned int ic=0; ic<pfconstituents_jet.size(); ++ic){ |
95 |
< |
|
96 |
< |
jetpart.push_back( fastjet::PseudoJet( |
97 |
< |
pfconstituents_jet[ic].pt()*cos(pfconstituents_jet[ic].phi()), |
98 |
< |
pfconstituents_jet[ic].pt()*sin(pfconstituents_jet[ic].phi()), |
99 |
< |
pfconstituents_jet[ic].pt()*sinh(pfconstituents_jet[ic].eta()), |
100 |
< |
pfconstituents_jet[ic].energy() ) ); |
101 |
< |
|
102 |
< |
} |
92 |
> |
JetProps jp(&topjet, allparts); |
93 |
> |
std::vector<fastjet::PseudoJet> jetpart = jp.GetJetConstituents(); |
94 |
|
|
95 |
|
//Clustering definition |
96 |
|
double conesize=3; |
97 |
< |
JetDef = new |
107 |
< |
fastjet::JetDefinition(fastjet::cambridge_algorithm,conesize); |
97 |
> |
JetDef = new fastjet::JetDefinition(fastjet::cambridge_algorithm,conesize); |
98 |
|
|
99 |
|
JetFinder = new fastjet::ClusterSequence(jetpart, *JetDef); |
100 |
|
|
443 |
|
return i; |
444 |
|
} |
445 |
|
|
456 |
– |
int JetFlavor(Jet *jet) |
457 |
– |
{ |
458 |
– |
|
459 |
– |
EventCalc* calc = EventCalc::Instance(); |
460 |
– |
|
461 |
– |
std::vector< GenParticle >* genparticles = calc->GetGenParticles(); |
462 |
– |
if(genparticles) { |
463 |
– |
|
464 |
– |
//fill pdg IDs of all matched GenParticles |
465 |
– |
std::vector<int> matched_genparticle_ids; |
466 |
– |
for(unsigned int i=0; i<genparticles->size(); ++i) { |
467 |
– |
|
468 |
– |
GenParticle genp = genparticles->at(i); |
469 |
– |
|
470 |
– |
//only take status 3 particles into account |
471 |
– |
//if(genp.status()!=3) continue; |
472 |
– |
|
473 |
– |
if(jet->deltaR(genp)<0.5) |
474 |
– |
matched_genparticle_ids.push_back(genp.pdgId()); |
475 |
– |
} |
476 |
– |
|
477 |
– |
//search for b quarks first |
478 |
– |
for(unsigned int i=0; i<matched_genparticle_ids.size(); ++i) { |
479 |
– |
if(abs(matched_genparticle_ids[i])==5) return matched_genparticle_ids[i]; |
480 |
– |
} |
481 |
– |
//no b quark -> search for c quarks |
482 |
– |
for(unsigned int i=0; i<matched_genparticle_ids.size(); ++i) { |
483 |
– |
if(abs(matched_genparticle_ids[i])==4) return matched_genparticle_ids[i]; |
484 |
– |
} |
485 |
– |
for(unsigned int i=0; i<matched_genparticle_ids.size(); ++i) { |
486 |
– |
if(abs(matched_genparticle_ids[i])==3) return matched_genparticle_ids[i]; |
487 |
– |
} |
488 |
– |
for(unsigned int i=0; i<matched_genparticle_ids.size(); ++i) { |
489 |
– |
if(abs(matched_genparticle_ids[i])==2) return matched_genparticle_ids[i]; |
490 |
– |
} |
491 |
– |
for(unsigned int i=0; i<matched_genparticle_ids.size(); ++i) { |
492 |
– |
if(abs(matched_genparticle_ids[i])==1) return matched_genparticle_ids[i]; |
493 |
– |
} |
494 |
– |
for(unsigned int i=0; i<matched_genparticle_ids.size(); ++i) { |
495 |
– |
if(abs(matched_genparticle_ids[i])==21) return matched_genparticle_ids[i]; |
496 |
– |
} |
497 |
– |
|
498 |
– |
} |
499 |
– |
|
500 |
– |
//no matched GenParticle -> return default value 0 |
501 |
– |
return 0; |
502 |
– |
|
503 |
– |
} |