8 #include <DDG4/Geant4Converter.h>
9 #include <DDG4/Geant4GeometryInfo.h>
10 #include <DDG4/Geant4Mapping.h>
11 #include <DD4hep/Detector.h>
12 #include <DD4hep/Filter.h>
14 #include "G4LogicalVolume.hh"
15 #include "G4LogicalVolumeStore.hh"
16 #include "G4ReflectionFactory.hh"
27 : compactView_(cpv), map_(lvmap), check_(
check) {}
30 G4ReflectionFactory *refFact = G4ReflectionFactory::Instance();
31 refFact->SetScalePrecision(100. * refFact->GetScalePrecision());
39 g4Geo.debugMaterials =
false;
40 Geant4GeometryInfo *
geometry = g4Geo.create(world).detach();
44 std::vector<std::pair<G4LogicalVolume *, const dd4hep::SpecPar *>> dd4hepVec;
45 const dd4hep::SpecParRegistry &specPars = det->
specpars();
46 dd4hep::SpecParRefs
specs;
47 specPars.filter(
specs,
"SensitiveDetector");
48 for (
auto const &it :
map_) {
49 bool foundMatch =
false;
51 for (
auto const &pit :
fit.second->paths) {
52 if (dd4hep::dd::compareEqualName(dd4hep::dd::noNamespace(dd4hep::dd::realTopName(pit)),
53 dd4hep::dd::noNamespace(it.first.name()))) {
54 dd4hepVec.emplace_back(&*it.second, &*
fit.second);
66 for (
auto const &it : dd4hepVec) {
68 const G4String &sensitiveDetectorG4Name = it.first->GetName();
69 auto sClassName = it.second->strValue(
"SensitiveDetector");
70 auto sROUName = it.second->strValue(
"ReadOutName");
72 catalog.insert({sClassName.data(), sClassName.size()}, {sROUName.data(), sROUName.size()}, sensitiveDetectorG4Name);
74 edm::LogVerbatim(
"SimG4CoreApplication") <<
" DDG4SensitiveConverter: Sensitive " << sensitiveDetectorG4Name
75 <<
" Class Name " << sClassName <<
" ROU Name " << sROUName;
79 const G4String &sensitiveDetectorG4ReflectedName = sensitiveDetectorG4Name +
"_refl";
81 const G4LogicalVolumeStore *
const allG4LogicalVolumes = G4LogicalVolumeStore::GetInstance();
82 const bool hasG4ReflectedVolume =
84 allG4LogicalVolumes->begin(), allG4LogicalVolumes->end(), [&](G4LogicalVolume *
const aG4LogicalVolume) {
85 return (aG4LogicalVolume->GetName() == sensitiveDetectorG4ReflectedName);
86 }) != allG4LogicalVolumes->end();
87 if (hasG4ReflectedVolume) {
90 {sClassName.data(), sClassName.size()}, {sROUName.data(), sROUName.size()}, sensitiveDetectorG4ReflectedName);
93 <<
" DDG4SensitiveConverter: Sensitive " << sensitiveDetectorG4ReflectedName <<
" Class Name " << sClassName
94 <<
" ROU Name " << sROUName;