New RestG4 generator in REST version v2.3

System : Linux
REST version : v2.3.6

Please, could somebody make a summary of the different generator specifications? The old “type=virtualWall” has changed and now using <generator type="surface" shape="wall" position="${REST_WPOSITION}" lenX="${REST_WSIZE}" lenY="${REST_WSIZE}" rotation="(0,0,0)" > it launches events at the rigth z position but x=0,y=0.

the virtualWall generator type stoped working recently with the introduction on new generator conventions.

The following example is affected, although the validation is not smart enough to catch this on the fly. I will have to update once we know what is the proper way to do it.

WARNING! Generator type "virtualWall" was not recognized. Launching particle from origin (0,0,0)
---------------------------------------------------------------------
REST WARNNING : Particle being launched from the ORIGIN!! Wrong momentum direction!
Setting direction to (1,0,0)
REST angular distribution is just implemented for virtualBox and virtualSphere
Other spatial distributions can be set but it will launch the event
 with a distribution direction to the origin of coordinates
---------------------------------------------------------------------
WARNING! Generator type "virtualWall" was not recognized. Launching particle from origin (0,0,0)
---------------------------------------------------------------------
REST WARNNING : Particle being launched from the ORIGIN!! Wrong momentum direction!
Setting direction to (1,0,0)
REST angular distribution is just implemented for virtualBox and virtualSphere
Other spatial distributions can be set but it will launch the event
 with a distribution direction to the origin of coordinates
---------------------------------------------------------------------

It is likely that TRestGeant4Metadata class needs few updates in that sense.

There is a point at the release:

I tried the example using shape="wall" type="surface" or shape="wall" type="custom" but the result was not what it was expected.

Plz, @nkx what it is the right way to launch from a virtual wall now?

Plz, I would need to have this information. Currently, it behaves as a “point” source, launching events at (0,0, WallPosition)!

After using REST_Metadata("created root file"), it seems that you need to give these data:

Generator type : surface                                   
Generator shape : wall, (length, width, ): 0, 0, 0   
Generator center : (0,173,0) mm  
Generator rotation : (0,0,1), degree: 0

But how to define them in rml file?
In rml file I had written
<generator type="surface" shape="wall" length="5cm" width="0.5mm" position="173mm" rotation="(90,0,0)" >

Hi, it looks like the right generator type is “surface” and the right shape is “wall”. This is deduced from PrimaryGenerator.cc

    while (1) {
        if (generator_type == g4_metadata_parameters::generator_types::POINT) {
            GenPositionOnPoint(x, y, z);
        } else if (generator_type == g4_metadata_parameters::generator_types::SURFACE) {
            if (generator_shape == g4_metadata_parameters::generator_shapes::GDML) {
                GenPositionOnGDMLSurface(x, y, z);
            } else if (generator_shape == g4_metadata_parameters::generator_shapes::BOX) {
                GenPositionOnBoxSurface(x, y, z);
            } else if (generator_shape == g4_metadata_parameters::generator_shapes::CYLINDER) {
                GenPositionOnCylinderSurface(x, y, z);
            } else if (generator_shape == g4_metadata_parameters::generator_shapes::SPHERE) {
                GenPositionOnSphereSurface(x, y, z);
            } else if (generator_shape == g4_metadata_parameters::generator_shapes::PLATE) {
                GenPositionOnPlate(x, y, z);
            } else if (generator_shape == g4_metadata_parameters::generator_shapes::WALL) {
                GenPositionOnWall(x, y, z);
            }

where it calls GenPositionOnWall.

At TRestGeant4Metadata.cxx we find the definitions of those enums.

map<string, generator_types> generator_types_map = {
    {CleanString("custom"), generator_types::CUSTOM},
    {CleanString("volume"), generator_types::VOLUME},
    {CleanString("surface"), generator_types::SURFACE},
    {CleanString("point"), generator_types::POINT},
};

The problem is that the generator size changed how it is defined at the RML. It is defined now in a TVector3 format.

    fGenType = GetParameter("type", generatorDefinition, "volume");
    fGenShape = GetParameter("shape", generatorDefinition, "box");
    fGenFrom = GetParameter("from", generatorDefinition);
+---  3 lines: if (fGenFrom != PARAMETER_NOT_FOUND_STR) {-------------------------------------------------------------------------
    fGenSize = StringTo3DVector(GetParameter("size", generatorDefinition));
    fGenPosition = Get3DVectorParameterWithUnits("position", generatorDefinition);

The connnection between X,Y,Z at the fGenSize are described at the corresponding metadata member documentation.

    /// \brief The size of the generator. Stores up to three deminsions according to the shape
    /// box: length, width, height
    /// sphere: radius
    /// wall: length, width
    /// plate: radius
    /// cylinder: radius, length
    TVector3 fGenSize;

Which is actually rendered at:

https://sultan.unizar.es/rest/classTRestGeant4Metadata.html

But the documentation is now obsolete, and requires revision. I created a new issue so that the problem is addressed whenever someone is available to work on it.

I fixed units at generator, and added a validation pipeline

Please, aprouve other pending PR at geant4lib/restG4.