1 // example on using with exteral classes (doxygen page)
5 \page ExtUsagePage Examples with External Packages
7 ### Connection to Linear Algebra classes
9 It is possible to use the Vector and Rotation classes together with the Linear Algebra classes. It is possible to set and get the contents of any 3D or 4D Vector from a Linear Agebra Vector class which implements an iterator or something which behaves like an iterator. For example a pointer to a C array (double *) behaves like an iterator. It is then assumed that the coordinates, like (x,y,z) will be stored contiguosly.
11 <pre>TVectorD r2(N) // %ROOT Linear Algebra Vector containing many vectors
13 v2.SetCoordinates(&r2[INDEX],&r2[index]+3); // construct vector from x=r[INDEX], y=r[INDEX+1], z=r[INDEX+2]
16 To fill a Linear Algebra Vector from a 3D or 4D Vector, with GetCoordinates() one can get the internal coordinate data.
18 <pre>HepVector c(3); // CLHEP Linear algebra vector
19 v2.GetCoordinates(&c[0],&c[index]+3 ) // fill HepVector c with c[0] = x, c[1] = y , c[2] = z
24 <pre>double * data[3];
25 v2.GetCoordinates(data,data+3);
26 TVectorD r1(3,data); // create a new Linear Algebra vector copying the data
29 In the case of transformations, constructor and method to set/get components exist with Linear Algebra matrices. The requisite is that the matrix data are stored, for example in the cse of a LorentzRotation, from (0,0) thru (3,3)
32 LorentzRotation r(m) // create LorentzRotation from matrix m
33 r.GetComponents(m) // fill matrix m with LorentzRotation components
36 ### Connection to Other Vector classes
38 The 3D and 4D vectors of the GenVector package can be constructed and assigned from any Vector, which satisfies the following requisites:
40 * for 3D Vectors and Points must implement the x(), y() ans z() methods
41 * for LorentzVectors must implement the x(), y(), z() and t() methods.
43 <pre>CLHEP::Hep3Vector hv;
44 XYZVector v1(hv); // create 3D Vector from CLHEP 3D Vector
46 HepGeom::Point3D <double>hp;
47 XYZPoint p1(hp); // create a 3D Point from CLHEP geom Point
49 CLHEP::HepLorentzVector hq;
50 XYZTVector q(hq); // create a LorentzVector from CLHEP L.V.</double> </pre>