CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ( const L1MuGlobalMuonTrigger gmt)

constructor

Definition at line 54 of file L1MuGMTSorter.cc.

References m_MuonCands.

54 : m_gmt(gmt), m_MuonCands() { m_MuonCands.reserve(4); }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTSorter.h:63
L1MuGMTSorter::~L1MuGMTSorter ( )
virtual

destructor

Definition at line 60 of file L1MuGMTSorter.cc.

60 {}

Member Function Documentation

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

return std::vector with all muon candidates

Definition at line 60 of file L1MuGMTSorter.h.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

60 { return m_MuonCands; }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
int L1MuGMTSorter::numberOfCands ( ) const
inline

return number of found muon candidates after sorter

Definition at line 57 of file L1MuGMTSorter.h.

References m_MuonCands.

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

57 { return m_MuonCands.size(); }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
void L1MuGMTSorter::print ( void  )

print results after sorting

Definition at line 169 of file L1MuGMTSorter.cc.

References m_MuonCands, and numberOfCands().

Referenced by L1MuGlobalMuonTrigger::produce().

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 }
Log< level::Info, true > LogVerbatim
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
int numberOfCands() const
return number of found muon candidates after sorter
Definition: L1MuGMTSorter.h:57
void L1MuGMTSorter::reset ( void  )
virtual

reset Sorter

Definition at line 158 of file L1MuGMTSorter.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::reset().

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 }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
void L1MuGMTSorter::run ( )
virtual

run Sorter

Definition at line 69 of file L1MuGMTSorter.cc.

References L1MuGMTMerger::Cands(), L1MuGMTExtendedCand::compareRank(), submitPVResolutionJobs::count, L1MuGlobalMuonTrigger::currentReadoutRecord(), L1MuGMTConfig::Debug(), L1MuGlobalMuonTrigger::DebugBlockForFill(), m_gmt, m_MuonCands, L1MuGlobalMuonTrigger::Merger(), L1MuGMTDebugBlock::SetBrlGMTCands(), L1MuGMTDebugBlock::SetFwdGMTCands(), L1MuGMTReadoutRecord::setGMTBrlCand(), L1MuGMTReadoutRecord::setGMTCand(), and L1MuGMTReadoutRecord::setGMTFwdCand().

Referenced by L1MuGlobalMuonTrigger::produce().

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
85  std::function<bool(const L1MuGMTExtendedCand* first, const L1MuGMTExtendedCand* second)> rankFunction{
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));
95  m_gmt.DebugBlockForFill()->SetBrlGMTCands(count, **iter);
96  m_gmt.currentReadoutRecord()->setGMTBrlCand(count, **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));
122  m_gmt.DebugBlockForFill()->SetFwdGMTCands(count, **iter);
123  m_gmt.currentReadoutRecord()->setGMTFwdCand(count, **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 }
Log< level::Info, true > LogVerbatim
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:64
void SetBrlGMTCands(int idx, L1MuGMTExtendedCand const &cand)
Set brl GMT Cands.
static bool Debug()
const L1MuGMTMerger * Merger(int id) const
return pointer to Merger
static bool compareRank(const L1MuGMTExtendedCand *first, const L1MuGMTExtendedCand *second)
define a rank for muon candidates
void SetFwdGMTCands(int idx, L1MuGMTExtendedCand const &cand)
Set fwd GMT Cands.
const std::vector< L1MuGMTExtendedCand * > & Cands() const
return std::vector with all muon candidates
Definition: L1MuGMTMerger.h:79
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
L1MuGMTDebugBlock * DebugBlockForFill() const
for debug: return the debug block (in order to fill it)
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTSorter.h:63
L1MuGMTReadoutRecord * currentReadoutRecord() const
return a reference to the current record in the ring buffer

Member Data Documentation

const L1MuGlobalMuonTrigger& L1MuGMTSorter::m_gmt
private

Definition at line 63 of file L1MuGMTSorter.h.

Referenced by run().

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