Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:39

0001 // Include files
0002 
0003 // local
0004 #include "L1Trigger/RPCTechnicalTrigger/interface/RPCData.h"
0005 
0006 //-----------------------------------------------------------------------------
0007 // Implementation file for class : RPCData
0008 //
0009 // 2008-11-18 : Andres Osorio
0010 //-----------------------------------------------------------------------------
0011 
0012 //=============================================================================
0013 // Standard constructor, initializes variables
0014 //=============================================================================
0015 
0016 namespace l1trigger {
0017 
0018   Counters::Counters(int wheel) {
0019     m_wheelid = wheel;
0020     int maxsectors = 12;
0021 
0022     for (int k = 1; k <= maxsectors; ++k)
0023       m_sector[k] = 0;
0024     m_nearSide = 0;
0025     m_farSide = 0;
0026     m_wheel = 0;
0027   }
0028 
0029   void Counters::evalCounters() {
0030     std::map<int, int>::iterator itr;
0031     for (itr = m_sector.begin(); itr != m_sector.end(); ++itr)
0032       m_wheel += (*itr).second;
0033 
0034     std::vector<int> far;
0035     std::vector<int> near;
0036 
0037     far.push_back(3);
0038     far.push_back(4);
0039     far.push_back(5);
0040     far.push_back(6);
0041     far.push_back(7);
0042     far.push_back(8);
0043 
0044     near.push_back(1);
0045     near.push_back(2);
0046     near.push_back(12);
0047     near.push_back(11);
0048     near.push_back(10);
0049     near.push_back(9);
0050 
0051     std::vector<int>::iterator sec;
0052     for (sec = far.begin(); sec != far.end(); ++sec) {
0053       std::map<int, int>::iterator sector;
0054       sector = m_sector.find((*sec));
0055       m_farSide += (*sector).second;
0056     }
0057 
0058     for (sec = near.begin(); sec != near.end(); ++sec) {
0059       std::map<int, int>::iterator sector;
0060       sector = m_sector.find((*sec));
0061       m_nearSide += (*sector).second;
0062     }
0063   }
0064 
0065   void Counters::printSummary() const {
0066     std::cout << m_wheelid << std::endl;
0067     std::map<int, int>::iterator itr;
0068     for (auto const& s : m_sector)
0069       std::cout << s.first << ": " << s.second << '\t';
0070     std::cout << '\n';
0071 
0072     std::cout << "total wheel: " << m_wheel << " " << m_farSide << " " << m_nearSide << '\n';
0073   }
0074 
0075   void Counters::incrementSector(int sector) { m_sector[sector] += 1; }
0076 }  // namespace l1trigger
0077 
0078 RPCData::RPCData() { m_wheel = 10; }
0079 
0080 //=============================================================================
0081 
0082 std::istream& operator>>(std::istream& istr, RPCData& rhs) {
0083   (istr) >> rhs.m_wheel;
0084   for (int k = 0; k < 6; ++k) {
0085     (istr) >> rhs.m_sec1[k] >> rhs.m_sec2[k];
0086     (istr) >> rhs.m_orsignals[k];
0087   }
0088 
0089   return istr;
0090 }
0091 
0092 std::ostream& operator<<(std::ostream& ostr, RPCData const& rhs) {
0093   ostr << rhs.m_wheel << '\t';
0094   for (int k = 0; k < 6; ++k) {
0095     ostr << rhs.m_sec1[k] << '\t' << rhs.m_sec2[k] << '\n';
0096     ostr << rhs.m_orsignals[k];
0097   }
0098 
0099   return ostr;
0100 }