Class that sorts electron candidates. More...
#include <L1GctElectronSorter.h>
Classes | |
struct | prioritisedEmCand |
struct | rank_gt |
Public Member Functions | |
virtual void | fetchInput () |
std::vector< L1CaloEmCand > | getInputCands () |
std::vector< L1GctEmCand > | getOutputCands () |
L1GctElectronSorter (int nInputs, bool iso) | |
constructor; set type (isolated or non-isolated) | |
virtual void | process () |
void | setInputEmCand (const L1CaloEmCand &cand) |
~L1GctElectronSorter () | |
Protected Member Functions | |
virtual void | resetPipelines () |
virtual void | resetProcessor () |
Separate reset methods for the processor itself and any data stored in pipelines. | |
virtual void | setupObjects () |
Initialise inputs with null objects for the correct bunch crossing if required. | |
Private Attributes | |
int | m_id |
std::vector< L1CaloEmCand > | m_inputCands |
bool | m_isolation |
std::vector< L1GctEmCand > | m_outputCands |
Friends | |
std::ostream & | operator<< (std::ostream &s, const L1GctElectronSorter &card) |
Class that sorts electron candidates.
L1GctElectronSorter This class can be constructed to sort iso or non-iso electron candidates. The electrons are sorted in ascending order and the 4 highest in rank will be returned. It represents the 1st stage sorter FPGA's on the electron leaf cards.
Definition at line 27 of file L1GctElectronSorter.h.
L1GctElectronSorter::L1GctElectronSorter | ( | int | nInputs, |
bool | iso | ||
) |
constructor; set type (isolated or non-isolated)
Definition at line 4 of file L1GctElectronSorter.cc.
: L1GctProcessor(), m_id(nInputs), m_isolation(iso), m_inputCands(nInputs*4), m_outputCands(4) {}
L1GctElectronSorter::~L1GctElectronSorter | ( | ) |
Definition at line 12 of file L1GctElectronSorter.cc.
{ }
void L1GctElectronSorter::fetchInput | ( | ) | [virtual] |
get input data from sources
Implements L1GctProcessor.
Definition at line 37 of file L1GctElectronSorter.cc.
{
// This does nothing, assume the input candidates get pushed in
}
std::vector<L1CaloEmCand> L1GctElectronSorter::getInputCands | ( | ) | [inline] |
get input candidates
Definition at line 73 of file L1GctElectronSorter.h.
References m_inputCands.
{ return m_inputCands; }
std::vector<L1GctEmCand> L1GctElectronSorter::getOutputCands | ( | ) | [inline] |
get output candidates
Definition at line 76 of file L1GctElectronSorter.h.
References m_outputCands.
Referenced by L1GctElectronFinalSort::fetchInput().
{ return m_outputCands; }
void L1GctElectronSorter::process | ( | ) | [virtual] |
process the data, fill output buffers
Implements L1GctProcessor.
Definition at line 42 of file L1GctElectronSorter.cc.
References trackerHits::c, AlCaHLTBitMon_QueryRunRegistry::data, i, m_inputCands, m_outputCands, and python::multivaluedict::sort().
{ //Convert from caloEmCand to gctEmCand and make temporary copy of data std::vector<prioritisedEmCand> data(m_inputCands.size()); // Assign a "priority" for sorting - this assumes the candidates // have already been filled in "priority order" for (unsigned i=0; i<m_inputCands.size(); i++) { prioritisedEmCand c(m_inputCands.at(i), i); data.at(i) = c; } //Then sort it sort(data.begin(),data.end(),rank_gt()); //Copy data to output buffer for(int i = 0; i<4; i++){ m_outputCands.at(i) = data.at(i).emCand; } }
virtual void L1GctElectronSorter::resetPipelines | ( | ) | [inline, protected, virtual] |
void L1GctElectronSorter::resetProcessor | ( | ) | [protected, virtual] |
Separate reset methods for the processor itself and any data stored in pipelines.
Implements L1GctProcessor.
Definition at line 17 of file L1GctElectronSorter.cc.
References m_id, m_inputCands, and m_outputCands.
{ m_inputCands.clear(); m_inputCands.resize(m_id*4); m_outputCands.clear(); m_outputCands.resize(4); }
void L1GctElectronSorter::setInputEmCand | ( | const L1CaloEmCand & | cand | ) |
set input candidate
Definition at line 62 of file L1GctElectronSorter.cc.
References i, L1CaloEmCand::index(), LaserDQM_cfg::input, m_id, m_inputCands, and L1CaloEmCand::rctCrate().
{ // Fills the candidates in "priority order" // The lowest numbered RCT crate in each FPGA has highest priority. // We distinguish the two FPGAs on a leaf card by the number of inputs. // FPGA U1 has 5 inputs (crates 4-8) and FPGA U2 has 4 inputs (crates 0-3). // Within a crate the four input candidates are arranged in the order // that they arrive on the cable, using the index() method. unsigned crate = cand.rctCrate(); unsigned input = ( (m_id==4) ? (crate%9) : (crate%9 - 4) ); unsigned i = input*4 + (3-cand.index()); if (m_inputCands.at(i).rank()==0) { m_inputCands.at(i) = cand; } }
void L1GctElectronSorter::setupObjects | ( | ) | [protected, virtual] |
Initialise inputs with null objects for the correct bunch crossing if required.
Initialise inputs with null objects for the correct bunch crossing If no other input candidates "arrive", we have the correct bunch crossing to propagate through the processing.
Create a null input electron with the right bunch crossing, and fill the input candidates with copies of this.
Implements L1GctProcessor.
Definition at line 28 of file L1GctElectronSorter.cc.
References L1GctProcessor::bxAbs(), m_id, m_inputCands, L1CaloEmCand::setBx(), and groupFilesInBlocks::temp.
{ L1CaloEmCand temp; temp.setBx(bxAbs()); m_inputCands.assign(m_id*4, temp); }
std::ostream& operator<< | ( | std::ostream & | s, |
const L1GctElectronSorter & | card | ||
) | [friend] |
overload of cout operator
Definition at line 77 of file L1GctElectronSorter.cc.
int L1GctElectronSorter::m_id [private] |
algo ID (is it FPGA 1 or 2 processing)
Definition at line 92 of file L1GctElectronSorter.h.
Referenced by resetProcessor(), setInputEmCand(), and setupObjects().
std::vector<L1CaloEmCand> L1GctElectronSorter::m_inputCands [private] |
input data
Definition at line 98 of file L1GctElectronSorter.h.
Referenced by getInputCands(), operator<<(), process(), resetProcessor(), setInputEmCand(), and setupObjects().
bool L1GctElectronSorter::m_isolation [private] |
type of electron to sort (isolated = 0 or non isolated = 1)
Definition at line 95 of file L1GctElectronSorter.h.
Referenced by operator<<().
std::vector<L1GctEmCand> L1GctElectronSorter::m_outputCands [private] |
output data
Definition at line 101 of file L1GctElectronSorter.h.
Referenced by getOutputCands(), operator<<(), process(), and resetProcessor().