test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 41 of file L1MuGMTSorter.h.

Constructor & Destructor Documentation

L1MuGMTSorter::L1MuGMTSorter ( const L1MuGlobalMuonTrigger gmt)

constructor

Definition at line 53 of file L1MuGMTSorter.cc.

References m_MuonCands.

53  :
54  m_gmt(gmt), m_MuonCands() {
55 
56  m_MuonCands.reserve(4);
57 
58 }
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 65 of file L1MuGMTSorter.cc.

65  {
66 
67 }

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 184 of file L1MuGMTSorter.cc.

References m_MuonCands, and numberOfCands().

Referenced by L1MuGlobalMuonTrigger::produce().

184  {
185 
186  edm::LogVerbatim("GMT_Sorter_info") << " ";
187  edm::LogVerbatim("GMT_Sorter_info") << "Muon candidates found by the L1 Global Muon Trigger : "
188  << numberOfCands();
189  std::vector<const L1MuGMTExtendedCand*>::const_iterator iter = m_MuonCands.begin();
190  while ( iter != m_MuonCands.end() ) {
191  if ( *iter ) (*iter)->print();
192  iter++;
193  }
194  edm::LogVerbatim("GMT_Sorter_info") << " ";
195 
196 }
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 170 of file L1MuGMTSorter.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::reset().

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

run Sorter

Definition at line 77 of file L1MuGMTSorter.cc.

References L1MuGMTMerger::Cands(), prof2calltree::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().

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

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