CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/L1Trigger/RPCTechnicalTrigger/src/TTUConfigurator.cc

Go to the documentation of this file.
00001 // $Id: TTUConfigurator.cc,v 1.3 2009/12/25 06:24:34 elmer Exp $
00002 // Include files 
00003 
00004 
00005 
00006 // local
00007 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUConfigurator.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 
00010 //-----------------------------------------------------------------------------
00011 // Implementation file for class : TTUConfigurator
00012 //
00013 // 2009-06-02 : Andres Felipe Osorio Oliveros
00014 //-----------------------------------------------------------------------------
00015 
00016 //=============================================================================
00017 // Standard constructor, initializes variables
00018 //=============================================================================
00019 TTUConfigurator::TTUConfigurator( const std::string& infile ) {
00020   
00021   m_in = new std::ifstream();
00022   m_in->open( infile.c_str() );
00023   
00024   if(!m_in->is_open()) {
00025     edm::LogError("TTUConfigurator") << "TTUConfigurator cannot open file";
00026     m_hasConfig = false;
00027   } else {
00028     m_hasConfig = true;
00029   }
00030   
00031   m_rbcspecs = new RBCBoardSpecs();
00032   m_ttuspecs = new TTUBoardSpecs();
00033   
00034 }
00035 //=============================================================================
00036 // Destructor
00037 //=============================================================================
00038 TTUConfigurator::~TTUConfigurator() {
00039   
00040   if ( m_in ) {
00041     m_in->close();
00042     delete m_in;
00043   }
00044   
00045   if ( m_rbcspecs ) delete m_rbcspecs;
00046   if ( m_ttuspecs ) delete m_ttuspecs;
00047   
00048 } 
00049 
00050 //=============================================================================
00051 
00052 void TTUConfigurator::process()
00053 {
00054   
00055   addData( m_rbcspecs );
00056   addData( m_ttuspecs );
00057   
00058 }
00059 
00060 void TTUConfigurator::addData( RBCBoardSpecs * specs )
00061 {
00062   
00063   RBCBoardSpecs::RBCBoardConfig * board;
00064   
00065   for( int i=0; i < 30; i++) {
00066     
00067     board = new RBCBoardSpecs::RBCBoardConfig();
00068     
00069     (*m_in) >> (*board);
00070     
00071     specs->v_boardspecs.push_back( *board );
00072     
00073   }
00074   
00075 }
00076 
00077 void TTUConfigurator::addData( TTUBoardSpecs * specs )
00078 {
00079   
00080   TTUBoardSpecs::TTUBoardConfig * board;
00081   
00082   for(int i=0; i < 3; i++){
00083     
00084     board= new TTUBoardSpecs::TTUBoardConfig();
00085     
00086     (*m_in) >> (*board);
00087     
00088     specs->m_boardspecs.push_back( *board );
00089     
00090   }
00091   
00092 }