CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
HGCalConcentratorBestChoiceImpl Class Reference

#include <HGCalConcentratorBestChoiceImpl.h>

Public Member Functions

void eventSetup (const edm::EventSetup &es)
 
 HGCalConcentratorBestChoiceImpl (const edm::ParameterSet &conf)
 
void select (unsigned nLinks, unsigned nWafers, const std::vector< l1t::HGCalTriggerCell > &trigCellVecInput, std::vector< l1t::HGCalTriggerCell > &trigCellVecOutput, std::vector< l1t::HGCalTriggerCell > &trigCellVecNotSelected)
 

Private Attributes

std::vector< unsigned > nData_
 
HGCalTriggerTools triggerTools_
 

Static Private Attributes

static constexpr uint32_t kLinkMask_ = 0xF
 
static constexpr unsigned kNDataSize_ = 128
 
static constexpr uint32_t kWaferMask_ = 0x7
 
static constexpr uint32_t kWaferOffset_ = 4
 

Detailed Description

Definition at line 9 of file HGCalConcentratorBestChoiceImpl.h.

Constructor & Destructor Documentation

◆ HGCalConcentratorBestChoiceImpl()

HGCalConcentratorBestChoiceImpl::HGCalConcentratorBestChoiceImpl ( const edm::ParameterSet conf)

Definition at line 8 of file HGCalConcentratorBestChoiceImpl.cc.

9  : nData_(conf.getParameter<std::vector<unsigned>>("NData")) {
10  if (nData_.size() != kNDataSize_) {
11  throw cms::Exception("BadInitialization") << "NData vector must be of size " << kNDataSize_;
12  }
13 }

References Exception, kNDataSize_, and nData_.

Member Function Documentation

◆ eventSetup()

void HGCalConcentratorBestChoiceImpl::eventSetup ( const edm::EventSetup es)
inline

◆ select()

void HGCalConcentratorBestChoiceImpl::select ( unsigned  nLinks,
unsigned  nWafers,
const std::vector< l1t::HGCalTriggerCell > &  trigCellVecInput,
std::vector< l1t::HGCalTriggerCell > &  trigCellVecOutput,
std::vector< l1t::HGCalTriggerCell > &  trigCellVecNotSelected 
)

Definition at line 15 of file HGCalConcentratorBestChoiceImpl.cc.

19  {
20  trigCellVecOutput = trigCellVecInput;
21  trigCellVecNotSelected.resize(0);
22  // sort, reverse order
23  std::sort(
24  trigCellVecOutput.begin(),
25  trigCellVecOutput.end(),
26  [](const l1t::HGCalTriggerCell& a, const l1t::HGCalTriggerCell& b) -> bool { return a.mipPt() > b.mipPt(); });
27 
28  uint32_t nLinksIndex = 0;
29  if (nLinks > kLinkMask_) {
30  throw cms::Exception("BadConfig") << "BestChoice: Nlinks=" << nLinks
31  << " larger then the max supported number of links " << kLinkMask_;
32  }
33  nLinksIndex |= ((nLinks - 1) & kLinkMask_);
34  nLinksIndex |= (((nWafers - 1) & kWaferMask_) << kWaferOffset_);
35  unsigned nData = nData_.at(nLinksIndex);
36  if (nData == 0) {
37  throw cms::Exception("BadConfig") << "BestChoice: NData=0 for "
38  << " NWafers=" << nWafers << " and NLinks=" << nLinks;
39  }
40  // keep only N trigger cells
41  if (trigCellVecOutput.size() > nData) {
42  // store the last cells (not selected)
43  std::move(trigCellVecOutput.begin() + nData, trigCellVecOutput.end(), std::back_inserter(trigCellVecNotSelected));
44  // keep only N trigger cells
45  trigCellVecOutput.resize(nData);
46  }
47 }

References a, b, Exception, kLinkMask_, kWaferMask_, kWaferOffset_, eostools::move(), and nData_.

Member Data Documentation

◆ kLinkMask_

constexpr uint32_t HGCalConcentratorBestChoiceImpl::kLinkMask_ = 0xF
staticconstexprprivate

Definition at line 26 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

◆ kNDataSize_

constexpr unsigned HGCalConcentratorBestChoiceImpl::kNDataSize_ = 128
staticconstexprprivate

Definition at line 23 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by HGCalConcentratorBestChoiceImpl().

◆ kWaferMask_

constexpr uint32_t HGCalConcentratorBestChoiceImpl::kWaferMask_ = 0x7
staticconstexprprivate

Definition at line 25 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

◆ kWaferOffset_

constexpr uint32_t HGCalConcentratorBestChoiceImpl::kWaferOffset_ = 4
staticconstexprprivate

Definition at line 24 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

◆ nData_

std::vector<unsigned> HGCalConcentratorBestChoiceImpl::nData_
private

Definition at line 22 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by HGCalConcentratorBestChoiceImpl(), and select().

◆ triggerTools_

HGCalTriggerTools HGCalConcentratorBestChoiceImpl::triggerTools_
private

Definition at line 28 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by eventSetup().

HGCalConcentratorBestChoiceImpl::kWaferMask_
static constexpr uint32_t kWaferMask_
Definition: HGCalConcentratorBestChoiceImpl.h:25
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
HGCalConcentratorBestChoiceImpl::kNDataSize_
static constexpr unsigned kNDataSize_
Definition: HGCalConcentratorBestChoiceImpl.h:23
HGCalConcentratorBestChoiceImpl::kWaferOffset_
static constexpr uint32_t kWaferOffset_
Definition: HGCalConcentratorBestChoiceImpl.h:24
HGCalConcentratorBestChoiceImpl::kLinkMask_
static constexpr uint32_t kLinkMask_
Definition: HGCalConcentratorBestChoiceImpl.h:26
l1t::HGCalTriggerCell
Definition: HGCalTriggerCell.h:14
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
HGCalConcentratorBestChoiceImpl::nData_
std::vector< unsigned > nData_
Definition: HGCalConcentratorBestChoiceImpl.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCalConcentratorBestChoiceImpl::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalConcentratorBestChoiceImpl.h:28
Exception
Definition: hltDiff.cc:246