CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/L1Trigger/RPCTechnicalTrigger/src/TTUBasicConfig.cc

Go to the documentation of this file.
00001 // $Id: TTUBasicConfig.cc,v 1.7 2009/08/19 15:04:01 aosorio Exp $
00002 // Include files 
00003 
00004 
00005 
00006 // local
00007 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUBasicConfig.h"
00008 
00009 //-----------------------------------------------------------------------------
00010 // Implementation file for class : TTUBasicConfig
00011 //
00012 // 2008-10-31 : Andres Osorio
00013 //-----------------------------------------------------------------------------
00014 
00015 //=============================================================================
00016 // Standard constructor, initializes variables
00017 //=============================================================================
00018 TTUBasicConfig::TTUBasicConfig( const TTUBoardSpecs * ttuspecs ) {
00019 
00020   m_ttuboardspecs = ttuspecs;
00021 
00022   m_ttulogic      = new TTULogicUnit();
00023   
00024   m_debug = false;
00025   
00026 }
00027 
00028 TTUBasicConfig::TTUBasicConfig( const char * logic  ) {
00029   
00030   m_ttulogic = new TTULogicUnit( logic );
00031 
00032   m_debug = false;
00033     
00034 }
00035 
00036 //=============================================================================
00037 // Destructor
00038 //=============================================================================
00039 TTUBasicConfig::~TTUBasicConfig() {
00040 
00041   if (m_ttulogic) delete m_ttulogic;
00042 
00043   m_vecmask.clear();
00044   m_vecforce.clear();
00045 
00046 } 
00047 
00048 //=============================================================================
00049 bool TTUBasicConfig::initialise( int line , int ttuid )
00050 {
00051   
00052   bool status(false);
00053   
00054   //.  read specifications and set it to the corresponding TTU board
00055   
00056   std::vector<TTUBoardSpecs::TTUBoardConfig>::const_iterator itr;
00057   itr = m_ttuboardspecs->m_boardspecs.begin();
00058   
00059   int pos(0);
00060   int maxboards = m_ttuboardspecs->m_boardspecs.size();
00061   
00062   for( pos=0; pos < maxboards; ++pos) {
00063     if ( m_debug ) std::cout << "TTUBasicConfig::initialise> " 
00064                              << m_ttuboardspecs->m_boardspecs[pos].m_Wheel1Id 
00065                              << std::endl;
00066     if ( m_ttuboardspecs->m_boardspecs[pos].m_runId == ttuid ) break;
00067     
00068   }
00069   
00070   // initialise logic unit
00071   
00072   if ( line == 2 ) {
00073     m_ttulogic->setlogic( "WedgeORLogic" );
00074   } else {
00075     m_ttulogic->setlogic( (*itr).m_LogicType.c_str() );
00076   }
00077   
00078   status = m_ttulogic->initialise();
00079   
00080   //itr = m_ttuboardspecs->m_boardspecs.begin();
00081   
00082   m_ttulogic->setBoardSpecs( m_ttuboardspecs->m_boardspecs[pos] );
00083   
00084   // get mask and force vectors
00085   
00086   m_vecmask.assign( (*itr).m_MaskedSectors.begin(), (*itr).m_MaskedSectors.end() );
00087   
00088   m_vecforce.assign( (*itr).m_ForcedSectors.begin(), (*itr).m_ForcedSectors.end() );
00089   
00090   if ( !status ) { 
00091     if( m_debug ) std::cout << "TTUConfiguration> Problem initialising the logic unit\n"; 
00092     return 0; };
00093   
00094   return status;
00095   
00096 }
00097 
00098 void TTUBasicConfig::preprocess( TTUInput & input )
00099 {
00100   
00101   if( m_debug ) std::cout << "TTUBasicConfig::preprocess> starts here" << std::endl;
00102   
00103   input.mask( m_vecmask );
00104   //input.force( m_vecforce );
00105   
00106   if( m_debug ) std::cout << "TTUBasicConfig::preprocess> done" << std::endl;
00107   
00108 }