CMS 3D CMS Logo

RBCInput.cc
Go to the documentation of this file.
1 // Include files
2 
3 // local
5 
6 //-----------------------------------------------------------------------------
7 // Implementation file for class : RBCInput
8 //
9 // 2008-10-10 : Andres Osorio
10 //-----------------------------------------------------------------------------
11 
12 std::istream& operator>>(std::istream& istr, RBCInput& rhs) {
13  int _ks = 0;
14 
15  for (int i = 0; i < 30; ++i) {
16  istr >> rhs.input[i];
17  if (i < 15)
18  _ks = 0;
19  else
20  _ks = 1;
21  rhs.input_sec[_ks].set(i - (15 * _ks), rhs.input[i]);
22  }
23  return istr;
24 }
25 
26 std::ostream& operator<<(std::ostream& ostr, RBCInput const& rhs) {
27  for (int i = 0; i < 15; ++i)
28  ostr << rhs.input_sec[0][i];
29  ostr << '\t';
30  for (int i = 0; i < 15; ++i)
31  ostr << rhs.input_sec[1][i];
32  ostr << '\n';
33 
34  return ostr;
35 }
36 
37 void RBCInput::mask(const std::vector<int>& maskvec) {
38  //... operate on the first sector
39 
40  for (int i = 0; i < 15; ++i)
41  if (maskvec[i])
42  input_sec[0].set(i, false);
43 
44  //... operate on the second sector
45 
46  for (int i = 15; i < 30; ++i)
47  if (maskvec[i])
48  input_sec[1].set((i - 15), false);
49 }
50 
51 void RBCInput::force(const std::vector<int>& forcevec) {
52  if (m_debug)
53  std::cout << forcevec.size() << std::endl;
54 
55  std::bitset<15> tmp;
56 
57  for (int i = 0; i < 15; ++i)
58  tmp.set(i, forcevec[i]);
59 
60  //... operate on the first sector
61  input_sec[0] |= tmp;
62  tmp.reset();
63 
64  for (int i = 15; i < 30; ++i)
65  tmp.set((i - 15), forcevec[i]);
66 
67  input_sec[1] |= tmp;
68 
69  tmp.reset();
70 }
std::array< std::bitset< 15 >, 2 > input_sec
Definition: RBCInput.h:41
void mask(const std::vector< int > &)
Definition: RBCInput.cc:37
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
std::istream & operator>>(std::istream &istr, RBCInput &rhs)
Definition: RBCInput.cc:12
std::ostream & operator<<(std::ostream &ostr, RBCInput const &rhs)
Definition: RBCInput.cc:26
void force(const std::vector< int > &)
Definition: RBCInput.cc:51
bool input[30]
Definition: RBCInput.h:40
tmp
align.sh
Definition: createJobs.py:716
bool m_debug
Definition: RBCInput.h:54