File indexing completed on 2024-04-06 12:19:53
0001 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetSorter.h"
0002
0003 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h"
0004
0005 L1GctJetSorter::L1GctJetSorter() : m_inputJets() {}
0006 L1GctJetSorter::L1GctJetSorter(L1GctJetSorter::JetVector& inputJets) : m_inputJets(inputJets) {}
0007
0008 L1GctJetSorter::~L1GctJetSorter() {}
0009
0010 void L1GctJetSorter::setJets(L1GctJetSorter::JetVector& inputJets) { m_inputJets = inputJets; }
0011
0012 L1GctJetSorter::JetVector L1GctJetSorter::getSortedJets() const {
0013 unsigned nJets = m_inputJets.size();
0014 std::vector<unsigned> position(nJets, 0);
0015
0016
0017
0018 for (unsigned j1 = 0; j1 < nJets; j1++) {
0019 for (unsigned j2 = j1 + 1; j2 < nJets; j2++) {
0020 if (m_inputJets.at(j1).rank() < m_inputJets.at(j2).rank()) {
0021 position.at(j1) = position.at(j1) + 1;
0022 } else {
0023 position.at(j2) = position.at(j2) + 1;
0024 }
0025 }
0026 }
0027
0028 JetVector result(m_inputJets.size());
0029 for (unsigned j1 = 0; j1 < nJets; j1++) {
0030 result.at(position.at(j1)) = m_inputJets.at(j1);
0031 }
0032
0033 return result;
0034 }
0035
0036 L1GctJetSorter::JetVector L1GctJetSorter::getInputJets() const { return m_inputJets; }