CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPCData.cc
Go to the documentation of this file.
1 // Include files
2 
3 // local
5 
6 //-----------------------------------------------------------------------------
7 // Implementation file for class : RPCData
8 //
9 // 2008-11-18 : Andres Osorio
10 //-----------------------------------------------------------------------------
11 
12 //=============================================================================
13 // Standard constructor, initializes variables
14 //=============================================================================
15 
16 namespace l1trigger {
17 
18  Counters::Counters(int wheel) {
19  m_wheelid = wheel;
20  int maxsectors = 12;
21 
22  for (int k = 1; k <= maxsectors; ++k)
23  m_sector[k] = 0;
24  m_nearSide = 0;
25  m_farSide = 0;
26  m_wheel = 0;
27  }
28 
30  std::map<int, int>::iterator itr;
31  for (itr = m_sector.begin(); itr != m_sector.end(); ++itr)
32  m_wheel += (*itr).second;
33 
34  std::vector<int> far;
35  std::vector<int> near;
36 
37  far.push_back(3);
38  far.push_back(4);
39  far.push_back(5);
40  far.push_back(6);
41  far.push_back(7);
42  far.push_back(8);
43 
44  near.push_back(1);
45  near.push_back(2);
46  near.push_back(12);
47  near.push_back(11);
48  near.push_back(10);
49  near.push_back(9);
50 
51  std::vector<int>::iterator sec;
52  for (sec = far.begin(); sec != far.end(); ++sec) {
53  std::map<int, int>::iterator sector;
54  sector = m_sector.find((*sec));
55  m_farSide += (*sector).second;
56  }
57 
58  for (sec = near.begin(); sec != near.end(); ++sec) {
59  std::map<int, int>::iterator sector;
60  sector = m_sector.find((*sec));
61  m_nearSide += (*sector).second;
62  }
63  }
64 
65  void Counters::printSummary() const {
66  std::cout << m_wheelid << std::endl;
67  std::map<int, int>::iterator itr;
68  for (auto const& s : m_sector)
69  std::cout << s.first << ": " << s.second << '\t';
70  std::cout << '\n';
71 
72  std::cout << "total wheel: " << m_wheel << " " << m_farSide << " " << m_nearSide << '\n';
73  }
74 
75  void Counters::incrementSector(int sector) { m_sector[sector] += 1; }
76 } // namespace l1trigger
77 
79 
80 //=============================================================================
81 
82 std::istream& operator>>(std::istream& istr, RPCData& rhs) {
83  (istr) >> rhs.m_wheel;
84  for (int k = 0; k < 6; ++k) {
85  (istr) >> rhs.m_sec1[k] >> rhs.m_sec2[k];
86  (istr) >> rhs.m_orsignals[k];
87  }
88 
89  return istr;
90 }
91 
92 std::ostream& operator<<(std::ostream& ostr, RPCData const& rhs) {
93  ostr << rhs.m_wheel << '\t';
94  for (int k = 0; k < 6; ++k) {
95  ostr << rhs.m_sec1[k] << '\t' << rhs.m_sec2[k] << '\n';
96  ostr << rhs.m_orsignals[k];
97  }
98 
99  return ostr;
100 }
RPCData()
Standard constructor.
Definition: RPCData.cc:78
std::array< int, 6 > m_sec1
Definition: RPCData.h:49
void printSummary() const
Definition: RPCData.cc:65
std::map< int, int > m_sector
Definition: RPCData.h:38
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
void evalCounters()
Definition: RPCData.cc:29
int m_wheel
Definition: RPCData.h:48
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
void incrementSector(int)
Definition: RPCData.cc:75
std::istream & operator>>(std::istream &input, CLHEP::HepGenMatrix &matrix)
Definition: matrixSaver.cc:80
std::array< RBCInput, 6 > m_orsignals
Definition: RPCData.h:51
tuple cout
Definition: gather_cfg.py:144
std::array< int, 6 > m_sec2
Definition: RPCData.h:50