Skip to content

Commit

Permalink
Merge pull request #42419 from bsunanda/Phase2-sim145X
Browse files Browse the repository at this point in the history
Phase2-sim145X Modify some of the SIM codes to understand the difference between DDD and DD4hep for HGCal
  • Loading branch information
cmsbuild authored Jul 30, 2023
2 parents 297383a + 410be4c commit aa9676e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
3 changes: 3 additions & 0 deletions SimG4CMS/Calo/src/HGCalSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ uint32_t HGCalSD::setDetUnitId(const G4Step* aStep) {
moduleLev = 2;
}
int module = touch->GetReplicaNumber(moduleLev);
if (verbose_ && (cell == -1))
edm::LogVerbatim("HGCSim") << "Top " << touch->GetVolume(0)->GetName() << " Module "
<< touch->GetVolume(moduleLev)->GetName();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCSim") << "DepthsTop: " << touch->GetHistoryDepth() << ":" << levelT1_ << ":" << levelT2_ << ":"
<< useSimWt_ << " name " << touch->GetVolume(0)->GetName() << " layer:module:cell "
Expand Down
2 changes: 2 additions & 0 deletions SimG4CMS/Calo/test/python/Sim2026_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
if 'MessageLogger' in process.__dict__:
process.MessageLogger.G4cerr=dict()
process.MessageLogger.HitStudy=dict()
process.MessageLogger.HGCSim=dict()
# process.MessageLogger.SensitiveDetector=dict()

process.Timing = cms.Service("Timing")

Expand Down
20 changes: 10 additions & 10 deletions SimG4Core/Geometry/src/SensitiveDetectorCatalog.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "SimG4Core/Geometry/interface/SensitiveDetectorCatalog.h"

#define DEBUG
#define EDM_ML_DEBUG

#include <iostream>

void SensitiveDetectorCatalog::insert(const std::string &cN, const std::string &rN, const std::string &lvN) {
theClassNameMap[cN].insert(rN);
theROUNameMap[rN].insert(lvN);
#ifdef DEBUG
edm::LogVerbatim("SimG4CoreGeometry") << "SenstiveDetectorCatalog: insert (" << cN << "," << rN << "," << lvN << ")\n"
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("SensitiveDetector") << "SenstiveDetectorCatalog: insert (" << cN << "," << rN << "," << lvN << ")\n"
<< " has " << readoutNames().size() << " ROUs "
<< readoutNames().front() << "\n"
<< " has " << classNames().size() << " classes "
Expand Down Expand Up @@ -60,8 +60,8 @@ std::vector<std::string_view> SensitiveDetectorCatalog::classNames() const {
}

void SensitiveDetectorCatalog::printMe() const {
edm::LogVerbatim("SimG4CoreGeometry") << "Class names map size is: " << theClassNameMap.size() << "\n";
edm::LogVerbatim("SimG4CoreGeometry").log([&](auto &log) {
edm::LogVerbatim("SensitiveDetector") << "Class names map size is: " << theClassNameMap.size() << "\n";
edm::LogVerbatim("SensitiveDetector").log([&](auto &log) {
int i(0);
for (const auto &cn : theClassNameMap) {
log << "#" << ++i << ": " << cn.first << " has " << cn.second.size() << " class names:\n";
Expand All @@ -71,20 +71,20 @@ void SensitiveDetectorCatalog::printMe() const {
}
log << "\n";
});
edm::LogVerbatim("SimG4CoreGeometry") << "\nROU names map: " << theROUNameMap.size() << "\n";
edm::LogVerbatim("SimG4CoreGeometry").log([&](auto &log) {
edm::LogVerbatim("SensitiveDetector") << "\nROU names map: " << theROUNameMap.size() << "\n";
edm::LogVerbatim("SensitiveDetector").log([&](auto &log) {
int i(0);
for (const auto &rn : theROUNameMap) {
log << "#" << ++i << ": " << rn.first << " has " << rn.second.size() << " ROU names:\n";
for (const auto &rnv : rn.second)
log << rnv << ", ";
log << rnv << "\n ";
log << "\n";
}
log << "\n";
});

edm::LogVerbatim("SimG4CoreGeometry") << "\n========== Here are the accessors =================\n";
edm::LogVerbatim("SimG4CoreGeometry").log([&](auto &log) {
edm::LogVerbatim("SensitiveDetector") << "\n========== Here are the accessors =================\n";
edm::LogVerbatim("SensitiveDetector").log([&](auto &log) {
for (auto c : classNames()) {
log << "ClassName:" << c << "\n";
for (auto r : readoutNames({c.data(), c.size()})) {
Expand Down
5 changes: 3 additions & 2 deletions SimG4Core/SensitiveDetector/src/SensitiveDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ SensitiveDetector::SensitiveDetector(const std::string& iname, const SensitiveDe
std::stringstream ss;
for (auto& lvname : lvNames) {
this->AssignSD({lvname.data(), lvname.size()});
ss << " " << lvname;
ss << " " << lvname << "\n";
}
edm::LogVerbatim("SensitiveDetector") << " <" << iname << "> : Assigns SD to LVs " << ss.str();
edm::LogVerbatim("SensitiveDetector") << " <" << iname << "> : Assigns SD to " << lvNames.size() << " LVs "
<< ss.str();
}

SensitiveDetector::~SensitiveDetector() {}
Expand Down

0 comments on commit aa9676e

Please sign in to comment.