Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Fix wrong logic in JetPtFilterPlugin
Browse files Browse the repository at this point in the history
Before this commit the plugin asks for at least (n+1) jets above the
threshold if configured with n jets.
  • Loading branch information
andrey-popov committed Jan 29, 2014
1 parent cd88816 commit 6c6c51c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions extensions/src/JetPtFilterPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <string>
#include <sstream>
#include <stdexcept>


using namespace std;
Expand All @@ -26,7 +27,11 @@ string BuildPluginName(string const &baseName, unsigned nJets, double pt)
JetPtFilterPlugin::JetPtFilterPlugin(unsigned minNumJets_, double ptThreshold_):
Plugin(BuildPluginName("JetPtFilter", minNumJets_, ptThreshold_)),
minNumJets(minNumJets_), ptThreshold(ptThreshold_)
{}
{
if (minNumJets == 0)
throw logic_error("JetPtFilterPlugin::JetPtFilterPlugin: Number of jets must be sctrictly "
"positive.");
}


Plugin *JetPtFilterPlugin::Clone() const
Expand All @@ -48,11 +53,11 @@ bool JetPtFilterPlugin::ProcessEvent()
auto const &softJets = (*reader)->GetAdditionalJets();


if (minNumJets < jets.size())
return (jets.at(minNumJets).Pt() > ptThreshold);
if (minNumJets - 1 < jets.size())
return (jets.at(minNumJets - 1).Pt() > ptThreshold);

if (minNumJets < jets.size() + softJets.size())
return (softJets.at(minNumJets - jets.size()).Pt() > ptThreshold);
if (minNumJets - 1 < jets.size() + softJets.size())
return (softJets.at(minNumJets - 1 - jets.size()).Pt() > ptThreshold);


// If control reaches this point, there are less than minNumJets jets in both collections
Expand Down

0 comments on commit 6c6c51c

Please sign in to comment.