Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:34

0001 // Include files
0002 
0003 // local
0004 #include "L1Trigger/RPCTechnicalTrigger/interface/RBCInput.h"
0005 
0006 //-----------------------------------------------------------------------------
0007 // Implementation file for class : RBCInput
0008 //
0009 // 2008-10-10 : Andres Osorio
0010 //-----------------------------------------------------------------------------
0011 
0012 std::istream& operator>>(std::istream& istr, RBCInput& rhs) {
0013   int _ks = 0;
0014 
0015   for (int i = 0; i < 30; ++i) {
0016     istr >> rhs.input[i];
0017     if (i < 15)
0018       _ks = 0;
0019     else
0020       _ks = 1;
0021     rhs.input_sec[_ks].set(i - (15 * _ks), rhs.input[i]);
0022   }
0023   return istr;
0024 }
0025 
0026 std::ostream& operator<<(std::ostream& ostr, RBCInput const& rhs) {
0027   for (int i = 0; i < 15; ++i)
0028     ostr << rhs.input_sec[0][i];
0029   ostr << '\t';
0030   for (int i = 0; i < 15; ++i)
0031     ostr << rhs.input_sec[1][i];
0032   ostr << '\n';
0033 
0034   return ostr;
0035 }
0036 
0037 void RBCInput::mask(const std::vector<int>& maskvec) {
0038   //... operate on the first sector
0039 
0040   for (int i = 0; i < 15; ++i)
0041     if (maskvec[i])
0042       input_sec[0].set(i, false);
0043 
0044   //... operate on the second sector
0045 
0046   for (int i = 15; i < 30; ++i)
0047     if (maskvec[i])
0048       input_sec[1].set((i - 15), false);
0049 }
0050 
0051 void RBCInput::force(const std::vector<int>& forcevec) {
0052   if (m_debug)
0053     std::cout << forcevec.size() << std::endl;
0054 
0055   std::bitset<15> tmp;
0056 
0057   for (int i = 0; i < 15; ++i)
0058     tmp.set(i, forcevec[i]);
0059 
0060   //... operate on the first sector
0061   input_sec[0] |= tmp;
0062   tmp.reset();
0063 
0064   for (int i = 15; i < 30; ++i)
0065     tmp.set((i - 15), forcevec[i]);
0066 
0067   input_sec[1] |= tmp;
0068 
0069   tmp.reset();
0070 }