CMS 3D CMS Logo

List of all members | Public Member Functions
HGCalSortingTruncationImplSA Class Reference

#include <HGCalSortingTruncationImpl_SA.h>

Public Member Functions

 HGCalSortingTruncationImplSA ()=default
 
void sortAndTruncate_SA (const std::vector< l1thgcfirmware::HGCalMulticluster > &inputMulticlusters, std::vector< l1thgcfirmware::HGCalMulticluster > &outputMulticlusters, const l1thgcfirmware::SortingTruncationAlgoConfig &configuration) const
 
 ~HGCalSortingTruncationImplSA ()=default
 

Detailed Description

Definition at line 10 of file HGCalSortingTruncationImpl_SA.h.

Constructor & Destructor Documentation

◆ HGCalSortingTruncationImplSA()

HGCalSortingTruncationImplSA::HGCalSortingTruncationImplSA ( )
default

◆ ~HGCalSortingTruncationImplSA()

HGCalSortingTruncationImplSA::~HGCalSortingTruncationImplSA ( )
default

Member Function Documentation

◆ sortAndTruncate_SA()

void HGCalSortingTruncationImplSA::sortAndTruncate_SA ( const std::vector< l1thgcfirmware::HGCalMulticluster > &  inputMulticlusters,
std::vector< l1thgcfirmware::HGCalMulticluster > &  outputMulticlusters,
const l1thgcfirmware::SortingTruncationAlgoConfig configuration 
) const

Definition at line 3 of file HGCalSortingTruncationImpl_SA.cc.

References ctppsRawToDigi_cff::configuration, hgcalBackEndLayer2Producer_cfi::maxTCs, SiPixelPI::one, jetUpdater_cfi::sort, and SiPixelPI::two.

Referenced by HGCalSortingTruncationWrapper::process().

6  {
7  outputMulticlusters.reserve(inputMulticlusters.size());
8  for (const auto& multicluster : inputMulticlusters) {
9  outputMulticlusters.push_back(multicluster);
10  }
11 
12  //Sort based on 3D cluster sum pT
13  std::sort(outputMulticlusters.begin(),
14  outputMulticlusters.end(),
16  return one.sumPt() < two.sumPt();
17  });
18 
19  //Truncate, keeping maxTCs entries
20  unsigned maxTCs = configuration.maxTCs();
21  if (outputMulticlusters.size() > maxTCs) {
22  outputMulticlusters.resize(maxTCs);
23  }
24 }