CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SensitiveDetectorCatalog Class Reference

#include <SensitiveDetectorCatalog.h>

Public Types

using MapType = std::map< std::string, std::unordered_set< std::string > >
 

Public Member Functions

std::string_view className (const std::string &readoutName) const
 
void insert (const std::string &, const std::string &, const std::string &)
 
const std::vector< std::string_view > logicalNames (const std::string &readoutName) const
 
void printMe () const
 
const std::vector< std::string_view > readoutNames (const std::string &className) const
 
std::vector< std::string_view > readoutNames () const
 

Private Member Functions

std::vector< std::string_view > classNames () const
 
std::vector< std::string_view > logicalNamesFromClassName (const std::string &className) const
 

Private Attributes

MapType theClassNameMap
 
MapType theROUNameMap
 

Detailed Description

Definition at line 10 of file SensitiveDetectorCatalog.h.

Member Typedef Documentation

◆ MapType

using SensitiveDetectorCatalog::MapType = std::map<std::string, std::unordered_set<std::string> >

Definition at line 12 of file SensitiveDetectorCatalog.h.

Member Function Documentation

◆ className()

std::string_view SensitiveDetectorCatalog::className ( const std::string &  readoutName) const

Definition at line 44 of file SensitiveDetectorCatalog.cc.

References groupFilesInBlocks::temp, and theClassNameMap.

Referenced by logicalNamesFromClassName(), and readoutNames().

44  {
45  for (auto const &it : theClassNameMap) {
46  std::vector<std::string_view> temp(it.second.begin(), it.second.end());
47  for (auto const &it2 : temp) {
48  if (it2 == readoutName)
49  return it.first;
50  }
51  }
52  return "NotFound";
53 }

◆ classNames()

std::vector< std::string_view > SensitiveDetectorCatalog::classNames ( ) const
private

Definition at line 55 of file SensitiveDetectorCatalog.cc.

References groupFilesInBlocks::temp, and theClassNameMap.

Referenced by insert(), and printMe().

55  {
56  std::vector<std::string_view> temp;
57  for (auto const &it : theClassNameMap)
58  temp.emplace_back(it.first);
59  return temp;
60 }

◆ insert()

void SensitiveDetectorCatalog::insert ( const std::string &  cN,
const std::string &  rN,
const std::string &  lvN 
)

Definition at line 8 of file SensitiveDetectorCatalog.cc.

References classNames(), readoutNames(), theClassNameMap, and theROUNameMap.

8  {
9  theClassNameMap[cN].insert(rN);
10  theROUNameMap[rN].insert(lvN);
11 #ifdef DEBUG
12  edm::LogVerbatim("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 }
Log< level::Info, true > LogVerbatim
std::vector< std::string_view > readoutNames() const
std::vector< std::string_view > classNames() const

◆ logicalNames()

const std::vector< std::string_view > SensitiveDetectorCatalog::logicalNames ( const std::string &  readoutName) const

Definition at line 31 of file SensitiveDetectorCatalog.cc.

References theROUNameMap.

Referenced by ECalSD::ECalSD(), HCalSD::HCalSD(), printMe(), and SensitiveDetector::SensitiveDetector().

31  {
32  return std::vector<std::string_view>(theROUNameMap.at(readoutName).begin(), theROUNameMap.at(readoutName).end());
33 }

◆ logicalNamesFromClassName()

std::vector< std::string_view > SensitiveDetectorCatalog::logicalNamesFromClassName ( const std::string &  className) const
private

Definition at line 35 of file SensitiveDetectorCatalog.cc.

References className(), groupFilesInBlocks::temp, and theClassNameMap.

35  {
36  std::vector<std::string_view> temp;
37  const std::vector<std::string_view> rous(theClassNameMap.at(className).begin(), theClassNameMap.at(className).end());
38  temp.reserve(rous.size());
39  for (auto const &it : rous)
40  temp.emplace_back(it);
41  return temp;
42 }
std::string_view className(const std::string &readoutName) const

◆ printMe()

void SensitiveDetectorCatalog::printMe ( ) const

Definition at line 62 of file SensitiveDetectorCatalog.cc.

References HltBtagPostValidation_cff::c, classNames(), mps_fire::i, MainPageGenerator::l, dqm-mbProfile::log, logicalNames(), alignCSCRings::r, readoutNames(), theClassNameMap, and theROUNameMap.

62  {
63  edm::LogVerbatim("SimG4CoreGeometry") << "Class names map size is: " << theClassNameMap.size() << "\n";
64  edm::LogVerbatim("SimG4CoreGeometry").log([&](auto &log) {
65  int i(0);
66  for (const auto &cn : theClassNameMap) {
67  log << "#" << ++i << ": " << cn.first << " has " << cn.second.size() << " class names:\n";
68  for (const auto &cnv : cn.second)
69  log << cnv << ", ";
70  log << "\n";
71  }
72  log << "\n";
73  });
74  edm::LogVerbatim("SimG4CoreGeometry") << "\nROU names map: " << theROUNameMap.size() << "\n";
75  edm::LogVerbatim("SimG4CoreGeometry").log([&](auto &log) {
76  int i(0);
77  for (const auto &rn : theROUNameMap) {
78  log << "#" << ++i << ": " << rn.first << " has " << rn.second.size() << " ROU names:\n";
79  for (const auto &rnv : rn.second)
80  log << rnv << ", ";
81  log << "\n";
82  }
83  log << "\n";
84  });
85 
86  edm::LogVerbatim("SimG4CoreGeometry") << "\n========== Here are the accessors =================\n";
87  edm::LogVerbatim("SimG4CoreGeometry").log([&](auto &log) {
88  for (auto c : classNames()) {
89  log << "ClassName:" << c << "\n";
90  for (auto r : readoutNames({c.data(), c.size()})) {
91  log << " RedoutName:" << r << "\n";
92  for (auto l : logicalNames({r.data(), r.size()})) {
93  log << " LogicalName:" << l << "\n";
94  }
95  }
96  }
97  });
98 }
Log< level::Info, true > LogVerbatim
std::vector< std::string_view > readoutNames() const
const std::vector< std::string_view > logicalNames(const std::string &readoutName) const
std::vector< std::string_view > classNames() const

◆ readoutNames() [1/2]

const std::vector< std::string_view > SensitiveDetectorCatalog::readoutNames ( const std::string &  className) const

Definition at line 27 of file SensitiveDetectorCatalog.cc.

References className(), and theClassNameMap.

27  {
28  return std::vector<std::string_view>(theClassNameMap.at(className).begin(), theClassNameMap.at(className).end());
29 }
std::string_view className(const std::string &readoutName) const

◆ readoutNames() [2/2]

std::vector< std::string_view > SensitiveDetectorCatalog::readoutNames ( ) const

Definition at line 20 of file SensitiveDetectorCatalog.cc.

References groupFilesInBlocks::temp, and theROUNameMap.

Referenced by insert(), and printMe().

20  {
21  std::vector<std::string_view> temp;
22  for (auto const &it : theROUNameMap)
23  temp.emplace_back(it.first);
24  return temp;
25 }

Member Data Documentation

◆ theClassNameMap

MapType SensitiveDetectorCatalog::theClassNameMap
private

◆ theROUNameMap

MapType SensitiveDetectorCatalog::theROUNameMap
private

Definition at line 25 of file SensitiveDetectorCatalog.h.

Referenced by insert(), logicalNames(), printMe(), and readoutNames().