CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/L1Trigger/RPCTechnicalTrigger/src/RPCData.cc

Go to the documentation of this file.
00001 // $Id: RPCData.cc,v 1.3 2009/10/26 12:52:15 aosorio Exp $
00002 // Include files 
00003 
00004 
00005 
00006 // local
00007 #include "L1Trigger/RPCTechnicalTrigger/interface/RPCData.h"
00008 
00009 //-----------------------------------------------------------------------------
00010 // Implementation file for class : RPCData
00011 //
00012 // 2008-11-18 : Andres Osorio
00013 //-----------------------------------------------------------------------------
00014 
00015 //=============================================================================
00016 // Standard constructor, initializes variables
00017 //=============================================================================
00018 
00019 Counters::Counters(int wheel)
00020 {
00021   m_wheelid = wheel;
00022   int maxsectors=12;
00023   
00024   for(int k=1; k <= maxsectors; ++k)
00025     m_sector[k] = 0;
00026   m_nearSide = 0;
00027   m_farSide = 0;
00028   m_wheel=0;
00029   
00030 }
00031 
00032 Counters::~Counters()
00033 {
00034   m_sector.clear();
00035 }
00036 
00037 void Counters::evalCounters()
00038 {
00039   
00040   std::map<int,int>::iterator itr;
00041   for(itr = m_sector.begin(); itr != m_sector.end(); ++itr)
00042     m_wheel += (*itr).second;
00043   
00044   std::vector<int> far;
00045   std::vector<int> near;
00046   
00047   far.push_back(3);
00048   far.push_back(4);
00049   far.push_back(5);
00050   far.push_back(6);
00051   far.push_back(7);
00052   far.push_back(8);
00053   
00054   near.push_back(1);
00055   near.push_back(2);
00056   near.push_back(12);
00057   near.push_back(11);
00058   near.push_back(10);
00059   near.push_back(9);
00060   
00061   std::vector<int>::iterator sec;
00062   for( sec = far.begin(); sec != far.end(); ++sec) {
00063     std::map<int, int>::iterator sector;
00064     sector = m_sector.find( (*sec) );
00065     m_farSide  += (*sector).second;
00066   }
00067   
00068   for( sec = near.begin(); sec != near.end(); ++sec) {
00069     std::map<int, int>::iterator sector;
00070     sector = m_sector.find( (*sec) );
00071     m_nearSide += (*sector).second;
00072   }
00073   
00074 
00075 }
00076 
00077 void Counters::printSummary()
00078 {
00079 
00080   std::cout << m_wheelid << std::endl;
00081   std::map<int,int>::iterator itr;
00082   for(itr = m_sector.begin(); itr != m_sector.end(); ++itr)
00083     std::cout << (*itr).first << ": " << (*itr).second << '\t';
00084   std::cout << '\n';
00085   
00086   std::cout << "total wheel: " 
00087             << m_wheel << " " << m_farSide << " " << m_nearSide << '\n';
00088     
00089 }
00090 
00091 void Counters::incrementSector( int sector )
00092 {
00093   m_sector[ sector ] += 1;
00094 }
00095 
00096 RPCData::RPCData() {
00097   
00098   m_wheel     = 10;
00099   m_sec1      = new int[6];
00100   m_sec2      = new int[6];
00101   m_orsignals = new RBCInput[6];
00102 
00103 }
00104 //=============================================================================
00105 // Destructor
00106 //=============================================================================
00107 RPCData::~RPCData() {
00108   
00109   delete [] m_sec1;
00110   delete [] m_sec2;
00111   delete [] m_orsignals;
00112   
00113 } 
00114 
00115 //=============================================================================
00116 
00117 std::istream& operator>>(std::istream &istr , RPCData & rhs) 
00118 {
00119   
00120   (istr) >> rhs.m_wheel;
00121   for(int k=0; k < 6; ++k)
00122   {
00123     (istr) >> rhs.m_sec1[k] >> rhs.m_sec2[k];
00124     (istr) >> rhs.m_orsignals[k];
00125   }
00126 
00127   return istr;
00128     
00129 }
00130 
00131 std::ostream& operator<<(std::ostream& ostr , RPCData & rhs) 
00132 {
00133   
00134   ostr << rhs.m_wheel << '\t';
00135   for(int k=0; k < 6; ++k)
00136   {
00137     ostr << rhs.m_sec1[k] << '\t' <<  rhs.m_sec2[k] << '\n';
00138     ostr << rhs.m_orsignals[k];
00139   }
00140   
00141   return ostr;
00142   
00143 }
00144 
00145