-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing CRY generator as a new source inside TRestGeant4ParticleSourceCry
#116
Conversation
TRestGeant4ParticleSourceCry
Maybe it's interesting to add a new class like |
The present implementation will do exactly that using the CRY generator. So, I don't understand, what do you mean? You mean the present |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
TRestGeant4ParticleSourceCry
TRestGeant4ParticleSourceCry
Yes! Actually there was a naming convention that when you want to add external generators the class name should be From my point of view, CRY(and also decay0) is just a random number generator. That is, every time you call a certain method, it will randomize the energy and angle of a particle according to the muon spectrum. Those information can be well kept in
I guess the altitude only changes the muon energy distribution. In any case your simulation origin is not necessarily same as your lab altitude. Perhaps we need to add some options inside rml, such as the lab altitude, longitude and latitude. We may also need a definition of source volume (normally in muon simulation we set the particles to be generated from a very large horizontal plane above the detector) |
Yes, this shall be OK. |
for more information, see https://pre-commit.ci
Actually I think it is the CRY generator the responsible to do this. It is generating particles in a 2-dimensional box with dimensions Those values can now be updated in the RML, they are metadata members of the generator. |
One last thing that needs to be integrated is the random generator seed. It is always producing the same sequence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The REST implementation works correctly. The only thing is that I had to generate the shared library of CRY using objects created with the -fPIC flag (something about the CRY installation)
The following PR implements an interface to CRY generator that can be plugged to
restG4
. All the access to CRY libraries is inside the classTRestGeant4ParticleSourceCry
, which has been inspired onTRestGeant4ParticleSourceDecay0
.The class allows to configure/setup the CRY generator and it implements a method to update the particles for each event.
This PR requires minor contributions to
restG4
andframework
repositories.Inside
restG4
we simply include an example to test the generatorCryGenerator.rml
, and we introduce minor modifications insidePrimaryGeneratorAction
so that when we use<generator type="cry" ... >
the position of the particle is fixed using the CRY generator positions. Implementing the CRY generator into restG4 restG4#121.Inside the framework we need to add the library
CRY
insidethisREST.sh
so that executables will be able to find the library path. Adding CRY to LD_LIBRARY_PATH inside thisREST.sh framework#489In order to link the CRY libraries to
libRestGeant4
we need to generate the shared object from the static librarylibCRY.a
.This can be done with the following command:
Once we have generated the
libCRY.so
we need to compile REST with the new option.And we can use the new example added to
restG4
.10 events will be generated in this example, stored in the output file
CryGenerator.root
. We can open to inspect:And access the new particle source generator metadata:
And check the generator events:
In the previous image we can see how the CRY generator has produced an
electron
and aneutron
.The event header contains also the source position, but only the one for the first (or last) particle. This is redundant information, but incomplete, since we need to really look to the tracks to understand what are the particles produced by the generator. Perhaps it would be better to remove those fields from TRestGeant4Event? @lobis?
I have seen that
TRestGeant4ParticleSource
definesPrintParticleSource
but perhaps this should be migrated toPrintMetadata
? @nkx111I let @Jaime-AA to play around and validate the generator.
I was surprised that when I define altitude = 2100m, the particle is still produced at
z=0
, I guess one needs to usezoffset
so that the particles are generated at that altitude.