37 THROW_EXCEPTION(
"ERROR: Geo2G4Builder for detector "<< detectorName <<
" could not access the detector store.");
42 THROW_EXCEPTION(detectorName<<
" could not get GeoModelExperiment");
45 const GeoVDetectorManager *theManager =
m_theExpt->getManager(detectorName);
50 for(
unsigned int i=0; i<theManager->getNumTreeTops(); ++i) {
51 m_treeTops.push_back(theManager->getTreeTop(i));
55 for(
unsigned int i=0; i<
m_treeTops.size();++i) {
62 if(theMaterialManager) {
69 if (
m_g2gSvc.retrieve().isFailure()) {
78 <<
"\n Use 'DefaultBuilder' property of Geo2G4Svc or"
79 <<
"\n 'GetVolumeBuilder' method of Geo2G4Builder");
86 G4LogicalVolume*
result =
nullptr;
87 std::unique_ptr<OpticalVolumesMap> optical_volumes{};
93 if(
sc.isSuccess() && surface_container->size()>0) {
94 optical_volumes = std::make_unique<OpticalVolumesMap>();
106 GeoIntrusivePtr<const GeoShape> shResult{&shFirst};
108 for(
unsigned int i=1; i<
m_treeTops.size(); i++) {
109 GeoIntrusivePtr<const GeoShape> booleanOp{&shResult->add((*(
m_treeTops[i]->getLogVol()->getShape()))<<(
m_treeTops[i]->getX()))};
110 shResult = booleanOp;
114 auto pvEnvelope = make_intrusive<GeoPhysVol>(lvEnvelope);
119 PVConstLink world =
m_treeTops[0]->getParent();
122 for(
unsigned int i=0; i<
m_treeTops.size(); i++) {
125 std::optional<unsigned int> childIndx = world->indexOf(pv);
132 std::optional<int> Qint = world->getIdOfChildVol(*childIndx);
136 std::string nameTT = world->getNameOfChildVol(*childIndx);
137 if (nameTT ==
"ANON") nameTT = pv->getLogVol()->getName();
140 G4LogicalVolume* g4LV =
m_theBuilder->Build(pv, optical_volumes.get());
141 G4ReflectionFactory::Instance()->Place(theG4Position,
152 if(optical_volumes) {
153 if(optical_volumes->size()>0) {
156 ATH_MSG_WARNING(
"Optical volumes apparently requested, but none found! Deleting temps");
178 G4OpticalSurface* g4OptSurface = surfaceFactory.
Build(border_surface.getOptSurface());
180 G4VPhysicalVolume* g4PV1 = 0;
181 G4VPhysicalVolume* g4PV2 = 0;
182 OpticalVolumesMap::const_iterator volIt;
185 volIt = optical_volumes->find(border_surface.getPV1());
186 if(volIt == optical_volumes->end())
188 ATH_MSG_WARNING(
"Unable to find " << border_surface.getPV1()->getLogVol()->getName() <<
" in Optical Volumes map");
191 g4PV1 = volIt.operator->()->second;
194 volIt = optical_volumes->find(border_surface.getPV2());
195 if(volIt == optical_volumes->end())
197 ATH_MSG_WARNING(
"Unable to find " << border_surface.getPV2()->getLogVol()->getName() <<
" in Optical Volumes map");
200 g4PV2 = volIt.operator->()->second;
203 G4LogicalBorderSurface* g4BorderSurface
__attribute__((
unused)) =
new G4LogicalBorderSurface(border_surface.getName(),g4PV1,g4PV2,g4OptSurface);