CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Protected Attributes
Counters Class Reference

#include <Counters.h>

Inheritance diagram for Counters:
TrackerCounters

Public Member Functions

 Counters ()
 
 Counters (int)
 
 Counters ()
 Build the counters map. More...
 
void evalCounters ()
 
virtual align::Counter get (align::StructureType) const
 Get a counter based on its structure type. More...
 
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.

34 {}
Counters::~Counters ( )
inlinevirtual

Definition at line 36 of file Counters.h.

36 {}
Counters::Counters ( )
inline

Definition at line 27 of file RPCData.h.

27 {};
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.

20 {
21  m_wheelid = wheel;
22  int maxsectors=12;
23 
24  for(int k=1; k <= maxsectors; ++k)
25  m_sector[k] = 0;
26  m_nearSide = 0;
27  m_farSide = 0;
28  m_wheel=0;
29 
30 }
int m_farSide
Definition: RPCData.h:40
int m_wheelid
Definition: RPCData.h:38
std::map< int, int > m_sector
Definition: RPCData.h:42
int m_wheel
Definition: RPCData.h:41
int k[5][pyjets_maxn]
int m_nearSide
Definition: RPCData.h:39
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.

38 {
39 
40  std::map<int,int>::iterator itr;
41  for(itr = m_sector.begin(); itr != m_sector.end(); ++itr)
42  m_wheel += (*itr).second;
43 
44  std::vector<int> far;
45  std::vector<int> near;
46 
47  far.push_back(3);
48  far.push_back(4);
49  far.push_back(5);
50  far.push_back(6);
51  far.push_back(7);
52  far.push_back(8);
53 
54  near.push_back(1);
55  near.push_back(2);
56  near.push_back(12);
57  near.push_back(11);
58  near.push_back(10);
59  near.push_back(9);
60 
61  std::vector<int>::iterator sec;
62  for( sec = far.begin(); sec != far.end(); ++sec) {
63  std::map<int, int>::iterator sector;
64  sector = m_sector.find( (*sec) );
65  m_farSide += (*sector).second;
66  }
67 
68  for( sec = near.begin(); sec != near.end(); ++sec) {
69  std::map<int, int>::iterator sector;
70  sector = m_sector.find( (*sec) );
71  m_nearSide += (*sector).second;
72  }
73 
74 
75 }
int m_farSide
Definition: RPCData.h:40
std::map< int, int > m_sector
Definition: RPCData.h:42
int m_wheel
Definition: RPCData.h:41
int m_nearSide
Definition: RPCData.h:39
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 edm::hlt::Exception, n, and AlignableObjectId::typeToName().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), and AlignableBuilder::index().

9 {
10  std::map<StructureType, Counter>::const_iterator n = theCounters.find(type);
11 
12  if (theCounters.end() == n)
13  {
14  throw cms::Exception("SetupError")
15  << "Cannot find counter corresponding to the structure "
17  }
18 
19  return n->second;
20 }
type
Definition: HCALResponse.h:22
const std::string & typeToName(align::StructureType type) const
Convert type to name.
std::map< align::StructureType, align::Counter > theCounters
Definition: Counters.h:42
Allows conversion between type and name, and vice-versa.
void Counters::incrementSector ( int  sector)

Definition at line 91 of file RPCData.cc.

References m_sector.

92 {
93  m_sector[ sector ] += 1;
94 }
std::map< int, int > m_sector
Definition: RPCData.h:42
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.

78 {
79 
80  std::cout << m_wheelid << std::endl;
81  std::map<int,int>::iterator itr;
82  for(itr = m_sector.begin(); itr != m_sector.end(); ++itr)
83  std::cout << (*itr).first << ": " << (*itr).second << '\t';
84  std::cout << '\n';
85 
86  std::cout << "total wheel: "
87  << m_wheel << " " << m_farSide << " " << m_nearSide << '\n';
88 
89 }
int m_farSide
Definition: RPCData.h:40
int m_wheelid
Definition: RPCData.h:38
std::map< int, int > m_sector
Definition: RPCData.h:42
int m_wheel
Definition: RPCData.h:41
int m_nearSide
Definition: RPCData.h:39
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

int Counters::m_farSide

Definition at line 40 of file RPCData.h.

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

int Counters::m_nearSide

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().

int Counters::m_wheel

Definition at line 41 of file RPCData.h.

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

int Counters::m_wheelid

Definition at line 38 of file RPCData.h.

Referenced by Counters(), and printSummary().

std::map<align::StructureType, align::Counter> Counters::theCounters
protected

Definition at line 42 of file Counters.h.