Hello,
I am hoping to get some help with applying a global coordinate transformation to a gdml file.
For context, my MC and reconstruction software have differing coordinate systems. The gdml file is produced in the MC coordinate system (via G4GDMLParser), when it needs to be in the other coordinate system.
I wish to apply the transformation (x,y,z)->(-z,y,x) and preferably save the output as another gdml file.
Is there any means to do this via ROOT? Can this be done via TGeoManager? If so, is there any insight as to how to do this?
Appreciate any help,
Kind regards,
Charlie
ROOT Version: 6.22
Platform: Ubuntu 20.04
Compiler: cmake 3.16.3
Hi @Chuggles ,
welcome to the ROOT forum and sorry for the late reply, @agheata might be able to help.
Cheers,
Enrico
Hi, you can try something like:
TGeoRotation world_rot("rot", 90, -90, -90);
auto top = gGeoManager->GetTopVolume();
TIter next1(top->GetNodes());
TGeoNodeMatrix *node;
while ((node = (TGeoNodeMatrix*)next1())) {
auto m = new TGeoHMatrix(world_rot);
m->Multiply(node->GetMatrix());
node->SetMatrix(m);
}
gGeoManager->Export("geom.gdml");
Not sure I got the Euler angles right. Note that this will not rotate the top volume, but just the content at the first level.
Thank you and @eguiraud very much for getting back to me.
This is exactly what I needed, thank you.