CMS 3D CMS Logo

L1GctElectronSorter Class Reference

Class that sorts electron candidates. More...

#include <L1Trigger/GlobalCaloTrigger/interface/L1GctElectronSorter.h>

Inheritance diagram for L1GctElectronSorter:

L1GctProcessor

List of all members.

Public Member Functions

virtual void fetchInput ()
 get input data from sources
std::vector< L1CaloEmCandgetInputCands ()
 get input candidates
std::vector< L1GctEmCandgetOutputCands ()
 get output candidates
 L1GctElectronSorter (int nInputs, bool iso)
 constructor; set type (isolated or non-isolated)
virtual void process ()
 process the data, fill output buffers
void setInputEmCand (const L1CaloEmCand &cand)
 set input candidate
 ~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
 algo ID (is it FPGA 1 or 2 processing)
std::vector< L1CaloEmCandm_inputCands
 input data
bool m_isolation
 type of electron to sort (isolated = 0 or non isolated = 1)
std::vector< L1GctEmCandm_outputCands
 output data

Friends

std::ostream & operator<< (std::ostream &s, const L1GctElectronSorter &card)
 overload of cout operator

Classes

struct  prioritisedEmCand
 Data type to associate each electron candidate with a priority based on its position in the sorting tree. More...
struct  rank_gt
 comparison operator for sort, used here and in the ElectronFinalSort Candidates of equal rank are sorted by priority, with the lower value given precedence More...


Detailed Description

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.

Author:
Maria Hansen
Date:
21/04/06

Definition at line 27 of file L1GctElectronSorter.h.


Constructor & Destructor Documentation

L1GctElectronSorter::L1GctElectronSorter ( int  nInputs,
bool  iso 
)

constructor; set type (isolated or non-isolated)

Definition at line 4 of file L1GctElectronSorter.cc.

00004                                                              :
00005   L1GctProcessor(),
00006   m_id(nInputs),
00007   m_isolation(iso),
00008   m_inputCands(nInputs*4),
00009   m_outputCands(4)
00010 {}  

L1GctElectronSorter::~L1GctElectronSorter (  ) 

Definition at line 12 of file L1GctElectronSorter.cc.

00013 {
00014 }


Member Function Documentation

void L1GctElectronSorter::fetchInput (  )  [virtual]

get input data from sources

Implements L1GctProcessor.

Definition at line 37 of file L1GctElectronSorter.cc.

00037                                      {
00038   // This does nothing, assume the input candidates get pushed in
00039 }

std::vector<L1CaloEmCand> L1GctElectronSorter::getInputCands (  )  [inline]

get input candidates

Definition at line 73 of file L1GctElectronSorter.h.

References m_inputCands.

00073 { 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().

00076 { return m_outputCands; }

void L1GctElectronSorter::process (  )  [virtual]

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 42 of file L1GctElectronSorter.cc.

References c, data, i, m_inputCands, m_outputCands, and python::multivaluedict::sort().

00042                                   {
00043 
00044   //Convert from caloEmCand to gctEmCand and make temporary copy of data
00045   std::vector<prioritisedEmCand> data(m_inputCands.size());
00046   // Assign a "priority" for sorting - this assumes the candidates
00047   // have already been filled in "priority order"
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   //Then sort it
00054   sort(data.begin(),data.end(),rank_gt());
00055 
00056   //Copy data to output buffer
00057   for(int i = 0; i<4; i++){
00058     m_outputCands.at(i) = data.at(i).emCand;
00059   }
00060 }

virtual void L1GctElectronSorter::resetPipelines (  )  [inline, protected, virtual]

Implements L1GctProcessor.

Definition at line 84 of file L1GctElectronSorter.h.

00084 {}

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.

00017                                          {
00018   m_inputCands.clear();
00019   m_inputCands.resize(m_id*4);
00020 
00021   m_outputCands.clear();
00022   m_outputCands.resize(4);
00023 }

void L1GctElectronSorter::setInputEmCand ( const L1CaloEmCand cand  ) 

set input candidate

Definition at line 62 of file L1GctElectronSorter.cc.

References i, L1CaloEmCand::index(), iggi_31X_cfg::input, m_id, m_inputCands, and L1CaloEmCand::rctCrate().

00062                                                                 {
00063   // Fills the candidates in "priority order"
00064   // The lowest numbered RCT crate in each FPGA has highest priority.
00065   // We distinguish the two FPGAs on a leaf card by the number of inputs.
00066   // FPGA U1 has 5 inputs (crates 4-8) and FPGA U2 has 4 inputs (crates 0-3).
00067   // Within a crate the four input candidates are arranged in the order
00068   // that they arrive on the cable, using the index() method.
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 }

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 pyDBSRunClass::temp.

00028                                        {
00031   L1CaloEmCand temp;
00032   temp.setBx(bxAbs());
00033   m_inputCands.assign(m_id*4, temp);
00034 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const L1GctElectronSorter card 
) [friend]

overload of cout operator

Definition at line 77 of file L1GctElectronSorter.cc.

00077                                                                       {
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 }


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:29 2009 for CMSSW by  doxygen 1.5.4