G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
Loading...
Searching...
No Matches
G4OCCT_STEPAssemblySD.cc
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2// Copyright (C) 2026 G4OCCT Contributors
3
6
8
12
13#include <G4Exception.hh>
14#include <G4String.hh>
15
16#include <cstddef>
17#include <string>
18#include <utility>
19#include <vector>
20
22 const std::string& detectorName,
23 const std::vector<std::pair<std::string, G4VSensitiveDetector*>>& assignments) {
25 if (!assembly) {
26 G4Exception("G4OCCTAssemblySDSetup::Apply", "G4OCCT_ASDSD000", JustWarning,
27 ("Assembly '" + detectorName +
28 "' not found in G4OCCTAssemblyRegistry. "
29 "Ensure G4OCCT_STEPAssembly was used to import this detector.")
30 .c_str());
31 return 0;
32 }
33
35 for (const auto& [pattern, sd] : assignments) {
36 sdMap.Add(G4String(pattern), sd);
37 }
38 return assembly->ApplySDMap(sdMap);
39}
Declaration of G4OCCTAssemblyRegistry.
Declaration of G4OCCTAssemblyVolume.
Declaration of G4OCCTSensitiveDetectorMap.
DD4hep sim action helper for G4OCCT STEP assembly sensitive detectors.
G4OCCTAssemblyVolume * Get(const std::string &name) const
static G4OCCTAssemblyRegistry & Instance()
Return the singleton instance.
static std::size_t Apply(const std::string &detectorName, const std::vector< std::pair< std::string, G4VSensitiveDetector * > > &assignments)
Extends Geant4's G4AssemblyVolume with an OCCT XDE label reference.
std::size_t ApplySDMap(const G4OCCTSensitiveDetectorMap &sdMap)
Maps volume name patterns to Geant4 G4VSensitiveDetector objects.
void Add(const G4String &pattern, G4VSensitiveDetector *sd)