Error in results of Rotate USRBIN

Dear Experts,
I put a USRBIN as a detector for detecting electron position. I simulated the electron source (primary particle) as the pin source that passes a magnetic field that bends the beam.
I put a USRBIN around 140cm after the magnetic field.
I compare two scenarios :
1-USRBIN without rotating ( I put Polar=0 in ROT-DEFI )
2-USRBIN with rotating ( I put Polar=45 in ROT-DEFI )
I expect the position of maxima to be different for two scenarios but both of them are the same.
I check this scenario for several energies but this problem remains.
how can I handle this problem?

Best regards,

Please, share your flair file and all the routines you’re using (if any)

Dear @amario
This is my file:
lanex4.flair (3.5 KB)
As you see I try to define two USRBIN.
for 4 GeV electron beam: the Fluka returns 443.2cm as the max position for lanex4(for 0 degrees and 45 degrees) but it is incorrect.

Dear @rezaei.m.p,

You are trying to transform your USRBIN using $start_transform. This instruction can be applied only to bodies.
If you want to apply a rotation to a USRBIN, you would have to use a ROTPRBIN instruction.

Thanks @amario
I modified my file
lanex4.flair (4.4 KB)
but I think something is wrong. because my source point is y=448.5 and B(magnetic field) is in the Z direction.
The maximum point on the detector when the degree of rotation is zero:y=445.5 and for 45-degree y is 447.9 and this is wrong because when I rotate my detector this part go farther from the source so the point of hitting on the detector must be lower than 445.5 but now is a bigger
hint: The direction of movement of the electron beam is opposite to the y-axis

Dear @amario
I tested this scenario by the neutron source and as the electric charge =0 so the magnet can not change the direction but I see USRBIN return y=452 for the maximum point but I think It must be return y=448.5 .
I am so confuse about the concept of rotation for this simulation Is it possible look at my file I can not find witch part is wrong or maybe I did not understand this concept.
Best regards

Dear @rezaei.m.p,

There is a fundamental error in your input. The ROT-DEFI cards are within the geometry section, while they should be outside it. As soon as I moved them outside the geometry section (i.e. after the GEOEND card), I could see your lanex screen and the corresponding scoring “Lanex4” rotated by 45 degrees.

Beside this error, I have to say that I don’t understand why you are working with a geometry that is 10 meters away from the origin (your beam starts at x=9.34m, y=448.5m, z=1.38m). While there is nothing wrong with this, I find it strange, because then you have to deal with large numbers rather the small ones you would have locating your geometry in origin or nearby it.

1 Like

Dear @amario
Thanks so much for your reply.
I use this coordinate for the magnet and detector because I need to add several things after confirming this rotation work well.
By the way, I try to solve it in the simplest way I just define a photon beam that propagates in the x-direction and two USRBINs in the same position.

test_rotate_usrbin.flair (2.9 KB)

I rotate 45 degrees a USRBIN around the z-axis.
when I plot 1D projection for two USRBIN in y-direction I expect both of them the same but it is different.

Do you have any recommendations about solve this?

Best regards,

Dear @rezaei.m.p,

What you see makes sense and corresponds to your input.

In the non rotated case, your beam is directed along the x axis with y=0. Therefore, as you can see from the picture, it intercepts the USRBIN mesh at 1 cm from one end and 5 cm from the other.

In the rotated case, the beam has the same definition, but since the USRBIN is rotated, it is impinged upon basically at one end (see picture).


As you mention, logically the position of the beam(y coordinate) on the USRBINs does not change because the beam is the same definition and by this rotating just x coordinate of the incident beam on the USRBINs must change.

My question is why does the maximum of 1D projection in y-direction change by rotating?
Is correct this change?

best regards,

This effect is due to the fact that the two meshes are at an angle.
In the non rotated case, all the particles cross the mesh in a single bin in Z, indeed you have only one point in your plot.
In the rotated case, the particles cross different bins in Z, indeed you have about 20 points in your plot.
Have a look at the scoring lecture to understand better how scoring works.

Dear @amario
As you mention maybe this error is related to two different meshes. I try to solve this error by increase the number of bins (mesh: x=4e-5, y=0.003, z=0.0002) and accuracy(10e-6) in the Geometry card but unfortunately, I cannot solve it.

I think maybe it is not related to mesh because my error is 0.4cm and it is very bigger than my mesh size and in the other hand I wanna use the results of the simulation for scaling the energy in the experimental so this error is very big.

this is my file:
test_rotate_usrbin.flair (3.2 KB)
Do you have any suggestions for solving this?

This is not an error.
In the non-rotated case, the particles cross a mesh cell which appears at 90 degrees and therefore appears thick L.
In the rotated case, the particles cross a mesh cell which appears at 45 degrees and therefore appears thick L*sqrt(2).
The results cannot be the same.

Dear @amario
Thanks so much finally I can find what is mean this number.

when I rotated the USRBIN the Fluka return me distance from zero coordinate in the new coordinate system, not the old one.
By the way, thanks so much to help me to understand this point and now I can solve my problem.
Best Regard