CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

L1MuDTQualPatternLut Class Reference

#include <L1MuDTQualPatternLut.h>

List of all members.

Public Types

typedef LUT::iterator EMULut_iter
typedef std::map< LUTID, LUTCONTLUT
typedef std::pair< short,
std::vector< short > > 
LUTCONT
typedef std::pair< short, short > LUTID

Public Member Functions

EMULut_iter begin ()
 return iterator which points to the first entry of the LUT
EMULut_iter end ()
 return iterator which points to the one-past-last entry of the LUT
int getCoarseEta (int sp, int adr) const
 get coarse eta value for a given sector processor [1-6] and address [1-22]
const std::vector< short > & getQualifiedPatterns (int sp, int adr) const
 get list of qualified patterns for a given sector processor [1-6] and address [1-22]
 L1MuDTQualPatternLut ()
 constructor
int load ()
 load look-up tables
void print () const
 print look-up tables
void reset ()
 reset look-up tables
int size () const
 return number of entries in the LUT
virtual ~L1MuDTQualPatternLut ()
 destructor

Private Attributes

LUT m_lut

Detailed Description

Look-up tables for eta matching unit (EMU) stores lists of qualified patterns and coarse eta values

Date:
2008/04/09 15:22:31
Revision:
1.2

N. Neumeister CERN EP

Definition at line 41 of file L1MuDTQualPatternLut.h.


Member Typedef Documentation

typedef LUT::iterator L1MuDTQualPatternLut::EMULut_iter

Definition at line 48 of file L1MuDTQualPatternLut.h.

typedef std::map< LUTID, LUTCONT > L1MuDTQualPatternLut::LUT

Definition at line 47 of file L1MuDTQualPatternLut.h.

typedef std::pair< short, std::vector<short> > L1MuDTQualPatternLut::LUTCONT

Definition at line 46 of file L1MuDTQualPatternLut.h.

typedef std::pair< short, short > L1MuDTQualPatternLut::LUTID

Definition at line 45 of file L1MuDTQualPatternLut.h.


Constructor & Destructor Documentation

L1MuDTQualPatternLut::L1MuDTQualPatternLut ( )

constructor

Definition at line 50 of file L1MuDTQualPatternLut.cc.

                                           {

  //  if ( load() != 0 ) {
  //    cout << "Can not open files to load eta matching look-up tables for DTTrackFinder!" << endl;
  //  }

  //  if ( L1MuDTTFConfig::Debug(6) ) print();

}
L1MuDTQualPatternLut::~L1MuDTQualPatternLut ( ) [virtual]

destructor

Definition at line 65 of file L1MuDTQualPatternLut.cc.

                                            {

  LUT::iterator iter = m_lut.begin();
  while ( iter != m_lut.end() ) {
    (*iter).second.second.clear(); 
    iter++;
  }

  m_lut.clear();

}

Member Function Documentation

EMULut_iter L1MuDTQualPatternLut::begin ( void  ) [inline]

return iterator which points to the first entry of the LUT

Definition at line 75 of file L1MuDTQualPatternLut.h.

References m_lut.

{ return m_lut.begin(); }
EMULut_iter L1MuDTQualPatternLut::end ( void  ) [inline]

return iterator which points to the one-past-last entry of the LUT

Definition at line 78 of file L1MuDTQualPatternLut.h.

References m_lut.

{ return m_lut.end(); }
int L1MuDTQualPatternLut::getCoarseEta ( int  sp,
int  adr 
) const

get coarse eta value for a given sector processor [1-6] and address [1-22]

Definition at line 198 of file L1MuDTQualPatternLut.cc.

References benchmark_cfg::cerr.

                                                            {

  LUT::const_iterator it = m_lut.find(make_pair(sp,adr));
  if ( it == m_lut.end() ) {
    cerr << "Error: L1MuDTQualPatternLut: no coarse eta found for address " << adr << endl;
    return 0;
  }
  return (*it).second.first;

}
const vector< short > & L1MuDTQualPatternLut::getQualifiedPatterns ( int  sp,
int  adr 
) const

get list of qualified patterns for a given sector processor [1-6] and address [1-22]

Definition at line 213 of file L1MuDTQualPatternLut.cc.

References benchmark_cfg::cerr.

                                                                                     {

  LUT::const_iterator it = m_lut.find(make_pair(sp,adr));
  if ( it == m_lut.end() ) {
    cerr << "Error: L1MuDTQualPatternLut: no pattern list found for address " << adr << endl;
  }
  return (*it).second.second;

}
int L1MuDTQualPatternLut::load ( )

load look-up tables

Definition at line 95 of file L1MuDTQualPatternLut.cc.

References L1TriggerLutFile::close(), eta(), mergeVDriftHistosByStation::file, edm::FileInPath::fullPath(), L1TriggerLutFile::good(), i, L1TriggerLutFile::ignoreLines(), L1TriggerLutFile::open(), listBenchmarks::pattern, and L1TriggerLutFile::readInteger().

                               {

  // get directory name
  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
  string eau_dir = "L1TriggerData/DTTrackFinder/Eau/";
  string emu_str = "";

  // loop over all sector processors
  for ( int sp = 0; sp < 6; sp++ ) { 
    switch ( sp ) {
      case 0  : { emu_str = "QualPatternList_SP1"; break; }
      case 1  : { emu_str = "QualPatternList_SP2"; break; }
      case 2  : { emu_str = "QualPatternList_SP3"; break; }
      case 3  : { emu_str = "QualPatternList_SP4"; break; }
      case 4  : { emu_str = "QualPatternList_SP5"; break; }
      case 5  : { emu_str = "QualPatternList_SP6"; break; }
    }  
  
    // assemble file name
    edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + eau_dir + emu_str + ".lut"));
    string emu_file = lut_f.fullPath();

    // open file
    L1TriggerLutFile file(emu_file);
    if ( file.open() != 0 ) return -1;
    //    if ( L1MuDTTFConfig::Debug(1) ) cout << "Reading file : " 
    //                                         << file.getName() << endl; 

    // ignore comment lines 
    file.ignoreLines(14);

    // read file
    while ( file.good() ) {
  
      int id  = file.readInteger();
      if ( !file.good() ) break;
      int eta = file.readInteger();
      if ( !file.good() ) break;
      int num = file.readInteger();
      if ( !file.good() ) break;

      vector<short> patternlist;
      for ( int i = 0; i < num; i++ ) {
        int pattern = file.readInteger();
        patternlist.push_back(pattern);
      }
      
      m_lut[make_pair(sp+1,id)] = make_pair(eta,patternlist);

      if ( !file.good() ) { file.close(); break; }
    
    }

    file.close();
  }  
    
  return 0;

}
void L1MuDTQualPatternLut::print ( void  ) const

print look-up tables

Definition at line 159 of file L1MuDTQualPatternLut.cc.

References gather_cfg::cout.

                                       {

  cout << endl;
  cout << "L1 barrel Track Finder Qual Pattern look-up tables :" << endl;
  cout << "====================================================" << endl;
  cout << endl;

  int spold = 0;
  
  LUT::const_iterator iter = m_lut.begin();
  while ( iter != m_lut.end() ) {
    int sp = (*iter).first.first;
    if ( sp != spold ) {
      cout << endl;
      cout << "Qualified Patterns for Sector Processor " << setw(1) << sp << " :" << endl;
      cout << "===========================================" << endl;
      cout << endl;
      spold = sp;
    }
    cout << setw(2) << (*iter).first.second << "  "
         << setw(3) << (*iter).second.first << "  "
         << setw(5) << (*iter).second.second.size() << " : ";
    const vector<short>& patternlist = (*iter).second.second;
    vector<short>::const_iterator it;
    for ( it = patternlist.begin(); it != patternlist.end(); it++ ) {
      cout << setw(5) << (*it) << " ";
    }
    cout << endl;
    iter++;
  }
 
  cout << endl;

}
void L1MuDTQualPatternLut::reset ( void  )

reset look-up tables

Definition at line 85 of file L1MuDTQualPatternLut.cc.

                                 {

  m_lut.clear();

}
int L1MuDTQualPatternLut::size ( void  ) const [inline]

return number of entries in the LUT

Definition at line 72 of file L1MuDTQualPatternLut.h.

References m_lut.

{ return m_lut.size(); }

Member Data Documentation

Definition at line 82 of file L1MuDTQualPatternLut.h.

Referenced by begin(), end(), and size().