CMS 3D CMS Logo

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