GetOrigin after a translation

Hey,

I try to get the coordinates of the center of a volume after a TGeoTranslation. But when I use the method GetOrigin it´s always return (0, 0, 0)… I think that GetOrigin return the origin of this volume but before the translation, I mean when it was created around the origin.

[code]
TGeoVolume *myBox = MakeBox(“myBox”, 0, 4, 4, 5 );
SetTopVolume(myBox);

myVolume= new TGeoVolume(“myvolume”, new TGeoBBox(2, 1, 0.5)); //volume is created around the origin

myBox->AddNode(myVolume, 1, new TGeoTranslation(1, 0, 1)); // this volume is translated

// I need the coordinates of the “center” of myBox after the translation

TGeoBBox panBox = (TGeoBBox)(myBox->GetShape());
Double_t OX=(panBox->GetOrigin()) [0];
Double_t OY=(panBox->GetOrigin()) [1];
Double_t OZ=(panBox->GetOrigin()) [2];
cout << " myBox origin " << OX << " " << OY << " " << OZ << endl;[/code]

Any help would be greatly appreciated

Thanks

Hi,

GetOrigin returns the origin coordinates of the local reference frame of the bounding box of any shape/volume. The transformation you use to position this volume just defines the position of the volume frame with respect to its parent. So the behavior you get is normal.

Cheers,

If what you want is to get the coordinates with respect to the mother volume origin, the following seems to work for me:

will show you the TGeoMatrix* used to place this node within its mother volume. Which gets you one level above where you were.

If you want coordinates with respect to the top volume origin, I think you want to get the TGeoHMatrix from the TGeoPhysicalNode. I think here you have to know the path from top to the final volume, e.g. something like “TOP/A_1/B_2”.

Joe