TGeoManager units

Hello,

Switching to v 6.24 from 6.22 I’ve found that TGeoManager related classes/functions assume
[mm] as units of coordinates/length.
In versions <= 6.22 it was [cm].
TGeoManager::GetDefaultUnits() returns “0” (kG4Units) for both ROOT versions.

What was a reason to change default and how to know which units TGeoManager expects?

Regards
Sergei


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.24
Platform: CentOS 7
Compiler: g++ 10.1.0


Hi Sergei,

The G4 units were made default to avoid problems in GDML conversions. Units are relevant mainly in conversions. TGeo does not “expect” any units, i,e these are only relevant for the clients reading numbers from the geometry.

Thank you for you reply.

I also was sure, that TGeoManager “do not knows” about units assumed in GDML. But seems it’s not the case. Here is my example of ROOT script showing that access to GDML in v6.24 gives different results than in previous versions:

#include "TGeoManager.h"
void test_gdml()
{
  TGeoManager::Import("NA66_DY_Geometry.gdml");

  double x = 0; double y =0; double z = 0;
  gGeoManager->InitTrack(x, y, z, 1., 0., 0.);
  TGeoMaterial* cmat = gGeoManager->GetCurrentVolume()->GetMedium()->GetMaterial();
  cout<<"Interaction Length at "<<x<<"  "<<y<<"  "<<z<<"  = " <<cmat->GetIntLen()<<endl;
  
  x = 10; y = 10; z = 10;
  gGeoManager->InitTrack(x, y, z, 1., 0., 0.);
  cmat = gGeoManager->GetCurrentVolume()->GetMedium()->GetMaterial();
  cout<<"Interaction Length at "<<x<<"  "<<y<<"  "<<z<<" = " <<cmat->GetIntLen()<<endl;

  x = 100; y = 100; z = 100;
  gGeoManager->InitTrack(x, y, z, 1., 0., 0.);
  cmat = gGeoManager->GetCurrentVolume()->GetMedium()->GetMaterial();
  cout<<"Interaction Length at "<<x<<"  "<<y<<"  "<<z<<" = " <<cmat->GetIntLen()<<endl;
}

This script prints:
Interaction Length at 0 0 0 = 1.03056
Interaction Length at 10 10 10 = 1.03056
Interaction Length at 100 100 100 = 3.88767
if I run it in v. 6.24/00
and
Interaction Length at 0 0 0 = 10.3056
Interaction Length at 10 10 10 = 38.8767
Interaction Length at 100 100 100 = 41.2467
in v 6.22/06 and in v 6.10/06

Regards
Sergei

Thank you for pointing to this very useful discussion.
But my case is not really similar: interpretations of the same gdml file with different ROOT versions give different results.

Regards
Sergei

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.