Make primary coordinates clearer in output

Issue #248 resolved
Laurie Nevay created an issue

Primary "sampler" is really just a record of the global coordinates given to Geant4 at the start of the event. These are written using the sampler structure for convenience. A sampler is always in the curvilinear frame so the coordinates are labelled with lower case to denote this. Generally, these are degenerate so no one notices and it makes optical function analysis easier.

However, this leads to much confusion when a finite S0 is used and a large finite global offset is added to the coordinates. This has arisen several times with users. This wouldn't be an issue if the coordinates were properly labelled. Even better, there should be both curvilinear and global coordinates for the primary input coordinates.

The only reason this wasn't done originally is to make the primary the same type as the samplers for optical analysis. We really have to fix this though. The analysis problem can be solved via inheritance or via a new class - BDSOutputROOTEventSampler can have an implicit constructor that converts an instance of this new class so it can be easily folded into the analysis.

Comments (1)

  1. Laurie Nevay reporter

    I have fixed this in develop and the change will be in the next release of BDSIM.

    I've added a separate branch in the output beside "Primary" called "PrimaryGlobal". The coordinates in "Primary" are like the other samplers and are curvilinear coordinates whereas the ones in "PrimaryGlobal" are as the name suggests global Cartesian coordinates.

    There was some refactoring of the beam generation classes (ones that derive from BDSBunch) to put unit conversions in the base class as well as use a few new classes to easily pass coordinates around.

    There were a few fixes to some distributions (circle, square) that were documented in the version history also. Only these ones will produce different coordinates for the same seed as compared to a previous version of BDSIM.

  2. Log in to comment