| Summary: | Problem in G4Sphere sections with G4OpBoundaryProcess | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | yordan <yordan> |
| Component: | geometry/solids | Assignee: | Vladimir.Grichine |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | gum, tatiana.nikitina |
| Priority: | P3 | ||
| Version: | 8.1 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
Hello Peter,
I have some new information for you.
The bug in G4OpBoundaryProcess is caused (as you predict) by the problem in the class G4Sphere. The problem is that in some events theLocalNormal is not a unit vector.
00331 G4ThreeVector theLocalNormal; // Normal points back into volume
00332
00333 G4bool valid;
00334 theLocalNormal = theNavigator->GetLocalExitNormal(&valid);
I think this is because of the problem in
G4double G4Sphere::DistanceToOutonst (G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm,
G4bool *validNorm,
G4ThreeVector *n ) const
The second bug (an infinite loop) do not have any connection with G4OpBoundaryProcess. It is caused by
G4SubtractionSolid::DistanceToIn()
the loop
00282 while( Inside(p+dist*v) == kOutside ) // pushing loop 00283 {
00284 disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) ;
00285 dist += disTmp ;
00286
00287 if( Inside(p+dist*v) == kOutside )
00288 {
00289 disTmp = fPtrSolidA->DistanceToIn(p+dist*v,v) ;
00290
00291 if(disTmp == kInfinity) // past A, hence past A\B 00292 {
00293 return kInfinity ;
00294 }
00295 dist += disTmp ;
00296 }
00297 }
became infinite because disTmp = fPtrSolidB->DistanceToOut(p+dist*v,v) is
always = 0
the definition of the volume is :
fPmts = new G4Box("Pmts", fDxOfPmts, fDyOfPmts, fDzOfPmts);
fSide = new G4Box("Side", fDxOfSide, fDyOfSide, fDzOfSide);
fGate = new G4Box("Gate", fDxOfGate, fDyOfGate, fDzOfGate);
fCone = new G4Cons("Cone", fRmin1, fRmax1, fRmin2, fRmax2, fDz, fSPhi, fDPhi);
// Adding four Cones
fCon1 = new G4IntersectionSolid("Con1", fPmts, fCone, fRotcon, fPosOfCone);
fCon2 = new G4IntersectionSolid("Con2", fCon1, fSide, fRot045, fPosOfSide);
fCon3 = new G4UnionSolid("Con3", fCon2, fCon2, fRot180, fZero);
fCon4 = new G4UnionSolid("Con4", fCon3, fCon3, fRot090, fZero);
// Solid, Logical and Physical Volumes
fSolid = new G4SubtractionSolid(mod->name(), fCon4, fGate, 0, fPosOfGate);
fLogic = new G4LogicalVolume(fSolid, mater, mod->name(), 0, 0, 0);
fPlace = new G4PVPlacement(0, fPosOfZero, fLogic, mod->name(), mlv->GetLogicalVolume(), 0, 0);
Please. let me know if you have a solution for these problems.
Best regards,
Yordan
For your further information, the G4Sphere problem is for simply a Sphere with Rmin = 107.0mm , Rmax = 110.0mm , Thetamin =0.0 deg , Thetamax = 70.0deg, Phimim = 0.0 deg and Phimax = 360.0 deg The bug stops to appear if Thetamax of the Sphere is 90.0deg or more. Looks like the problem is with partial spheres. Please, is it possible to send the code of a simple application which reproduces the problem? Thanks I have verified G4Sphere(version 4.9.2.ref07), the SurfaceNormal given by DistanceToOut() is corrected and gives an unit vector. Only for one specific case(fRMin=0,Intersection with ThetaSection, point going across the center of the Sphere) the SurfaceNormal is not correct. The fix is proposed to testing and will be available in the next release. The second problem with boolean operations normally happends when solids have shared surfaces. It has to be verified in the user application. fRMin=0 case is also corrected now. Tag "geom-csg-V09-02-05" by Tatiana. |
I am simulating the Cherenkov detector and I found a problem in the function void G4OpBoundaryProcess::DielectricDielectric() in some events the do – while loop (lines 559 - 757 ) becomes infinite (really infinite) and the program (the simulation) cannot continue behind this loop. I fixed the problem temporally by adding some lines at the end of the loop limit ++; if(limit>100){ Done = true; G4cout <<limit<< " G4OpBoundaryProcess::DielectricDielectric() -- the track is killed !!!! " << G4endl; aParticleChange.ProposeTrackStatus(fStopAndKill); } } while (!Done); but definitely something more reasonable have to be done.