CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/L1Trigger/RPCTechnicalTrigger/src/RBCInput.cc

Go to the documentation of this file.
00001 // $Id: RBCInput.cc,v 1.3 2009/05/10 00:33:18 aosorio Exp $
00002 // Include files 
00003 
00004 // local
00005 #include "L1Trigger/RPCTechnicalTrigger/interface/RBCInput.h"
00006 
00007 //-----------------------------------------------------------------------------
00008 // Implementation file for class : RBCInput
00009 //
00010 // 2008-10-10 : Andres Osorio
00011 //-----------------------------------------------------------------------------
00012 
00013 std::istream& operator>>(std::istream &istr , RBCInput & rhs) {
00014   
00015   int _ks=0;
00016   
00017   for(int i=0 ; i < 30; ++i) { 
00018     istr >> rhs.input[i];
00019     if ( i < 15 ) _ks = 0;
00020     else _ks = 1;
00021     rhs.input_sec[_ks].set(i-(15*_ks), rhs.input[i]);
00022   }
00023   return istr;
00024 
00025 }
00026 
00027 std::ostream& operator<<(std::ostream &ostr , RBCInput & rhs) {
00028   
00029   for(int i=0; i < 15; ++i) ostr << rhs.input_sec[0][i];
00030   ostr << '\t';
00031   for(int i=0; i < 15; ++i) ostr << rhs.input_sec[1][i];
00032   ostr << '\n';
00033   
00034   return ostr;
00035   
00036 }
00037 
00038 void RBCInput::mask( const std::vector<int> & maskvec )
00039 {
00040   
00041   //... operate on the first sector
00042 
00043   for(int i=0; i < 15; ++i) 
00044     if ( maskvec[i] ) input_sec[0].set(i,0);
00045   
00046   //... operate on the second sector
00047   
00048   for(int i=15; i < 30; ++i)
00049     if ( maskvec[i] ) input_sec[1].set( (i-15),0);
00050   
00051 }
00052 
00053 void RBCInput::force( const std::vector<int> & forcevec )
00054 {
00055   
00056   if( m_debug ) std::cout << forcevec.size() << std::endl;
00057 
00058   std::bitset<15> tmp;
00059   
00060   for(int i=0; i < 15; ++i)
00061     tmp.set(i,forcevec[i]);
00062   
00063   //... operate on the first sector
00064   input_sec[0]|=tmp;
00065   tmp.reset();
00066   
00067   for(int i=15; i < 30; ++i)
00068     tmp.set( (i-15),forcevec[i]);
00069   
00070   input_sec[1]|=tmp;
00071   
00072   tmp.reset();
00073   
00074 }
00075