#include <RBCChamberORLogic.h>
Public Types | |
typedef std::map< std::string, bool >::iterator | itr2chambers |
typedef std::vector < std::string >::iterator | itr2names |
Public Member Functions | |
void | copymap (const std::bitset< 15 > &) |
void | createmap (const std::bitset< 15 > &) |
bool | evaluateLayerOR (const char *, const char *) |
std::bitset< 6 > * | getlayersignal (int _idx) |
void | process (const RBCInput &, std::bitset< 2 > &) |
RBCChamberORLogic () | |
Standard constructor. | |
void | reset () |
void | setBoardSpecs (const RBCBoardSpecs::RBCBoardConfig &) |
void | setmaxlevel (int _mx) |
virtual | ~RBCChamberORLogic () |
Destructor. | |
Public Attributes | |
std::bitset< 6 > * | m_layersignal |
Private Attributes | |
std::map< std::string, bool > | m_chamber |
int | m_maxcb |
int | m_maxlevel |
std::vector< std::string > | m_rbname |
This class works out the mapping of inputs to chambers and applies a Coincidence Logic. The criteria for coincidence is set by the parameter m_maxlevel.
email: aosorio@uniandes.edu.co
Definition at line 28 of file RBCChamberORLogic.h.
typedef std::map<std::string,bool>::iterator RBCChamberORLogic::itr2chambers |
Definition at line 42 of file RBCChamberORLogic.h.
typedef std::vector<std::string>::iterator RBCChamberORLogic::itr2names |
Definition at line 39 of file RBCChamberORLogic.h.
RBCChamberORLogic::RBCChamberORLogic | ( | ) |
Standard constructor.
Definition at line 17 of file RBCChamberORLogic.cc.
References m_chamber, m_layersignal, m_maxcb, m_maxlevel, and m_rbname.
{ m_rbname.push_back(std::string("RB1InFw")); m_rbname.push_back(std::string("RB1OutFw")); m_rbname.push_back(std::string("RB22Fw")); m_rbname.push_back(std::string("RB23Fw")); m_rbname.push_back(std::string("RB23M")); m_rbname.push_back(std::string("RB3Fw")); m_rbname.push_back(std::string("RB4Fw")); m_rbname.push_back(std::string("RB1InBk")); m_rbname.push_back(std::string("RB1OutBk")); m_rbname.push_back(std::string("RB22Bk")); m_rbname.push_back(std::string("RB23Bk")); m_rbname.push_back(std::string("RB3Bk")); m_rbname.push_back(std::string("RB4Bk")); itr2names itr = m_rbname.begin(); while ( itr != m_rbname.end() ) { m_chamber.insert( make_pair( (*itr) , 0 ) ); ++itr; } m_maxcb = 13; m_maxlevel = 3; // 1 <= m <= 6 m_layersignal = new std::bitset<6>[2]; m_layersignal[0].reset(); m_layersignal[1].reset(); }
RBCChamberORLogic::~RBCChamberORLogic | ( | ) | [virtual] |
Destructor.
Definition at line 53 of file RBCChamberORLogic.cc.
References m_layersignal.
{ if ( m_layersignal ) delete[] m_layersignal; }
void RBCChamberORLogic::copymap | ( | const std::bitset< 15 > & | _input | ) |
Definition at line 146 of file RBCChamberORLogic.cc.
References m_chamber, and m_rbname.
Referenced by process().
{ m_chamber[m_rbname[0]] = _input[0]; m_chamber[m_rbname[1]] = _input[1]; m_chamber[m_rbname[2]] = _input[2]; m_chamber[m_rbname[3]] = _input[3]; m_chamber[m_rbname[4]] = _input[4]; m_chamber[m_rbname[5]] = _input[5]; m_chamber[m_rbname[6]] = _input[6]; m_chamber[m_rbname[7]] = _input[7]; m_chamber[m_rbname[8]] = _input[8]; m_chamber[m_rbname[9]] = _input[9]; m_chamber[m_rbname[10]] = _input[10]; m_chamber[m_rbname[11]] = _input[11]; m_chamber[m_rbname[12]] = _input[12]; }
void RBCChamberORLogic::createmap | ( | const std::bitset< 15 > & | _input | ) |
Definition at line 165 of file RBCChamberORLogic.cc.
References m_chamber, and m_rbname.
Referenced by process().
{ m_chamber[m_rbname[0]] = _input[3]; m_chamber[m_rbname[1]] = _input[4]; m_chamber[m_rbname[2]] = _input[5]; m_chamber[m_rbname[3]] = _input[8]; m_chamber[m_rbname[4]] = _input[7]; m_chamber[m_rbname[5]] = _input[11]; m_chamber[m_rbname[6]] = _input[12] || _input[14]; m_chamber[m_rbname[7]] = _input[0]; m_chamber[m_rbname[8]] = _input[1]; m_chamber[m_rbname[9]] = _input[2]; m_chamber[m_rbname[10]] = _input[6]; m_chamber[m_rbname[11]] = _input[9]; m_chamber[m_rbname[12]] = _input[10] || _input[13]; }
bool RBCChamberORLogic::evaluateLayerOR | ( | const char * | _chA, |
const char * | _chB | ||
) |
Definition at line 203 of file RBCChamberORLogic.cc.
References gather_cfg::cout, and m_chamber.
Referenced by process().
{ itr2chambers ptr1 = m_chamber.find( std::string(_chA) ); itr2chambers ptr2 = m_chamber.find( std::string(_chB) ); if ( ptr1 == m_chamber.end() || ptr2 == m_chamber.end() ) { //handle error... std::cout << "RBCChamberORLogic> Cannot find a chamber name" << '\n'; return false; } return ( ptr1->second || ptr2->second ); }
std::bitset<6>* RBCChamberORLogic::getlayersignal | ( | int | _idx | ) | [inline, virtual] |
Implements RBCLogic.
Definition at line 39 of file RBCChamberORLogic.h.
{ return & m_layersignal[_idx]; };
void RBCChamberORLogic::process | ( | const RBCInput & | _input, |
std::bitset< 2 > & | _decision | ||
) | [virtual] |
Implements RBCLogic.
Definition at line 61 of file RBCChamberORLogic.cc.
References abs, copymap(), prof2calltree::count, createmap(), evaluateLayerOR(), RBCInput::input_sec, gen::k, m_layersignal, m_maxlevel, RBCInput::needmapping, reset(), ntuplemaker::status, and RBCInput::wheelId().
{ bool status(false); //std::cout << "RBCChamberORLogic> Working with chambers OR logic ..." << '\n'; m_layersignal[0].reset(); m_layersignal[1].reset(); for (int k=0; k < 2; ++k ) { if( _input.needmapping ) this->createmap( _input.input_sec[k] ); else this->copymap ( _input.input_sec[k] ); status = this->evaluateLayerOR( "RB1InFw" , "RB1InBk" ); m_layersignal[k].set( 0 , status); status = this->evaluateLayerOR( "RB1OutFw" , "RB1OutBk" ); m_layersignal[k].set( 1 , status); //... RB2 //... wheel -2,+2 RB2IN divided in 2 eta partitions, RB2OUT in 3 eta //... wheel -1, 0, +1 RB2IN divided in 3 eta partitions, RB2OUT in 2 eta if ( abs( _input.wheelId() ) >= 2 ) { status = this->evaluateLayerOR( "RB22Fw" , "RB22Bk" ); m_layersignal[k].set( 2 , status); bool rb23FB = this->evaluateLayerOR( "RB23Fw" , "RB23Bk" ); bool rb23MF = this->evaluateLayerOR( "RB23Fw" , "RB23M" ); bool rb23MB = this->evaluateLayerOR( "RB23M" , "RB23Bk" ); status = rb23FB || rb23MF || rb23MB; m_layersignal[k].set( 3 , status ); } else { status = this->evaluateLayerOR( "RB22Fw" , "RB22Bk" ); m_layersignal[k].set( 3 , status); bool rb23FB = this->evaluateLayerOR( "RB23Fw" , "RB23Bk" ); bool rb23MF = this->evaluateLayerOR( "RB23Fw" , "RB23M" ); bool rb23MB = this->evaluateLayerOR( "RB23M" , "RB23Bk" ); status = rb23FB || rb23MF || rb23MB; m_layersignal[k].set( 2 , status ); } //....... status = this->evaluateLayerOR( "RB3Fw" , "RB3Bk" ); m_layersignal[k].set( 4 , status); status = this->evaluateLayerOR( "RB4Fw" , "RB4Bk" ); m_layersignal[k].set( 5 , status); reset(); //... apply now majority level criteria: int _majority = int(m_layersignal[k].count()); if ( _majority >= m_maxlevel) _decision[k] = true; else _decision[k] = false; } //...all done! }
void RBCChamberORLogic::reset | ( | void | ) |
Definition at line 184 of file RBCChamberORLogic.cc.
References m_chamber, and m_rbname.
Referenced by process().
void RBCChamberORLogic::setBoardSpecs | ( | const RBCBoardSpecs::RBCBoardConfig & | specs | ) | [virtual] |
Implements RBCLogic.
Definition at line 139 of file RBCChamberORLogic.cc.
References m_maxlevel, and RBCBoardSpecs::RBCBoardConfig::m_MayorityLevel.
{ m_maxlevel = specs.m_MayorityLevel; }
void RBCChamberORLogic::setmaxlevel | ( | int | _mx | ) | [inline] |
std::map<std::string, bool> RBCChamberORLogic::m_chamber [private] |
Definition at line 62 of file RBCChamberORLogic.h.
Referenced by copymap(), createmap(), evaluateLayerOR(), RBCChamberORLogic(), and reset().
std::bitset<6>* RBCChamberORLogic::m_layersignal |
Definition at line 52 of file RBCChamberORLogic.h.
Referenced by process(), RBCChamberORLogic(), and ~RBCChamberORLogic().
int RBCChamberORLogic::m_maxcb [private] |
Definition at line 64 of file RBCChamberORLogic.h.
Referenced by RBCChamberORLogic().
int RBCChamberORLogic::m_maxlevel [private] |
Definition at line 66 of file RBCChamberORLogic.h.
Referenced by process(), RBCChamberORLogic(), setBoardSpecs(), and setmaxlevel().
std::vector<std::string> RBCChamberORLogic::m_rbname [private] |
Definition at line 60 of file RBCChamberORLogic.h.
Referenced by copymap(), createmap(), RBCChamberORLogic(), and reset().