CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L1MuGMTSorter Class Reference

#include <L1MuGMTSorter.h>

Public Member Functions

const std::vector< const L1MuGMTExtendedCand * > & Cands () const
 return std::vector with all muon candidates More...
 
 L1MuGMTSorter (const L1MuGlobalMuonTrigger &)
 constructor More...
 
int numberOfCands () const
 return number of found muon candidates after sorter More...
 
void print ()
 print results after sorting More...
 
virtual void reset ()
 reset Sorter More...
 
virtual void run ()
 run Sorter More...
 
virtual ~L1MuGMTSorter ()
 destructor More...
 

Private Attributes

const L1MuGlobalMuonTriggerm_gmt
 
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
 

Detailed Description

L1 Global Muon Trigger Sorter.

Definition at line 39 of file L1MuGMTSorter.h.

Constructor & Destructor Documentation

◆ L1MuGMTSorter()

L1MuGMTSorter::L1MuGMTSorter ( const L1MuGlobalMuonTrigger gmt)

constructor

Definition at line 54 of file L1MuGMTSorter.cc.

54 : m_gmt(gmt), m_MuonCands() { m_MuonCands.reserve(4); }

References m_MuonCands.

◆ ~L1MuGMTSorter()

L1MuGMTSorter::~L1MuGMTSorter ( )
virtual

destructor

Definition at line 60 of file L1MuGMTSorter.cc.

60 {}

Member Function Documentation

◆ Cands()

const std::vector<const L1MuGMTExtendedCand*>& L1MuGMTSorter::Cands ( ) const
inline

return std::vector with all muon candidates

Definition at line 60 of file L1MuGMTSorter.h.

60 { return m_MuonCands; }

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

◆ numberOfCands()

int L1MuGMTSorter::numberOfCands ( ) const
inline

return number of found muon candidates after sorter

Definition at line 57 of file L1MuGMTSorter.h.

57 { return m_MuonCands.size(); }

References m_MuonCands.

Referenced by print(), and L1MuGlobalMuonTrigger::produce().

◆ print()

void L1MuGMTSorter::print ( void  )

print results after sorting

Definition at line 169 of file L1MuGMTSorter.cc.

169  {
170  edm::LogVerbatim("GMT_Sorter_info") << " ";
171  edm::LogVerbatim("GMT_Sorter_info") << "Muon candidates found by the L1 Global Muon Trigger : " << numberOfCands();
172  std::vector<const L1MuGMTExtendedCand*>::const_iterator iter = m_MuonCands.begin();
173  while (iter != m_MuonCands.end()) {
174  if (*iter)
175  (*iter)->print();
176  iter++;
177  }
178  edm::LogVerbatim("GMT_Sorter_info") << " ";
179 }

References m_MuonCands, and numberOfCands().

Referenced by L1MuGlobalMuonTrigger::produce().

◆ reset()

void L1MuGMTSorter::reset ( void  )
virtual

reset Sorter

Definition at line 158 of file L1MuGMTSorter.cc.

158  {
159  std::vector<const L1MuGMTExtendedCand*>::iterator iter;
160  for (iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++) {
161  *iter = nullptr;
162  }
163  m_MuonCands.clear();
164 }

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::reset().

◆ run()

void L1MuGMTSorter::run ( )
virtual

run Sorter

Definition at line 69 of file L1MuGMTSorter.cc.

69  {
70  std::vector<L1MuGMTExtendedCand*> mycands;
71  std::vector<L1MuGMTExtendedCand*> my_brl_cands;
72 
73  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
74 
75  // get muon candidates from barrel Merger
76  const std::vector<L1MuGMTExtendedCand*>& brl_cands = m_gmt.Merger(0)->Cands();
77  iter = brl_cands.begin();
78  while (iter != brl_cands.end()) {
79  if (*iter && !(*iter)->empty()) {
80  my_brl_cands.push_back((*iter));
81  }
82  iter++;
83  }
84  // sort by rank
87  stable_sort(my_brl_cands.begin(), my_brl_cands.end(), rankFunction);
88 
89  // copy best four of brl to main sorter
90  iter = my_brl_cands.begin();
91  int count = 0;
92  while (iter != my_brl_cands.end() && (count < 4)) {
93  if (*iter && !(*iter)->empty()) {
94  mycands.push_back((*iter));
97  count++;
98  }
99  iter++;
100  }
101 
102  std::vector<L1MuGMTExtendedCand*> my_fwd_cands;
103 
104  // get muon candidates from forward Merger
105  const std::vector<L1MuGMTExtendedCand*>& fwd_cands = m_gmt.Merger(1)->Cands();
106  iter = fwd_cands.begin();
107  while (iter != fwd_cands.end()) {
108  if (*iter && !(*iter)->empty()) {
109  my_fwd_cands.push_back((*iter));
110  }
111  iter++;
112  }
113  // sort by rank
114  stable_sort(my_fwd_cands.begin(), my_fwd_cands.end(), rankFunction);
115 
116  // copy best four of fwd to main sorter
117  iter = my_fwd_cands.begin();
118  count = 0;
119  while (iter != my_fwd_cands.end() && (count < 4)) {
120  if (*iter && !(*iter)->empty()) {
121  mycands.push_back((*iter));
124  count++;
125  }
126  iter++;
127  }
128 
129  // print input data
130  if (L1MuGMTConfig::Debug(5)) {
131  edm::LogVerbatim("GMT_Sorter_info") << "GMT Sorter input: " << mycands.size();
132  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
133  for (iter = mycands.begin(); iter != mycands.end(); iter++) {
134  if (*iter)
135  (*iter)->print();
136  }
137  }
138 
139  // sort by rank
140  stable_sort(mycands.begin(), mycands.end(), rankFunction);
141 
142  // copy the best 4 candidates
143  int number_of_cands = 0;
144  std::vector<L1MuGMTExtendedCand*>::const_iterator iter1 = mycands.begin();
145  while (iter1 != mycands.end()) {
146  if (*iter1 && number_of_cands < 4) {
147  m_MuonCands.push_back(*iter1);
148  m_gmt.currentReadoutRecord()->setGMTCand(number_of_cands, **iter1);
149  number_of_cands++;
150  }
151  iter1++;
152  }
153 }

References electrons_cff::bool, L1MuGMTMerger::Cands(), L1MuGMTExtendedCand::compareRank(), submitPVResolutionJobs::count, L1MuGlobalMuonTrigger::currentReadoutRecord(), L1MuGMTConfig::Debug(), L1MuGlobalMuonTrigger::DebugBlockForFill(), dqmdumpme::first, HiBiasedCentrality_cfi::function, m_gmt, m_MuonCands, L1MuGlobalMuonTrigger::Merger(), edm::second(), L1MuGMTDebugBlock::SetBrlGMTCands(), L1MuGMTDebugBlock::SetFwdGMTCands(), L1MuGMTReadoutRecord::setGMTBrlCand(), L1MuGMTReadoutRecord::setGMTCand(), and L1MuGMTReadoutRecord::setGMTFwdCand().

Referenced by L1MuGlobalMuonTrigger::produce().

Member Data Documentation

◆ m_gmt

const L1MuGlobalMuonTrigger& L1MuGMTSorter::m_gmt
private

Definition at line 63 of file L1MuGMTSorter.h.

Referenced by run().

◆ m_MuonCands

std::vector<const L1MuGMTExtendedCand*> L1MuGMTSorter::m_MuonCands
private

Definition at line 64 of file L1MuGMTSorter.h.

Referenced by Cands(), L1MuGMTSorter(), numberOfCands(), print(), reset(), and run().

L1MuGMTMerger::Cands
const std::vector< L1MuGMTExtendedCand * > & Cands() const
return std::vector with all muon candidates
Definition: L1MuGMTMerger.h:79
electrons_cff.bool
bool
Definition: electrons_cff.py:393
L1MuGMTExtendedCand
Definition: L1MuGMTExtendedCand.h:46
L1MuGMTSorter::m_gmt
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTSorter.h:63
L1MuGMTReadoutRecord::setGMTBrlCand
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
Definition: L1MuGMTReadoutRecord.cc:230
L1MuGlobalMuonTrigger::DebugBlockForFill
L1MuGMTDebugBlock * DebugBlockForFill() const
for debug: return the debug block (in order to fill it)
Definition: L1MuGlobalMuonTrigger.h:101
L1MuGMTSorter::m_MuonCands
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
L1MuGMTDebugBlock::SetBrlGMTCands
void SetBrlGMTCands(int idx, L1MuGMTExtendedCand const &cand)
Set brl GMT Cands.
Definition: L1MuGMTDebugBlock.h:93
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
L1MuGMTReadoutRecord::setGMTFwdCand
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
Definition: L1MuGMTReadoutRecord.cc:244
dqmdumpme.first
first
Definition: dqmdumpme.py:55
L1MuGMTExtendedCand::compareRank
static bool compareRank(const L1MuGMTExtendedCand *first, const L1MuGMTExtendedCand *second)
define a rank for muon candidates
Definition: L1MuGMTExtendedCand.h:119
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
L1MuGMTSorter::numberOfCands
int numberOfCands() const
return number of found muon candidates after sorter
Definition: L1MuGMTSorter.h:57
L1MuGMTReadoutRecord::setGMTCand
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
Definition: L1MuGMTReadoutRecord.cc:258
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
L1MuGlobalMuonTrigger::currentReadoutRecord
L1MuGMTReadoutRecord * currentReadoutRecord() const
return a reference to the current record in the ring buffer
Definition: L1MuGlobalMuonTrigger.h:98
L1MuGMTDebugBlock::SetFwdGMTCands
void SetFwdGMTCands(int idx, L1MuGMTExtendedCand const &cand)
Set fwd GMT Cands.
Definition: L1MuGMTDebugBlock.h:96
L1MuGMTConfig::Debug
static bool Debug()
Definition: L1MuGMTConfig.h:101
L1MuGlobalMuonTrigger::Merger
const L1MuGMTMerger * Merger(int id) const
return pointer to Merger
Definition: L1MuGlobalMuonTrigger.h:87