Re: [ROOT] TMatrix

From: Balint Radics (radbal@pegazus.phys.klte.hu)
Date: Fri Sep 24 2004 - 16:42:53 MEST


Dear All,

Thanx,I managed to that! :)

b.


On Fri, 24 Sep 2004, Andrei Gheata wrote:

> Hi Balint,
> 
> You can use TGeoMatrix classes from /geom :
> 
> void rotate()
> {
>     Double_t master[3], local[3];
> 
>     // rotation using Euler angles (see 
> ftp://root.cern.ch/root/doc/chapter16.pdf)
>     TGeoRotation m1("m1", 45, 0, 90);
> 
>     // rotation using GEANT3-like angles (e.g theta/phi angles of each 
> axis of the rotated fram w.r.t. the original)
>     TGeoRotation m2("m2", 90,90,90,180,0,0);
> 
>     // translation
>     TGeoTranslation t1(10,20,30);
> 
>     // rotation + translation
>     TGeoCombiTrans c1(t1,m1);
> 
>     // or directly
>     TGeoRotation r; // creating an identity rotation
>     r.RotateX(45); // RotateY/Z also work
> 
>     // Then rotate your points:   MASTER = ROT * LOCAL
>     r.LocalToMaster(local, master); // direct rotation
>     r.MasterToLocal(master,local);  // inverse rotation
> }
> 
> Regards,
> Andrei
> 
> Balint Radics wrote:
> > Hello,
> > 
> > I would like to rotate set of points (x,y,z) in 3D. Which class should I 
> > use to do that?I didn't find any rotational functions in the TMatrix class.
> > I found general transformational functions only in the TGeoMatrix classes 
> > but that belongs to the detector geometry classes,don't they?
> > Or maybe I am wrong.
> > And do you have little example scripts for matrix transformation?
> > I mean general rotation or translation functions.Like:
> > 
> >  m = new TMatrix(3,1,elements);
> >  m->Rotate(phi,theta);	
> > 
> > etc....
> > 
> > I am trying to MC-simulate ellipsoid showers of hadrons in a detector...
> > 
> > Thanx in advance,
> > 
> > radbal
> > 
> 
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET