Git Product home page Git Product logo

Comments (10)

fmauger avatar fmauger commented on June 23, 2024

Dear Diego,
Yes the basic behavior of the BxDecay0 generators is to isotropically randomize the momentum vectors of emitted particles because it is the most useful (and realistic) use case in many simulation applications. So the Geant4 extension does the same because it is just a wrapping interface to BxDecay0 generators. However, I understand that in some situations, you may want to shoot single particles in some specific direction, probably to avoid propagating particles through sterile/unsensitive region of your geometry setup. This makes sense for decays with only one emitted particle or at least for decays where you can decide which primary particle you'd like to target to lock its momentum direction. This is a typical biased sampling. Let me think about it before to propose you a solution.

Regards
frc

from bxdecay0.

fmauger avatar fmauger commented on June 23, 2024

Hi Diego

I have implemented a special "post-generation operation" that is able to rotate the full generated event in such a way one of the generated particles in this event (namely the target particle) is emitted in a cone with a preferential direction (defined by a (x,y,z) triplet of coordinates or by (theta,phi) doublet of longitude and colatitude angles) and an angle of aperture. This is a typical geometry biasing operation that is useful for radiation protection studies with G4 when you want to track only gammas that go in an interesting direction.

The target particle can be selected by type (electron, gamma...) and its ranking in the event, so that you can choose for example: the first particle of any type, the first gamma, the second electron...
If the algorithm cannot fullfil this criterion and fails to determine the target particle, you can choose to simply pass and not rotate the generated event (default behavior), or throw and exception that should abort your run.

The preliminary algorithm seems to work and I have tried it for forcing Cs137 gamma rays to run in a cone along the X axis. The resulting histogram is shown below:
test_decay0_generator_mdl.pdf

I now have to provide an extended interface in the G4 extension. Let me know if that would solve your problem.

By the way: this algorithm is named MDL for Momentum Direction Lock ;-)

Regards
frc

from bxdecay0.

diegoibros avatar diegoibros commented on June 23, 2024

Dear François,

I really thank you for your help. This solution seems to be ideal for my interest, as I am only interested in changing the direction of the electrons in the Cs-137 decay. However, I wonder about the internal conversion electrons that are sometimes produced: the Cs137 decay produces an electron and then the Ba137 that is excited and emits a gamma in most of the cases but also sometimes an internal conversion electron instead of the gamma. I am also interested in emitting these second electrons in the same solid angle that the first ones but if I don't understand wrongly, the method you propose can achieve this too. I comment this just to be sure :)

The histogram you send confirms the validity of the method for my problem! Thank you so much!

I look forward to hearing about the implementation of this new tool.

Best,

Diego

from bxdecay0.

fmauger avatar fmauger commented on June 23, 2024

Dear François,

I really thank you for your help. This solution seems to be ideal for my interest, as I am only interested in changing the direction of the electrons in the Cs-137 decay. However, I wonder about the internal conversion electrons that are sometimes produced: the Cs137 decay produces an electron and then the Ba137 that is excited and emits a gamma in most of the cases but also sometimes an internal conversion electron instead of the gamma. I am also interested in emitting these second electrons in the same solid angle that the first ones but if I don't understand wrongly, the method you propose can achieve this too. I comment this just to be sure :)

In principle, What you are asking is not correct in terms of the solid angle distributions associated to the particles in a same event. I mean that if you choose a target particle to go in a given direction, then forcing this momentum without corrupting the solid angle distributions of all other particles will result in rotating the full event and this will not imply that other particles goes in the same cone like the target one.
Of course I can add an option to enforce this specific "force cone" behaviour, but users should be aware that doing this possibly introduces large geometrical biases for some simulation. I suppose that you understand this point and that we are on the same page here.

In the case of Cs137, this does not hurt because emission directions of all electrons and gammas in each event are non correlated in principle. So the effect would be just like biased sampling with preference for events with particles emitted in the same cone. This would be another story for other kinds of decays (like double beta decay or similar process) where emitted particles are strongly correlated in solid angle and corrupting the angular distribution like this implies wrong geometrical acceptance.

Anyway I propose you to add another option to achieve what you want so that you could make a try ASAP with the development branch I will create for that. If it is ok, I will push the mods in a new tag.

The histogram you send confirms the validity of the method for my problem! Thank you so much!

I look forward to hearing about the implementation of this new tool.

Best,

Diego

Regards
frc

from bxdecay0.

diegoibros avatar diegoibros commented on June 23, 2024

Dear François,

I totally agree with your reasoning. Theoretically, there would be a correlation between the direction of emission and forcing one particle to be produced in one direction will have an impact on the other particles that are produced. However, under the assumptions of the real experiment that I am trying to simulate and compare, I have reached to the conclusion that I can neglect this correlation as the real radioactive source is fixed at an position and it is large enough to assume the Ba137 nuclei to be fixed after the decay, so the direction emission of gammas or internal conversion electrons wouldn't be affected.

The fact that in the Cs137 decay the emissions of the particles are not correlated in the simulation is perfect under the previous assumption and helps to achieve the aim I want. Of course, I am not interested for the moment in other types of decay, so I also agree that it would be a different story for them.

I thank you for your suggestion, I would be very pleased to check the results after implementing your code!

Best regards,

Diego

from bxdecay0.

fmauger avatar fmauger commented on June 23, 2024

Hi Diego,

I've pushed a new feature branch that implements the MDL post-generation event operation :
https://github.com/BxCppDev/bxdecay0/blob/feature-lock-particule-dir/extensions/bxdecay0_g4/examples/bxdecay0_g4_ex01/README.rst

The documentation about MDL is here: https://github.com/BxCppDev/bxdecay0/blob/feature-lock-particule-dir/documentation/PostGenEventOps/MDL/README.rst . There are several snapshots to figure out the behavior of the MDL driver.
The G4 extension has of course been updated with a new "mdl" command to select the parameters. The internal configuration mechanism has been modified and I hope there is no remaining bug here. As far as I can test and see, the messenger behaves properly but one never knows.

It is now possible to force all particles of a given type in the original BxDecay0 generated event to be emitted in the requested emission cone. The cone is specified by its longitude (first param) then colatitude (2nd params) and finally its (demi-)angle of aperture. All angles are given in degrees in the G4 interface (the conversion is automatically done in the MDFL driver internally).

The supported particle types are: "all", "*", "e+", "positron", "e-", "electron", "g", "gamma", "a", "alpha", "n", "neutron", "p" and "proton". The rank of the particle is an integer:

  • Use 0,1,... for target particle mode.
  • Use -1 for rotating all particles of the selected type(s)

Please make a try and report and let me know if it works for you.

Regards
frc

from bxdecay0.

diegoibros avatar diegoibros commented on June 23, 2024

Dear François,

I apologize for the lack of feedback these days, I hadn't been able to try the new tool until now. I can confirm that it works very accurately, I haven't found any bug! The example is also very helpful to understand how it works and the option to include all particles in the decay or only some of them just what I needed. I really thank you for your time and the solution!

However, I have just realized about little problems to apply this tool in my case: first, because of the detector geometry that I am trying to simulate, the solid angle emission in which I am interested is not a cone. It is defined by two angles and it normally has a rectangle form (or when they are equal, square form). I attach a picture of an example I did. I think it wouldn't be a big problem but I have to think how to solve this.

Secondly, the particles are always produced at the origin (0,0,0). This can be a disadvantage in order to implement the Primary Generator in an already existing geometry, as my case is. I am trying to solve it changing somethings in the tool that you just provided, but I just wanted to comment this to see your opinion.

Again, many thanks for your time and the help. It is being very important to improve my simulation!

Best,
Screenshot from 2021-04-28 12-21-54
Screenshot from 2021-05-07 10-52-47

Diego

from bxdecay0.

fmauger avatar fmauger commented on June 23, 2024

test_decay0_generator_mdlr
Dear Diego,

The MDL Post Generation Op has been updated to optionaly support a rectangular cut with two angles of aperture of your choice (see the doc in documentation/PostGenEventOps/MDL/ about the new Geant4 command /bxdecay0/generator/mdlr).

Concerning the position of the vertex, the Geant4 extension already proposes an interface to install your own vertex generator
(by default is was (0,0,0) as you have checked it). I have improved this part and provided the new /bxdecay0/upvg/vertex command to allow users to set an unique arbitrary primary vertex. This interface can be extended to fulfill your specific needs. Please see the extensions/bxdecay0_g4/examples/bxdecay0_g4_ex01 README file and have a look on the UniquePointVertexGeneratorMessenger class if you need to provide you own vertex generator which is pluggable in the BxDecay0/Geant4 PGA.

Let me know if this is still free of bugs (which I hope) and enjoy !

Best regards.
frc

from bxdecay0.

fmauger avatar fmauger commented on June 23, 2024

This new features discussed in this issue are now integrated in BxDecay0 1.0.10.

from bxdecay0.

diegoibros avatar diegoibros commented on June 23, 2024

Dear François,

Sorry for my luck of feedback these days. I really thank you for making the effort to implement new tool in the BxDecay0. I finished some weeks ago my project and the results have been very satisfactory making use of your Primary Generator, which is also very easy to use with the instructions!

I wish you all the best! I will continue learning and using Geant4 :)

Kind regards,

Diego

from bxdecay0.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.