CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SensitiveDetectorCatalog.cc
Go to the documentation of this file.
3 
4 #define DEBUG
5 
6 #include <iostream>
7 
8 void SensitiveDetectorCatalog::insert(std::string& cN, std::string& rN,
9  std::string& lvN) {
10  theClassNameMap[cN].push_back(rN);
11  theROUNameMap[rN].push_back(lvN);
12 #ifdef DEBUG
13  LogDebug("SimG4CoreGeometry") << "SenstiveDetectorCatalog: insert (" << cN
14  << "," << rN << "," << lvN << ")\n"
15  << " has "
16  << readoutNames().size() << " ROUs "
17  << readoutNames().front() << "\n"
18  << " has "
19  << classNames().size() << " classes "
20  << classNames().front();
21 #endif
22 }
23 
24 std::vector<std::string> SensitiveDetectorCatalog::readoutNames() {
25  std::vector<std::string> temp;
26  for (MapType::const_iterator it = theROUNameMap.begin();
27  it != theROUNameMap.end(); it++)
28  temp.push_back(it->first);
29  return temp;
30 }
31 
32 std::vector<std::string> SensitiveDetectorCatalog::readoutNames(std::string & className) {
33  return theClassNameMap[className];
34 }
35 
36 std::vector<std::string> SensitiveDetectorCatalog::logicalNames(std::string & readoutName) {
37  return theROUNameMap[readoutName];
38 }
39 
40 std::vector<std::string> SensitiveDetectorCatalog::logicalNamesFromClassName(std::string & className) {
41  std::vector<std::string> temp;
42  std::vector<std::string> rous = theClassNameMap[className];
43  for (std::vector<std::string>::const_iterator it = rous.begin();
44  it!= rous.end(); it++)
45  temp.push_back(*it);
46  return temp;
47 }
48 
49 std::string SensitiveDetectorCatalog::className(std::string & readoutName) {
50  for (MapType::const_iterator it = theClassNameMap.begin();
51  it != theClassNameMap.end(); it++) {
52  std::vector<std::string> temp = (*it).second;
53  for (std::vector<std::string>::const_iterator it2 = temp.begin();
54  it2!=temp.end(); it2++) {
55  if (*it2 == readoutName ) return (*it).first;
56  }
57  }
58  return "NotFound";
59 }
60 
61 std::vector<std::string> SensitiveDetectorCatalog::classNames() {
62  std::vector<std::string> temp;
63  for (MapType::const_iterator it = theClassNameMap.begin();
64  it != theClassNameMap.end(); it++)
65  temp.push_back(it->first);
66  return temp;
67 }
#define LogDebug(id)
void insert(std::string &, std::string &, std::string &)
std::vector< std::string > readoutNames()
std::vector< std::string > logicalNames(std::string &readoutName)
std::vector< std::string > logicalNamesFromClassName(std::string &className)
std::vector< std::string > classNames()
std::string className(std::string &readoutName)
std::string className(const T &t)
Definition: ClassName.h:30