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 43 of file L1MuGMTSorter.h.

Constructor & Destructor Documentation

L1MuGMTSorter::L1MuGMTSorter ( const L1MuGlobalMuonTrigger gmt)

constructor

Definition at line 55 of file L1MuGMTSorter.cc.

References m_MuonCands.

55  :
56  m_gmt(gmt), m_MuonCands() {
57 
58  m_MuonCands.reserve(4);
59 
60 }
std::vector< const L1MuGMTExtendedCand * > m_MuonCands
Definition: L1MuGMTSorter.h:71
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTSorter.h:70
L1MuGMTSorter::~L1MuGMTSorter ( )
virtual

destructor

Definition at line 67 of file L1MuGMTSorter.cc.

67  {
68 
69 }

Member Function Documentation

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

return std::vector with all muon candidates

Definition at line 66 of file L1MuGMTSorter.h.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

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

return number of found muon candidates after sorter

Definition at line 63 of file L1MuGMTSorter.h.

References m_MuonCands.

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

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

print results after sorting

Definition at line 186 of file L1MuGMTSorter.cc.

References m_MuonCands, and numberOfCands().

Referenced by L1MuGlobalMuonTrigger::produce().

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

reset Sorter

Definition at line 172 of file L1MuGMTSorter.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::reset().

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

run Sorter

Definition at line 79 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().

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

Referenced by run().

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

Definition at line 71 of file L1MuGMTSorter.h.

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