Hi, I need to build a box-shaped object with a conical hole inside. I chose a G4SubtractionSolid made of a G4Box and a G4Cons: G4double x = 10.*cm; G4double y = 10.*cm; G4double z = 40.*cm; // Copper Block G4Box* collimatorBox = new G4Box("CollimatorBox", x/2., y/2., z/2.); // hole cone G4Cons* collimatorHole = new G4Cons("CollimatorHole", 0,0.5*cm,0.*cm,0.625*cm,20.1*cm,0.*pi*rad,2.*pi*rad); // Collimator G4SubtractionSolid* collimatorSolid = new G4SubtractionSolid("collimatorSolid",collimatorBox,collimatorHole); I took care avoiding touching faces of the components making the G4Cons slightly bigger I use the general particle gun with gammas (15 MeV), isotropic phi distribution and a specific theta distribution. So, I hit the collimator object with different angles. It runs for a while (maybe 10,000,00 events sometimes), but than it gets stuck (100% CPU, no more new events being processed). I let it run within gdb to see, where it happens. Here is a typical output after interruption with Ctrl+C. Program received signal SIGINT, Interrupt. 0x0000000101edb00e in G4Cons::Inside () (gdb) bt #0 0x0000000101edb00e in G4Cons::Inside () #1 0x0000000101f6c7f5 in G4SubtractionSolid::DistanceToIn () #2 0x0000000101ec3b29 in G4VoxelNavigation::ComputeStep () #3 0x0000000101eabf7d in G4Navigator::ComputeStep () #4 0x00000001007284c0 in G4Transportation::AlongStepGetPhysicalInteractionLength () at G4ReferenceCountedHandle.hh:315 #5 0x000000010063a426 in G4SteppingManager::DefinePhysicalStepLength () #6 0x0000000100638c7d in G4SteppingManager::Stepping () #7 0x00000001006407fb in G4TrackingManager::ProcessOneTrack () #8 0x00000001005cf154 in G4EventManager::DoProcessing () #9 0x0000000100593e6c in G4RunManager::DoEventLoop () #10 0x0000000100593d6f in G4RunManager::BeamOn () This happened on MacOS X 10.6.5 and Linux Debian. I used different geant4 versions including 4.9.3p2 As this is the first time I send a bug report, I hope this information is good enough to reproduce the problem. Thanks for any help solving this problem. Linda
Dear Linda, Thank you for open this problem report and for provaded information. I constructed your Detector configuration(Box+Cons+Subtraction). I tested it with Geant4 geometry tests, but I can not reproduce the problem. I have also tested Inside() method, but it doesn't show any problems. Can you provide more information or just your application, that I can reproduce this looping? Best Regards, Tatiana Nikitina
Created attachment 94 [details] GPS macro file This is the configuration file I use to customize GPS.
Hi, too bad. Here is some more information, that might be useful: The position of my solid: // rotate collimator G4RotationMatrix* rotation=new G4RotationMatrix(); rotation->rotateY(collimatorAngle); theCollimator = new TaggerCollimator(); G4VPhysicalVolume* CollimatorPhys = new G4PVPlacement(rotation, G4ThreeVector(0.*cm,0.*cm,-181.*cm),theCollimator->GetLogical(), "TaggerCollimator", expHallLog, false, 0); collimatorAngle is 0, usually. I use the GPS and I attach my angular distribution as a file. The energy is e.g 14 MeV (not set in the file I attach) The position for the gps is 0 0 0 . Maybe it has to do with small theta angles? So beam almost parallel to the surfaces?? Thanks for caring, Linda
Hi Linda, Thank you. I will try to run it. Your remarque about small angles is very useful, I will look on it. Best Regards, Tatiana Nikitina
Dear Linda, Thank you for your help and files. I manage to reproduce the problem and fix it. It was an error in G4Cons in DistanceToIn(p,v) with handling of Tolerance. This fix will be available in the next release of Geant4. If you have a local version of Geant4, I can send you new version of G4Cons.cc already. Best Regards, Tatiana Nikitina