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)
 

Private Attributes

std::vector< unsigned > nData_
 
HGCalTriggerTools triggerTools_
 

Static Private Attributes

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

Detailed Description

Definition at line 9 of file HGCalConcentratorBestChoiceImpl.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file HGCalConcentratorBestChoiceImpl.cc.

References Exception, kNDataSize_, and nData_.

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 }
T getParameter(std::string const &) const

Member Function Documentation

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

Definition at line 18 of file HGCalConcentratorBestChoiceImpl.h.

References HGCalTriggerTools::eventSetup(), and triggerTools_.

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

Definition at line 15 of file HGCalConcentratorBestChoiceImpl.cc.

References a, b, Exception, kLinkMask_, kWaferMask_, kWaferOffset_, l1t::HGCalTriggerCell::mipPt(), and nData_.

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

Member Data Documentation

uint32_t HGCalConcentratorBestChoiceImpl::kLinkMask_ = 0xF
staticprivate

Definition at line 25 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

unsigned HGCalConcentratorBestChoiceImpl::kNDataSize_ = 128
staticprivate

Definition at line 22 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by HGCalConcentratorBestChoiceImpl().

uint32_t HGCalConcentratorBestChoiceImpl::kWaferMask_ = 0x7
staticprivate

Definition at line 24 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

uint32_t HGCalConcentratorBestChoiceImpl::kWaferOffset_ = 4
staticprivate

Definition at line 23 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

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

Definition at line 21 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by HGCalConcentratorBestChoiceImpl(), and select().

HGCalTriggerTools HGCalConcentratorBestChoiceImpl::triggerTools_
private

Definition at line 27 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by eventSetup().