CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

RPCWheel Class Reference

#include <RPCWheel.h>

List of all members.

Public Member Functions

void createWheelMap ()
void emulate ()
int getid ()
bool initialise ()
void print_wheel (const TTUInput &)
void printinfo ()
bool process (int, const std::map< int, RBCInput * > &)
bool process (int, const std::map< int, TTUInput * > &)
void retrieveWheelMap (TTUInput &)
 RPCWheel ()
 Standard constructor.
void setProperties (int, const char *)
void setProperties (int, const char *, const char *)
void setProperties (int)
void setSpecifications (const RBCBoardSpecs *)
virtual ~RPCWheel ()
 Destructor.

Public Attributes

std::vector< RBCEmulator * > m_RBCE

Private Attributes

bool m_debug
int m_id
int m_maxlayers
int m_maxrbc
int m_maxsectors
std::bitset< 12 > m_rbcDecision
std::vector< int > m_sec1id
std::vector< int > m_sec2id
std::bitset< 6 > * m_wheelmap

Detailed Description

Author:
Andres Osorio

email: aosorio@uniandes.edu.co

Date:
2008-10-15

Definition at line 24 of file RPCWheel.h.


Constructor & Destructor Documentation

RPCWheel::RPCWheel ( )

Standard constructor.

Definition at line 18 of file RPCWheel.cc.

References m_debug, m_id, m_maxlayers, m_maxrbc, m_maxsectors, m_sec1id, m_sec2id, and m_wheelmap.

                   {
  
  m_id = 0; 
  
  m_maxrbc     = 6;
  m_maxlayers  = 6;
  m_maxsectors = 12;
  
  m_debug = false;

  m_sec1id.push_back(12);
  m_sec2id.push_back(1);
  m_sec1id.push_back(2);
  m_sec2id.push_back(3);
  m_sec1id.push_back(4);
  m_sec2id.push_back(5);
  m_sec1id.push_back(6);
  m_sec2id.push_back(7);
  m_sec1id.push_back(8);
  m_sec2id.push_back(9);
  m_sec1id.push_back(10);
  m_sec2id.push_back(11);

  m_wheelmap = new std::bitset<6>[12];
    
}
RPCWheel::~RPCWheel ( ) [virtual]

Destructor.

Definition at line 106 of file RPCWheel.cc.

References m_RBCE, m_sec1id, m_sec2id, and m_wheelmap.

                    {
  
  //destroy all rbc objects associated
  std::vector<RBCEmulator*>::iterator itr;
  for( itr = m_RBCE.begin(); itr != m_RBCE.end(); ++itr)
    if ( (*itr) ) delete (*itr);
  
  m_RBCE.clear();
  m_sec1id.clear();
  m_sec2id.clear();

  if ( m_wheelmap ) delete[] m_wheelmap;
    
} 

Member Function Documentation

void RPCWheel::createWheelMap ( )

Definition at line 234 of file RPCWheel.cc.

References gather_cfg::cout, gen::k, m_debug, m_maxrbc, m_rbcDecision, m_RBCE, and m_wheelmap.

Referenced by TTUEmulator::processTtu().

{
  
  m_rbcDecision.reset();
  
  std::bitset<6> layersignal;
  
  layersignal       = * m_RBCE[0]->getlayersignal( 0 );
  m_wheelmap[11]     = layersignal;
  
  m_rbcDecision.set( 11 , m_RBCE[0]->getdecision( 0 ) );
  
  for( int k=0; k < (m_maxrbc-1); ++k )
  {
    layersignal             = * m_RBCE[k+1]->getlayersignal( 0 );
    m_wheelmap[(k*2)+1]     = layersignal;
    layersignal             = * m_RBCE[k+1]->getlayersignal( 1 );
    m_wheelmap[(k*2)+2]     = layersignal;
    
    m_rbcDecision.set( (k*2)+1  , m_RBCE[k+1]->getdecision( 0 ) );
    m_rbcDecision.set( (k*2)+2  , m_RBCE[k+1]->getdecision( 1 ) );
    
  }
  
  layersignal       = * m_RBCE[0]->getlayersignal( 1 );
  m_wheelmap[0]     = layersignal;
  
  m_rbcDecision.set( 0 , m_RBCE[0]->getdecision( 1 ) );
  
  if( m_debug ) std::cout << "RPCWheel::createWheelMap done" << std::endl;
  
}
void RPCWheel::emulate ( )

Definition at line 140 of file RPCWheel.cc.

References gen::k, m_maxrbc, and m_RBCE.

{
  //This is a test emulation
  for( int k=0; k < m_maxrbc; ++k )
  {
    m_RBCE[k]->emulate();
  }
  
}
int RPCWheel::getid ( ) [inline]

Definition at line 51 of file RPCWheel.h.

References m_id.

Referenced by TTUEmulator::processTtu().

{ return m_id; };
bool RPCWheel::initialise ( )

Definition at line 130 of file RPCWheel.cc.

References gen::k, m_maxrbc, m_RBCE, and ntuplemaker::status.

{

  bool status(false);
  for( int k=0; k < m_maxrbc; ++k )
    status = m_RBCE[k]->initialise();
  return status;
  
}
void RPCWheel::print_wheel ( const TTUInput wmap)

Definition at line 301 of file RPCWheel.cc.

References gather_cfg::cout, i, TTUInput::input_sec, j, gen::k, TTUInput::m_bx, m_maxlayers, m_maxsectors, and TTUInput::m_wheelId.

Referenced by retrieveWheelMap().

{

  std::cout << "RPCWheel::print_wheel> " << wmap.m_wheelId << '\t' << wmap.m_bx << std::endl;
  
  for( int i=0; i < m_maxsectors; ++i) std::cout << '\t' << (i+1);
  std::cout << std::endl;
  
  for( int k=0; k < m_maxlayers; ++k )
  {
    std::cout << (k+1) << '\t';
    for( int j=0; j < m_maxsectors; ++j)
      std::cout << wmap.input_sec[j][k] << '\t';
    std::cout << std::endl;
  }
  
}
void RPCWheel::printinfo ( )

Definition at line 292 of file RPCWheel.cc.

References gather_cfg::cout, gen::k, m_id, m_maxrbc, and m_RBCE.

{
  
  std::cout << "Wheel -> " << m_id << '\n';
  for( int k=0; k < m_maxrbc; ++k )
    m_RBCE[k]->printinfo();
  
}
bool RPCWheel::process ( int  bx,
const std::map< int, TTUInput * > &  data 
)

Definition at line 196 of file RPCWheel.cc.

References abs, gather_cfg::cout, gen::k, combine::key, m_debug, m_id, m_maxsectors, m_wheelmap, and ntuplemaker::status.

{
  
  int bxsign(1);
  bool status(false);
  
  std::map<int,TTUInput*>::const_iterator itr;
  
  if ( bx != 0 ) bxsign = ( bx / abs(bx) );
  else bxsign = 1;
  
  int key = bxsign*( 1000000 * abs(bx) + (m_id+2)*10000 );
  
  itr = data.find( key );
  
  if ( itr != data.end() )  {
    if( m_debug ) std::cout << "RPCWheel::process> found data at: " <<  key << '\t' 
                            << ( itr->second ) << std::endl;

    if ( ! (*itr).second->m_hasHits ) return false;
    
    for( int k=0; k < m_maxsectors; ++k ) {
      m_wheelmap[k]     = (*itr).second->input_sec[k];
      status = true;
    }

  } else {
    //if( m_debug ) std::cout << "RPCWheel::process> position not found: " <<  key << std::endl;
    status = false;
  }
  
  return status;
  
}
bool RPCWheel::process ( int  bx,
const std::map< int, RBCInput * > &  data 
)

Definition at line 150 of file RPCWheel.cc.

References abs, gather_cfg::cout, gen::k, combine::key, m_debug, m_maxrbc, m_RBCE, and ntuplemaker::status.

{
  
  int bxsign(1);
  bool status(false);
  
  std::map<int,RBCInput*>::const_iterator itr;
  
  if ( bx != 0 ) bxsign = ( bx / abs(bx) );
  else bxsign = 1;
  
  for(int k=0; k < m_maxrbc; ++k) {
    
    m_RBCE[k]->reset();
    
    int key = bxsign*( 1000000 * abs(bx)
                       + m_RBCE[k]->m_rbcinfo->wheelIdx()*10000 
                       + m_RBCE[k]->m_rbcinfo->sector(0)*100
                       + m_RBCE[k]->m_rbcinfo->sector(1) );
    
    itr = data.find( key );
    
    if ( itr != data.end() )  {
      
      if ( ! (*itr).second->hasData )  { 
        status |= false;
        continue;
      } else {
        if( m_debug ) std::cout << "RPCWheel::process> found data at: " 
                                <<  key << '\t' 
                                << ( itr->second ) << std::endl;
        m_RBCE[k]->emulate( ( itr->second ) );
        status |= true;
      }
      
    } else {
      //if( m_debug ) std::cout << "RPCWheel::process> position not found: " <<  key << std::endl;
      status |= false;
    }
    
  }
  
  return status;
  
}
void RPCWheel::retrieveWheelMap ( TTUInput output)

Definition at line 267 of file RPCWheel.cc.

References gather_cfg::cout, i, TTUInput::input_sec, j, m_debug, m_id, m_maxlayers, m_maxsectors, m_rbcDecision, TTUInput::m_rbcDecision, TTUInput::m_wheelId, m_wheelmap, print_wheel(), and TTUInput::reset().

Referenced by TTUEmulator::processTtu().

{
  
  if( m_debug ) std::cout << "RPCWheel::retrieveWheelMap starts" << std::endl;
  output.reset();
  
  for(int i=0; i < m_maxsectors; ++i ) {
    for( int j=0; j < m_maxlayers; ++j ) 
    {
      output.input_sec[i].set(j, m_wheelmap[i][j]);
    }
  }
  
  output.m_wheelId = m_id;
  
  output.m_rbcDecision = m_rbcDecision;
    
  if( m_debug ) print_wheel( output );
  if( m_debug ) std::cout << "RPCWheel::retrieveWheelMap done" << std::endl;
  
}
void RPCWheel::setProperties ( int  wid,
const char *  f_name,
const char *  logic_type 
)

Definition at line 84 of file RPCWheel.cc.

References gen::k, m_id, m_maxrbc, m_maxsectors, m_RBCE, m_wheelmap, and reset().

                                                                                   {
  
  m_id = wid; 
  
  int bisector[2];
  
  for( int k=0; k < m_maxrbc; ++k )
  {
    bisector[0]= (k*2)+1;
    bisector[1]= (k*2)+2;
    m_RBCE.push_back( new RBCEmulator( f_name, logic_type ) ); 
    m_RBCE[k]->setid( wid, bisector );
  }
  
  for( int k=0; k < m_maxsectors; ++k)
    m_wheelmap[k].reset();
  
}
void RPCWheel::setProperties ( int  wid)

Definition at line 45 of file RPCWheel.cc.

References gen::k, m_id, m_maxrbc, m_maxsectors, m_RBCE, m_sec1id, m_sec2id, m_wheelmap, and reset().

                                      {
  
  m_id = wid;
  
  int bisector[2];
  
  for( int k=0; k < m_maxrbc; ++k )
  {
    bisector[0]= m_sec1id[k];
    bisector[1]= m_sec2id[k];
    m_RBCE.push_back( new RBCEmulator( ) ); 
    m_RBCE[k]->setid( wid, bisector );
  }

  for( int k=0; k < m_maxsectors; ++k)
    m_wheelmap[k].reset();
  
}
void RPCWheel::setProperties ( int  wid,
const char *  logic_type 
)

Definition at line 65 of file RPCWheel.cc.

References gen::k, m_id, m_maxrbc, m_maxsectors, m_RBCE, m_sec1id, m_sec2id, m_wheelmap, and reset().

                                                              {
  
  m_id = wid;
  
  int bisector[2];
  
  for( int k=0; k < m_maxrbc; ++k )
  {
    bisector[0]= m_sec1id[k];
    bisector[1]= m_sec2id[k];
    m_RBCE.push_back( new RBCEmulator( logic_type ) ); 
    m_RBCE[k]->setid( wid, bisector );
  }

  for( int k=0; k < m_maxsectors; ++k)
    m_wheelmap[k].reset();
  
}
void RPCWheel::setSpecifications ( const RBCBoardSpecs rbcspecs)

Definition at line 122 of file RPCWheel.cc.

References gen::k, m_maxrbc, and m_RBCE.

{
  
  for( int k=0; k < m_maxrbc; ++k )
    m_RBCE[k]->setSpecifications( rbcspecs ); 
  
}

Member Data Documentation

bool RPCWheel::m_debug [private]

Definition at line 76 of file RPCWheel.h.

Referenced by createWheelMap(), process(), retrieveWheelMap(), and RPCWheel().

int RPCWheel::m_id [private]

Definition at line 63 of file RPCWheel.h.

Referenced by getid(), printinfo(), process(), retrieveWheelMap(), RPCWheel(), and setProperties().

int RPCWheel::m_maxlayers [private]

Definition at line 65 of file RPCWheel.h.

Referenced by print_wheel(), retrieveWheelMap(), and RPCWheel().

int RPCWheel::m_maxrbc [private]
int RPCWheel::m_maxsectors [private]

Definition at line 66 of file RPCWheel.h.

Referenced by print_wheel(), process(), retrieveWheelMap(), RPCWheel(), and setProperties().

std::bitset<12> RPCWheel::m_rbcDecision [private]

Definition at line 73 of file RPCWheel.h.

Referenced by createWheelMap(), and retrieveWheelMap().

std::vector<int> RPCWheel::m_sec1id [private]

Definition at line 68 of file RPCWheel.h.

Referenced by RPCWheel(), setProperties(), and ~RPCWheel().

std::vector<int> RPCWheel::m_sec2id [private]

Definition at line 69 of file RPCWheel.h.

Referenced by RPCWheel(), setProperties(), and ~RPCWheel().

std::bitset<6>* RPCWheel::m_wheelmap [private]

Definition at line 74 of file RPCWheel.h.

Referenced by createWheelMap(), process(), retrieveWheelMap(), RPCWheel(), setProperties(), and ~RPCWheel().