Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:34

0001 // Include files
0002 
0003 // local
0004 #include "L1Trigger/RPCTechnicalTrigger/interface/RBCProcessTestSignal.h"
0005 #include "L1Trigger/RPCTechnicalTrigger/interface/RBCLinkBoardSignal.h"
0006 //-----------------------------------------------------------------------------
0007 // Implementation file for class : RBCProcessTestSignal
0008 //
0009 // 2008-10-10 : Andres Osorio
0010 //-----------------------------------------------------------------------------
0011 
0012 //=============================================================================
0013 // Standard constructor, initializes variables
0014 //=============================================================================
0015 RBCProcessTestSignal::RBCProcessTestSignal(const char* f_name)
0016     : m_in{}, m_input{}, m_lbin{std::make_unique<RBCLinkBoardSignal>(&m_input)} {
0017   m_in.open(f_name);
0018 
0019   if (!m_in.is_open()) {
0020     std::cout << "RBCProcessTestSignal> cannot open file" << std::endl;
0021   } else {
0022     std::cout << "RBCProcessTestSignal> file is now open" << std::endl;
0023   }
0024 
0025   showfirst();
0026 }
0027 //=============================================================================
0028 // Destructor
0029 //=============================================================================
0030 RBCProcessTestSignal::~RBCProcessTestSignal() { m_in.close(); }
0031 
0032 //=============================================================================
0033 
0034 int RBCProcessTestSignal::next() {
0035   if (m_in.fail())
0036     return 0;
0037   m_in >> m_input;
0038   if (m_in.eof())
0039     return 0;
0040   return 1;
0041 }
0042 
0043 void RBCProcessTestSignal::showfirst() {
0044   rewind();
0045   m_in >> m_input;
0046   std::cout << m_input;
0047   rewind();
0048 }
0049 
0050 void RBCProcessTestSignal::rewind() {
0051   m_in.clear();
0052   m_in.seekg(0, std::ios::beg);
0053 }