CMS 3D CMS Logo

Public Member Functions | Public Attributes | Protected Attributes

Counters Class Reference

#include <Counters.h>

Inheritance diagram for Counters:
TrackerCounters

List of all members.

Public Member Functions

 Counters ()
 Build the counters map.
 Counters ()
 Counters (int)
void evalCounters ()
virtual align::Counter get (align::StructureType) const
 Get a counter based on its structure type.
void incrementSector (int)
void printSummary ()
virtual ~Counters ()
virtual ~Counters ()

Public Attributes

int m_farSide
int m_nearSide
std::map< int, int > m_sector
int m_wheel
int m_wheelid

Protected Attributes

std::map< align::StructureType,
align::Counter
theCounters

Detailed Description

Class to store a list of counters.

A counter is a pointer to a function that returns the number of an alignable based on its id. The number of an alignable is given by its position within its parent. User gets a counter using its structure type via Counters::get(type). Each sub-system has its own concrete counter class implementation.

Date:
2007/10/18 09:41:07
Revision:
1.2
Author:
Chung Khim Lae

Definition at line 29 of file Counters.h.


Constructor & Destructor Documentation

Counters::Counters ( ) [inline]

Build the counters map.

Definition at line 34 of file Counters.h.

{}
Counters::~Counters ( ) [inline, virtual]

Definition at line 36 of file Counters.h.

{}
Counters::Counters ( ) [inline]

Definition at line 27 of file RPCData.h.

{};
Counters::Counters ( int  wheel)

Definition at line 19 of file RPCData.cc.

References gen::k, m_farSide, m_nearSide, m_sector, m_wheel, and m_wheelid.

{
  m_wheelid = wheel;
  int maxsectors=12;
  
  for(int k=1; k <= maxsectors; ++k)
    m_sector[k] = 0;
  m_nearSide = 0;
  m_farSide = 0;
  m_wheel=0;
  
}
virtual Counters::~Counters ( ) [virtual]

Member Function Documentation

void Counters::evalCounters ( )

Definition at line 37 of file RPCData.cc.

References m_farSide, m_nearSide, m_sector, and m_wheel.

{
  
  std::map<int,int>::iterator itr;
  for(itr = m_sector.begin(); itr != m_sector.end(); ++itr)
    m_wheel += (*itr).second;
  
  std::vector<int> far;
  std::vector<int> near;
  
  far.push_back(3);
  far.push_back(4);
  far.push_back(5);
  far.push_back(6);
  far.push_back(7);
  far.push_back(8);
  
  near.push_back(1);
  near.push_back(2);
  near.push_back(12);
  near.push_back(11);
  near.push_back(10);
  near.push_back(9);
  
  std::vector<int>::iterator sec;
  for( sec = far.begin(); sec != far.end(); ++sec) {
    std::map<int, int>::iterator sector;
    sector = m_sector.find( (*sec) );
    m_farSide  += (*sector).second;
  }
  
  for( sec = near.begin(); sec != near.end(); ++sec) {
    std::map<int, int>::iterator sector;
    sector = m_sector.find( (*sec) );
    m_nearSide += (*sector).second;
  }
  

}
Counter Counters::get ( align::StructureType  type) const [virtual]

Get a counter based on its structure type.

Definition at line 8 of file Counters.cc.

References Exception, n, and AlignableObjectId::typeToName().

Referenced by AlignableBuilder::index().

{
  std::map<StructureType, Counter>::const_iterator n = theCounters.find(type);

  if (theCounters.end() == n)
    {
      throw cms::Exception("SetupError")
        << "Cannot find counter corresponding to the structure "
        << AlignableObjectId().typeToName(type);
    }

  return n->second;
}
void Counters::incrementSector ( int  sector)

Definition at line 91 of file RPCData.cc.

References m_sector.

{
  m_sector[ sector ] += 1;
}
void Counters::printSummary ( )

Definition at line 77 of file RPCData.cc.

References gather_cfg::cout, m_farSide, m_nearSide, m_sector, m_wheel, and m_wheelid.

{

  std::cout << m_wheelid << std::endl;
  std::map<int,int>::iterator itr;
  for(itr = m_sector.begin(); itr != m_sector.end(); ++itr)
    std::cout << (*itr).first << ": " << (*itr).second << '\t';
  std::cout << '\n';
  
  std::cout << "total wheel: " 
            << m_wheel << " " << m_farSide << " " << m_nearSide << '\n';
    
}

Member Data Documentation

Definition at line 40 of file RPCData.h.

Referenced by Counters(), evalCounters(), and printSummary().

Definition at line 39 of file RPCData.h.

Referenced by Counters(), evalCounters(), and printSummary().

std::map<int,int> Counters::m_sector

Definition at line 42 of file RPCData.h.

Referenced by Counters(), evalCounters(), incrementSector(), and printSummary().

Definition at line 41 of file RPCData.h.

Referenced by Counters(), evalCounters(), and printSummary().

Definition at line 38 of file RPCData.h.

Referenced by Counters(), and printSummary().

Definition at line 42 of file Counters.h.