1 #ifndef HLTJetsCleanedFromLeadingLeptons_h
2 #define HLTJetsCleanedFromLeadingLeptons_h
29 template <
typename JetType>
119 template <
typename JetType>
121 etaValue(eta), phiValue(phi),
126 template <
typename JetType>
133 template <
typename JetType>
140 template <
typename JetType>
147 template <
typename JetType>
150 return (eValue < rhs.
eValue);
154 template <
typename JetType>
157 minDeltaR2(std::
pow(iConfig.getParameter<double>(
"minDeltaR"), 2)),
158 numLeptons(iConfig.getParameter<unsigned>(
"numLeptons"))
160 leptonToken = consumes<trigger::TriggerFilterObjectWithRefs>(
164 produces<JetCollectionVector>();
168 template <
typename JetType>
175 setComment(
"A collection of leptons that pass an HLT filter");
177 setComment(
"A collection of jets");
178 desc.
add<
double>(
"minDeltaR", 0.3)->
179 setComment(
"Minimal allowed angular separation between a jet and a lepton");
180 desc.
add<
unsigned>(
"numLeptons", 1)->
181 setComment(
"Number of leading leptons against which the jets are cleaned");
187 template <
typename JetType>
196 std::vector<EtaPhiE> leptonMomenta;
203 for (
auto const &muRef: muons)
204 leptonMomenta.emplace_back(muRef->eta(), muRef->phi(), muRef->energy());
213 for (
auto const &eRef: electrons)
215 auto const &sc = eRef->superCluster();
216 leptonMomenta.emplace_back(sc->eta(), sc->phi(), sc->energy());
222 for (
auto const &eRef: photons)
224 auto const &sc = eRef->superCluster();
225 leptonMomenta.emplace_back(sc->eta(), sc->phi(), sc->energy());
231 for (
auto const &eRef: clusters)
233 auto const &sc = eRef->superCluster();
234 leptonMomenta.emplace_back(sc->eta(), sc->phi(), sc->energy());
239 std::sort(leptonMomenta.rbegin(), leptonMomenta.rend());
250 unsigned const numLeptonsToLoop = std::min<unsigned>(leptonMomenta.size(),
numLeptons);
252 for (
unsigned iJet = 0; iJet < jets.size(); ++iJet)
256 for (
unsigned iLepton = 0; iLepton < numLeptonsToLoop; ++iLepton)
257 if (
reco::deltaR2(leptonMomenta.at(iLepton), jets.at(iJet)) < minDeltaR2)
271 product->emplace_back(cleanedJetRefs);
275 #endif // HLTJetsCleanedFromLeadingLeptons_h
HLTJetsCleanedFromLeadingLeptons(edm::ParameterSet const &iConfig)
Constructor.
T getParameter(std::string const &) const
std::string defaultModuleLabel()
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > leptonToken
Token to identify a collection of leptons that pass an HLT filter.
unsigned numLeptons
Number of leading leptons against which the jets are cleaned.
bool operator<(EtaPhiE const &rhs) const
A comparison operator to sort a collection of objects of this type.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Describes configuration of the plugin.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double phi() const
Returns azimuthal angle.
edm::RefVector< JetCollection > JetRefVector
std::vector< JetType > JetCollection
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
An auxiliary class to store momentum parametrised in eta, phi, and energy.
edm::Ref< JetBxCollection > JetRef
virtual void produce(edm::Event &iEvent, edm::EventSetup const &iSetup)
Produces jets cleaned against leptons.
std::vector< edm::RefVector< JetCollection, JetType, edm::refhelper::FindUsingAdvance< JetCollection, JetType > > > JetCollectionVector
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double minDeltaR2
A square of the minimal allowed angular separation between a lepton and a jet.
EtaPhiE(double eta, double phi, double e)
Constructor.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Produces a collection of jets cleaned against leading leptons.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Geom::Phi< T > phi() const
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
std::vector< reco::RecoChargedCandidateRef > VRmuon
double eta() const
Returns pseudorapidity.
double e() const
Returns energy.
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
std::vector< reco::ElectronRef > VRelectron
edm::EDGetTokenT< std::vector< JetType > > jetToken
Token to access a collection of jets.
std::vector< reco::RecoEcalCandidateRef > VRphoton
edm::Ref< JetCollection > JetRef
Power< A, B >::type pow(const A &a, const B &b)
double etaValue
Pseudorapidity and azimuthal angle.