Message: Infinite loop while generating Cerenkov photons Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Infinite loop while generating Cerenkov photons 

Forum: Processes Involving Optical Photons
Date: 26 Sep, 2017
From: Emanuele Leonardi <Emanuele Leonardi>

Starting from the OpNovice example I am trying to simulate the optical properties of a PbF2 crystal.

I defined the RINDEX and ABSLENGTH properties of the PbF2 material in the 1.6-5 eV energy range and then used the standard gun to send a 100MeV photon on the front end of a 30x30x140 mm3 crystal.

In several occasions the simulation enters an infinite loop while generating Cerenkov photons.

According to gdb, the location where this happens is inside the G4Cerenkov.cc code:

(gdb) backtrace

#0  CLHEP::RanecuEngine::flat() () at /mnt/build/jenkins/workspace/g4-clhep-2/COMPILER/gcc49/label/slc6/2.3.4.3/CLHEP/Random/src/RanecuEngine.cc:230
#1  0x00007ffff2f4bb7f in G4Cerenkov::PostStepDoIt(G4Track const&, G4Step const&) () at /afs/cern.ch/sw/geant4/releases/geant4.10.3.ref01/share/source/processes/electromagnetic/xrays/src/G4Cerenkov.cc:353
#2  0x00007ffff49492d9 in G4SteppingManager::InvokePSDIP(unsigned long) () at /afs/cern.ch/sw/geant4/releases/geant4.10.3.ref01/share/source/tracking/src/G4SteppingManager2.cc:530
#3  0x00007ffff494975b in G4SteppingManager::InvokePostStepDoItProcs() () at /afs/cern.ch/sw/geant4/releases/geant4.10.3.ref01/share/source/tracking/src/G4SteppingManager2.cc:502
...etc.etc.etc...

Looking at the code, this corresponds to the lines:

      // Generate new G4Track object:

      G4double NumberOfPhotons, N;

      do {
         rand = G4UniformRand();
         NumberOfPhotons = MeanNumberOfPhotons1 - rand *
                                (MeanNumberOfPhotons1-MeanNumberOfPhotons2);
         N = G4UniformRand() *
                        std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
        // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
      } while (N > NumberOfPhotons);

Is there something wrong in the way I set up the simulation?

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Infinite loop while generating Cerenkov photons   (Daren Sawkey - 27 Sep, 2017)
1 Ok: Re: Infinite loop while generating Cerenkov photons   (Emanuele Leonardi - 28 Sep, 2017)
2 None: Re: Infinite loop while generating Cerenkov photons   (Porosev Viacheslav - 06 Oct, 2017)
 Add Message Add Message
to: "Infinite loop while generating Cerenkov photons"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews