CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes | Friends

RBCInput Class Reference

#include <interface/RBCInput.h>

List of all members.

Public Member Functions

void force (const std::vector< int > &)
void mask (const std::vector< int > &)
RBCInputoperator= (const RBCInput &rhs)
void printinfo ()
 RBCInput ()
 Standard constructor.
 RBCInput (const RBCInput &in)
 Destructor.
void setWheelId (int wid)
int wheelId () const
virtual ~RBCInput ()

Public Attributes

bool hasData
bool input [30]
std::bitset< 15 > * input_sec
bool needmapping

Private Attributes

bool m_debug
int m_wheelId

Friends

std::ostream & operator<< (std::ostream &ostr, RBCInput &)
std::istream & operator>> (std::istream &istr, RBCInput &)

Detailed Description

Author:
Andres Osorio

email: aosorio@uniandes.edu.co

Date:
2008-10-16

Definition at line 22 of file RBCInput.h.


Constructor & Destructor Documentation

RBCInput::RBCInput ( ) [inline]

Standard constructor.

Definition at line 25 of file RBCInput.h.

References hasData, input_sec, m_debug, and needmapping.

              { 
    input_sec = new std::bitset<15>[2];
    needmapping = false; 
    m_debug = false; 
    hasData = false;
  }; 
virtual RBCInput::~RBCInput ( ) [inline, virtual]

Definition at line 32 of file RBCInput.h.

References input_sec.

                       {
    if ( input_sec ) delete[] input_sec;
  }; 
RBCInput::RBCInput ( const RBCInput in) [inline]

Destructor.

Definition at line 36 of file RBCInput.h.

References hasData, i, input, input_sec, m_debug, m_wheelId, and needmapping.

  {
    for(int i=0; i < 30; ++i) input[i] = in.input[i];
    for(int i=0; i <  2; ++i) input_sec[i] = in.input_sec[i];
    needmapping = in.needmapping;
    m_debug = in.m_debug;
    hasData = in.hasData;
    m_wheelId = in.m_wheelId;
  };

Member Function Documentation

void RBCInput::force ( const std::vector< int > &  forcevec)

Definition at line 53 of file RBCInput.cc.

References gather_cfg::cout, i, input_sec, m_debug, and tmp.

Referenced by RBCBasicConfig::preprocess().

{
  
  if( m_debug ) std::cout << forcevec.size() << std::endl;

  std::bitset<15> tmp;
  
  for(int i=0; i < 15; ++i)
    tmp.set(i,forcevec[i]);
  
  //... operate on the first sector
  input_sec[0]|=tmp;
  tmp.reset();
  
  for(int i=15; i < 30; ++i)
    tmp.set( (i-15),forcevec[i]);
  
  input_sec[1]|=tmp;
  
  tmp.reset();
  
}
void RBCInput::mask ( const std::vector< int > &  maskvec)

Definition at line 38 of file RBCInput.cc.

References i, and input_sec.

Referenced by RBCBasicConfig::preprocess().

{
  
  //... operate on the first sector

  for(int i=0; i < 15; ++i) 
    if ( maskvec[i] ) input_sec[0].set(i,0);
  
  //... operate on the second sector
  
  for(int i=15; i < 30; ++i)
    if ( maskvec[i] ) input_sec[1].set( (i-15),0);
  
}
RBCInput& RBCInput::operator= ( const RBCInput rhs) [inline]

Definition at line 46 of file RBCInput.h.

References gather_cfg::cout, hasData, i, input, input_sec, m_debug, m_wheelId, and needmapping.

  {
    if (this == &rhs) {
      std::cout << "RBCInput:(this=rhs)" << '\n'; return (*this);
    };
    for(int i=0; i < 30; ++i) (*this).input[i]     = rhs.input[i];
    for(int i=0; i <  2; ++i) (*this).input_sec[i] = rhs.input_sec[i];
    (*this).needmapping = rhs.needmapping;
    (*this).m_debug = rhs.m_debug;
    (*this).hasData = rhs.hasData;
    (*this).m_wheelId = rhs.m_wheelId;
    return (*this);
  };
void RBCInput::printinfo ( ) [inline]

Definition at line 67 of file RBCInput.h.

References gather_cfg::cout.

                   {
    std::cout << "RBCInput: " << (*this);
  };
void RBCInput::setWheelId ( int  wid) [inline]

Definition at line 78 of file RBCInput.h.

References m_wheelId.

Referenced by RBCEmulator::emulate().

                             { 
    m_wheelId = wid;
  };
int RBCInput::wheelId ( ) const [inline]

Definition at line 82 of file RBCInput.h.

References m_wheelId.

Referenced by RBCChamberORLogic::process().

                      {
    return m_wheelId;
  };

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ostr,
RBCInput rhs 
) [friend]

Definition at line 27 of file RBCInput.cc.

                                                          {
  
  for(int i=0; i < 15; ++i) ostr << rhs.input_sec[0][i];
  ostr << '\t';
  for(int i=0; i < 15; ++i) ostr << rhs.input_sec[1][i];
  ostr << '\n';
  
  return ostr;
  
}
std::istream& operator>> ( std::istream &  istr,
RBCInput rhs 
) [friend]

Definition at line 13 of file RBCInput.cc.

                                                          {
  
  int _ks=0;
  
  for(int i=0 ; i < 30; ++i) { 
    istr >> rhs.input[i];
    if ( i < 15 ) _ks = 0;
    else _ks = 1;
    rhs.input_sec[_ks].set(i-(15*_ks), rhs.input[i]);
  }
  return istr;

}

Member Data Documentation

bool RBCInput::input[30]

Definition at line 64 of file RBCInput.h.

Referenced by operator=(), operator>>(), and RBCInput().

std::bitset<15>* RBCInput::input_sec
bool RBCInput::m_debug [private]

Definition at line 84 of file RBCInput.h.

Referenced by force(), operator=(), and RBCInput().

int RBCInput::m_wheelId [private]

Definition at line 91 of file RBCInput.h.

Referenced by operator=(), RBCInput(), setWheelId(), and wheelId().