]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added Cylinderical Coordinates for use with Tracking. Fixed a but in the
authornilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Mar 2001 15:21:56 +0000 (15:21 +0000)
committernilsen <nilsen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Mar 2001 15:21:56 +0000 (15:21 +0000)
Streamer, It was not setting a value for frot[3] as it should when reading.

ITS/AliITSgeom.h
ITS/AliITSgeomMatrix.cxx
ITS/AliITSgeomMatrix.h
ITS/ITSLinkDef.h

index 9a145de6b86764bf29bed64b400595700a4a33f0..cba3677275d48460da17516b5fdb5b92202129c9 100644 (file)
@@ -158,6 +158,26 @@ class AliITSgeom : public TObject {
     void  GetTrans(const Int_t lay,const Int_t lad,const Int_t det,
                    Float_t &x,Float_t &y,Float_t &z) {
                    GetTrans(GetModuleIndex(lay,lad,det),x,y,z);}
+//
+    //     This function returns the Cartesian translation for a give
+    // module in the Double array t[3]. The units are
+    // those of the Monte Carlo, generally cm.
+    void  GetTransCyln(const Int_t index,Double_t *t) {
+                   GetGeomMatrix(index)->GetTranslationCylinderical(t);}
+    //     This function returns the Cartesian translation for a give
+    // module index in the three floating point variables provided.
+    // x = fx0, y = fy0, z = fz0. The units are those of the Mont
+    // Carlo, generally cm.
+    void  GetTransCyln(const Int_t index,Float_t &x,Float_t &y,Float_t &z) {
+                   Double_t t[3];GetTransCyln(index,t);
+                   x = t[0];y = t[1];z = t[2];}
+    //     This function returns the Cartesian translation for a give
+    // detector on a give ladder in a give layer in the three floating
+    // point variables provided. x = fx0, y = fy0, z = fz0. The units are
+    // those of the Monte Carlo, generally cm.
+    void  GetTransCyln(const Int_t lay,const Int_t lad,const Int_t det,
+                   Float_t &x,Float_t &y,Float_t &z) {
+                   GetTransCyln(GetModuleIndex(lay,lad,det),x,y,z);}
 //
     //      This function returns the Cartesian translation [cm] and the
     // 6 GEANT rotation angles [degrees]for a given layer ladder and
index a40e4f0ac2951f2522b88a9fcacc317970494368..960691b2170d54c11125501bbee5553793634db1 100644 (file)
 
 /*
 $Log$
+Revision 1.8  2001/02/09 00:00:57  nilsen
+Fixed compatibility problem with HP unix {ios::fmtflags -> Int_t}. Fixed
+bugs in iostream based streamers used to read and write .det files. Fixed
+some detector sizes. Fixed bugs in some default-special constructors.
+
 Revision 1.7  2001/02/03 00:00:30  nilsen
 New version of AliITSgeom and related files. Now uses automatic streamers,
 set up for new formatted .det file which includes detector information.
@@ -49,6 +54,7 @@ A new class to hold the matrix information needed by AliITSgeom.
 #include <iomanip.h>
 #include <TMath.h>
 #include <TBuffer.h>
+#include <TClass.h>
 
 #include "AliITSgeomMatrix.h"
 
@@ -78,6 +84,7 @@ AliITSgeomMatrix::AliITSgeomMatrix(){
        fid[i] = 0;
        frot[i] = ftran[i] = 0.0;
        for(j=0;j<3;j++) fm[i][j] = 0.0;
+       fCylR = fCylPhi = 0.0;
     }// end for i
     fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
 }
@@ -94,6 +101,8 @@ AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &sourse){
                this->fid[i]     = sourse.fid[i];
                this->frot[i]    = sourse.frot[i];
                this->ftran[i]   = sourse.ftran[i];
+               this->fCylR      = sourse.fCylR;
+               this->fCylPhi    = sourse.fCylPhi;
                for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
        }// end for i
 }
@@ -110,6 +119,8 @@ void AliITSgeomMatrix::operator=(const AliITSgeomMatrix &sourse){
                this->fid[i]     = sourse.fid[i];
                this->frot[i]    = sourse.frot[i];
                this->ftran[i]   = sourse.ftran[i];
+               this->fCylR      = sourse.fCylR;
+               this->fCylPhi    = sourse.fCylPhi;
                for(j=0;j<3;j++) this->fm[i][j] = sourse.fm[i][j];
        }// end for i
 }
@@ -132,15 +143,18 @@ AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt,const Int_t id[3],
 */
 //End_Html
 ////////////////////////////////////////////////////////////////////////
-       Int_t i;
+    Int_t i;
 
-       fDetectorIndex = idt; // a value never defined.
-       for(i=0;i<3;i++){
-               fid[i]   = id[i];
-               frot[i]  = rot[i];
-               ftran[i] = tran[i];
-       }// end for i
-       this->MatrixFromAngle();
+    fDetectorIndex = idt; // a value never defined.
+    for(i=0;i<3;i++){
+       fid[i]   = id[i];
+       frot[i]  = rot[i];
+       ftran[i] = tran[i];
+    }// end for i
+    fCylR   = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+    fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+    if(fCylPhi<0.0) fCylPhi += TMath::Pi();
+    this->MatrixFromAngle();
 }
 //----------------------------------------------------------------------
 AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt, const Int_t id[3],
@@ -162,15 +176,18 @@ AliITSgeomMatrix::AliITSgeomMatrix(const Int_t idt, const Int_t id[3],
 */
 //End_Html
 ////////////////////////////////////////////////////////////////////////
-       Int_t i,j;
+    Int_t i,j;
 
-       fDetectorIndex = idt; // a value never defined.
-       for(i=0;i<3;i++){
-               fid[i]   = id[i];
-               ftran[i] = tran[i];
-               for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
-       }// end for i
-       this->AngleFromMatrix();
+    fDetectorIndex = idt; // a value never defined.
+    for(i=0;i<3;i++){
+       fid[i]   = id[i];
+       ftran[i] = tran[i];
+       for(j=0;j<3;j++) fm[i][j] = matrix[i][j];
+    }// end for i
+    fCylR   = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+    fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+    if(fCylPhi<0.0) fCylPhi += TMath::Pi();
+    this->AngleFromMatrix();
 }
 //----------------------------------------------------------------------
 void AliITSgeomMatrix::SixAnglesFromMatrix(Double_t *ang){
@@ -276,6 +293,9 @@ AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/,
        fid[i]   = id[i];
        ftran[i] = tran[i];
     }// end for i
+    fCylR   = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+    fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+    if(fCylPhi<0.0) fCylPhi += TMath::Pi();
     this->MatrixFromSixAngles(rotd);
 }
 //----------------------------------------------------------------------
@@ -655,8 +675,25 @@ void AliITSgeomMatrix::Read(istream *is){
     for(i=0;i<3;i++) *is >> ftran[i];
     for(i=0;i<3;i++)for(j=0;j<3;j++)  *is >> fm[i][j];
     AngleFromMatrix(); // compute angles frot[].
+    fCylR   = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+    fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+    if(fCylPhi<0.0) fCylPhi += TMath::Pi();
     return;
 }
+//______________________________________________________________________
+void AliITSgeomMatrix::Streamer(TBuffer &R__b){
+   // Stream an object of class AliITSgeomMatrix.
+
+   if (R__b.IsReading()) {
+      AliITSgeomMatrix::Class()->ReadBuffer(R__b, this);
+      fCylR   = TMath::Sqrt(ftran[0]*ftran[0]+ftran[1]*ftran[1]);
+      fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+      this->AngleFromMatrix();
+    if(fCylPhi<0.0) fCylPhi += TMath::Pi();
+   } else {
+      AliITSgeomMatrix::Class()->WriteBuffer(R__b, this);
+   }
+}
 //----------------------------------------------------------------------
 ostream &operator<<(ostream &os,AliITSgeomMatrix &p){
 ////////////////////////////////////////////////////////////////////////
index 3791c7a9cbafd28c3a6d5dc690c3ba65aa2b8988..b3777ff64cc28b1fc8d99698a6c00cef19fe15c0 100644 (file)
@@ -32,7 +32,11 @@ class AliITSgeomMatrix : public TObject {
        void SetAngles(const Double_t rot[3]){// [radians]
               for(Int_t i=0;i<3;i++)frot[i] = rot[i];this->MatrixFromAngle();}
        void SetTranslation(const Double_t tran[3]){
-                           for(Int_t i=0;i<3;i++) ftran[i] = tran[i];}
+                           for(Int_t i=0;i<3;i++) ftran[i] = tran[i];
+                           fCylR   = TMath::Sqrt(ftran[0]*ftran[0]+
+                                                 ftran[1]*ftran[1]);
+                           fCylPhi = TMath::ATan2(ftran[1],ftran[0]);
+                           if(fCylPhi<0.0) fCylPhi += TMath::Pi();}
        void SetMatrix(Double_t matrix[3][3]){ for(Int_t i=0;i<3;i++)
         for(Int_t j=0;j<3;j++) fm[i][j]=matrix[i][j];this->AngleFromMatrix();}
        void SetDetectorIndex(const Int_t idt) {fDetectorIndex = idt;}
@@ -42,6 +46,10 @@ class AliITSgeomMatrix : public TObject {
                           for(Int_t i=0;i<3;i++)  rot[i] = frot[i];}
        void GetTranslation(Double_t tran[3]){
                            for(Int_t i=0;i<3;i++) tran[i] = ftran[i];}
+       void GetTranslationCylinderical(Double_t tran[3]){
+                           tran[0] = fCylR;
+                           tran[1] = fCylPhi;
+                           tran[2] = ftran[2];}
        void GetMatrix(Double_t matrix[3][3]){for(Int_t i=0;i<3;i++)
                         for(Int_t j=0;j<3;j++) matrix[i][j] = fm[i][j];}
        Int_t GetDetectorIndex() {return fDetectorIndex;}
@@ -75,8 +83,14 @@ class AliITSgeomMatrix : public TObject {
        Int_t    fid[3];         // layer, ladder, detector numbers.
        Double_t frot[3];        //! vector of rotations about x,y,z [radians].
        Double_t ftran[3];       // Translation vector of module x,y,z.
+       Double_t fCylR,fCylPhi;  //! Translation vector in Cylinderical coord.
        Double_t fm[3][3];       // Rotation matrix based on frot.
 
+       // Note, fCylR and fCylPhi are added as data members because it costs
+       // about a factor of 10 to compute them over looking them up. Since
+       // they are used in some tracking algorithms this can be a large cost
+       // in computing time. They are not written out but computed.
+
        ClassDef(AliITSgeomMatrix,1) // Matrix class used by AliITSgeom.
 };
 // Input and output function for standard C++ input/output.
index c7dbe3a3fbd8aa8b930e342b0a6c3c896041ff42..f023ee069e5ce5374b0fb6bfa6dda13557f20901 100644 (file)
@@ -30,7 +30,7 @@
 #pragma link C++ class  AliITSdigitSSD+;
 #pragma link C++ class  AliITSTransientDigit+;
 #pragma link C++ class  AliITSgeom+;
-#pragma link C++ class  AliITSgeomMatrix+;
+#pragma link C++ class  AliITSgeomMatrix-;
 #pragma link C++ class  AliITSgeomSPD+;
 #pragma link C++ class  AliITSgeomSDD+;
 #pragma link C++ class  AliITSgeomSSD+;