Re: [ROOT] TMatrix

From: Balint Radics (
Date: Thu Sep 23 2004 - 22:12:02 MEST

Hi Rene,

Thanx,but I want to MC-simulate a distribution of hadron showers.Not 
visualize it.So, let's say we have a detected shower at some part of the 
detector.Unfortunately,our detector (at BNL) can give only the projection 
of - let's say - an ellipsoid shower.The shower can be at any angle.So if 
I make an assumption that the spatial shape of the shower is an ellipsoid
I have to rotate it randomly (and make a projection of each) to simulate 
the randomness of the angular distribution of the showers.So,let's say:

for(int i = 0; i<10000000;i++){
	r = gRandom->Rndm();
	phi = 2*Pi*gRandom->Rndm();
	theta = gRandom->Rndm();
//	corrigating back for the shape of the shower 
	point[x] = r*Sin(phi)*Cos(theta);
	point[y] = ...;
	point[z] = ...;
//      rotating randomly
	TMatrix * m = new TMatrix(3,1,m);
	alfa = gRandom->Rndm();
	beta = ...;
	gamma = ...;
	and then project it with let's say the TH3::Project3D() function.


I found that the TGeoRotation class gives you rotational transformational 
matrices if someone gives the rotational angles as an argument.So,I 
thought that with them (and with simple matrix multiplication) one can 
easily randomly rotate each point of the simulated shower.

> I suggest two solutions;
>  -via TPolyMarker3D (see example in tutorial tornado.C
>  -via TNtuple. make a Tree with your variables x,y,z, possibly more
>   to visualize one event (one Tree), do
>     ntuple.Draw("x:y:z","may be a cut (or cuts)")
>   This will produce a 3-d scatter plot that you can rotate interactively or via
>    the OpenGL viewer (in 4.01/02)

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