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

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

Definition at line 12 of file SensitiveDetectorCatalog.h.

Member Function Documentation

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

Definition at line 43 of file SensitiveDetectorCatalog.cc.

References groupFilesInBlocks::temp, and theClassNameMap.

Referenced by AttachSD::create().

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

Definition at line 54 of file SensitiveDetectorCatalog.cc.

References groupFilesInBlocks::temp, and theClassNameMap.

Referenced by insert(), and printMe().

54  {
55  std::vector<std::string_view> temp;
56  for (auto const &it : theClassNameMap)
57  temp.emplace_back(it.first);
58  return temp;
59 }
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.

Referenced by cms::DDG4Builder::BuildGeometry(), and DDG4SensitiveConverter::upDate().

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 }
std::vector< std::string_view > readoutNames() const
std::vector< std::string_view > classNames() const
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 printMe(), and SensitiveDetector::SensitiveDetector().

31  {
32  return std::vector<std::string_view>(theROUNameMap.at(readoutName).begin(), theROUNameMap.at(readoutName).end());
33 }
std::vector< std::string_view > SensitiveDetectorCatalog::logicalNamesFromClassName ( const std::string &  className) const
private

Definition at line 35 of file SensitiveDetectorCatalog.cc.

References 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  for (auto const &it : rous)
39  temp.emplace_back(it);
40  return temp;
41 }
std::string_view className(const std::string &readoutName) const
void SensitiveDetectorCatalog::printMe ( ) const

Definition at line 61 of file SensitiveDetectorCatalog.cc.

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

Referenced by DDDWorld::DDDWorld().

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

Definition at line 27 of file SensitiveDetectorCatalog.cc.

References theClassNameMap.

Referenced by AttachSD::create().

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
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

MapType SensitiveDetectorCatalog::theClassNameMap
private
MapType SensitiveDetectorCatalog::theROUNameMap
private

Definition at line 25 of file SensitiveDetectorCatalog.h.

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