How to use TGeoMatrix?

I need to rotate a solid (TGeoVolume) with the TGeoMatrix, but I have not understand how is possible to do this. I have tried with the Example 1 of the chapter 16 of the User Manual.
In the root documentation I have found only an example of rotation with the TView class, but I would like to rotate the solid, not the view.

Thank you very much
Best regards
Andrea Bulgarelli

Hi Andrea,

First you have to pick the appropriate type of TGeoMatrix (TGeoMatrix itself is an abstract class):
TGeoTranslation - for pure translations
TGeoRotation - for pure rotations
TGeoCombiTrans/TGeoHMatrix - for translation + rotation

Look at at pages 328-331 on how to define them. To actually rotate the volume you have to position it into some other container volume:

TGeoVolume *top = gGeoManager->MakeBox("TOP", ptrMedium, 1000,1000,1000);
TGeoRotation *rot = new TGeoRotation();
rot->RotateZ(phi);  // there are several other ways to do it
// position your volume like this:
top->AddNode(myVol, 1, rot);

The volume myVol will be now rotated with phi degrees by the Z axis of TOP.