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 42 of file SensitiveDetectorCatalog.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, groupFilesInBlocks::temp, and theClassNameMap.

Referenced by logicalNamesFromClassName(), and readoutNames().

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

◆ classNames()

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

Definition at line 53 of file SensitiveDetectorCatalog.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, groupFilesInBlocks::temp, and theClassNameMap.

Referenced by insert(), and printMe().

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

◆ insert()

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

Definition at line 6 of file SensitiveDetectorCatalog.cc.

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

6  {
7  theClassNameMap[cN].insert(rN);
8  theROUNameMap[rN].insert(lvN);
9 #ifdef EDM_ML_DEBUG
10  edm::LogVerbatim("SensitiveDetector") << "SenstiveDetectorCatalog: insert (" << cN << "," << rN << "," << lvN << ")\n"
11  << " has " << readoutNames().size() << " ROUs "
12  << readoutNames().front() << "\n"
13  << " has " << classNames().size() << " classes "
14  << classNames().front();
15 #endif
16 }
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 29 of file SensitiveDetectorCatalog.cc.

References theROUNameMap.

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

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

◆ logicalNamesFromClassName()

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

Definition at line 33 of file SensitiveDetectorCatalog.cc.

References className(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, groupFilesInBlocks::temp, and theClassNameMap.

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

◆ printMe()

void SensitiveDetectorCatalog::printMe ( ) const

Definition at line 60 of file SensitiveDetectorCatalog.cc.

References DummyCfis::c, classNames(), mps_fire::i, MainPageGenerator::l, CrabHelper::log, logicalNames(), alignCSCRings::r, readoutNames(), theClassNameMap, and theROUNameMap.

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

References className(), and theClassNameMap.

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

◆ readoutNames() [2/2]

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

Definition at line 18 of file SensitiveDetectorCatalog.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, groupFilesInBlocks::temp, and theROUNameMap.

Referenced by insert(), and printMe().

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

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