54 xml_comp_t x_step = x_det.child(_Unicode(step_file));
55 xml_comp_t x_pos = x_det.child(_Unicode(position));
56 xml_comp_t x_map = x_det.child(_Unicode(material_map));
58 std::string name = x_det.nameStr();
59 std::string path = x_step.attr<std::string>(_Unicode(path));
62 std::map<std::string, G4Material*> materials;
63 for (xml_coll_t it(x_map, _Unicode(entry)); it; ++it) {
64 xml_comp_t x_entry = it;
65 std::string stepName = x_entry.attr<std::string>(_Unicode(step_name));
66 std::string dd4hepMatName = x_entry.attr<std::string>(_Unicode(dd4hep_material));
70 G4Material* g4mat = G4NistManager::Instance()->FindOrBuildMaterial(dd4hepMatName);
74 g4mat = G4Material::GetMaterial(dd4hepMatName,
false);
77 throw std::runtime_error(
"G4OCCT_STEPAssembly: Geant4 material '" + dd4hepMatName +
78 "' not found for STEP name '" + stepName +
"'");
80 materials[stepName] = g4mat;
81 printout(DEBUG,
"G4OCCT_STEPAssembly",
"Mapped STEP material '%s' → G4Material '%s'",
82 stepName.c_str(), dd4hepMatName.c_str());
96 Assembly dd4hepAssembly(name +
"_assembly");
98 printout(INFO,
"G4OCCT_STEPAssembly",
99 "Imported STEP assembly '%s' from '%s'; %d constituent solid(s) on "
100 "OCCT side; created empty dd4hep::Assembly '%s' as top-level container",
101 name.c_str(), path.c_str(), nConstituents, (name +
"_assembly").c_str());
104 DetElement det(name, x_det.id());
105 Position pos(x_pos.x(), x_pos.y(), x_pos.z());
107 PlacedVolume pv = description.pickMotherVolume(det).placeVolume(dd4hepAssembly, pos);
108 pv.addPhysVolID(
"system", x_det.id());
109 det.setPlacement(pv);