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 }
void select(unsigned nLinks, unsigned nWafers, const std::vector< l1t::HGCalTriggerCell > &trigCellVecInput, std::vector< l1t::HGCalTriggerCell > &trigCellVecOutput, std::vector< l1t::HGCalTriggerCell > &trigCellVecNotSelected)
double b
Definition: hdecay.h:120
HGCalConcentratorBestChoiceImpl(const edm::ParameterSet &conf)
double a
Definition: hdecay.h:121
def move(src, dest)
Definition: eostools.py:511