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

 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)
 
void setGeometry (const HGCalTriggerGeometryBase *const geom)
 

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.

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
Definition: ParameterSet.h:303

Member Function Documentation

◆ 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.

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

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 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
def move(src, dest)
Definition: eostools.py:511

◆ setGeometry()

void HGCalConcentratorBestChoiceImpl::setGeometry ( const HGCalTriggerGeometryBase *const  geom)
inline

Member Data Documentation

◆ kLinkMask_

constexpr uint32_t HGCalConcentratorBestChoiceImpl::kLinkMask_ = 0xF
staticprivate

Definition at line 26 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

◆ kNDataSize_

constexpr unsigned HGCalConcentratorBestChoiceImpl::kNDataSize_ = 128
staticprivate

Definition at line 23 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by HGCalConcentratorBestChoiceImpl().

◆ kWaferMask_

constexpr uint32_t HGCalConcentratorBestChoiceImpl::kWaferMask_ = 0x7
staticprivate

Definition at line 25 of file HGCalConcentratorBestChoiceImpl.h.

Referenced by select().

◆ kWaferOffset_

constexpr uint32_t HGCalConcentratorBestChoiceImpl::kWaferOffset_ = 4
staticprivate

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 setGeometry().