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
 
std::vector< std::string_view > readoutNames () const
 
const std::vector< std::string_view > readoutNames (const std::string &className) 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 43 of file SensitiveDetectorCatalog.cc.

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 }

References groupFilesInBlocks::temp, and theClassNameMap.

Referenced by AttachSD::create(), logicalNamesFromClassName(), and readoutNames().

◆ classNames()

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

Definition at line 54 of file SensitiveDetectorCatalog.cc.

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

References groupFilesInBlocks::temp, and theClassNameMap.

Referenced by insert(), and printMe().

◆ insert()

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

Definition at line 8 of file SensitiveDetectorCatalog.cc.

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 }

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

◆ logicalNames()

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

Definition at line 31 of file SensitiveDetectorCatalog.cc.

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

References theROUNameMap.

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

◆ logicalNamesFromClassName()

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

Definition at line 35 of file SensitiveDetectorCatalog.cc.

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 }

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

◆ printMe()

void SensitiveDetectorCatalog::printMe ( ) const

Definition at line 61 of file SensitiveDetectorCatalog.cc.

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 }

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

◆ readoutNames() [1/2]

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

Definition at line 20 of file SensitiveDetectorCatalog.cc.

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

References groupFilesInBlocks::temp, and theROUNameMap.

Referenced by insert(), and printMe().

◆ readoutNames() [2/2]

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

Definition at line 27 of file SensitiveDetectorCatalog.cc.

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

References className(), and theClassNameMap.

Referenced by AttachSD::create().

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

mps_fire.i
i
Definition: mps_fire.py:355
SensitiveDetectorCatalog::className
std::string_view className(const std::string &readoutName) const
Definition: SensitiveDetectorCatalog.cc:43
SensitiveDetectorCatalog::readoutNames
std::vector< std::string_view > readoutNames() const
Definition: SensitiveDetectorCatalog.cc:20
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
SensitiveDetectorCatalog::theClassNameMap
MapType theClassNameMap
Definition: SensitiveDetectorCatalog.h:24
edm::LogVerbatim::log
LogVerbatim & log(F &&iF)
Definition: MessageLogger.h:327
edm::LogVerbatim
Definition: MessageLogger.h:297
SensitiveDetectorCatalog::theROUNameMap
MapType theROUNameMap
Definition: SensitiveDetectorCatalog.h:25
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
alignCSCRings.r
r
Definition: alignCSCRings.py:93
SensitiveDetectorCatalog::classNames
std::vector< std::string_view > classNames() const
Definition: SensitiveDetectorCatalog.cc:54
SensitiveDetectorCatalog::logicalNames
const std::vector< std::string_view > logicalNames(const std::string &readoutName) const
Definition: SensitiveDetectorCatalog.cc:31
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17