3 #include <Pythia8/Pythia.h>
6 #include <fastjet/JetDefinition.hh>
7 #include <fastjet/PseudoJet.hh>
8 #include <fastjet/ClusterSequence.hh>
9 #include <fastjet/SISConePlugin.hh>
31 cout <<
"PHPy8JetTrigger::Apply - pythia event size: "
32 << pythia->event.size() << endl;
36 std::vector<fastjet::PseudoJet> pseudojets;
37 for (
int i = 0; i < pythia->event.size(); ++i) {
39 if (pythia->event[i].status() > 0) {
47 if ((abs(pythia->event[i].id()) >= 12) && (abs(pythia->event[i].id()) <= 16))
continue;
50 if ((pythia->event[i].px() == 0.0) && (pythia->event[i].py() == 0.0))
continue;
51 if ( (pythia->event[i].eta() < _theEtaLow ||
52 pythia->event[i].eta() > _theEtaHigh))
continue;
55 fastjet::PseudoJet pseudojet (pythia->event[i].px(),
56 pythia->event[i].py(),
57 pythia->event[i].pz(),
58 pythia->event[i].e());
59 pseudojet.set_user_index(i);
60 pseudojets.push_back(pseudojet);
68 fastjet::JetDefinition *jetdef =
new fastjet::JetDefinition(fastjet::antikt_algorithm,_R, fastjet::E_scheme,fastjet::Best);
69 fastjet::ClusterSequence jetFinder(pseudojets,*jetdef);
70 std::vector<fastjet::PseudoJet> fastjets = jetFinder.inclusive_jets();
73 bool jetFound =
false;
75 for (
unsigned int ijet = 0; ijet < fastjets.size(); ++ijet) {
77 const double pt = sqrt(pow(fastjets[ijet].px(),2) + pow(fastjets[ijet].py(),2));
79 if (pt > max_pt) max_pt = pt;
87 float leading_Z = 0.0;
89 float jet_ptot = sqrt( pow(fastjets[ijet].px(),2) +
90 pow(fastjets[ijet].py(),2) +
91 pow(fastjets[ijet].pz(),2) );
93 vector<fastjet::PseudoJet> constituents = fastjets[ijet].constituents();
94 for (
unsigned int j=0; j<constituents.size(); j++){
96 float con_ptot = sqrt( pow(constituents[j].px(),2) +
97 pow(constituents[j].py(),2) +
98 pow(constituents[j].pz(),2) );
100 float ctheta = (constituents[j].px()*fastjets[ijet].px() +
101 constituents[j].py()*fastjets[ijet].py() +
102 constituents[j].pz()*fastjets[ijet].pz())/(con_ptot*jet_ptot);
104 float z_constit = con_ptot*ctheta/jet_ptot;
106 if(z_constit>leading_Z) leading_Z = z_constit;
124 cout <<
"PHPy8JetTrigger::Apply - max_pt = "<<max_pt<<
", and jetFound = "<<jetFound<<endl;
132 _theEtaHigh = etaHigh;
135 if (_theEtaHigh<_theEtaLow)
137 swap(_theEtaHigh, _theEtaLow);
155 cout <<
"---------------- PHPy8JetTrigger::PrintConfig --------------------" << endl;
157 cout <<
" Particles EtaCut: " << _theEtaLow <<
" < eta < " << _theEtaHigh << endl;
158 cout <<
" Minimum Jet pT: " << _minPt <<
" GeV/c" << endl;
159 cout <<
" Anti-kT Radius: " << _R << endl;
160 cout <<
"-----------------------------------------------------------------------" << endl;
void SetEtaHighLow(double etaHigh, double etaLow)
bool Apply(Pythia8::Pythia *pythia)
void swap(array< T, N > &x, array< T, N > &y)
PHPy8JetTrigger(const std::string &name="PHPy8JetTrigger")
void SetMinLeadingZ(double minZ)
void SetMinJetPt(double minPt)
virtual ~PHPy8JetTrigger()