Problem 1236 - G4SynchrotronRadiation has serious bugs
Summary: G4SynchrotronRadiation has serious bugs
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/electromagnetic (show other problems)
Version: 9.4
Hardware: All All
: P5 major
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2011-07-29 23:24 CEST by Tom Roberts
Modified: 2011-07-30 00:15 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Tom Roberts 2011-07-29 23:24:49 CEST
G4SynchrotronRadiation.cc calls GetFieldValue() with the old-style convention. This can give WILDLY incorrect results, and has the potential to crash the program. Programs with a static B field and no E field probably would not see this.

Lines 132-136:
      G4double  globPosVec[3], FieldValueVec[3];

      globPosVec[0] = globPosition.x();
      globPosVec[1] = globPosition.y();
      globPosVec[2] = globPosition.z();

SHOULD BE:
      G4double  globPosVec[4], FieldValueVec[6];    // 3->4,  3->6

      globPosVec[0] = globPosition.x();
      globPosVec[1] = globPosition.y();
      globPosVec[2] = globPosition.z();
      globPosVec[3] = trackData.GetGlobalTime();    // new line

The same modification must be made to lines 227-230.

These modifications must also be made to G4SynchrotronRadiationInMat.cc.


There is also a documentation issue: this code is valid only for fields that are constant throughout the step. Users should be cautioned to make sure to limit the stepsize in regions where the field varies. (Thread 1005 in the EM Processes Forum said this is mentioned in the Physics Manual, but I did not find it.)


Suggestion: search the entire code base for calls to GetFieldValue and check that the new calling convention is used and that position[3] is always set to the time coordinate.
Comment 1 Vladimir.Ivantchenko 2011-07-30 00:15:54 CEST
Hello,

Thank you very much for detailed and clear report. The bug fix is submitted for the testing. I will contact original author of the code about documentation.

Vladimir