CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1MuGMTSorter Class Reference

#include <L1MuGMTSorter.h>

List of all members.

Public Member Functions

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

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.

                                                             :
      m_gmt(gmt), m_MuonCands() {

  m_MuonCands.reserve(4);
  
}
L1MuGMTSorter::~L1MuGMTSorter ( ) [virtual]

destructor

Definition at line 67 of file L1MuGMTSorter.cc.

                              {

}

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

{ return m_MuonCands; }
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().

{ return m_MuonCands.size(); }
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().

                          {

  edm::LogVerbatim("GMT_Sorter_info") << " ";
  edm::LogVerbatim("GMT_Sorter_info") << "Muon candidates found by the L1 Global Muon Trigger : "
       << numberOfCands();
  std::vector<const L1MuGMTExtendedCand*>::const_iterator iter = m_MuonCands.begin();
  while ( iter != m_MuonCands.end() ) {
    if ( *iter ) (*iter)->print();
    iter++;
  }
  edm::LogVerbatim("GMT_Sorter_info") << " ";

}
void L1MuGMTSorter::reset ( void  ) [virtual]

reset Sorter

Definition at line 172 of file L1MuGMTSorter.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::reset().

                          {

  std::vector<const L1MuGMTExtendedCand*>::iterator iter;
  for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
    *iter = 0;
  }
  m_MuonCands.clear();

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

                        {

  std::vector<L1MuGMTExtendedCand*> mycands;
   std::vector<L1MuGMTExtendedCand*> my_brl_cands;

  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
  
  // get muon candidates from barrel Merger 
  const std::vector<L1MuGMTExtendedCand*>& brl_cands = m_gmt.Merger(0)->Cands();
  iter = brl_cands.begin();
  while ( iter != brl_cands.end() ) {
    if ( *iter && !(*iter)->empty() ) {
      my_brl_cands.push_back((*iter));
    }
    iter++;
  }
  // sort by rank
  stable_sort( my_brl_cands.begin(), my_brl_cands.end(), L1MuGMTExtendedCand::Rank() );

  // copy best four of brl to main sorter
  iter = my_brl_cands.begin();
  int count=0;
  while ( iter != my_brl_cands.end() && (count<4) ) {
    if ( *iter && !(*iter)->empty() ) {
      mycands.push_back((*iter));
      m_gmt.DebugBlockForFill()->SetBrlGMTCands( count, **iter) ; 
      m_gmt.currentReadoutRecord()->setGMTBrlCand ( count, **iter );
      count++;
   }
    iter++;
  }

   
  std::vector<L1MuGMTExtendedCand*> my_fwd_cands;

  // get muon candidates from forward Merger 
  const std::vector<L1MuGMTExtendedCand*>& fwd_cands = m_gmt.Merger(1)->Cands();
  iter = fwd_cands.begin();
  while ( iter != fwd_cands.end() ) {
    if ( *iter && !(*iter)->empty() ) {
      my_fwd_cands.push_back((*iter));
    }
    iter++;
  }
   // sort by rank
  stable_sort( my_fwd_cands.begin(), my_fwd_cands.end(), L1MuGMTExtendedCand::Rank() );


  // copy best four of fwd to main sorter
  iter = my_fwd_cands.begin();
  count=0;
  while ( iter != my_fwd_cands.end() && (count<4) ) {
    if ( *iter && !(*iter)->empty() ) {
      mycands.push_back((*iter));
      m_gmt.DebugBlockForFill()->SetFwdGMTCands( count, **iter) ; 
      m_gmt.currentReadoutRecord()->setGMTFwdCand ( count, **iter );
      count++;
    }
    iter++;
  }


  // print input data
  if ( L1MuGMTConfig::Debug(5) ) {
    edm::LogVerbatim("GMT_Sorter_info") << "GMT Sorter input: "
         << mycands.size();
    std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
    for ( iter = mycands.begin(); iter != mycands.end(); iter++ ) {
      if (*iter ) (*iter)->print();
    }
  }
  
  // sort by rank
  stable_sort( mycands.begin(), mycands.end(), L1MuGMTExtendedCand::Rank() );

  // copy the best 4 candidates
  int number_of_cands = 0;
  std::vector<L1MuGMTExtendedCand*>::const_iterator iter1 = mycands.begin();
  while ( iter1 != mycands.end() ) {
    if ( *iter1 && number_of_cands < 4 ) {
      m_MuonCands.push_back(*iter1);
      m_gmt.currentReadoutRecord()->setGMTCand ( count, **iter1 );
      number_of_cands++;
    }
    iter1++;
  }  

} 

Member Data Documentation

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