Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion generators/Herwig/HepMCTrigger/HepMCJetTrigger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ bool HepMCJetTrigger::isGoodEvent(HepMC::GenEvent* e1)
return false;
}

/**
* @brief Cluster final-state particles into anti-kt R=0.4 jets and return the resulting PseudoJets.
*
* Clusters particles from the provided HepMC::GenEvent into jets using the anti-kt algorithm with radius 0.4.
* Final-state particles with PDG IDs in the range 12–18 (neutrinos / similar, by absolute value) are excluded
* from clustering.
*
* @param e1 Pointer to the HepMC::GenEvent whose particles will be clustered.
* @return std::vector<fastjet::PseudoJet> Vector of clustered jets (inclusive jets) as FastJet PseudoJet objects.
*/
std::vector<fastjet::PseudoJet> HepMCJetTrigger::findAllJets(HepMC::GenEvent* e1)
{
// do the fast jet clustering, antikt r=-0.4
Expand All @@ -96,6 +106,11 @@ std::vector<fastjet::PseudoJet> HepMCJetTrigger::findAllJets(HepMC::GenEvent* e1
if (!(*iter)->end_vertex() && (*iter)->status() == 1)
{
auto p = (*iter)->momentum();
auto pd = std::abs((*iter)->pdg_id());
if (pd >= 12 && pd <= 18)
{
continue; // keep jet in the expected behavioro
}
fastjet::PseudoJet pj(p.px(), p.py(), p.pz(), p.e());
pj.set_user_index((*iter)->barcode());
input.push_back(pj);
Expand All @@ -115,17 +130,30 @@ std::vector<fastjet::PseudoJet> HepMCJetTrigger::findAllJets(HepMC::GenEvent* e1
return output;
}

/**
* @brief Counts jets that exceed the configured transverse momentum threshold within the central acceptance.
*
* Counts how many jets in `jets` have transverse momentum greater than the module's `threshold`
* and pseudorapidity magnitude less than or equal to 1.1.
*
* @param jets Vector of clustered jets to evaluate.
* @return int Number of jets with pt greater than the threshold and |eta| <= 1.1.
*/
int HepMCJetTrigger::jetsAboveThreshold(const std::vector<fastjet::PseudoJet>& jets) const
{
// search through for the number of identified jets above the threshold
int n_good_jets = 0;
for (const auto& j : jets)
{
float const pt = j.pt();
if (std::abs(j.eta()) > 1.1)
{
continue;
}
if (pt > this->threshold)
{
n_good_jets++;
}
}
return n_good_jets;
}
}
Loading
Loading