CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

RBCEmulator Class Reference

#include <RBCEmulator.h>

List of all members.

Public Member Functions

void emulate ()
void emulate (RBCInput *)
bool getdecision (int idx)
std::bitset< 6 > * getlayersignal (int idx)
bool initialise ()
void printinfo ()
void printlayerinfo ()
 RBCEmulator (const char *)
 RBCEmulator (const char *, const char *, int, int *)
 RBCEmulator ()
 Standard constructor.
 RBCEmulator (const char *, const char *)
void reset ()
void setid (int, int *)
void setSpecifications (const RBCBoardSpecs *)
virtual ~RBCEmulator ()
 Destructor.

Public Attributes

RBCIdm_rbcinfo

Private Attributes

int m_bx
bool m_debug
std::bitset< 2 > m_decision
RBCInputm_input
std::bitset< 6 > * m_layersignal [2]
std::vector< std::bitset< 6 > * > m_layersignalVec
std::string m_logtype
RBCConfigurationm_rbcconf
ProcessInputSignalm_signal

Detailed Description

Author:
Andres Osorio, Flavio Loddo, Marcello Maggi

email: aosorio@uniandes.edu.co

Date:
2008-10-10

Definition at line 25 of file RBCEmulator.h.


Constructor & Destructor Documentation

RBCEmulator::RBCEmulator ( )

Standard constructor.

Definition at line 19 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcinfo, m_signal, and NULL.

                          {
  
  m_signal  = NULL;
  m_logtype = std::string("TestLogic");
  m_rbcinfo = new RBCId();
  m_input   = new RBCInput();
    
  m_layersignal[0] = new std::bitset<6>();
  m_layersignal[1] = new std::bitset<6>();
  m_layersignalVec.push_back( m_layersignal[0] );
  m_layersignalVec.push_back( m_layersignal[1] );

  m_debug   = false;
  
}
RBCEmulator::RBCEmulator ( const char *  logic_type)

Definition at line 35 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcconf, m_rbcinfo, m_signal, and NULL.

                                                  {
  
  m_signal  = NULL;
  m_logtype = std::string( logic_type );
  m_rbcinfo = new RBCId();
  m_input   = new RBCInput();
  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(logic_type));
  
  m_layersignal[0] = new std::bitset<6>();
  m_layersignal[1] = new std::bitset<6>();
  m_layersignalVec.push_back( m_layersignal[0] );
  m_layersignalVec.push_back( m_layersignal[1] );
  
  m_debug   = false;
  
}
RBCEmulator::RBCEmulator ( const char *  f_name,
const char *  logic_type 
)

Definition at line 52 of file RBCEmulator.cc.

References m_debug, m_input, m_layersignal, m_layersignalVec, m_logtype, m_rbcconf, m_rbcinfo, and m_signal.

                                                                         {
  
  m_signal  = dynamic_cast<ProcessInputSignal*>(new RBCProcessTestSignal( f_name ));
  m_logtype = std::string( logic_type );
  m_rbcinfo = new RBCId();
  m_input   = new RBCInput();
  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(logic_type));

  m_layersignal[0] = new std::bitset<6>();
  m_layersignal[1] = new std::bitset<6>();
  m_layersignalVec.push_back( m_layersignal[0] );
  m_layersignalVec.push_back( m_layersignal[1] );
  
  m_debug   = false;
  
}
RBCEmulator::RBCEmulator ( const char *  ,
const char *  ,
int  ,
int *   
)
RBCEmulator::~RBCEmulator ( ) [virtual]

Destructor.

Definition at line 72 of file RBCEmulator.cc.

References m_input, m_layersignalVec, m_rbcconf, m_rbcinfo, and m_signal.

                          {
  
  if (m_signal)  delete m_signal;
  if (m_rbcconf) delete m_rbcconf;
  if (m_rbcinfo) delete m_rbcinfo;
  if (m_input)   delete m_input;

  std::vector<std::bitset<6>*>::iterator itr;
  for(itr =  m_layersignalVec.begin(); itr != m_layersignalVec.end(); ++itr)
    delete (*itr);
  
} 

Member Function Documentation

void RBCEmulator::emulate ( )

Definition at line 113 of file RBCEmulator.cc.

References gather_cfg::cout, data, RBCLogicUnit::getlayersignal(), m_debug, m_input, m_layersignal, m_rbcconf, RBCConfiguration::m_rbclogic, m_signal, ProcessInputSignal::next(), printlayerinfo(), ProcessInputSignal::retrievedata(), and RBCLogicUnit::run().

{
  
  if( m_debug ) std::cout << "RBCEmulator> starting test emulation" << std::endl;
  
  std::bitset<2> decision;
  
  while ( m_signal->next() ) 
  {
    
    RPCInputSignal * data = m_signal->retrievedata();
    (*m_input) = * dynamic_cast<RBCLinkBoardSignal*>( data )->m_linkboardin ;
    
    m_rbcconf->m_rbclogic->run( (*m_input) , decision );
    
    m_layersignal[0] = m_rbcconf->m_rbclogic->getlayersignal( 0 );
    m_layersignal[1] = m_rbcconf->m_rbclogic->getlayersignal( 1 );
    
    printlayerinfo();
    
    if ( m_debug ) std::cout << decision[0] << " " << decision[1] << std::endl;
    
  }
  
  if( m_debug ) std::cout << "RBCEmulator> end test emulation" << std::endl;
  
}
void RBCEmulator::emulate ( RBCInput in)

Definition at line 141 of file RBCEmulator.cc.

References gather_cfg::cout, RBCLogicUnit::getlayersignal(), m_debug, m_decision, m_input, m_layersignal, m_rbcconf, m_rbcinfo, RBCConfiguration::m_rbclogic, RBCConfiguration::preprocess(), printlayerinfo(), RBCLogicUnit::run(), RBCInput::setWheelId(), and RBCId::wheel().

{
  
  if( m_debug ) std::cout << "RBCEmulator> starting emulation" << std::endl;
  
  std::bitset<2> decision;
  
  in->setWheelId( m_rbcinfo->wheel() );
  
  (*m_input) =  (*in);
  
  if( m_debug ) std::cout << "RBCEmulator> copied data" << std::endl;

  //.. mask and force as specified in hardware configuration
  m_rbcconf->preprocess( (*m_input) );

  if( m_debug ) std::cout << "RBCEmulator> preprocessing done" << std::endl;
    
  m_rbcconf->m_rbclogic->run( (*m_input) , decision );

  if( m_debug ) std::cout << "RBCEmulator> applying logic" << std::endl;
  
  m_layersignal[0] = m_rbcconf->m_rbclogic->getlayersignal( 0 );
  m_layersignal[1] = m_rbcconf->m_rbclogic->getlayersignal( 1 );

  m_decision.set(0, decision[0] );
  m_decision.set(1, decision[1] );
    
  if( m_debug ) {
    printlayerinfo();
    std::cout << decision[0] << " " << decision[1] << std::endl;
    std::cout << "RBCEmulator> end emulation" << std::endl;
  }
  
  decision.reset();  
  
}
bool RBCEmulator::getdecision ( int  idx) [inline]

Definition at line 52 of file RBCEmulator.h.

References m_decision.

{ return m_decision[idx];};
std::bitset<6>* RBCEmulator::getlayersignal ( int  idx) [inline]

Definition at line 50 of file RBCEmulator.h.

References m_layersignal.

{ return m_layersignal[idx];};
bool RBCEmulator::initialise ( )

Definition at line 93 of file RBCEmulator.cc.

References gather_cfg::cout, RBCConfiguration::initialise(), m_debug, m_rbcconf, and ntuplemaker::status.

{
  
  bool status(true);
  
  status = m_rbcconf->initialise();
  
  if ( !status ) { 
    if( m_debug ) std::cout << "RBCEmulator> Problem initialising the Configuration \n"; 
    return 0; };
  
  return 1;
  
}
void RBCEmulator::printinfo ( )

Definition at line 188 of file RBCEmulator.cc.

References gather_cfg::cout, m_debug, m_rbcinfo, and RBCId::printinfo().

{
  
  if( m_debug ) {
    std::cout << "RBC --> \n";
    m_rbcinfo->printinfo();
  }
  
}
void RBCEmulator::printlayerinfo ( )

Definition at line 198 of file RBCEmulator.cc.

References gather_cfg::cout, i, and m_layersignal.

Referenced by emulate().

{

  std::cout << "Sector summary by layer: \n";
  for(int i=0; i < 6; ++i)
    std::cout << (*m_layersignal[0])[i] << '\t' 
              << (*m_layersignal[1])[i] << '\n';  
  
}
void RBCEmulator::reset ( void  )

Definition at line 179 of file RBCEmulator.cc.

References m_decision, and m_layersignal.

{

  m_decision.reset();
  m_layersignal[0]->reset();
  m_layersignal[1]->reset();
  
}
void RBCEmulator::setid ( int  wh,
int *  sec 
)

Definition at line 108 of file RBCEmulator.cc.

References m_rbcinfo, and RBCId::setid().

{
  m_rbcinfo->setid ( wh, sec);
}
void RBCEmulator::setSpecifications ( const RBCBoardSpecs rbcspecs)

Definition at line 86 of file RBCEmulator.cc.

References m_rbcconf, and m_rbcinfo.

{

  m_rbcconf = dynamic_cast<RBCConfiguration*> (new RBCBasicConfig(rbcspecs, m_rbcinfo));

}

Member Data Documentation

int RBCEmulator::m_bx [private]

Definition at line 78 of file RBCEmulator.h.

bool RBCEmulator::m_debug [private]

Definition at line 82 of file RBCEmulator.h.

Referenced by emulate(), initialise(), printinfo(), and RBCEmulator().

std::bitset<2> RBCEmulator::m_decision [private]

Definition at line 72 of file RBCEmulator.h.

Referenced by emulate(), getdecision(), and reset().

Definition at line 68 of file RBCEmulator.h.

Referenced by emulate(), RBCEmulator(), and ~RBCEmulator().

std::bitset<6>* RBCEmulator::m_layersignal[2] [private]

Definition at line 70 of file RBCEmulator.h.

Referenced by emulate(), getlayersignal(), printlayerinfo(), RBCEmulator(), and reset().

std::vector< std::bitset<6> *> RBCEmulator::m_layersignalVec [private]

Definition at line 74 of file RBCEmulator.h.

Referenced by RBCEmulator(), and ~RBCEmulator().

std::string RBCEmulator::m_logtype [private]

Definition at line 80 of file RBCEmulator.h.

Referenced by RBCEmulator().

Definition at line 66 of file RBCEmulator.h.

Referenced by emulate(), initialise(), RBCEmulator(), setSpecifications(), and ~RBCEmulator().

Definition at line 58 of file RBCEmulator.h.

Referenced by emulate(), printinfo(), RBCEmulator(), setid(), setSpecifications(), and ~RBCEmulator().

Definition at line 64 of file RBCEmulator.h.

Referenced by emulate(), RBCEmulator(), and ~RBCEmulator().