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

materialScan is not adapted for USE_GEANT4_UNITS #1163

Closed
atolosadelgado opened this issue Aug 28, 2023 · 6 comments
Closed

materialScan is not adapted for USE_GEANT4_UNITS #1163

atolosadelgado opened this issue Aug 28, 2023 · 6 comments
Labels
bug Fixed Problem is solved Testing

Comments

@atolosadelgado
Copy link
Contributor

  • OS version: Alma9
  • Compiler version: gcc 11.3
  • Package version: 1.26
  • Goal: distance in proper units

To reproduce the issue, you can load any detector and check distances. This should create a box of 19x19x19 cm3, in a world 30cm x 30cm x 30cm.

git clone https://github.com/atolosadelgado/dd4hep_cube.git
cd dd4hep_cube/
cmake -B build -S . -D CMAKE_INSTALL_PREFIX=install
cmake --build build -- install
export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH
geoDisplay compact/simple_detector.xml 
materialScan ./compact/simple_detector.xml 0 0 300 0 0 -300

I think the units are in mm, but it is written cm. Also, if I remember correctly, the expected output with older versions of DD4hep would be Air-Material-Air when doing this, not Air-Material.

Thank you for your time :)
Alvaro

@andresailer
Copy link
Member

andresailer commented Aug 28, 2023

  • How do you build Dd4hep?
  • Why do you think distances are in mm?
  • What output do you get?

Edit: more questions

@atolosadelgado
Copy link
Contributor Author

Hi,

I have attached the cmake cache file of my local DD4hep
CMakeCache.txt

I enabled the build option USE GEANT4 UNITS, maybe it is the problem?

I know that the units are shown in mm and not in cm (as it is said in the output of materialScan) because I build the geometry.

This is the output of materialScan:

$ materialScan ./compact/simple_detector.xml 0 0 300 0 0 -300
DD4hep           WARN  ++ STD conditions NOT defined by client. NTP defaults taken.
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 + Material scan between: x_0 = (   0.00,   0.00, 300.00) [cm] and x_1 = (   0.00,   0.00,-300.00) [cm] : 
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 |     \   Material           Atomic                 Radiation   Interaction               Path   Integrated  Integrated    Material
 | Num. \  Name          Number/Z   Mass/A  Density    Length       Length    Thickness   Length      X0        Lambda      Endpoint  
 | Layer \                        [g/mole]  [g/cm3]     [cm]        [cm]          [cm]      [cm]     [cm]        [cm]     (     cm,     cm,     cm)
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 |     1 Air                    7   14.784   0.0012      305288       719982    205.000   205.00    0.000671    0.000285  (   0.00,   0.00,  95.00)
 |     2 Silicon               14   28.085   2.3300     93.6608     457.5312    190.000   395.00    2.029268    0.415557  (   0.00,   0.00, -95.00)
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 |     0 Average Material      14   28.071   1.1214    194.6515     950.5316    395.000   395.00    2.029268    0.415557  (   0.00,   0.00, -95.00)
 +--------------------------------------------------------------------------------------------------------------------------------------------------

This is the line which defines the box of silicon (it is the only volume),

  Box siSolid(19 * cm / 2.,
              19 * cm / 2.,
              19 * cm / 2.);

Thank you for your time
Alvaro

@andresailer
Copy link
Member

andresailer commented Aug 28, 2023

USE_GEANT4_UNITS

Yes, that turns the units from cm to mm, but the output of the materialScan command has not been changed to switch when this GEANT4_UNITS flag is turned on.

@atolosadelgado
Copy link
Contributor Author

atolosadelgado commented Aug 28, 2023

I have recompiled without that flag and it is back to normal. Shall we close the issue?

Thank you for your time!!

@andresailer
Copy link
Member

we should fix the printouts of the materialScan command when GEANT4_UNITS is on

@andresailer andresailer changed the title materialScan gives now distances in mm? materialScan is not adapted for USE_GEANT4_UNITS Sep 1, 2023
@MarkusFrankATcernch MarkusFrankATcernch added Testing Fixed Problem is solved labels Jan 15, 2024
@MarkusFrankATcernch
Copy link
Contributor

@atolosadelgado Hi Alvaro,
I updated the materialscan. Could you please verify if this is correct ?
I also added the changes of materials to the output (G4 units):

$ materialScan checkout/examples/ClientTests/compact/SiliconBlock.xml -30 0 0 30 0 0
DD4hep           WARN  ++ STD conditions NOT defined by client. NTP defaults taken.
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 + Material scan between: x_0 = (-300.00,   0.00,   0.00) [cm] and x_1 = ( 300.00,   0.00,   0.00) [cm] : 
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 |       \   Material                  Atomic               Radiation   Interaction               Path   Integrated  Integrated    Material
 | Num.   \  Name               Number/Z   Mass/A  Density    Length       Length    Thickness   Length      X0        Lambda      Endpoint/Startpoint
 | Layer   \                             [g/mole]  [g/cm3]     [cm]        [cm]          [cm]      [cm]     [cm]        [cm]     (     cm,     cm,     cm)
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 | (start) Air                         7   14.784   0.0012     30528.8      71998.2      0.000     0.00    0.000000    0.000000  ( -30.00,   0.00,   0.00)
 |       1 Air -> Silicon             14   28.085   2.3300     9.36608      45.7531     23.000    23.00    0.000753    0.000319  (  -7.00,   0.00,   0.00)
 |       2 Silicon -> Air              7   14.784   0.0012  30528.8407   71998.1725      6.000    29.00    0.641363    0.131458  (  -1.00,   0.00,   0.00)
 |       3 Air -> Silicon             14   28.085   2.3300     9.36608      45.7531      2.000    31.00    0.641428    0.131486  (   1.00,   0.00,   0.00)
 |       4 Silicon -> Air              7   14.784   0.0012  30528.8407   71998.1725      6.000    37.00    1.282037    0.262624  (   7.00,   0.00,   0.00)
 |   (end) Air                         7   14.784   0.0012     30528.8      71998.2      0.000     0.00    0.000000    0.000000  ( -30.00,   0.00,   0.00)
 +--------------------------------------------------------------------------------------------------------------------------------------------------
 |         Average Material           14   28.034   0.4670     46.7730     228.1856     60.000    60.00    1.282791    0.262944  (  30.00,   0.00,   0.00)
 +--------------------------------------------------------------------------------------------------------------------------------------------------

for TGeo units I get the same output. All input lengths are in [cm] regardless of the compilation mode:

$ materialScan 
 usage: materialScan compact.xml x0 y0 z0 x1 y1 z1 [-interactive]
 or:    materialScan compact.xml -interactive
        -> prints the materials on a straight line between the two given points (unit is cm) 
        -interactive   Load geometry once, then allow for shots from the ROOT prompt
 NOTE:  ALL lengths in units of [cm]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixed Problem is solved Testing
Projects
None yet
Development

No branches or pull requests

3 participants