CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
HLTJetsCleanedFromLeadingLeptons< JetType > Class Template Reference

Produces a collection of jets cleaned against leading leptons. More...

#include <HLTJetsCleanedFromLeadingLeptons.h>

Inheritance diagram for HLTJetsCleanedFromLeadingLeptons< JetType >:
edm::stream::EDProducer<>

Classes

class  EtaPhiE
 An auxiliary class to store momentum parametrised in eta, phi, and energy. More...
 

Public Types

typedef std::vector< JetType > JetCollection
 
typedef std::vector< edm::RefVector< JetCollection, JetType, edm::refhelper::FindUsingAdvance< JetCollection, JetType > > > JetCollectionVector
 
typedef edm::Ref< JetCollectionJetRef
 
typedef edm::RefVector< JetCollectionJetRefVector
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

 HLTJetsCleanedFromLeadingLeptons (edm::ParameterSet const &iConfig)
 Constructor. More...
 
void produce (edm::Event &iEvent, edm::EventSetup const &iSetup) override
 Produces jets cleaned against leptons. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 Describes configuration of the plugin. More...
 

Private Attributes

edm::EDGetTokenT< std::vector< JetType > > jetToken
 Token to access a collection of jets. More...
 
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefsleptonToken
 Token to identify a collection of leptons that pass an HLT filter. More...
 
double minDeltaR2
 A square of the minimal allowed angular separation between a lepton and a jet. More...
 
unsigned numLeptons
 Number of leading leptons against which the jets are cleaned. More...
 

Detailed Description

template<typename JetType>
class HLTJetsCleanedFromLeadingLeptons< JetType >

Produces a collection of jets cleaned against leading leptons.

Author
Andrey Popov, inspired by code by Lukasz Kreczko Leptons (muons or electrons) are read from results of a previous HLT filter. They are ordered in energy, and the user can configure how many leading leptons are used to clean jets. If the requested number is larger than the total number of leptons, all of them are used.

The plugin loops over the given collection of jets and exclude ones that are close to one of the leading leptons. References to surviving jets are stored in the same format as expected by the HLTJetCollectionsFilter plugin.

Definition at line 28 of file HLTJetsCleanedFromLeadingLeptons.h.

Member Typedef Documentation

◆ JetCollection

template<typename JetType >
typedef std::vector<JetType> HLTJetsCleanedFromLeadingLeptons< JetType >::JetCollection

Definition at line 30 of file HLTJetsCleanedFromLeadingLeptons.h.

◆ JetCollectionVector

template<typename JetType >
typedef std::vector<edm::RefVector<JetCollection, JetType, edm::refhelper::FindUsingAdvance<JetCollection, JetType> > > HLTJetsCleanedFromLeadingLeptons< JetType >::JetCollectionVector

Definition at line 35 of file HLTJetsCleanedFromLeadingLeptons.h.

◆ JetRef

template<typename JetType >
typedef edm::Ref<JetCollection> HLTJetsCleanedFromLeadingLeptons< JetType >::JetRef

Definition at line 31 of file HLTJetsCleanedFromLeadingLeptons.h.

◆ JetRefVector

template<typename JetType >
typedef edm::RefVector<JetCollection> HLTJetsCleanedFromLeadingLeptons< JetType >::JetRefVector

Definition at line 32 of file HLTJetsCleanedFromLeadingLeptons.h.

Constructor & Destructor Documentation

◆ HLTJetsCleanedFromLeadingLeptons()

template<typename JetType >
HLTJetsCleanedFromLeadingLeptons< JetType >::HLTJetsCleanedFromLeadingLeptons ( edm::ParameterSet const &  iConfig)

Constructor.

Definition at line 137 of file HLTJetsCleanedFromLeadingLeptons.h.

138  : minDeltaR2(std::pow(iConfig.getParameter<double>("minDeltaR"), 2)),
139  numLeptons(iConfig.getParameter<unsigned>("numLeptons")) {
140  leptonToken = consumes<trigger::TriggerFilterObjectWithRefs>(iConfig.getParameter<edm::InputTag>("leptons"));
141  jetToken = consumes<std::vector<JetType>>(iConfig.getParameter<edm::InputTag>("jets"));
142 
143  produces<JetCollectionVector>();
144 }

References edm::ParameterSet::getParameter(), HLTJetsCleanedFromLeadingLeptons< JetType >::jetToken, and HLTJetsCleanedFromLeadingLeptons< JetType >::leptonToken.

Member Function Documentation

◆ fillDescriptions()

template<typename JetType >
void HLTJetsCleanedFromLeadingLeptons< JetType >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Describes configuration of the plugin.

Definition at line 147 of file HLTJetsCleanedFromLeadingLeptons.h.

147  {
149 
150  desc.add<edm::InputTag>("leptons", edm::InputTag("triggerFilterObjectWithRefs"))
151  ->setComment("A collection of leptons that pass an HLT filter");
152  desc.add<edm::InputTag>("jets", edm::InputTag("jetCollection"))->setComment("A collection of jets");
153  desc.add<double>("minDeltaR", 0.3)->setComment("Minimal allowed angular separation between a jet and a lepton");
154  desc.add<unsigned>("numLeptons", 1)->setComment("Number of leading leptons against which the jets are cleaned");
155 
157 }

References edm::ConfigurationDescriptions::add(), defaultModuleLabel(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ produce()

template<typename JetType >
void HLTJetsCleanedFromLeadingLeptons< JetType >::produce ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
override

Produces jets cleaned against leptons.

Definition at line 160 of file HLTJetsCleanedFromLeadingLeptons.h.

160  {
161  // Read results of the lepton filter
163  iEvent.getByToken(leptonToken, filterOutput);
164 
165  // Momenta of the leptons that passed the filter will be pushed into a vector
166  std::vector<EtaPhiE> leptonMomenta;
167 
168  // First, assume these are muons and try to store their momenta
170  filterOutput->getObjects(trigger::TriggerMuon, muons);
171 
172  for (auto const &muRef : muons) // the collection might be empty
173  leptonMomenta.emplace_back(muRef->eta(), muRef->phi(), muRef->energy());
174 
175  // Then get the momenta as if these are electrons. Electrons are tricky because they can be
176  //stored with three types of trigger objects: TriggerElectron, TriggerPhoton, and
177  //TriggerCluster. Try them one by one.
180 
181  for (auto const &eRef : electrons) // the collection might be empty
182  {
183  auto const &sc = eRef->superCluster();
184  leptonMomenta.emplace_back(sc->eta(), sc->phi(), sc->energy());
185  }
186 
188  filterOutput->getObjects(trigger::TriggerPhoton, photons);
189 
190  for (auto const &eRef : photons) // the collection might be empty
191  {
192  auto const &sc = eRef->superCluster();
193  leptonMomenta.emplace_back(sc->eta(), sc->phi(), sc->energy());
194  }
195 
198 
199  for (auto const &eRef : clusters) // the collection might be empty
200  {
201  auto const &sc = eRef->superCluster();
202  leptonMomenta.emplace_back(sc->eta(), sc->phi(), sc->energy());
203  }
204 
205  // Make sure the momenta are sorted
206  std::sort(leptonMomenta.rbegin(), leptonMomenta.rend());
207 
208  // Read the source collection of jets
209  edm::Handle<JetCollection> jetHandle;
210  iEvent.getByToken(jetToken, jetHandle);
211  JetCollection const &jets = *jetHandle;
212 
213  // Put references to jets that are not matched to leptons into a dedicated collection
214  JetRefVector cleanedJetRefs;
215  unsigned const numLeptonsToLoop = std::min<unsigned>(leptonMomenta.size(), numLeptons);
216 
217  for (unsigned iJet = 0; iJet < jets.size(); ++iJet) {
218  bool overlap = false;
219 
220  for (unsigned iLepton = 0; iLepton < numLeptonsToLoop; ++iLepton)
221  if (reco::deltaR2(leptonMomenta.at(iLepton), jets.at(iJet)) < minDeltaR2) {
222  overlap = true;
223  break;
224  }
225 
226  if (not overlap)
227  cleanedJetRefs.push_back(JetRef(jetHandle, iJet));
228  }
229 
230  // Store the collection in the event
231  std::unique_ptr<JetCollectionVector> product(new JetCollectionVector);
232  //^ Have to use the depricated unique_ptr here because this is what edm::Event::put expects
233  product->emplace_back(cleanedJetRefs);
234  iEvent.put(std::move(product));
235 }

References bsc_activity_cfg::clusters, reco::deltaR2(), pwdgSkimBPark_cfi::electrons, trigger::TriggerRefsCollections::getObjects(), iEvent, singleTopDQM_cfi::jets, unpackData-CaloStage1::jetToken, eostools::move(), PDWG_BPHSkim_cff::muons, HLT_FULL_cff::numLeptons, muon::overlap(), BPHMonitor_cfi::photons, edm::RefVector< C, T, F >::push_back(), jetUpdater_cfi::sort, trigger::TriggerCluster, trigger::TriggerElectron, trigger::TriggerMuon, and trigger::TriggerPhoton.

Member Data Documentation

◆ jetToken

template<typename JetType >
edm::EDGetTokenT<std::vector<JetType> > HLTJetsCleanedFromLeadingLeptons< JetType >::jetToken
private

Token to access a collection of jets.

Definition at line 87 of file HLTJetsCleanedFromLeadingLeptons.h.

Referenced by HLTJetsCleanedFromLeadingLeptons< JetType >::HLTJetsCleanedFromLeadingLeptons().

◆ leptonToken

template<typename JetType >
edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> HLTJetsCleanedFromLeadingLeptons< JetType >::leptonToken
private

Token to identify a collection of leptons that pass an HLT filter.

Definition at line 84 of file HLTJetsCleanedFromLeadingLeptons.h.

Referenced by HLTJetsCleanedFromLeadingLeptons< JetType >::HLTJetsCleanedFromLeadingLeptons().

◆ minDeltaR2

template<typename JetType >
double HLTJetsCleanedFromLeadingLeptons< JetType >::minDeltaR2
private

A square of the minimal allowed angular separation between a lepton and a jet.

Definition at line 90 of file HLTJetsCleanedFromLeadingLeptons.h.

◆ numLeptons

template<typename JetType >
unsigned HLTJetsCleanedFromLeadingLeptons< JetType >::numLeptons
private

Number of leading leptons against which the jets are cleaned.

If the number is larger than the total number of leptons, the jets are cleaned against all leptons.

Definition at line 98 of file HLTJetsCleanedFromLeadingLeptons.h.

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
HLTJetsCleanedFromLeadingLeptons::jetToken
edm::EDGetTokenT< std::vector< JetType > > jetToken
Token to access a collection of jets.
Definition: HLTJetsCleanedFromLeadingLeptons.h:87
trigger::TriggerElectron
Definition: TriggerTypeDefs.h:78
HLTJetsCleanedFromLeadingLeptons::JetCollection
std::vector< JetType > JetCollection
Definition: HLTJetsCleanedFromLeadingLeptons.h:30
trigger::VRphoton
std::vector< reco::RecoEcalCandidateRef > VRphoton
Definition: TriggerRefsCollections.h:67
HLTJetsCleanedFromLeadingLeptons::leptonToken
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > leptonToken
Token to identify a collection of leptons that pass an HLT filter.
Definition: HLTJetsCleanedFromLeadingLeptons.h:84
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HLTJetsCleanedFromLeadingLeptons
Produces a collection of jets cleaned against leading leptons.
Definition: HLTJetsCleanedFromLeadingLeptons.h:28
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle< trigger::TriggerFilterObjectWithRefs >
HLTJetsCleanedFromLeadingLeptons::JetCollectionVector
std::vector< edm::RefVector< JetCollection, JetType, edm::refhelper::FindUsingAdvance< JetCollection, JetType > > > JetCollectionVector
Definition: HLTJetsCleanedFromLeadingLeptons.h:35
trigger::TriggerRefsCollections::getObjects
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Definition: TriggerRefsCollections.h:590
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
trigger::TriggerMuon
Definition: TriggerTypeDefs.h:79
HLTJetsCleanedFromLeadingLeptons::minDeltaR2
double minDeltaR2
A square of the minimal allowed angular separation between a lepton and a jet.
Definition: HLTJetsCleanedFromLeadingLeptons.h:90
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
defaultModuleLabel
std::string defaultModuleLabel()
Definition: defaultModuleLabel.h:16
HLTJetsCleanedFromLeadingLeptons::JetRef
edm::Ref< JetCollection > JetRef
Definition: HLTJetsCleanedFromLeadingLeptons.h:31
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
muon::overlap
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
Definition: MuonSelectors.cc:791
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
trigger::TriggerCluster
Definition: TriggerTypeDefs.h:88
trigger::VRelectron
std::vector< reco::ElectronRef > VRelectron
Definition: TriggerRefsCollections.h:68
HLTJetsCleanedFromLeadingLeptons::JetRefVector
edm::RefVector< JetCollection > JetRefVector
Definition: HLTJetsCleanedFromLeadingLeptons.h:32
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
trigger::VRmuon
std::vector< reco::RecoChargedCandidateRef > VRmuon
Definition: TriggerRefsCollections.h:69
HLTJetsCleanedFromLeadingLeptons::numLeptons
unsigned numLeptons
Number of leading leptons against which the jets are cleaned.
Definition: HLTJetsCleanedFromLeadingLeptons.h:98
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
trigger::TriggerPhoton
HLT.
Definition: TriggerTypeDefs.h:77
edm::InputTag
Definition: InputTag.h:15