Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:50

0001 //-------------------------------------------------
0002 //
0003 //   Class: DTTPGLutFile
0004 //
0005 //   Description: Auxiliary class for
0006 //                Look-up table files
0007 //
0008 //
0009 //
0010 //   Author :
0011 //   N. Neumeister            CERN EP
0012 //
0013 //--------------------------------------------------
0014 
0015 //-----------------------
0016 // This Class's Header --
0017 //-----------------------
0018 
0019 #include "L1Trigger/DTUtilities/interface/DTTPGLutFile.h"
0020 
0021 //---------------
0022 // C++ Headers --
0023 //---------------
0024 
0025 #include <iostream>
0026 
0027 using namespace std;
0028 
0029 //-------------------------------
0030 // Collaborating Class Headers --
0031 //-------------------------------
0032 
0033 // --------------------------------
0034 //       class DTTPGLutFile
0035 //---------------------------------
0036 
0037 //----------------
0038 // Constructors --
0039 //----------------
0040 
0041 DTTPGLutFile::DTTPGLutFile(const string name) : m_file(name) {}
0042 
0043 DTTPGLutFile::DTTPGLutFile(const DTTPGLutFile &in) : m_file(in.m_file) {}
0044 
0045 //--------------
0046 // Destructor --
0047 //--------------
0048 
0049 DTTPGLutFile::~DTTPGLutFile() {}
0050 
0051 //--------------
0052 // Operations --
0053 //--------------
0054 
0055 DTTPGLutFile &DTTPGLutFile::operator=(const DTTPGLutFile &lut) {
0056   m_file = lut.m_file;
0057   return *this;
0058 }
0059 
0060 int DTTPGLutFile::open() {
0061   const char *file_name = m_file.c_str();
0062   m_fin.open(file_name, ios::in);
0063   if (!m_fin) {
0064     cout << "can not open file : " << file_name << endl;
0065     return -1;
0066   } else {
0067     return 0;
0068   }
0069 }
0070 
0071 void DTTPGLutFile::ignoreLines(int n) {
0072   char buf[256];
0073   for (int i = 0; i < n; i++)
0074     m_fin.getline(buf, 256);
0075 }
0076 
0077 int DTTPGLutFile::readInteger() {
0078   int tmp = 0;
0079   m_fin >> tmp;
0080   return tmp;
0081 }
0082 
0083 int DTTPGLutFile::readHex() {
0084   int tmp = 0;
0085   m_fin >> hex >> tmp;
0086   return tmp;
0087 }
0088 
0089 string DTTPGLutFile::readString() {
0090   string tmp;
0091   m_fin >> tmp;
0092   return tmp;
0093 }