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 41 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  :
55  m_gmt(gmt), m_MuonCands() {
56 
57  m_MuonCands.reserve(4);
58 
59 }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:69
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTSorter.h:68
L1MuGMTSorter::~L1MuGMTSorter ( )
virtual

destructor

Definition at line 66 of file L1MuGMTSorter.cc.

66  {
67 
68 }

Member Function Documentation

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

return std::vector with all muon candidates

Definition at line 64 of file L1MuGMTSorter.h.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

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

return number of found muon candidates after sorter

Definition at line 61 of file L1MuGMTSorter.h.

References m_MuonCands.

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

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

print results after sorting

Definition at line 187 of file L1MuGMTSorter.cc.

References m_MuonCands, and numberOfCands().

Referenced by L1MuGlobalMuonTrigger::produce().

187  {
188 
189  edm::LogVerbatim("GMT_Sorter_info") << " ";
190  edm::LogVerbatim("GMT_Sorter_info") << "Muon candidates found by the L1 Global Muon Trigger : "
191  << numberOfCands();
192  std::vector<const L1MuGMTExtendedCand*>::const_iterator iter = m_MuonCands.begin();
193  while ( iter != m_MuonCands.end() ) {
194  if ( *iter ) (*iter)->print();
195  iter++;
196  }
197  edm::LogVerbatim("GMT_Sorter_info") << " ";
198 
199 }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:69
int numberOfCands() const
return number of found muon candidates after sorter
Definition: L1MuGMTSorter.h:61
void L1MuGMTSorter::reset ( void  )
virtual

reset Sorter

Definition at line 173 of file L1MuGMTSorter.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::reset().

173  {
174 
175  std::vector<const L1MuGMTExtendedCand*>::iterator iter;
176  for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
177  *iter = nullptr;
178  }
179  m_MuonCands.clear();
180 
181 }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:69
void L1MuGMTSorter::run ( )
virtual

run Sorter

Definition at line 78 of file L1MuGMTSorter.cc.

References electrons_cff::bool, L1MuGMTMerger::Cands(), L1MuGMTExtendedCand::compareRank(), KineDebug3::count(), L1MuGlobalMuonTrigger::currentReadoutRecord(), L1MuGMTConfig::Debug(), L1MuGlobalMuonTrigger::DebugBlockForFill(), plotBeamSpotDB::first, RecoTauPiZeroBuilderPlugins_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().

78  {
79 
80  std::vector<L1MuGMTExtendedCand*> mycands;
81  std::vector<L1MuGMTExtendedCand*> my_brl_cands;
82 
83  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
84 
85  // get muon candidates from barrel Merger
86  const std::vector<L1MuGMTExtendedCand*>& brl_cands = m_gmt.Merger(0)->Cands();
87  iter = brl_cands.begin();
88  while ( iter != brl_cands.end() ) {
89  if ( *iter && !(*iter)->empty() ) {
90  my_brl_cands.push_back((*iter));
91  }
92  iter++;
93  }
94  // sort by rank
97  stable_sort( my_brl_cands.begin(), my_brl_cands.end(), rankFunction );
98 
99  // copy best four of brl to main sorter
100  iter = my_brl_cands.begin();
101  int count=0;
102  while ( iter != my_brl_cands.end() && (count<4) ) {
103  if ( *iter && !(*iter)->empty() ) {
104  mycands.push_back((*iter));
105  m_gmt.DebugBlockForFill()->SetBrlGMTCands( count, **iter) ;
106  m_gmt.currentReadoutRecord()->setGMTBrlCand ( count, **iter );
107  count++;
108  }
109  iter++;
110  }
111 
112 
113  std::vector<L1MuGMTExtendedCand*> my_fwd_cands;
114 
115  // get muon candidates from forward Merger
116  const std::vector<L1MuGMTExtendedCand*>& fwd_cands = m_gmt.Merger(1)->Cands();
117  iter = fwd_cands.begin();
118  while ( iter != fwd_cands.end() ) {
119  if ( *iter && !(*iter)->empty() ) {
120  my_fwd_cands.push_back((*iter));
121  }
122  iter++;
123  }
124  // sort by rank
125  stable_sort( my_fwd_cands.begin(), my_fwd_cands.end(), rankFunction );
126 
127 
128  // copy best four of fwd to main sorter
129  iter = my_fwd_cands.begin();
130  count=0;
131  while ( iter != my_fwd_cands.end() && (count<4) ) {
132  if ( *iter && !(*iter)->empty() ) {
133  mycands.push_back((*iter));
134  m_gmt.DebugBlockForFill()->SetFwdGMTCands( count, **iter) ;
135  m_gmt.currentReadoutRecord()->setGMTFwdCand ( count, **iter );
136  count++;
137  }
138  iter++;
139  }
140 
141 
142  // print input data
143  if ( L1MuGMTConfig::Debug(5) ) {
144  edm::LogVerbatim("GMT_Sorter_info") << "GMT Sorter input: "
145  << mycands.size();
146  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
147  for ( iter = mycands.begin(); iter != mycands.end(); iter++ ) {
148  if (*iter ) (*iter)->print();
149  }
150  }
151 
152  // sort by rank
153  stable_sort( mycands.begin(), mycands.end(), rankFunction );
154 
155  // copy the best 4 candidates
156  int number_of_cands = 0;
157  std::vector<L1MuGMTExtendedCand*>::const_iterator iter1 = mycands.begin();
158  while ( iter1 != mycands.end() ) {
159  if ( *iter1 && number_of_cands < 4 ) {
160  m_MuonCands.push_back(*iter1);
161  m_gmt.currentReadoutRecord()->setGMTCand ( number_of_cands, **iter1 );
162  number_of_cands++;
163  }
164  iter1++;
165  }
166 
167 }
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:69
void SetBrlGMTCands(int idx, L1MuGMTExtendedCand const &cand)
Set brl GMT Cands.
U second(std::pair< T, U > const &p)
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:84
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:68
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 68 of file L1MuGMTSorter.h.

Referenced by run().

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

Definition at line 69 of file L1MuGMTSorter.h.

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