Skip to content
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

fix: geant4 transform conversion #3038

Merged

Conversation

asalzburger
Copy link
Contributor

@asalzburger asalzburger commented Mar 15, 2024

When translating the NA60+ gdml file, we notices a sign flip between Geant4 physical volume and Acts translated volume in global space.

This PR introuces a unit test that reproduces the NA60+ setup in a very limited number, and fixes the transform translation in the Geant4Converter to Acts.

@ssdetlab - I attached this test to your Gdml based Surface Provider test and made sure all your tests run through appropriately, however, might be good to have another look.

@asalzburger asalzburger added this to the next milestone Mar 15, 2024
@github-actions github-actions bot added the Component - Plugins Affects one or more Plugins label Mar 15, 2024
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.83%. Comparing base (49e815c) to head (a9a776c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3038   +/-   ##
=======================================
  Coverage   48.83%   48.83%           
=======================================
  Files         491      491           
  Lines       28889    28889           
  Branches    13711    13711           
=======================================
  Hits        14107    14107           
  Misses       4956     4956           
  Partials     9826     9826           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ssdetlab
Copy link
Contributor

Shouldn't we merge the #3025 first, as it changes the interface of the Geant4SurfaceProvider a bit?

@kodiakhq kodiakhq bot merged commit 44dd2ab into acts-project:main Mar 18, 2024
54 checks passed
dimitra97 pushed a commit to dimitra97/acts that referenced this pull request Mar 19, 2024
When translating the `NA60+` gdml file, we notices a sign flip between Geant4 physical volume and Acts translated volume in global space.

This PR introuces a unit test that reproduces the NA60+ setup in a very limited number, and fixes the transform translation in the `Geant4Converter` to Acts.

@ssdetlab - I attached this test to your Gdml based Surface Provider test and made sure all your tests run through appropriately, however, might be good to have another look.
@paulgessinger paulgessinger modified the milestones: next, v33.1.0 Mar 26, 2024
kodiakhq bot pushed a commit that referenced this pull request Apr 2, 2024
This PR addresses the issue raised in #3042 and #3038.

The underlying problem in both cases stemmed from the fact that the `Geant4DetectorSurfaceFactory` did not respect the Geant4 transformation relations between the mother and the daughter volumes. 

For example, in the picture below the `Blue` volume is the daughter of the `Red` volume and the `Red` volume is the daughter of the `Magenta` volume. The `Green` volume is the daughter of the `World` and its transformation is the composition of the `Magenta`, `Red`, and `Blue` volume transformations implemented as it is currently done in the `Geant4DetectorSurfaceFactory`. If the composition is realized correctly, the `Green` volume should completely overlap the `Blue` one, which is not the case here.  
![bad_conversion](https://github.com/acts-project/acts/assets/113530373/10f661c7-6592-4a38-8915-fad610db74b5)

The changes introduced here: 

a) Fix the transform composition in the `Geant4DetectorSurfaceFactory`;
b) Fix the transformation conversion in the `Geant4Converters` so that the Geant4 rotation/translation order (first the daughter is translated with respect to the mother-volume frame and then rotated) is respected;
c) Remove the unnecessary transposition of the rotation matrix in the `Geant4Converters` that resulted in the wrong normal direction of the converted surface.
d) Add a Unit Test that will insure the correct conversion. 

With the new composition applied this is how the picture from above changes (i.e. we see the complete overlap):    
![good_conversion](https://github.com/acts-project/acts/assets/113530373/91baddec-23cf-47fb-afde-dba193635ce4)

And this is how it looks inside Acts:
![good_conversion_acts](https://github.com/acts-project/acts/assets/113530373/c5d095ba-42d3-441f-bf81-f721b6df504c)

Using the opportunity, I'd like to raise a question of the convention for the rotation/translation order inside the Acts codebase, as it looks like right now there are no strict guidelines, which may be pretty confusing.
Ragansu pushed a commit to Ragansu/acts that referenced this pull request Apr 19, 2024
This PR addresses the issue raised in acts-project#3042 and acts-project#3038.

The underlying problem in both cases stemmed from the fact that the `Geant4DetectorSurfaceFactory` did not respect the Geant4 transformation relations between the mother and the daughter volumes. 

For example, in the picture below the `Blue` volume is the daughter of the `Red` volume and the `Red` volume is the daughter of the `Magenta` volume. The `Green` volume is the daughter of the `World` and its transformation is the composition of the `Magenta`, `Red`, and `Blue` volume transformations implemented as it is currently done in the `Geant4DetectorSurfaceFactory`. If the composition is realized correctly, the `Green` volume should completely overlap the `Blue` one, which is not the case here.  
![bad_conversion](https://github.com/acts-project/acts/assets/113530373/10f661c7-6592-4a38-8915-fad610db74b5)

The changes introduced here: 

a) Fix the transform composition in the `Geant4DetectorSurfaceFactory`;
b) Fix the transformation conversion in the `Geant4Converters` so that the Geant4 rotation/translation order (first the daughter is translated with respect to the mother-volume frame and then rotated) is respected;
c) Remove the unnecessary transposition of the rotation matrix in the `Geant4Converters` that resulted in the wrong normal direction of the converted surface.
d) Add a Unit Test that will insure the correct conversion. 

With the new composition applied this is how the picture from above changes (i.e. we see the complete overlap):    
![good_conversion](https://github.com/acts-project/acts/assets/113530373/91baddec-23cf-47fb-afde-dba193635ce4)

And this is how it looks inside Acts:
![good_conversion_acts](https://github.com/acts-project/acts/assets/113530373/c5d095ba-42d3-441f-bf81-f721b6df504c)

Using the opportunity, I'd like to raise a question of the convention for the rotation/translation order inside the Acts codebase, as it looks like right now there are no strict guidelines, which may be pretty confusing.
EleniXoch pushed a commit to EleniXoch/acts that referenced this pull request May 6, 2024
When translating the `NA60+` gdml file, we notices a sign flip between Geant4 physical volume and Acts translated volume in global space.

This PR introuces a unit test that reproduces the NA60+ setup in a very limited number, and fixes the transform translation in the `Geant4Converter` to Acts.

@ssdetlab - I attached this test to your Gdml based Surface Provider test and made sure all your tests run through appropriately, however, might be good to have another look.
EleniXoch pushed a commit to EleniXoch/acts that referenced this pull request May 6, 2024
This PR addresses the issue raised in acts-project#3042 and acts-project#3038.

The underlying problem in both cases stemmed from the fact that the `Geant4DetectorSurfaceFactory` did not respect the Geant4 transformation relations between the mother and the daughter volumes. 

For example, in the picture below the `Blue` volume is the daughter of the `Red` volume and the `Red` volume is the daughter of the `Magenta` volume. The `Green` volume is the daughter of the `World` and its transformation is the composition of the `Magenta`, `Red`, and `Blue` volume transformations implemented as it is currently done in the `Geant4DetectorSurfaceFactory`. If the composition is realized correctly, the `Green` volume should completely overlap the `Blue` one, which is not the case here.  
![bad_conversion](https://github.com/acts-project/acts/assets/113530373/10f661c7-6592-4a38-8915-fad610db74b5)

The changes introduced here: 

a) Fix the transform composition in the `Geant4DetectorSurfaceFactory`;
b) Fix the transformation conversion in the `Geant4Converters` so that the Geant4 rotation/translation order (first the daughter is translated with respect to the mother-volume frame and then rotated) is respected;
c) Remove the unnecessary transposition of the rotation matrix in the `Geant4Converters` that resulted in the wrong normal direction of the converted surface.
d) Add a Unit Test that will insure the correct conversion. 

With the new composition applied this is how the picture from above changes (i.e. we see the complete overlap):    
![good_conversion](https://github.com/acts-project/acts/assets/113530373/91baddec-23cf-47fb-afde-dba193635ce4)

And this is how it looks inside Acts:
![good_conversion_acts](https://github.com/acts-project/acts/assets/113530373/c5d095ba-42d3-441f-bf81-f721b6df504c)

Using the opportunity, I'd like to raise a question of the convention for the rotation/translation order inside the Acts codebase, as it looks like right now there are no strict guidelines, which may be pretty confusing.
asalzburger added a commit to asalzburger/acts that referenced this pull request May 21, 2024
When translating the `NA60+` gdml file, we notices a sign flip between Geant4 physical volume and Acts translated volume in global space.

This PR introuces a unit test that reproduces the NA60+ setup in a very limited number, and fixes the transform translation in the `Geant4Converter` to Acts.

@ssdetlab - I attached this test to your Gdml based Surface Provider test and made sure all your tests run through appropriately, however, might be good to have another look.
asalzburger pushed a commit to asalzburger/acts that referenced this pull request May 21, 2024
This PR addresses the issue raised in acts-project#3042 and acts-project#3038.

The underlying problem in both cases stemmed from the fact that the `Geant4DetectorSurfaceFactory` did not respect the Geant4 transformation relations between the mother and the daughter volumes. 

For example, in the picture below the `Blue` volume is the daughter of the `Red` volume and the `Red` volume is the daughter of the `Magenta` volume. The `Green` volume is the daughter of the `World` and its transformation is the composition of the `Magenta`, `Red`, and `Blue` volume transformations implemented as it is currently done in the `Geant4DetectorSurfaceFactory`. If the composition is realized correctly, the `Green` volume should completely overlap the `Blue` one, which is not the case here.  
![bad_conversion](https://github.com/acts-project/acts/assets/113530373/10f661c7-6592-4a38-8915-fad610db74b5)

The changes introduced here: 

a) Fix the transform composition in the `Geant4DetectorSurfaceFactory`;
b) Fix the transformation conversion in the `Geant4Converters` so that the Geant4 rotation/translation order (first the daughter is translated with respect to the mother-volume frame and then rotated) is respected;
c) Remove the unnecessary transposition of the rotation matrix in the `Geant4Converters` that resulted in the wrong normal direction of the converted surface.
d) Add a Unit Test that will insure the correct conversion. 

With the new composition applied this is how the picture from above changes (i.e. we see the complete overlap):    
![good_conversion](https://github.com/acts-project/acts/assets/113530373/91baddec-23cf-47fb-afde-dba193635ce4)

And this is how it looks inside Acts:
![good_conversion_acts](https://github.com/acts-project/acts/assets/113530373/c5d095ba-42d3-441f-bf81-f721b6df504c)

Using the opportunity, I'd like to raise a question of the convention for the rotation/translation order inside the Acts codebase, as it looks like right now there are no strict guidelines, which may be pretty confusing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Plugins Affects one or more Plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants