Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
//-------------------------------------------------
//
//   Class: L1MuDTEtaPatternLut
//
//   Description: Look-up table for eta track finder
//
//
//   $Date: 2007/03/30 07:48:02 $
//   $Revision: 1.1 $
//
//   Author :
//   N. Neumeister            CERN EP
//   J. Troconiz              UAM Madrid
//
//--------------------------------------------------

//-----------------------
// This Class's Header --
//-----------------------

#include "CondFormats/L1TObjects/interface/L1MuDTEtaPatternLut.h"

//---------------
// C++ Headers --
//---------------

#include <iostream>
#include <iomanip>
#include <string>

//-------------------------------
// Collaborating Class Headers --
//-------------------------------

#include "FWCore/Utilities/interface/FileInPath.h"
#include "CondFormats/L1TObjects/interface/L1TriggerLutFile.h"

using namespace std;

// --------------------------------
//       class L1MuDTEtaPatternLut
//---------------------------------

//----------------
// Constructors --
//----------------

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

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

//--------------
// Destructor --
//--------------

L1MuDTEtaPatternLut::~L1MuDTEtaPatternLut() { m_lut.clear(); }

//--------------
// Operations --
//--------------

//
// reset look-up table
//
void L1MuDTEtaPatternLut::reset() { m_lut.clear(); }

//
// load pattern look-up table for ETF
//
int L1MuDTEtaPatternLut::load() {
  // get directory name
  string defaultPath = "L1TriggerConfig/DTTrackFinder/parameters/";
  string eau_dir = "L1TriggerData/DTTrackFinder/Eau/";

  // assemble file name
  edm::FileInPath lut_f = edm::FileInPath(string(defaultPath + eau_dir + "ETFPatternList.lut"));
  const string& etf_file = lut_f.fullPath();

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

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

  // read patterns
  while (file.good()) {
    int id = file.readInteger();
    if (!file.good())
      break;
    string pat = file.readString();
    if (!file.good())
      break;
    int qual = file.readInteger();
    if (!file.good())
      break;
    int eta = file.readInteger();
    if (!file.good())
      break;
    L1MuDTEtaPattern pattern(id, pat, eta, qual);

    m_lut[pattern.id()] = pattern;

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

  file.close();

  return 0;
}

//
// print pattern look-up table for ETF
//
void L1MuDTEtaPatternLut::print() const {
  cout << endl;
  cout << "L1 barrel Track Finder ETA Pattern look-up table :" << endl;
  cout << "==================================================" << endl;
  cout << endl;

  cout << "ETF Patterns : " << m_lut.size() << endl;
  cout << "======================" << endl;
  cout << endl;

  LUT::const_iterator iter = m_lut.begin();
  while (iter != m_lut.end()) {
    cout << (*iter).second << endl;
    iter++;
  }

  cout << endl;
}

//
// get pattern with a given ID
//
L1MuDTEtaPattern L1MuDTEtaPatternLut::getPattern(int id) const {
  LUT::const_iterator it = m_lut.find(id);
  if (it == m_lut.end()) {
    cerr << "Error: L1MuDTEtaPatternLut: pattern not found : " << id << endl;
    //    return 0;
  }
  return (*it).second;
}