CMS 3D CMS Logo

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.

\Class 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::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) {}

◆ ~L1GctElectronSorter()

L1GctElectronSorter::~L1GctElectronSorter ( )
override

Definition at line 7 of file L1GctElectronSorter.cc.

7 {}

Member Function Documentation

◆ fetchInput()

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 }

◆ getInputCands()

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

get input candidates

Definition at line 67 of file L1GctElectronSorter.h.

67 { return m_inputCands; }

References m_inputCands.

◆ getOutputCands()

std::vector<L1GctEmCand> L1GctElectronSorter::getOutputCands ( )
inline

get output candidates

Definition at line 70 of file L1GctElectronSorter.h.

70 { return m_outputCands; }

References m_outputCands.

Referenced by L1GctElectronFinalSort::fetchInput().

◆ process()

void L1GctElectronSorter::process ( )
overridevirtual

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 35 of file L1GctElectronSorter.cc.

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 }

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

◆ rankByGt()

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.

48  {
49  return (x.rank() > y.rank() || ((x.rank() == y.rank()) && (x.priority < y.priority)));
50  }

References x, and y.

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

◆ resetPipelines()

void L1GctElectronSorter::resetPipelines ( )
inlineoverrideprotectedvirtual

Implements L1GctProcessor.

Definition at line 78 of file L1GctElectronSorter.h.

78 {}

◆ resetProcessor()

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.

10  {
11  m_inputCands.clear();
12  m_inputCands.resize(m_id * 4);
13 
14  m_outputCands.clear();
15  m_outputCands.resize(4);
16 }

References m_id, m_inputCands, and m_outputCands.

◆ setInputEmCand()

void L1GctElectronSorter::setInputEmCand ( const L1CaloEmCand cand)

set input candidate

Definition at line 54 of file L1GctElectronSorter.cc.

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 }

References mps_fire::i, input, m_id, and m_inputCands.

◆ setupObjects()

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.

21  {
25  temp.setBx(bxAbs());
26  m_inputCands.assign(m_id * 4, temp);
27 }

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

Friends And Related Function Documentation

◆ operator<<

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

◆ m_id

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

◆ m_inputCands

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

◆ m_isolation

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

◆ m_outputCands

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

output data

Definition at line 95 of file L1GctElectronSorter.h.

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

DDAxes::y
L1GctProcessor::L1GctProcessor
L1GctProcessor()
Definition: L1GctProcessor.h:24
mps_fire.i
i
Definition: mps_fire.py:428
input
static const std::string input
Definition: EdmProvDump.cc:48
L1GctElectronSorter::m_inputCands
std::vector< L1CaloEmCand > m_inputCands
input data
Definition: L1GctElectronSorter.h:92
L1GctElectronSorter::m_id
int m_id
algo ID (is it FPGA 1 or 2 processing)
Definition: L1GctElectronSorter.h:86
DDAxes::x
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
L1GctProcessor::bxAbs
int bxAbs() const
Definition: L1GctProcessor.h:80
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1GctElectronSorter::m_outputCands
std::vector< L1GctEmCand > m_outputCands
output data
Definition: L1GctElectronSorter.h:95
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
cand
Definition: decayParser.h:32
L1GctElectronSorter::rankByGt
static bool rankByGt(const prioritisedEmCand &x, const prioritisedEmCand &y)
Definition: L1GctElectronSorter.h:48
L1GctElectronSorter::m_isolation
bool m_isolation
type of electron to sort (isolated = 0 or non isolated = 1)
Definition: L1GctElectronSorter.h:89
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
L1CaloEmCand
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17