G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
Loading...
Searching...
No Matches
G4OCCTAssemblySDSetup Class Reference

Helper for assigning SDs to G4OCCT STEP assembly volumes. More...

#include <G4OCCT_STEPAssemblySD.hh>

Static Public Member Functions

static std::size_t Apply (const std::string &detectorName, const std::vector< std::pair< std::string, G4VSensitiveDetector * > > &assignments)
 

Detailed Description

Helper for assigning SDs to G4OCCT STEP assembly volumes.

In the DD4hep workflow, sensitive detectors (as G4VSensitiveDetector* objects) are created during ConstructSDandField(). For G4OCCT STEP assemblies the constituent G4LogicalVolumes bypass the TGeo representation and are therefore not reachable via the normal DD4hep volume-SD association.

This class bridges the gap: after creating SD objects, call G4OCCTAssemblySDSetup::Apply with the detector name (as registered in the compact XML) to retrieve the assembly from G4OCCTAssemblyRegistry and call ApplySDMap on it.

Usage (standalone Geant4)

void MyDetConstruction::ConstructSDandField() {
auto* absoSD = new CalorimeterSD("AbsorberSD", ...);
G4SDManager::GetSDMpointer()->AddNewDetector(absoSD);
{{"Absorber", absoSD}});
}
static std::size_t Apply(const std::string &detectorName, const std::vector< std::pair< std::string, G4VSensitiveDetector * > > &assignments)

Usage (DD4hep-driven)

Build a G4OCCTSensitiveDetectorMap from the DD4hep readout and call Apply from a dd4hep::sim::Geant4SensDetActionSequence or a custom ConstructSDandField.

Definition at line 47 of file G4OCCT_STEPAssemblySD.hh.

Member Function Documentation

◆ Apply()

std::size_t G4OCCTAssemblySDSetup::Apply ( const std::string &  detectorName,
const std::vector< std::pair< std::string, G4VSensitiveDetector * > > &  assignments 
)
static

Retrieve the named assembly from G4OCCTAssemblyRegistry and assign the given SDs to matching logical volumes via ApplySDMap.

Parameters
detectorNameAssembly name as registered in G4OCCTAssemblyRegistry (equals the DD4hep detector name attribute).
assignmentsVector of (volumePattern, sd*) pairs.
Returns
Number of logical volumes that received an SD assignment. Returns 0 and emits a JustWarning if the assembly is not found.

Definition at line 21 of file G4OCCT_STEPAssemblySD.cc.

References G4OCCTSensitiveDetectorMap::Add(), G4OCCTAssemblyVolume::ApplySDMap(), G4OCCTAssemblyRegistry::Get(), and G4OCCTAssemblyRegistry::Instance().


The documentation for this class was generated from the following files: