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.
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.
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;
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.