Go to the documentation of this file.00001 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctElectronSorter.h"
00002 #include <algorithm>
00003
00004 L1GctElectronSorter::L1GctElectronSorter(int nInputs, bool iso):
00005 L1GctProcessor(),
00006 m_id(nInputs),
00007 m_isolation(iso),
00008 m_inputCands(nInputs*4),
00009 m_outputCands(4)
00010 {}
00011
00012 L1GctElectronSorter::~L1GctElectronSorter()
00013 {
00014 }
00015
00016
00017 void L1GctElectronSorter::resetProcessor() {
00018 m_inputCands.clear();
00019 m_inputCands.resize(m_id*4);
00020
00021 m_outputCands.clear();
00022 m_outputCands.resize(4);
00023 }
00024
00028 void L1GctElectronSorter::setupObjects() {
00031 L1CaloEmCand temp;
00032 temp.setBx(bxAbs());
00033 m_inputCands.assign(m_id*4, temp);
00034 }
00035
00036
00037 void L1GctElectronSorter::fetchInput() {
00038
00039 }
00040
00041
00042 void L1GctElectronSorter::process() {
00043
00044
00045 std::vector<prioritisedEmCand> data(m_inputCands.size());
00046
00047
00048 for (unsigned i=0; i<m_inputCands.size(); i++) {
00049 prioritisedEmCand c(m_inputCands.at(i), i);
00050 data.at(i) = c;
00051 }
00052
00053
00054 sort(data.begin(),data.end(),rank_gt());
00055
00056
00057 for(int i = 0; i<4; i++){
00058 m_outputCands.at(i) = data.at(i).emCand;
00059 }
00060 }
00061
00062 void L1GctElectronSorter::setInputEmCand(const L1CaloEmCand& cand){
00063
00064
00065
00066
00067
00068
00069 unsigned crate = cand.rctCrate();
00070 unsigned input = ( (m_id==4) ? (crate%9) : (crate%9 - 4) );
00071 unsigned i = input*4 + (3-cand.index());
00072 if (m_inputCands.at(i).rank()==0) {
00073 m_inputCands.at(i) = cand;
00074 }
00075 }
00076
00077 std::ostream& operator<<(std::ostream& s, const L1GctElectronSorter& ems) {
00078 s << "===L1GctElectronSorter===" << std::endl;
00079 s << "Algo type = " << ems.m_isolation << std::endl;
00080 s << "No of Electron Input Candidates = " << ems.m_inputCands.size()<< std::endl;
00081 s << "No of Electron Output Candidates = " << ems.m_outputCands.size()<< std::endl;
00082 return s;
00083 }
00084