asalzburger / sms2023-flag

0 stars 1 forks source link

Create a t/X0 map for Geant and FLUKA #8

Open asalzburger opened 1 year ago

asalzburger commented 1 year ago

Use the same cylinder source and create

You can upload your results here.

Expand to multi-layer cylinder (and binning)

H4m5t3r commented 1 year ago

fluka_acts_comparison

A plot where the FLUKA plot is from the cylinder that Mika uploaded (cylExampl.txt).

Geant4 in orange and FLUKA in blue.

H4m5t3r commented 1 year ago

fluka_geant4_comparison_conversion

A plot where the FLUKA plot is the converted Geant4 geometry.

Geant4 in orange and FLUKA in blue.

I'm checking if I can find anything that could be causing the strange results.

asalzburger commented 1 year ago

Cool stuff though. I am confident we find the problem.

H4m5t3r commented 1 year ago

Me and Mika had a look at the FLUKA input files generated by pyg4ometry last Friday. The strange results were caused by an error in the definition of the silicon tube and its surroundings. I will check if there is something wrong with the way I defined the geometry in pyg4ometry that could be confusing the converter.

H4m5t3r commented 1 year ago

It seems like I just made a mistake somewhere in my code. After I looked through the code and automated the whole conversion and comparison process the converted Geant4 output values are now exactly the same as in the output from Mika's premade example. So the conversion works.

Geant4_FLUKA_comparison

asalzburger commented 1 year ago

That is excellent, can you expand this to a multi layered cylinder of different materials at next?

H4m5t3r commented 1 year ago

Yes. Any wishes for the materials? And should the silicon be the the outermost or innermost material or is it irrelevant?

H4m5t3r commented 1 year ago

Multiple cylinders and multiple layers implemented. Everything seems normal so far.

Screenshot from 2023-07-24 13-39-29 Screenshot from 2023-07-24 13-39-46

asalzburger commented 1 year ago

Fantastic - does the loop to fluka still work?

H4m5t3r commented 1 year ago

Yes, the loop still works. One thing I noticed is that when the number of layers is increased to over 6 the graphs start to diverge. Should they still be the same? This only seems to happen when the number of layers is increased. The number of cylinders does not affect this.

1 layer 1

6 layers 6

8 layers 8

16 layers 16

asalzburger commented 1 year ago

Interesting, can it be that the cylinders intersect if they are too many?

H4m5t3r commented 1 year ago

Maybe. FLUKA's graphical interface Flair gives warnings that the cylinders are touching each other. Mika mentioned something about that shapes should not be set to start exactly where another shape ends in FLUKA so I can try adding 0.1 between the cylinders and post an update here.

asalzburger commented 1 year ago

Good idea, please keep a thin separation between the cylinders.

H4m5t3r commented 1 year ago

The warnings about that the cylinders are touching are gone after I added a small gap between them, but the divergence still remains. There are still some warnings about that the surrounding space is touching the edges of the cylinders (in FLUKA) so I can try to see if I can make some changes so that all the warnings disappear.

Screenshot from 2023-07-27 14-25-50

asalzburger commented 1 year ago

Could it be that one of the materials is not recognized?

H4m5t3r commented 1 year ago

Fixing the warnings about the polygons touching each other didn't help, so there doesn't seem to be any problem in the conversion process. I tried fixing the warnings manually to see if it would have any effect, but the results were the same.

H4m5t3r commented 1 year ago

It could be something with the materials in the ACTS material recording. When I launch it the beginning it gives warnings about that the materials are referenced before they are declared.

G4GDML: Reading 'silicon_cylinder.gdml'... G4GDML: VALIDATION ERROR! ID attribute 'G4_U' is referenced but was never declared at line: 73 G4GDML: VALIDATION ERROR! ID attribute 'G4_Ag' is referenced but was never declared at line: 73 G4GDML: VALIDATION ERROR! ID attribute 'G4_Au' is referenced but was never declared at line: 73 G4GDML: VALIDATION ERROR! ID attribute 'G4_Si' is referenced but was never declared at line: 73 G4GDML: VALIDATION ERROR! ID attribute 'G4_Galactic' is referenced but was never declared at line: 73 G4GDML: Reading definitions... G4GDML: Reading materials... G4GDML: Reading solids... G4GDML: Reading structure... G4GDML: Reading setup... G4GDML: Reading 'silicon_cylinder.gdml' done!

Is there aything I can do about this?

asalzburger commented 1 year ago

You could in fact do the cross check by hand: the radiation lengths of materials can be obtained from tables, e.g the NIST database. Together with the thickness of the cylinders you can calculate it by hand - the shape comes from the incident angle.

H4m5t3r commented 1 year ago

In the last task "Introduce binning in z/phi as different cylinder (segments)", what is meant by "binning"? I assume the task is just about checking that it is possible to create segments, but I wanted to check this detail.

asalzburger commented 1 year ago

Exactly, basically, with different layers for different material sand segments in z, phi, we can adjust the granularity of the description accordingly.

asalzburger commented 1 year ago

Validation:

Cross-check:

asalzburger commented 1 year ago

Next step afterwards:

H4m5t3r commented 1 year ago

The Geant4 material recordings seem to scale correctly. At higher number of layers the scaling factor seems to become a bit smaller, but it still looks alright. These results were for one material (silicon) with increased layers, but the results also scaled correctly with more materials.

Geant4 1 layer G4_1

Geant4 2 layers G4_2

Geant4 6 layers G4_6

Geant4 16 layers G4_16

Geant4 32 layers G4_32

H4m5t3r commented 1 year ago

In the FLUKA simulations something seems to go wrong with 6+ layers. The results scale correctly for up to 5 layers, but after that the results are just the same as for 5 layers.

FLUKA 1 layer FLUKA_1

FLUKA 2 layers FLUKA_2

FLUKA 2 layers FLUKA_3

FLUKA 4 layers FLUKA_4

FLUKA 5 layers FLUKA_5

FLUKA 6 layers FLUKA_6

FLUKA 16 layers FLUKA_16

FLUKA 32 layers FLUKA_32

H4m5t3r commented 1 year ago

Here are also the results from when 4 different materials (silicon, lithium, aluminium and titanium) were used for the Geant4 material recordings.

Geant4 4 layers 4 materials G4_4_4

Geant4 8 layers 4 materials G4_4_8

Geant4 12 layers 4 materials G4_4_12

Geant4 16 layers 4 materials G4_4_16

Geant4 20 layers 4 materials G4_4_20

asalzburger commented 1 year ago

Is the code/produced files somewhere that I can look at it? I would like to see if there's anything odd with the Fluka conversion.

In particular, I would like to see the cylinder generation in python, to see if our envelope volume is big enough.

asalzburger commented 1 year ago

Also, just to make sure we have checked Mika's concern: if you make n cylinders, can you - as a cross-check - make the additional cylinders at decreasing radius and not increasing ones?

asalzburger commented 1 year ago

Hey @H4m5t3r - looking through your code I see that the FLUKA conversion always uses the GDML file at input - did you try to convert to FLUKA on the fly when you create the Geant4 geometry? Probably the file conversion is the problem for the 6 layer cutoff?

asalzburger commented 1 year ago

Did you check this?