CMS 3D CMS Logo

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

Public Member Functions

 MuBxSelector (const edm::ParameterSet &)
 
 ~MuBxSelector ()
 
- 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

std::vector< double > maxMuEta_
 
std::vector< int > maxMuTfIndex_
 
std::vector< int > minMuHwQual_
 
std::vector< double > minMuPt_
 
std::vector< int > minMuTfIndex_
 
int minNMu_
 
edm::EDGetTokenT< OrbitCollection< l1ScoutingRun3::Muon > > muonsTokenData_
 

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 MuBxSelector.cc.

Constructor & Destructor Documentation

◆ MuBxSelector()

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

Definition at line 47 of file MuBxSelector.cc.

References maxMuEta_, maxMuTfIndex_, minMuHwQual_, minMuPt_, minMuTfIndex_, and minNMu_.

48  : muonsTokenData_(consumes(iPSet.getParameter<edm::InputTag>("muonsTag"))),
49  minNMu_(iPSet.getParameter<int>("minNMu")),
50  minMuPt_(iPSet.getParameter<std::vector<double>>("minMuPt")),
51  maxMuEta_(iPSet.getParameter<std::vector<double>>("maxMuEta")),
52  minMuTfIndex_(iPSet.getParameter<std::vector<int>>("minMuTfIndex")),
53  maxMuTfIndex_(iPSet.getParameter<std::vector<int>>("maxMuTfIndex")),
54  minMuHwQual_(iPSet.getParameter<std::vector<int>>("minMuHwQual"))
55 
56 {
57  if ((minMuPt_.size() != (size_t)(size_t)minNMu_) || (maxMuEta_.size() != (size_t)minNMu_) ||
58  (minMuTfIndex_.size() != (size_t)minNMu_) || (maxMuTfIndex_.size() != (size_t)minNMu_) ||
59  (minMuHwQual_.size() != (size_t)minNMu_))
60  throw cms::Exception("MuBxSelector::MuBxSelector")
61  << "size mismatch: size of minMuPt or maxMuEta or minMuTfIndex or maxMuTfIndex or minMuHwQual != minNMu.";
62 
63  produces<std::vector<unsigned>>("SelBx").setBranchAlias("MuSelectedBx");
64 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< int > minMuTfIndex_
Definition: MuBxSelector.cc:42
std::vector< double > maxMuEta_
Definition: MuBxSelector.cc:41
std::vector< double > minMuPt_
Definition: MuBxSelector.cc:40
edm::EDGetTokenT< OrbitCollection< l1ScoutingRun3::Muon > > muonsTokenData_
Definition: MuBxSelector.cc:36
std::vector< int > minMuHwQual_
Definition: MuBxSelector.cc:44
std::vector< int > maxMuTfIndex_
Definition: MuBxSelector.cc:43

◆ ~MuBxSelector()

MuBxSelector::~MuBxSelector ( )
inline

Definition at line 29 of file MuBxSelector.cc.

29 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 105 of file MuBxSelector.cc.

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

105  {
107  desc.setUnknown();
108  descriptions.addDefault(desc);
109 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 67 of file MuBxSelector.cc.

References funct::abs(), nano_mu_digi_cff::bx, l1ScoutingRun3::ugmt::fEta(), l1ScoutingRun3::ugmt::fPt(), iEvent, maxMuEta_, maxMuTfIndex_, minMuHwQual_, minMuPt_, minMuTfIndex_, minNMu_, eostools::move(), DiMuonV_cfg::muons, and muonsTokenData_.

67  {
69 
70  iEvent.getByToken(muonsTokenData_, muonsCollection);
71 
72  std::unique_ptr<std::vector<unsigned>> muBx(new std::vector<unsigned>);
73 
74  // loop over valid bunch crossings
75  for (const unsigned& bx : muonsCollection->getFilledBxs()) {
76  const auto& muons = muonsCollection->bxIterator(bx);
77 
78  // we have at least a muon
79  if (muons.size() < minNMu_)
80  continue;
81 
82  // it must be in a certain eta region with an pT and quality threshold
83  bool muCond = false;
84  int nAccMus = 0;
85  for (const auto& muon : muons) {
86  muCond = (std::abs(ugmt::fEta(muon.hwEta())) < maxMuEta_[nAccMus]) &&
87  (muon.tfMuonIndex() <= maxMuTfIndex_[nAccMus]) && (muon.tfMuonIndex() >= minMuTfIndex_[nAccMus]) &&
88  (ugmt::fPt(muon.hwPt()) >= minMuPt_[nAccMus]) && (muon.hwQual() >= minMuHwQual_[nAccMus]);
89  if (muCond)
90  nAccMus++; // found muon meeting requirements
91  if (nAccMus == minNMu_)
92  break; // found all requested muons
93  }
94 
95  if (nAccMus < minNMu_)
96  continue;
97 
98  muBx->push_back(bx);
99 
100  } // end orbit loop
101 
102  iEvent.put(std::move(muBx), "SelBx");
103 }
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
std::vector< int > minMuTfIndex_
Definition: MuBxSelector.cc:42
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > maxMuEta_
Definition: MuBxSelector.cc:41
std::vector< double > minMuPt_
Definition: MuBxSelector.cc:40
edm::EDGetTokenT< OrbitCollection< l1ScoutingRun3::Muon > > muonsTokenData_
Definition: MuBxSelector.cc:36
std::vector< int > minMuHwQual_
Definition: MuBxSelector.cc:44
float fPt(int hwPt)
Definition: conversion.h:16
std::vector< int > maxMuTfIndex_
Definition: MuBxSelector.cc:43
def move(src, dest)
Definition: eostools.py:511
float fEta(int hwEta)
Definition: conversion.h:17

Member Data Documentation

◆ maxMuEta_

std::vector<double> MuBxSelector::maxMuEta_
private

Definition at line 41 of file MuBxSelector.cc.

Referenced by MuBxSelector(), and produce().

◆ maxMuTfIndex_

std::vector<int> MuBxSelector::maxMuTfIndex_
private

Definition at line 43 of file MuBxSelector.cc.

Referenced by MuBxSelector(), and produce().

◆ minMuHwQual_

std::vector<int> MuBxSelector::minMuHwQual_
private

Definition at line 44 of file MuBxSelector.cc.

Referenced by MuBxSelector(), and produce().

◆ minMuPt_

std::vector<double> MuBxSelector::minMuPt_
private

Definition at line 40 of file MuBxSelector.cc.

Referenced by MuBxSelector(), and produce().

◆ minMuTfIndex_

std::vector<int> MuBxSelector::minMuTfIndex_
private

Definition at line 42 of file MuBxSelector.cc.

Referenced by MuBxSelector(), and produce().

◆ minNMu_

int MuBxSelector::minNMu_
private

Definition at line 39 of file MuBxSelector.cc.

Referenced by MuBxSelector(), and produce().

◆ muonsTokenData_

edm::EDGetTokenT<OrbitCollection<l1ScoutingRun3::Muon> > MuBxSelector::muonsTokenData_
private

Definition at line 36 of file MuBxSelector.cc.

Referenced by produce().