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_) {
50 for (
auto const &pit :
fit.second->paths) {
51 if (dd4hep::dd::compareEqualName(dd4hep::dd::realTopName(pit), dd4hep::dd::noNamespace(it.first.name()))) {
52 dd4hepVec.emplace_back(&*it.second, &*
fit.second);
59 for (
auto const &it : dd4hepVec) {
61 const G4String &sensitiveDetectorG4Name = it.first->GetName();
62 auto sClassName = it.second->strValue(
"SensitiveDetector");
63 auto sROUName = it.second->strValue(
"ReadOutName");
65 catalog.insert({sClassName.data(), sClassName.size()}, {sROUName.data(), sROUName.size()}, sensitiveDetectorG4Name);
67 edm::LogVerbatim(
"SimG4CoreApplication") <<
" DDG4SensitiveConverter: Sensitive " << sensitiveDetectorG4Name
68 <<
" Class Name " << sClassName <<
" ROU Name " << sROUName;
72 const G4String &sensitiveDetectorG4ReflectedName = sensitiveDetectorG4Name +
"_refl";
74 const G4LogicalVolumeStore *
const allG4LogicalVolumes = G4LogicalVolumeStore::GetInstance();
75 const bool hasG4ReflectedVolume =
77 allG4LogicalVolumes->begin(), allG4LogicalVolumes->end(), [&](G4LogicalVolume *
const aG4LogicalVolume) {
78 return (aG4LogicalVolume->GetName() == sensitiveDetectorG4ReflectedName);
79 }) != allG4LogicalVolumes->end();
80 if (hasG4ReflectedVolume) {
83 {sClassName.data(), sClassName.size()}, {sROUName.data(), sROUName.size()}, sensitiveDetectorG4ReflectedName);
86 <<
" DDG4SensitiveConverter: Sensitive " << sensitiveDetectorG4ReflectedName <<
" Class Name " << sClassName
87 <<
" ROU Name " << sROUName;