CMS 3D CMS Logo

HGCalConcentratorBestChoiceImpl.cc
Go to the documentation of this file.
2 
7 
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 }
14 
16  unsigned nWafers,
17  const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
18  std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
19  std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected) {
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 }
HGCalConcentratorBestChoiceImpl::kWaferMask_
static constexpr uint32_t kWaferMask_
Definition: HGCalConcentratorBestChoiceImpl.h:25
HGCalConcentratorBestChoiceImpl::kNDataSize_
static constexpr unsigned kNDataSize_
Definition: HGCalConcentratorBestChoiceImpl.h:23
HGCalConcentratorBestChoiceImpl.h
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
HGCalConcentratorBestChoiceImpl::HGCalConcentratorBestChoiceImpl
HGCalConcentratorBestChoiceImpl(const edm::ParameterSet &conf)
Definition: HGCalConcentratorBestChoiceImpl.cc:8
b
double b
Definition: hdecay.h:118
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
HGCalConcentratorBestChoiceImpl::select
void select(unsigned nLinks, unsigned nWafers, const std::vector< l1t::HGCalTriggerCell > &trigCellVecInput, std::vector< l1t::HGCalTriggerCell > &trigCellVecOutput, std::vector< l1t::HGCalTriggerCell > &trigCellVecNotSelected)
Definition: HGCalConcentratorBestChoiceImpl.cc:15
HGCalConcentratorBestChoiceImpl::nData_
std::vector< unsigned > nData_
Definition: HGCalConcentratorBestChoiceImpl.h:22
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246