CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
JetBxSelector Class Reference
Inheritance diagram for JetBxSelector:
edm::stream::EDProducer<>

Public Member Functions

 JetBxSelector (const edm::ParameterSet &)
 
 ~JetBxSelector ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< OrbitCollection< l1ScoutingRun3::Jet > > jetsTokenData_
 
std::vector< double > maxJetEta_
 
std::vector< double > minJetEt_
 
int minNJet_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 26 of file JetBxSelector.cc.

Constructor & Destructor Documentation

◆ JetBxSelector()

JetBxSelector::JetBxSelector ( const edm::ParameterSet iPSet)
explicit

Definition at line 44 of file JetBxSelector.cc.

References maxJetEta_, minJetEt_, and minNJet_.

45  : jetsTokenData_(consumes(iPSet.getParameter<edm::InputTag>("jetsTag"))),
46  minNJet_(iPSet.getParameter<int>("minNJet")),
47  minJetEt_(iPSet.getParameter<std::vector<double>>("minJetEt")),
48  maxJetEta_(iPSet.getParameter<std::vector<double>>("maxJetEta"))
49 
50 {
51  if ((minJetEt_.size() != (size_t)minNJet_) || (maxJetEta_.size() != (size_t)minNJet_))
52  throw cms::Exception("JetBxSelector::JetBxSelector") << "size mismatch: size of minJetEt or maxJetEta != minNJet.";
53 
54  produces<std::vector<unsigned>>("SelBx").setBranchAlias("JetSelectedBx");
55 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< double > maxJetEta_
std::vector< double > minJetEt_
edm::EDGetTokenT< OrbitCollection< l1ScoutingRun3::Jet > > jetsTokenData_

◆ ~JetBxSelector()

JetBxSelector::~JetBxSelector ( )
inline

Definition at line 29 of file JetBxSelector.cc.

29 {}

Member Function Documentation

◆ fillDescriptions()

void JetBxSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 95 of file JetBxSelector.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

95  {
97  desc.setUnknown();
98  descriptions.addDefault(desc);
99 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void JetBxSelector::produce ( edm::Event iEvent,
const edm::EventSetup  
)
overrideprivate

Definition at line 58 of file JetBxSelector.cc.

References funct::abs(), nano_mu_digi_cff::bx, l1ScoutingRun3::demux::fEt(), l1ScoutingRun3::ugmt::fEta(), iEvent, metsig::jet, PDWG_EXODelayedJetMET_cff::jets, jetsTokenData_, maxJetEta_, minJetEt_, minNJet_, and eostools::move().

58  {
60 
61  iEvent.getByToken(jetsTokenData_, jetsCollection);
62 
63  std::unique_ptr<std::vector<unsigned>> jetBx(new std::vector<unsigned>);
64 
65  // loop over valid bunch crossings
66  for (const unsigned& bx : jetsCollection->getFilledBxs()) {
67  const auto& jets = jetsCollection->bxIterator(bx);
68 
69  // we have at least N jets
70  if (jets.size() < minNJet_)
71  continue;
72 
73  // it must be in a certain eta region with an pT and quality threshold
74  bool jetCond = false;
75  int nAccJets = 0;
76  for (const auto& jet : jets) {
77  jetCond = (std::abs(demux::fEta(jet.hwEta())) < maxJetEta_[nAccJets]) &&
78  (demux::fEt(jet.hwEt()) >= minJetEt_[nAccJets]);
79  if (jetCond)
80  nAccJets++; // found jet meeting requirements
81  if (nAccJets == minNJet_)
82  break; // found all requested jets
83  }
84 
85  if (nAccJets < minNJet_)
86  continue;
87 
88  jetBx->push_back(bx);
89 
90  } // end orbit loop
91 
92  iEvent.put(std::move(jetBx), "SelBx");
93 }
float fEt(int hwEt)
Definition: conversion.h:29
std::vector< double > maxJetEta_
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def move(src, dest)
Definition: eostools.py:511
float fEta(int hwEta)
Definition: conversion.h:17
std::vector< double > minJetEt_
edm::EDGetTokenT< OrbitCollection< l1ScoutingRun3::Jet > > jetsTokenData_

Member Data Documentation

◆ jetsTokenData_

edm::EDGetTokenT<OrbitCollection<l1ScoutingRun3::Jet> > JetBxSelector::jetsTokenData_
private

Definition at line 36 of file JetBxSelector.cc.

Referenced by produce().

◆ maxJetEta_

std::vector<double> JetBxSelector::maxJetEta_
private

Definition at line 41 of file JetBxSelector.cc.

Referenced by JetBxSelector(), and produce().

◆ minJetEt_

std::vector<double> JetBxSelector::minJetEt_
private

Definition at line 40 of file JetBxSelector.cc.

Referenced by JetBxSelector(), and produce().

◆ minNJet_

int JetBxSelector::minNJet_
private

Definition at line 39 of file JetBxSelector.cc.

Referenced by JetBxSelector(), and produce().