CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Attributes | Friends
L1GctElectronFinalSort Class Reference

#include <L1GctElectronFinalSort.h>

Inheritance diagram for L1GctElectronFinalSort:
L1GctProcessor

Public Types

typedef L1GctElectronSorter::prioritisedEmCand prioritisedEmCand
 Use some definitions from the ElectronSorter in the leaf cards. More...
 

Public Member Functions

void fetchInput () override
 get input data from sources More...
 
std::vector< L1GctEmCandgetInputCands () const
 return input data More...
 
std::vector< L1GctEmCandgetOutputCands () const
 return output data More...
 
 L1GctElectronFinalSort (bool iso, L1GctEmLeafCard *posEtaCard, L1GctEmLeafCard *negEtaCard)
 
void process () override
 process the data, fill output buffers More...
 
void setInputEmCand (unsigned i, const L1GctEmCand &cand)
 set input data More...
 
bool setupOk () const
 check setup More...
 
 ~L1GctElectronFinalSort () override
 destructor More...
 
- 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

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

bool m_emCandsType
 type of electron candidate (iso(0) or non-iso(1)) More...
 
std::vector< L1GctEmCandm_inputCands
 input data More...
 
Pipeline< L1GctEmCandm_outputCands
 output data More...
 
bool m_setupOk
 Check the setup. More...
 
L1GctEmLeafCardm_theNegEtaLeafCard
 
L1GctEmLeafCardm_thePosEtaLeafCard
 the 1st stage electron sorters More...
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from L1GctProcessor
bool m_verbose
 Flag to control output messages. More...
 

Detailed Description

Definition at line 29 of file L1GctElectronFinalSort.h.

Member Typedef Documentation

Use some definitions from the ElectronSorter in the leaf cards.

Definition at line 33 of file L1GctElectronFinalSort.h.

Constructor & Destructor Documentation

L1GctElectronFinalSort::L1GctElectronFinalSort ( bool  iso,
L1GctEmLeafCard posEtaCard,
L1GctEmLeafCard negEtaCard 
)

constructor

Definition at line 8 of file L1GctElectronFinalSort.cc.

References m_setupOk, m_theNegEtaLeafCard, m_thePosEtaLeafCard, and L1GctProcessor::m_verbose.

9  :
11  m_emCandsType(iso),
12  m_thePosEtaLeafCard(nullptr), m_theNegEtaLeafCard(nullptr),
13  m_inputCands(16),
14  m_outputCands(4),
15  m_setupOk(true)
16 {
17  if(posEtaCard!=nullptr){
18  m_thePosEtaLeafCard = posEtaCard;
19  }else{
20  m_setupOk = false;
21  if (m_verbose) {
22  edm::LogWarning("L1GctSetupError")
23  <<"L1GctElectronFinalSort::Constructor() : 1st EmLeafCard passed is zero";
24  }
25  }
26  if(negEtaCard!=nullptr){
27  m_theNegEtaLeafCard = negEtaCard;
28  }else{
29  m_setupOk = false;
30  if (m_verbose) {
31  edm::LogWarning("L1GctSetupError")
32  <<"L1GctElectronFinalSort::Constructor() : 2nd EmLeafCard passed is zero";
33  }
34  }
35  if (!m_setupOk && m_verbose) {
36  edm::LogError("L1GctSetupError") << "L1GctElectronFinalSort has been incorrectly constructed";
37  }
38 }
L1GctEmLeafCard * m_theNegEtaLeafCard
bool m_verbose
Flag to control output messages.
L1GctEmLeafCard * m_thePosEtaLeafCard
the 1st stage electron sorters
bool m_setupOk
Check the setup.
Pipeline< L1GctEmCand > m_outputCands
output data
std::vector< L1GctEmCand > m_inputCands
input data
bool m_emCandsType
type of electron candidate (iso(0) or non-iso(1))
L1GctElectronFinalSort::~L1GctElectronFinalSort ( )
override

destructor

Definition at line 40 of file L1GctElectronFinalSort.cc.

References m_inputCands, and m_outputCands.

40  {
41  m_inputCands.clear();
42  m_outputCands.contents.clear();
43 }
Pipeline< L1GctEmCand > m_outputCands
output data
std::vector< L1GctEmCand > m_inputCands
input data

Member Function Documentation

void L1GctElectronFinalSort::fetchInput ( )
overridevirtual

get input data from sources

loop over candidates from four electron sorter FPGAs

Implements L1GctProcessor.

Definition at line 54 of file L1GctElectronFinalSort.cc.

References L1GctEmLeafCard::getIsoElectronSorterU1(), L1GctEmLeafCard::getIsoElectronSorterU2(), L1GctEmLeafCard::getNonIsoElectronSorterU1(), L1GctEmLeafCard::getNonIsoElectronSorterU2(), L1GctElectronSorter::getOutputCands(), gen::k, m_emCandsType, m_setupOk, m_theNegEtaLeafCard, m_thePosEtaLeafCard, and setInputEmCand().

Referenced by L1GlobalCaloTrigger::bxProcess().

54  {
55  if (m_setupOk) {
56  for (int k=0; k<4; k++) {
57  if (m_emCandsType) {
62  }
63  else {
68  }
69  }
70  }
71 }
L1GctElectronSorter * getNonIsoElectronSorterU1()
L1GctEmLeafCard * m_theNegEtaLeafCard
std::vector< L1GctEmCand > getOutputCands()
get output candidates
L1GctElectronSorter * getNonIsoElectronSorterU2()
L1GctEmLeafCard * m_thePosEtaLeafCard
the 1st stage electron sorters
L1GctElectronSorter * getIsoElectronSorterU1()
bool m_setupOk
Check the setup.
int k[5][pyjets_maxn]
void setInputEmCand(unsigned i, const L1GctEmCand &cand)
set input data
bool m_emCandsType
type of electron candidate (iso(0) or non-iso(1))
L1GctElectronSorter * getIsoElectronSorterU2()
std::vector<L1GctEmCand> L1GctElectronFinalSort::getInputCands ( ) const
inline

return input data

Definition at line 52 of file L1GctElectronFinalSort.h.

References m_inputCands.

52 { return m_inputCands; }
std::vector< L1GctEmCand > m_inputCands
input data
std::vector<L1GctEmCand> L1GctElectronFinalSort::getOutputCands ( ) const
inline

return output data

Definition at line 55 of file L1GctElectronFinalSort.h.

References m_outputCands, operator<<, and alignCSCRings::s.

Referenced by L1GlobalCaloTrigger::getIsoElectrons(), and L1GlobalCaloTrigger::getNonIsoElectrons().

55 { return m_outputCands.contents; }
Pipeline< L1GctEmCand > m_outputCands
output data
void L1GctElectronFinalSort::process ( )
overridevirtual

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 73 of file L1GctElectronFinalSort.cc.

References L1GctProcessor::bxRel(), EnergyCorrector::c, data, mps_fire::i, m_inputCands, m_outputCands, m_setupOk, L1GctElectronSorter::rankByGt(), and groupFilesInBlocks::temp.

Referenced by L1GlobalCaloTrigger::bxProcess().

73  {
74 
75  if (m_setupOk) {
76  std::vector<prioritisedEmCand> data(m_inputCands.size());
77  // Assign a "priority" for sorting - this assumes the candidates
78  // have already been filled in "priority order"
79  for (unsigned i=0; i<m_inputCands.size(); i++) {
81  data.at(i) = c;
82  }
83 
84  //Then sort it
85  sort(data.begin(),data.end(),L1GctElectronSorter::rankByGt);
86 
87  //Copy data to output buffer
88  std::vector<L1GctEmCand> temp(4);
89  for(int i = 0; i<4; i++){
90  temp.at(i) = data.at(i).emCand;
91  }
92  m_outputCands.store(temp, bxRel());
93  }
94 }
static bool rankByGt(const prioritisedEmCand &x, const prioritisedEmCand &y)
int bxRel() const
L1GctElectronSorter::prioritisedEmCand prioritisedEmCand
Use some definitions from the ElectronSorter in the leaf cards.
bool m_setupOk
Check the setup.
Pipeline< L1GctEmCand > m_outputCands
output data
std::vector< L1GctEmCand > m_inputCands
input data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void L1GctElectronFinalSort::resetPipelines ( )
overrideprotectedvirtual

Implements L1GctProcessor.

Definition at line 50 of file L1GctElectronFinalSort.cc.

References m_outputCands, and L1GctProcessor::numOfBx().

Referenced by setupOk().

50  {
51  m_outputCands.reset(numOfBx());
52 }
int numOfBx() const
Pipeline< L1GctEmCand > m_outputCands
output data
void L1GctElectronFinalSort::resetProcessor ( )
overrideprotectedvirtual

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

Implements L1GctProcessor.

Definition at line 45 of file L1GctElectronFinalSort.cc.

References m_inputCands.

Referenced by setupOk().

45  {
46  m_inputCands.clear();
47  m_inputCands.resize(16);
48 }
std::vector< L1GctEmCand > m_inputCands
input data
void L1GctElectronFinalSort::setInputEmCand ( unsigned  i,
const L1GctEmCand cand 
)

set input data

Definition at line 96 of file L1GctElectronFinalSort.cc.

References L1GctEmCand::bx(), L1GctProcessor::bxAbs(), and m_inputCands.

Referenced by fetchInput().

96  {
97  if ((i<m_inputCands.size())
98  && (cand.bx()==bxAbs())) {
99  m_inputCands.at(i) = cand;
100  }
101 }
std::vector< L1GctEmCand > m_inputCands
input data
int16_t bx() const
get bunch-crossing index
Definition: L1GctEmCand.h:82
int bxAbs() const
void L1GctElectronFinalSort::setupObjects ( )
inlineoverrideprotectedvirtual

Initialise inputs with null objects for the correct bunch crossing if required.

Implements L1GctProcessor.

Definition at line 70 of file L1GctElectronFinalSort.h.

70 {}
bool L1GctElectronFinalSort::setupOk ( ) const
inline

check setup

Definition at line 61 of file L1GctElectronFinalSort.h.

References m_setupOk, resetPipelines(), and resetProcessor().

Referenced by L1GlobalCaloTrigger::setupOk().

61 { return m_setupOk; }
bool m_setupOk
Check the setup.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const L1GctElectronFinalSort cand 
)
friend

overload of cout operator

Definition at line 103 of file L1GctElectronFinalSort.cc.

Referenced by getOutputCands().

103  {
104  s << "===ElectronFinalSort===" << std::endl;
105  s << "Card type = " << ( cand.m_emCandsType ? "isolated" : "non-isolated" ) <<std::endl;
106  s << "Pointers to the Electron Leaf cards are: "<<std::endl;
107  s << " Pos. eta: " << cand.m_thePosEtaLeafCard;
108  s << " Neg. eta: " << cand.m_theNegEtaLeafCard;
109  s << std::endl;
110  s << "No of Electron Input Candidates " << cand.m_inputCands.size() << std::endl;
111  s << "No of Electron Output Candidates " << cand.m_outputCands.contents.size() << std::endl;
112 
113  return s;
114 }
L1GctEmLeafCard * m_theNegEtaLeafCard
L1GctEmLeafCard * m_thePosEtaLeafCard
the 1st stage electron sorters
Pipeline< L1GctEmCand > m_outputCands
output data
std::vector< L1GctEmCand > m_inputCands
input data
bool m_emCandsType
type of electron candidate (iso(0) or non-iso(1))

Member Data Documentation

bool L1GctElectronFinalSort::m_emCandsType
private

type of electron candidate (iso(0) or non-iso(1))

Definition at line 75 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), and operator<<().

std::vector<L1GctEmCand> L1GctElectronFinalSort::m_inputCands
private
Pipeline<L1GctEmCand> L1GctElectronFinalSort::m_outputCands
private

output data

Definition at line 85 of file L1GctElectronFinalSort.h.

Referenced by getOutputCands(), operator<<(), process(), resetPipelines(), and ~L1GctElectronFinalSort().

bool L1GctElectronFinalSort::m_setupOk
private

Check the setup.

Definition at line 88 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), L1GctElectronFinalSort(), process(), and setupOk().

L1GctEmLeafCard* L1GctElectronFinalSort::m_theNegEtaLeafCard
private

Definition at line 79 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), L1GctElectronFinalSort(), and operator<<().

L1GctEmLeafCard* L1GctElectronFinalSort::m_thePosEtaLeafCard
private

the 1st stage electron sorters

Definition at line 78 of file L1GctElectronFinalSort.h.

Referenced by fetchInput(), L1GctElectronFinalSort(), and operator<<().