#include <RBCProcessRPCDigis.h>
Definition at line 39 of file RBCProcessRPCDigis.h.
RBCProcessRPCDigis::RBCProcessRPCDigis | ( | ) | [inline] |
RBCProcessRPCDigis::RBCProcessRPCDigis | ( | const edm::ESHandle< RPCGeometry > & | rpcGeom, |
const edm::Handle< RPCDigiCollection > & | digiColl | ||
) |
Definition at line 20 of file RBCProcessRPCDigis.cc.
References configure(), m_data, m_debug, m_lbin, m_ptr_digiColl, and m_ptr_rpcGeom.
{ m_ptr_rpcGeom = & rpcGeom; m_ptr_digiColl = & digiColl; m_lbin = dynamic_cast<RPCInputSignal*>( new RBCLinkBoardGLSignal( &m_data ) ); m_debug = false; configure(); }
RBCProcessRPCDigis::~RBCProcessRPCDigis | ( | ) | [virtual] |
Destructor.
Definition at line 92 of file RBCProcessRPCDigis.cc.
References m_digiCounters, m_layermap, m_lbin, m_sec1id, m_sec2id, m_wheelid, and reset().
{ if ( m_lbin ) delete m_lbin; std::vector<int>::iterator wheel; for( wheel = m_wheelid.begin(); wheel != m_wheelid.end(); ++wheel) delete m_digiCounters[(*wheel)]; m_sec1id.clear(); m_sec2id.clear(); m_wheelid.clear(); m_layermap.clear(); reset(); }
void RBCProcessRPCDigis::builddata | ( | ) |
Definition at line 268 of file RBCProcessRPCDigis.cc.
References abs, gather_cfg::cout, gen::k, m_data, m_debug, m_vecDataperBx, and RBCInput::needmapping.
Referenced by next().
{ int bx(0); int code(0); int bxsign(1); std::vector<RPCData*>::iterator itr; std::map<int, std::vector<RPCData*> >::iterator itr2; itr2 = m_vecDataperBx.begin(); if( itr2 == ( m_vecDataperBx.end() ) ) return; while ( itr2 != m_vecDataperBx.end() ) { bx = (*itr2).first; if ( bx != 0 ) bxsign = ( bx / abs(bx) ); else bxsign = 1; for(itr = (*itr2).second.begin(); itr != (*itr2).second.end(); ++itr) { for(int k=0; k < 6; ++k) { code = bxsign * ( 1000000*abs(bx) + 10000*(*itr)->wheelIdx() + 100 *(*itr)->m_sec1[k] + 1 *(*itr)->m_sec2[k] ); RBCInput * signal = & (*itr)->m_orsignals[k]; signal->needmapping = false; if ( signal->hasData ) m_data.insert( std::make_pair( code , signal) ); } } ++itr2; } if ( m_debug ) std::cout << "builddata: completed. size of data: " << m_data.size() << std::endl; }
void RBCProcessRPCDigis::configure | ( | ) |
Definition at line 35 of file RBCProcessRPCDigis.cc.
References m_digiCounters, m_layermap, m_maxBxWindow, m_sec1id, m_sec2id, and m_wheelid.
Referenced by RBCProcessRPCDigis().
{ m_wheelid.push_back(-2); //-2 m_wheelid.push_back(-1); //-1 m_wheelid.push_back(0); // 0 m_wheelid.push_back( 1); //+1 m_wheelid.push_back( 2); //+2 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_layermap[113] = 0; //RB1InFw m_layermap[123] = 1; //RB1OutFw m_layermap[20213] = 2; //RB22Fw m_layermap[20223] = 2; //RB22Fw m_layermap[30223] = 3; //RB23Fw m_layermap[30213] = 3; //RB23Fw m_layermap[30212] = 4; //RB23M m_layermap[30222] = 4; //RB23M m_layermap[313] = 5; //RB3Fw m_layermap[413] = 6; //RB4Fw m_layermap[111] = 7; //RB1InBk m_layermap[121] = 8; //RB1OutBk m_layermap[20211] = 9; //RB22Bw m_layermap[20221] = 9; //RB22Bw m_layermap[30211] = 10; //RB23Bw m_layermap[30221] = 10; //RB23Bw m_layermap[311] = 11; //RB3Bk m_layermap[411] = 12; //RB4Bk m_maxBxWindow = 3; std::vector<int>::iterator wheel; for( wheel = m_wheelid.begin(); wheel != m_wheelid.end(); ++wheel) m_digiCounters[(*wheel)] = new Counters( (*wheel) ); }
int RBCProcessRPCDigis::getBarrelLayer | ( | const int & | _layer, |
const int & | _station | ||
) | [private] |
Definition at line 313 of file RBCProcessRPCDigis.cc.
Referenced by next().
{ //... Calculates the generic Barrel Layer (1 to 6) int blayer(0); if ( _station < 3 ) { blayer = ( (_station-1) * 2 ) + _layer; } else { blayer = _station + 2; } return blayer; }
void RBCProcessRPCDigis::initialize | ( | std::vector< RPCData * > & | dataVec | ) |
Definition at line 237 of file RBCProcessRPCDigis.cc.
References gather_cfg::cout, RBCInput::hasData, i, RBCInput::input_sec, j, m_block, m_debug, RPCData::m_orsignals, RPCData::m_sec1, m_sec1id, RPCData::m_sec2, m_sec2id, RPCData::m_wheel, m_wheelid, and RBCInput::needmapping.
Referenced by next().
{ if ( m_debug ) std::cout << "initialize" << std::endl; int maxWheels = 5; int maxRbcBrds = 6; for(int i=0; i < maxWheels; ++i) { m_block = new RPCData(); m_block->m_wheel = m_wheelid[i]; for(int j=0; j < maxRbcBrds; ++j) { m_block->m_sec1[j] = m_sec1id[j]; m_block->m_sec2[j] = m_sec2id[j]; m_block->m_orsignals[j].input_sec[0].reset(); m_block->m_orsignals[j].input_sec[1].reset(); m_block->m_orsignals[j].needmapping = false; m_block->m_orsignals[j].hasData = false; } dataVec.push_back( m_block ); } if ( m_debug ) std::cout << "initialize: completed" << std::endl; }
int RBCProcessRPCDigis::next | ( | void | ) | [virtual] |
Implements ProcessInputSignal.
Definition at line 111 of file RBCProcessRPCDigis.cc.
References abs, builddata(), gather_cfg::cout, getBarrelLayer(), RPCRoll::id(), initialize(), RPCRoll::isForward(), RPCDetId::layer(), m_block, m_data, m_debug, m_detUnitItr, m_digiCounters, m_digiItr, m_maxBxWindow, m_vecDataperBx, print_output(), reset(), RPCDetId::ring(), RPCDetId::sector(), setDigiAt(), relativeConstraints::station, and RPCDetId::station().
{ //...clean up previous data contents reset(); int ndigis(0); for (m_detUnitItr = (*m_ptr_digiColl)->begin(); m_detUnitItr != (*m_ptr_digiColl)->end(); ++m_detUnitItr ) { if ( m_debug ) std::cout << "looping over digis 1 ..." << std::endl; m_digiItr = (*m_detUnitItr ).second.first; int bx = (*m_digiItr).bx(); if ( abs(bx) >= m_maxBxWindow ) { if ( m_debug ) std::cout << "RBCProcessRPCDigis> found a bx bigger than max allowed: " << bx << std::endl; continue; } const RPCDetId & id = (*m_detUnitItr).first; const RPCRoll * roll = dynamic_cast<const RPCRoll* >( (*m_ptr_rpcGeom)->roll(id)); if((roll->isForward())) { if( m_debug ) std::cout << "RBCProcessRPCDigis: roll is forward" << std::endl; continue; } int wheel = roll->id().ring(); // -2,-1,0,+1,+2 int sector = roll->id().sector(); // 1 to 12 int layer = roll->id().layer(); // 1,2 int station = roll->id().station(); // 1-4 int blayer = getBarrelLayer( layer, station ); // 1 to 6 int rollid = id.roll(); int digipos = (station * 100) + (layer * 10) + rollid; if ( (wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 1 ) digipos = 30000 + digipos; if ( (wheel == -2 || wheel == 2) && station == 2 && layer == 2 ) digipos = 30000 + digipos; if ( (wheel == -1 || wheel == 0 || wheel == 1) && station == 2 && layer == 2 ) digipos = 20000 + digipos; if ( (wheel == -2 || wheel == 2) && station == 2 && layer == 1 ) digipos = 20000 + digipos; if ( m_debug ) std::cout << "Bx: " << bx << '\t' << "Wheel: " << wheel << '\t' << "Sector: " << sector << '\t' << "Station: " << station << '\t' << "Layer: " << layer << '\t' << "B-Layer: " << blayer << '\t' << "Roll id: " << rollid << '\t' << "Digi at: " << digipos << '\n'; //... Construct the RBCinput objects std::map<int,std::vector<RPCData*> >::iterator itr; itr = m_vecDataperBx.find( bx ); if ( itr == m_vecDataperBx.end() ) { if ( m_debug ) std::cout << "Found a new Bx: " << bx << std::endl; std::vector<RPCData*> wheelData; initialize(wheelData); m_vecDataperBx[bx] = wheelData; this->m_block = wheelData[ (wheel + 2) ]; setDigiAt( sector, digipos ); } else{ this->m_block = (*itr).second[ (wheel + 2) ]; setDigiAt( sector, digipos ); } std::map<int, Counters* >::iterator wheelCounter; wheelCounter = m_digiCounters.find( wheel ); if ( wheelCounter != m_digiCounters.end() ) (*wheelCounter).second->incrementSector( sector ); if ( m_debug ) std::cout << "looping over digis 2 ..." << std::endl; ++ndigis; } if ( m_debug ) std::cout << "size of data vectors: " << m_vecDataperBx.size() << std::endl; builddata(); if ( m_debug ) { std::cout << "after reset" << std::endl; print_output(); } if ( m_debug ) std::cout << "RBCProcessRPCDigis: DataSize: " << m_data.size() << " ndigis " << ndigis << std::endl; std::map<int, Counters* >::iterator wheelCounter; for( wheelCounter = m_digiCounters.begin(); wheelCounter != m_digiCounters.end(); ++wheelCounter) { (*wheelCounter).second->evalCounters(); if ( m_debug ) (*wheelCounter).second->printSummary(); } if ( m_data.size() <= 0 ) return 0; return 1; }
void RBCProcessRPCDigis::print_output | ( | ) |
Definition at line 373 of file RBCProcessRPCDigis.cc.
References gather_cfg::cout, and m_data.
Referenced by next().
void RBCProcessRPCDigis::reset | ( | void | ) |
Definition at line 222 of file RBCProcessRPCDigis.cc.
References m_vecDataperBx.
Referenced by next(), and ~RBCProcessRPCDigis().
{ std::map<int,std::vector<RPCData*> >::iterator itr1; for( itr1 = m_vecDataperBx.begin(); itr1 != m_vecDataperBx.end(); ++itr1) { std::vector<RPCData*>::iterator itr2; for(itr2 = (*itr1).second.begin(); itr2 != (*itr1).second.end();++itr2 ) if ( (*itr2) ) delete *itr2; (*itr1).second.clear(); } m_vecDataperBx.clear(); }
RPCInputSignal* RBCProcessRPCDigis::retrievedata | ( | ) | [inline, virtual] |
Implements ProcessInputSignal.
Definition at line 61 of file RBCProcessRPCDigis.h.
References m_lbin.
{ return m_lbin; };
void RBCProcessRPCDigis::rewind | ( | ) | [inline] |
Definition at line 65 of file RBCProcessRPCDigis.h.
{};
void RBCProcessRPCDigis::setDigiAt | ( | int | sector, |
int | digipos | ||
) | [private] |
Definition at line 331 of file RBCProcessRPCDigis.cc.
References gather_cfg::cout, spr::find(), RBCInput::hasData, RBCInput::input_sec, m_block, m_debug, RPCData::m_orsignals, RPCData::m_sec1, m_sec1id, m_sec2id, pos, and setInputBit().
Referenced by next().
{ int pos = 0; int isAoB = 0; if ( m_debug ) std::cout << "setDigiAt" << std::endl; std::vector<int>::const_iterator itr; itr = std::find( m_sec1id.begin(), m_sec1id.end(), sector ); if ( itr == m_sec1id.end()) { itr = std::find( m_sec2id.begin(), m_sec2id.end(), sector ); isAoB = 1; } for ( pos = 0; pos < 6; ++pos ) { if (this->m_block->m_sec1[pos] == sector || this->m_block->m_sec2[pos] == sector ) break; } if ( m_debug ) std::cout << this->m_block->m_orsignals[pos]; setInputBit( this->m_block->m_orsignals[pos].input_sec[ isAoB ] , digipos ); this->m_block->m_orsignals[pos].hasData = true; if ( m_debug ) std::cout << this->m_block->m_orsignals[pos]; if ( m_debug ) std::cout << "setDigiAt completed" << std::endl; }
void RBCProcessRPCDigis::setInputBit | ( | std::bitset< 15 > & | signals, |
int | digipos | ||
) | [private] |
Definition at line 364 of file RBCProcessRPCDigis.cc.
References gather_cfg::cout, m_debug, and m_layermap.
Referenced by setDigiAt().
{ int bitpos = m_layermap[digipos]; if( m_debug ) std::cout << "Bitpos: " << bitpos << std::endl; signals.set( bitpos , 1 ); }
void RBCProcessRPCDigis::showfirst | ( | ) | [inline] |
Definition at line 66 of file RBCProcessRPCDigis.h.
{};
RPCData* RBCProcessRPCDigis::m_block [private] |
Definition at line 84 of file RBCProcessRPCDigis.h.
Referenced by initialize(), next(), and setDigiAt().
std::map<int, RBCInput*> RBCProcessRPCDigis::m_data [private] |
Definition at line 90 of file RBCProcessRPCDigis.h.
Referenced by builddata(), next(), print_output(), and RBCProcessRPCDigis().
bool RBCProcessRPCDigis::m_debug [private] |
Definition at line 94 of file RBCProcessRPCDigis.h.
Referenced by builddata(), initialize(), next(), RBCProcessRPCDigis(), setDigiAt(), and setInputBit().
Definition at line 82 of file RBCProcessRPCDigis.h.
Referenced by next().
std::map<int, Counters*> RBCProcessRPCDigis::m_digiCounters [private] |
Definition at line 101 of file RBCProcessRPCDigis.h.
Referenced by configure(), next(), and ~RBCProcessRPCDigis().
Definition at line 81 of file RBCProcessRPCDigis.h.
Referenced by next().
std::map<int, int> RBCProcessRPCDigis::m_layermap [private] |
Definition at line 88 of file RBCProcessRPCDigis.h.
Referenced by configure(), setInputBit(), and ~RBCProcessRPCDigis().
RPCInputSignal* RBCProcessRPCDigis::m_lbin [private] |
Definition at line 86 of file RBCProcessRPCDigis.h.
Referenced by RBCProcessRPCDigis(), retrievedata(), and ~RBCProcessRPCDigis().
int RBCProcessRPCDigis::m_maxBxWindow [private] |
Definition at line 95 of file RBCProcessRPCDigis.h.
Referenced by configure(), and next().
const edm::Handle<RPCDigiCollection>* RBCProcessRPCDigis::m_ptr_digiColl [private] |
Definition at line 79 of file RBCProcessRPCDigis.h.
Referenced by RBCProcessRPCDigis().
const edm::ESHandle<RPCGeometry>* RBCProcessRPCDigis::m_ptr_rpcGeom [private] |
Definition at line 78 of file RBCProcessRPCDigis.h.
Referenced by RBCProcessRPCDigis().
std::vector<int> RBCProcessRPCDigis::m_sec1id [private] |
Definition at line 98 of file RBCProcessRPCDigis.h.
Referenced by configure(), initialize(), setDigiAt(), and ~RBCProcessRPCDigis().
std::vector<int> RBCProcessRPCDigis::m_sec2id [private] |
Definition at line 99 of file RBCProcessRPCDigis.h.
Referenced by configure(), initialize(), setDigiAt(), and ~RBCProcessRPCDigis().
std::map<int, std::vector<RPCData*> > RBCProcessRPCDigis::m_vecDataperBx [private] |
Definition at line 92 of file RBCProcessRPCDigis.h.
Referenced by builddata(), next(), and reset().
std::vector<int> RBCProcessRPCDigis::m_wheelid [private] |
Definition at line 97 of file RBCProcessRPCDigis.h.
Referenced by configure(), initialize(), and ~RBCProcessRPCDigis().