CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | 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
 
struct  rank_gt
 

Public Member Functions

virtual void fetchInput ()
 get input data from sources More...
 
std::vector< L1CaloEmCandgetInputCands ()
 
std::vector< L1GctEmCandgetOutputCands ()
 get output candidates More...
 
 L1GctElectronSorter (int nInputs, bool iso)
 constructor; set type (isolated or non-isolated) More...
 
virtual void process ()
 process the data, fill output buffers More...
 
void setInputEmCand (const L1CaloEmCand &cand)
 set input candidate More...
 
 ~L1GctElectronSorter ()
 
- 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 ()
 

Protected Member Functions

virtual void resetPipelines ()
 
virtual void resetProcessor ()
 Separate reset methods for the processor itself and any data stored in pipelines. More...
 
virtual void setupObjects ()
 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 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.

4  :
6  m_id(nInputs),
7  m_isolation(iso),
8  m_inputCands(nInputs*4),
10 {}
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 ( )

Definition at line 12 of file L1GctElectronSorter.cc.

13 {
14 }

Member Function Documentation

void L1GctElectronSorter::fetchInput ( )
virtual

get input data from sources

Implements L1GctProcessor.

Definition at line 37 of file L1GctElectronSorter.cc.

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

get input candidates

Definition at line 73 of file L1GctElectronSorter.h.

References m_inputCands.

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

get output candidates

Definition at line 76 of file L1GctElectronSorter.h.

References m_outputCands.

Referenced by L1GctElectronFinalSort::fetchInput().

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

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 42 of file L1GctElectronSorter.cc.

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

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_FASTSIM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

42  {
43 
44  //Convert from caloEmCand to gctEmCand and make temporary copy of data
45  std::vector<prioritisedEmCand> data(m_inputCands.size());
46  // Assign a "priority" for sorting - this assumes the candidates
47  // have already been filled in "priority order"
48  for (unsigned i=0; i<m_inputCands.size(); i++) {
49  prioritisedEmCand c(m_inputCands.at(i), i);
50  data.at(i) = c;
51  }
52 
53  //Then sort it
54  sort(data.begin(),data.end(),rank_gt());
55 
56  //Copy data to output buffer
57  for(int i = 0; i<4; i++){
58  m_outputCands.at(i) = data.at(i).emCand;
59  }
60 }
int i
Definition: DBlmapReader.cc:9
std::vector< L1GctEmCand > m_outputCands
output data
std::vector< L1CaloEmCand > m_inputCands
input data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual void L1GctElectronSorter::resetPipelines ( )
inlineprotectedvirtual

Implements L1GctProcessor.

Definition at line 84 of file L1GctElectronSorter.h.

84 {}
void L1GctElectronSorter::resetProcessor ( )
protectedvirtual

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.

17  {
18  m_inputCands.clear();
19  m_inputCands.resize(m_id*4);
20 
21  m_outputCands.clear();
22  m_outputCands.resize(4);
23 }
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 62 of file L1GctElectronSorter.cc.

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

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

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.

28  {
32  temp.setBx(bxAbs());
33  m_inputCands.assign(m_id*4, temp);
34 }
void setBx(int16_t bx)
set BX
Definition: L1CaloEmCand.cc:69
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:18
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 77 of file L1GctElectronSorter.cc.

77  {
78  s << "===L1GctElectronSorter===" << std::endl;
79  s << "Algo type = " << ems.m_isolation << std::endl;
80  s << "No of Electron Input Candidates = " << ems.m_inputCands.size()<< std::endl;
81  s << "No of Electron Output Candidates = " << ems.m_outputCands.size()<< std::endl;
82  return s;
83 }

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