CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends
L1GctElectronSorter Class Reference

Class that sorts electron candidates. More...

#include <L1GctElectronSorter.h>

Inheritance diagram for L1GctElectronSorter:
L1GctProcessor

Classes

struct  prioritisedEmCand
 

Public Member Functions

void fetchInput () override
 get input data from sources More...
 
std::vector< L1CaloEmCandgetInputCands ()
 get input candidates More...
 
std::vector< L1GctEmCandgetOutputCands ()
 get output candidates More...
 
 L1GctElectronSorter (int nInputs, bool iso)
 constructor; set type (isolated or non-isolated) More...
 
void process () override
 process the data, fill output buffers More...
 
void setInputEmCand (const L1CaloEmCand &cand)
 set input candidate More...
 
 ~L1GctElectronSorter () override
 
- Public Member Functions inherited from L1GctProcessor
 L1GctProcessor ()
 
void reset ()
 complete reset of processor More...
 
void setBxRange (const int firstBx, const int numberOfBx)
 define the bunch crossing range to process More...
 
void setNextBx (const int bxnum)
 clear input data buffers and process a new bunch crossing More...
 
void setTerse ()
 
bool setupOk () const
 Method to check the setup for this processor. Returns true by default. More...
 
void setVerbose ()
 control output messages More...
 
virtual ~L1GctProcessor ()
 

Static Public Member Functions

static bool rankByGt (const prioritisedEmCand &x, const prioritisedEmCand &y)
 

Protected Member Functions

void resetPipelines () override
 
void resetProcessor () override
 Separate reset methods for the processor itself and any data stored in pipelines. More...
 
void setupObjects () override
 Initialise inputs with null objects for the correct bunch crossing if required. More...
 
- Protected Member Functions inherited from L1GctProcessor
int bxAbs () const
 
int bxMax () const
 
int bxMin () const
 Support for multiple beam crossing operation. More...
 
int bxRel () const
 
int numOfBx () const
 

Private Attributes

int m_id
 algo ID (is it FPGA 1 or 2 processing) More...
 
std::vector< L1CaloEmCandm_inputCands
 input data More...
 
bool m_isolation
 type of electron to sort (isolated = 0 or non isolated = 1) More...
 
std::vector< L1GctEmCandm_outputCands
 output data More...
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from L1GctProcessor
bool m_verbose
 Flag to control output messages. 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 26 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.

5  : L1GctProcessor(), m_id(nInputs), m_isolation(iso), m_inputCands(nInputs * 4), m_outputCands(4) {}
std::vector< L1GctEmCand > m_outputCands
output data
bool m_isolation
type of electron to sort (isolated = 0 or non isolated = 1)
std::vector< L1CaloEmCand > m_inputCands
input data
int m_id
algo ID (is it FPGA 1 or 2 processing)
L1GctElectronSorter::~L1GctElectronSorter ( )
override

Definition at line 7 of file L1GctElectronSorter.cc.

7 {}

Member Function Documentation

void L1GctElectronSorter::fetchInput ( )
overridevirtual

get input data from sources

Implements L1GctProcessor.

Definition at line 30 of file L1GctElectronSorter.cc.

30  {
31  // This does nothing, assume the input candidates get pushed in
32 }
std::vector<L1CaloEmCand> L1GctElectronSorter::getInputCands ( )
inline

get input candidates

Definition at line 67 of file L1GctElectronSorter.h.

References m_inputCands.

67 { return m_inputCands; }
std::vector< L1CaloEmCand > m_inputCands
input data
std::vector<L1GctEmCand> L1GctElectronSorter::getOutputCands ( )
inline

get output candidates

Definition at line 70 of file L1GctElectronSorter.h.

References m_outputCands.

Referenced by L1GctElectronFinalSort::fetchInput().

70 { return m_outputCands; }
std::vector< L1GctEmCand > m_outputCands
output data
void L1GctElectronSorter::process ( )
overridevirtual

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 35 of file L1GctElectronSorter.cc.

References c, data, mps_fire::i, m_inputCands, m_outputCands, and rankByGt().

35  {
36  //Convert from caloEmCand to gctEmCand and make temporary copy of data
37  std::vector<prioritisedEmCand> data(m_inputCands.size());
38  // Assign a "priority" for sorting - this assumes the candidates
39  // have already been filled in "priority order"
40  for (unsigned i = 0; i < m_inputCands.size(); i++) {
41  prioritisedEmCand c(m_inputCands.at(i), i);
42  data.at(i) = c;
43  }
44 
45  //Then sort it
46  sort(data.begin(), data.end(), rankByGt);
47 
48  //Copy data to output buffer
49  for (int i = 0; i < 4; i++) {
50  m_outputCands.at(i) = data.at(i).emCand;
51  }
52 }
static bool rankByGt(const prioritisedEmCand &x, const prioritisedEmCand &y)
const edm::EventSetup & c
std::vector< L1GctEmCand > m_outputCands
output data
std::vector< L1CaloEmCand > m_inputCands
input data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static bool L1GctElectronSorter::rankByGt ( const prioritisedEmCand x,
const prioritisedEmCand y 
)
inlinestatic

comparison operator for sort, used here and in the ElectronFinalSort Candidates of equal rank are sorted by priority, with the lower value given precedence

Definition at line 48 of file L1GctElectronSorter.h.

References L1GctElectronSorter::prioritisedEmCand::priority, and L1GctElectronSorter::prioritisedEmCand::rank().

Referenced by L1GctElectronFinalSort::process(), and process().

48  {
49  return (x.rank() > y.rank() || ((x.rank() == y.rank()) && (x.priority < y.priority)));
50  }
void L1GctElectronSorter::resetPipelines ( )
inlineoverrideprotectedvirtual

Implements L1GctProcessor.

Definition at line 78 of file L1GctElectronSorter.h.

78 {}
void L1GctElectronSorter::resetProcessor ( )
overrideprotectedvirtual

Separate reset methods for the processor itself and any data stored in pipelines.

Implements L1GctProcessor.

Definition at line 10 of file L1GctElectronSorter.cc.

References m_id, m_inputCands, and m_outputCands.

10  {
11  m_inputCands.clear();
12  m_inputCands.resize(m_id * 4);
13 
14  m_outputCands.clear();
15  m_outputCands.resize(4);
16 }
std::vector< L1GctEmCand > m_outputCands
output data
std::vector< L1CaloEmCand > m_inputCands
input data
int m_id
algo ID (is it FPGA 1 or 2 processing)
void L1GctElectronSorter::setInputEmCand ( const L1CaloEmCand cand)

set input candidate

Definition at line 54 of file L1GctElectronSorter.cc.

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

54  {
55  // Fills the candidates in "priority order"
56  // The lowest numbered RCT crate in each FPGA has highest priority.
57  // We distinguish the two FPGAs on a leaf card by the number of inputs.
58  // FPGA U1 has 5 inputs (crates 4-8) and FPGA U2 has 4 inputs (crates 0-3).
59  // Within a crate the four input candidates are arranged in the order
60  // that they arrive on the cable, using the index() method.
61  unsigned crate = cand.rctCrate();
62  unsigned input = ((m_id == 4) ? (crate % 9) : (crate % 9 - 4));
63  unsigned i = input * 4 + (3 - cand.index());
64  if (m_inputCands.at(i).rank() == 0) {
65  m_inputCands.at(i) = cand;
66  }
67 }
std::vector< L1CaloEmCand > m_inputCands
input data
static std::string const input
Definition: EdmProvDump.cc:47
unsigned rctCrate() const
get RCT crate
Definition: L1CaloEmCand.h:51
int m_id
algo ID (is it FPGA 1 or 2 processing)
unsigned index() const
get index on cable
Definition: L1CaloEmCand.h:57
void L1GctElectronSorter::setupObjects ( )
overrideprotectedvirtual

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 21 of file L1GctElectronSorter.cc.

References L1GctProcessor::bxAbs(), m_id, m_inputCands, L1CaloEmCand::setBx(), and groupFilesInBlocks::temp.

21  {
25  temp.setBx(bxAbs());
26  m_inputCands.assign(m_id * 4, temp);
27 }
void setBx(int16_t bx)
set BX
Definition: L1CaloEmCand.cc:49
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
std::vector< L1CaloEmCand > m_inputCands
input data
int m_id
algo ID (is it FPGA 1 or 2 processing)
int bxAbs() const

Friends And Related Function Documentation

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

overload of cout operator

Definition at line 69 of file L1GctElectronSorter.cc.

69  {
70  s << "===L1GctElectronSorter===" << std::endl;
71  s << "Algo type = " << ems.m_isolation << std::endl;
72  s << "No of Electron Input Candidates = " << ems.m_inputCands.size() << std::endl;
73  s << "No of Electron Output Candidates = " << ems.m_outputCands.size() << std::endl;
74  return s;
75 }

Member Data Documentation

int L1GctElectronSorter::m_id
private

algo ID (is it FPGA 1 or 2 processing)

Definition at line 86 of file L1GctElectronSorter.h.

Referenced by resetProcessor(), setInputEmCand(), and setupObjects().

std::vector<L1CaloEmCand> L1GctElectronSorter::m_inputCands
private

input data

Definition at line 92 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 89 of file L1GctElectronSorter.h.

Referenced by operator<<().

std::vector<L1GctEmCand> L1GctElectronSorter::m_outputCands
private

output data

Definition at line 95 of file L1GctElectronSorter.h.

Referenced by getOutputCands(), operator<<(), process(), and resetProcessor().