| Summary: | A PhysicalVolume with more than two BorderSurface will not be writed to GDML file in correct way. | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Binbin Qi <qbb180> |
| Component: | persistency/gdml | Assignee: | Witold.Pokorski |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | brodsky3 |
| Priority: | P4 | ||
| Version: | 10.5 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: |
Test file
Test output A new GDML file which can reproduce my problem |
||
*** Problem 2148 has been marked as a duplicate of this problem. *** Created attachment 562 [details]
Test file
Created attachment 563 [details]
Test output
Hi, I am a bit confused. I tried running example G01 (load_gdml executable, without your changes applied) with the GDML file attached opticalsurfaces2.gdml which, as far as I see, contains a volume with two boarder surfaces as you have described. When I write out the gdml file, I get what is in output_test.gdml which contains two border surfaces as expected. Could you please provide a gdml file that I could use to reproduce your problem? Cheers, Witek Hi,
In opticalsurface2.gdml, two bordersurfaces are defined,but they are belong to different physicsvolume.
<bordersurface name="bordersrf1" surfaceproperty="surf2" >
<physvolref ref="pv1"/>
<physvolref ref="pv2"/>
</bordersurface>
<bordersurface name="bordersrf2" surfaceproperty="surf2" >
<physvolref ref="pv2"/>
<physvolref ref="pv3"/>
</bordersurface>
If you use bellow code to reproduce my problem
<bordersurface name="bordersrf1" surfaceproperty="surf2" >
<physvolref ref="pv2"/>
<physvolref ref="pv1"/> <!-- difference -->
</bordersurface>
<bordersurface name="bordersrf2" surfaceproperty="surf2" >
<physvolref ref="pv2"/>
<physvolref ref="pv3"/>
</bordersurface>
Created attachment 564 [details]
A new GDML file which can reproduce my problem
Yes, you are right. Thanks. Your fix is going in the patch release. Yes, you are right. Thanks. Your fix is going in the patch release. |
When a PhysicalVolume has boundaries with multiple different PhysicalVolumes, you need to define multiple BorderSurfaces. However, the GDML write operation only write the first defined BorderSurface of each PhysicalVolume to the GDML file. For example, A PhysicalVolume called physicalVolumeA has boundaries with physicalVolumeB and physicalVolumeC, the code shows as bellow: new G4LogicalBorderSurface(“nameAB”, physicalVolumeA, physicalVolumeB, opSurfaceAB); new G4LogicalBorderSurface(“nameAC”, physicalVolumeA, physicalVolumeC, opSurfaceAC); Then Only the BoderSurfaceAB is writed to GDML file, and the BorderSurfaceAC is ignored. Suggested fix: 343 const G4LogicalBorderSurface* 344 G4GDMLWriteStructure::GetBorderSurface(const G4VPhysicalVolume* const pvol) 345 { 346 G4LogicalBorderSurface* surf = 0; 347 G4int nsurf = G4LogicalBorderSurface::GetNumberOfBorderSurfaces(); 348 if (nsurf) 349 { 350 const G4LogicalBorderSurfaceTable* btable = 351 G4LogicalBorderSurface::GetSurfaceTable(); 352 std::vector<G4LogicalBorderSurface*>::const_iterator pos; 353 for (pos = btable->begin(); pos != btable->end(); pos++) 354 { 355 if (pvol == (*pos)->GetVolume1()) // just the first in the couple 356 { // is enough 357 surf = *pos; //break; 358 BorderSurfaceCache(surf); //add this code 359 } 360 } 361 } 362 return surf; 363 } And in G4GDMLWriteStructure::TraverseVolumeTree(),make the following changes: 546 //BorderSurfaceCache(GetBorderSurface(physvol)); 547 GetBorderSurface(physvol);