00001 // $Id: TTULogicUnit.cc,v 1.7 2009/10/26 12:52:15 aosorio Exp $ 00002 // Include files 00003 00004 00005 00006 // local 00007 #include "L1Trigger/RPCTechnicalTrigger/interface/TTULogicUnit.h" 00008 00009 //----------------------------------------------------------------------------- 00010 // Implementation file for class : TTULogicUnit 00011 // 00012 // 2008-10-25 : Andres Osorio 00013 //----------------------------------------------------------------------------- 00014 00015 //============================================================================= 00016 // Standard constructor, initializes variables 00017 //============================================================================= 00018 TTULogicUnit::TTULogicUnit( ) : RPCLogicUnit () { 00019 00020 m_logtool = new LogicTool<TTULogic>(); 00021 m_debug = false; 00022 00023 } 00024 00025 TTULogicUnit::TTULogicUnit( const char * logic_type ) : RPCLogicUnit () { 00026 00027 m_logtool = new LogicTool<TTULogic>(); 00028 m_logtype = std::string( logic_type ); 00029 m_debug = false; 00030 00031 } 00032 //============================================================================= 00033 // Destructor 00034 //============================================================================= 00035 TTULogicUnit::~TTULogicUnit() { 00036 00037 if (m_logtool) { 00038 if ( m_logtool->endjob() ) 00039 delete m_logtool; 00040 } 00041 00042 } 00043 00044 //============================================================================= 00045 bool TTULogicUnit::initialise() 00046 { 00047 00048 bool status(true); 00049 00050 status = m_logtool->initialise(); 00051 if ( !status ) { 00052 if( m_debug ) std::cout << "TTULogicUnit> Problem initialising LogicTool \n"; 00053 return 0; }; 00054 00055 m_logic = dynamic_cast<TTULogic*> ( m_logtool->retrieve(m_logtype) ); 00056 00057 if ( ! m_logic ) { 00058 if( m_debug ) std::cout << "TTULogicUnit> No logic found \n"; 00059 return 0; }; 00060 00061 return 1; 00062 00063 } 00064 00065 void TTULogicUnit::setlogic( const char * logic ) 00066 { 00067 00068 m_logtype = std::string( logic ); 00069 00070 } 00071 00072 void TTULogicUnit::setBoardSpecs( const TTUBoardSpecs::TTUBoardConfig & boardSpcs ) 00073 { 00074 00075 m_logic->setBoardSpecs ( boardSpcs ); 00076 00077 } 00078 00079 void TTULogicUnit::run( const TTUInput & input ) 00080 { 00081 00082 //... check the thresholds 00083 00084 //... by Sector 00085 00086 //... by Tower 00087 00088 //... by Wheel 00089 00090 m_logic->process( input ); 00091 00092 //m_logic->m_triggersignal = false; 00093 00094 00095 } 00096 00097 void TTULogicUnit::run( const TTUInput & input , int option ) 00098 { 00099 00100 m_logic->setOption( option ); 00101 m_logic->process( input ); 00102 00103 //m_logic->m_triggersignal = false; 00104 00105 }