Objects differentiation

Respected @horvathd,
I would be greatly thankful to you if you can open the following query again one last time ( Photon backscattering depth measurement and modifying angular distribution graph)

Respected @jemancza,
I am really thankful to you for your valuable suggestions and help it sorted out most part of my problem. However, I have one last query before this section can be closed. this query is related to the identification of objects inside a box filled with water. For clarification i am attaching the geometry sample here,
Screenshot from 2024-08-09 18-19-40
Here I have two materials e.g., TNT, and PMMA both are of different shapes and are inside the polyethylene box filled with water. What I want is that when I will irradiate the both objects and plot the scored coordinated both objects should be clearly differentiate able from one another based on their geometry. This is true when I did this without box and water filling where upon plotting both objects depicted the exact geometry as they had in flair interface. But problem arises when I enclosed them in the box filled with water. here is what I am getting

To do this what I am doing is that scoring the interactions happens inside the Targets (TARGET and TARGET1, one by one irradiation ) using USDRAW and stupre.f and in BXDRAW scoring the photons from the outerwall of the box into the air. For now I just irradiate the objects from one point which was at (0, 1,9) for TNT and (0,-1,9) for PMMA.
Moreover, I want to irradiate the object from multiple points (e.g., z=9, y=4,3,2,1,0,-1,-2,-3,-4) and want that it will be done in a single run rather than running multiple time over and over. For this I know that preprocessors, loop variables, etc., can be used for this purpose, but they are time and space-consuming, and each method generates separate files for each position/run. I would like to accomplish this in a single run with minimal CPU time and disk space. So, is there another way to do so? for this purpose can beamspot, and SPECSOUR be used?
I would be very thankful to you for your valuable suggestions
Sincerely,

Hi Abdul,

Let me start with the object separation in your scoring. You didn’t specify what is the quantity that you are trying to score, but in general whether you are able to distinguish your objects depends on material properties of the given objects. For example, the materials that you are using in your simulation have fairly similar density so it could be that they will not be clearly separated in your scoring.

About irradiation from different points in a single run - you have a very comprehensive presentation from the last FLUKA beginner’s course about the options to customize your source using built-in cards:

You should be able set up the source the way you described using the instructions from the above presentation.

ALTERNATIVELY

You can do this also with the source.f user routine or a more user friendly source_newgen.f:
https://flukafiles.web.cern.ch/manual/chapters/user_routines/user_routines/source.html
https://flukafiles.web.cern.ch/manual/chapters/user_routines/user_routines/source_newgen.html

What you have to do is randomize your beam position (keeping in mind that they direction will have to change accordingly) using for example a uniform distribution. To understand better how this works, I suggest you have a look at another presentation from the beginner’s course:

I hope that helps!
Best regards,
Jerzy

Respected Jerzy,

I am working on scoring the backscatter photons across the entire geometry, specifically targeting Compton-scattered photons influenced by material density. We had discussion in the following post ( Photon backscattering depth measurement and modifying angular distribution graph).
The goal is to clearly differentiate between the materials and object shapes, as I have successfully done in this case.

image
Here I had two objects same as asked in question one was carbon where as one was Copper but were not enclosed inside a box.

However, the objects should still be distinguishable based on their shapes and materials. In another example, I used concrete with rebar reinforcement inside it, but I was unable to reconstruct the entire geometry from the backscatter photons. Additionally, the steel rebars were not detected in the backscatter photons.


for this geometry was like this
Screenshot from 2024-08-22 16-49-53

In another example, I had a wall composed of different layers such as concrete, soil, and paint. I set the conditions like this: (IF(NRGNAM .EQ. "AIR" .AND. MRGNAM.EQ."TARGET" .OR. MRGNAM.EQ."soil" .OR. MRGNAM.EQ."paint" )). The results I obtained seemed reasonable, but I’m uncertain if the condition was correctly set. I also modified the MRGNAM in both USDRAW and stupre.f.

The three layers were clearly distinguishable: the first from -2 to -1, the second from 0 to 1, and the final one from 0 to 2, based on both density and geometry, as shown.

Screenshot from 2024-08-22 16-46-55

I am attaching my input files and routines with this email for the original question I asked.

wk1025-mgdraww.flair (7.8 KB)
mgdraw_bdx_C2.f (7.2 KB)
stupre.f (4.1 KB)

Thank you for your help, but I’ve set this up.

Respected @jemancza
I have tried various ways but I am not able to succeed in getting the desirable results. I need your kind suggestions on this problem.
Thank you

Hi Abdul,

Sorry I was quite busy the other week. Let me look at your problem again and hopefully we will find a way to solve it.

Cheers,
Jerzy

Respected @jemancza
Thank you very much.

Hi Abdul,

I was checking your the files that you attached and I don’t think the routines are working correctly for your case. You have to change the condition to account for various target regions. For example in stupre.f there is:

      IF(LTRACK.EQ.1 .AND. MRGNAM.EQ."TARGET" ) THEN
	 PRIMER = .TRUE.
      ELSE 
	 PRIMER = .FALSE.
      END IF

Where the backscattering vertex is propagated only when the interaction happens in the region called TARGET. Your regions assigned to different materials have different names. The same applies to ScatteredPhotons and DetectedPhotons. Also, in DetectedPhotons, I don’t quite understand what you are trying to achieve with this condition:
IF(NRGNAM .EQ. "AIR" .AND. MRGNAM.EQ."TARGET") TFLAG = .TRUE.
It will save the photons which appear on the border between the region TARGET and the region AIR (crossing in one direction). This, by the definition of your geometry, will always end up empty as TARGET and AIR do not touch.
Now, even if you are actually setting the BXDRAW between the outer wall of your box and the air, I still don’t understand what do you want to extract from this information? It will not tell you anything about what happened inside.

What I would like to know is what is the output file and the exact routine that you are using to produce the files with photon coordinates which you then use for the 3D plots. Before, we were just talking about the depth in Z of the backscattered photons, but you are obviously taking also the X and Y from somewhere. I deduce that you are using the output from USRDRW would be fine, but it does not explain how are you getting all this spread in X and Y.

If you are scoring photon fluence within a given volume with your USRBIN, most of the photons will be coming from electromagnetic showers and again, I am not sure what kind of information are you looking for in there. With your setup you will not be able to detect most of these photons.

If you want me to help you, you really need to me more precise. Maybe try to focus on a single example and one problem at a time.

Concerning our previous discussion, what I think you are looking for is whether you are able to distinguish different materials given the backscattered photon depth. And I think that yes, it’s possible, but I don’t know really how much the materials have to differ to see a clear separation. Still, you can get a 3D image by setting your source to be a uniform two-dimensional plane rather than a single point.

Best regards,
Jerzy

Respected @jemancza
I was anxiously waiting for you reply and thank you for your considerations.

I even tried using different conditions, but they didn’t work either. Later on, I realized that it was incorrect.

I scored the X and Y spread in BXDRAW and then intersected the ScatteredPhotons and DetectedPhotons files based on common NCASE and those values were used to plot the X Y and Z coordinates.

I will try to explain everything here. My goal is to detect and visualize backscatter photons from different layers of materials. For example, in archaeology, where painted walls have layers of various materials like soil, concrete, and paint, I aim to use backscatter photons to create 3D imaging of those layers (which is the objective of this project, a 3D X-ray backscatter). Since each layer consists of different materials with varying densities, backscatter photons should help visualize each layer. For instance, I want to start with a simple geometry that includes three layers: concrete, soil, and paint. By using backscatter photons, I aim to differentiate each material layer. Additionally, I want to detect any voids or cracks that might be present in these layers.
Screenshot from 2024-08-22 16-46-55

Yes, regardless of how many materials or different regions are present, the backscatter photons should be able to differentiate them all. No doubt, the energy will determine the depth.

The contrast depends on the differences in density and atomic number of the materials, as well as the energy of the backscatter photons. Greater differences in these properties will typically result in more distinct separation, but fine-tuning may be needed for optimal results.
If I haven’t made anything clear, please let me know. Thank you for your consideration.
I had attached the input files herewith
wk1025-mgdraw.flair (8.0 KB)
wk1025-mgdraw.inp (8.3 KB)
mysource_ng1.f (19.0 KB)
spectrum01.txt (18.7 KB)
stupre.f (4.2 KB)
mgdraw_bdx_C2.f (7.3 KB)

Respected @jemancza,
I am also interested in determining the thickness of each layer, which can only be accurately achieved by plotting the results in 3D. In this plot, each layer will be represented differently based on the material densities and the corresponding backscatter photon counts. For instance, in the described geometry with three distinct layers, I need simulation results that allow each layer to be clearly distinguishable and visually differentiated according to the backscatter count rate.
I’m looking forward to your response.
Sincerely,
Abdul Muneeb

Respected @jemancza,
I have tried various ways but I am not able to succeed in getting the desirable results. I need your kind suggestions on this problem.
Thank you

Respected @jemancza,
I tried by changing the conditions as mentioned in the following usrroutines. I now I got results like this


using the following routines
mgdraw_bdx_C2.f (7.5 KB)
stupre.f (4.2 KB)
is it the right way or need more corrections?
moreover I am still struggling with this.

the above plotted data is using the following input files

waiting for your response thanks

Dear user,

I’d like to step in on this thread with some general comments about it.

It contains two main questions:
1-why your user routines do not work as expected
2-how can the results of the simulations be used for your scientific goals

I believe that @jemancza has answered the first point.

Concerning the second point, I would say that it falls outside the scope of this forum, which is to provide technical support and guidance. How to interpret the results to understand what material is being irradiated is not a FLUKA related question but a more general question about detector development. I would suggest to look in literature for guidance on this matter.

Respected @amario
Yes I agree that this forum is primarily for technical guidance related to FLUKA, and I believe my question aligns with these guidelines. In my previous post, I was simply seeking confirmation on whether the conditions I applied in mgdraw and stupre were correct for the input files I had provided.

My routines were functioning, but they weren’t properly scoring the photons from different regions, which was the issue I was seeking guidance on.

If I’ve overlooked any forum rules, I sincerely apologize and would be grateful for your understanding.