Skip to content

Commit

Permalink
fix: Make ActsSimGeantinoRecordingDD4hep less verbose (#731)
Browse files Browse the repository at this point in the history
Fixes #730 . I now consider this to be a clean fix.
  • Loading branch information
HadrienG2 committed Mar 3, 2021
1 parent 26369ab commit 1d79bed
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <DD4hep/Detector.h>
#include <DD4hep/Plugins.h>
#include <DD4hep/Printout.h>
#include <DDG4/Geant4Converter.h>
#include <DDG4/Geant4GeometryInfo.h>

Expand All @@ -25,7 +26,7 @@ DD4hepDetectorConstruction::DD4hepDetectorConstruction(
G4VPhysicalVolume* DD4hepDetectorConstruction::Construct() {
dd4hep::sim::Geant4Mapping& g4map = dd4hep::sim::Geant4Mapping::instance();
dd4hep::DetElement world = m_detector.world();
dd4hep::sim::Geant4Converter conv(m_detector, dd4hep::INFO);
dd4hep::sim::Geant4Converter conv(m_detector, dd4hep::PrintLevel::VERBOSE);
dd4hep::sim::Geant4GeometryInfo* geo_info = conv.create(world).detach();
g4map.attach(geo_info);
// All volumes are deleted in ~G4PhysicalVolumeStore()
Expand Down
25 changes: 25 additions & 0 deletions Examples/Detectors/DD4hepDetector/src/DD4hepGeometryService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <stdexcept>

#include "DD4hep/Printout.h"

ActsExamples::DD4hep::DD4hepGeometryService::DD4hepGeometryService(
const ActsExamples::DD4hep::DD4hepGeometryService::Config& cfg)
: BareService("DD4hepGeometryService", cfg.logLevel), m_cfg(cfg) {
Expand All @@ -34,6 +36,29 @@ ActsExamples::DD4hep::DD4hepGeometryService::~DD4hepGeometryService() {

ActsExamples::ProcessCode
ActsExamples::DD4hep::DD4hepGeometryService::buildDD4hepGeometry() {
switch (m_cfg.logLevel) {
case Acts::Logging::Level::VERBOSE:
dd4hep::setPrintLevel(dd4hep::PrintLevel::VERBOSE);
break;
case Acts::Logging::Level::DEBUG:
dd4hep::setPrintLevel(dd4hep::PrintLevel::DEBUG);
break;
case Acts::Logging::Level::INFO:
dd4hep::setPrintLevel(dd4hep::PrintLevel::INFO);
break;
case Acts::Logging::Level::WARNING:
dd4hep::setPrintLevel(dd4hep::PrintLevel::WARNING);
break;
case Acts::Logging::Level::ERROR:
dd4hep::setPrintLevel(dd4hep::PrintLevel::ERROR);
break;
case Acts::Logging::Level::FATAL:
dd4hep::setPrintLevel(dd4hep::PrintLevel::FATAL);
break;
case Acts::Logging::Level::MAX:
dd4hep::setPrintLevel(dd4hep::PrintLevel::ALWAYS);
break;
}
m_lcdd = &(dd4hep::Detector::getInstance());
for (auto& file : m_cfg.xmlFileNames) {
m_lcdd->fromCompact(file.c_str());
Expand Down

0 comments on commit 1d79bed

Please sign in to comment.