/*
$Id$
*/
-/*
- This is the implementation file for AliITSgeomMatrix class. It
- contains the routines to manipulate, setup, and queary the geometry
- of a given ITS module. An ITS module may be one of at least three
- ITS detector technologies, Silicon Pixel, Drift, or Strip Detectors,
- and variations of these in size and/or layout. These routines let
- one go between ALICE global coordiantes (cm) to a given modules
- specific local coordinates (cm).
-*/
-#include <ctype.h>
+////////////////////////////////////////////////////////////////////////
+// This is the implementation file for AliITSgeomMatrix class. It
+// contains the routines to manipulate, setup, and queary the geometry
+// of a given ITS module. An ITS module may be one of at least three
+// ITS detector technologies, Silicon Pixel, Drift, or Strip Detectors,
+// and variations of these in size and/or layout. These routines let
+// one go between ALICE global coordiantes (cm) to a given modules
+// specific local coordinates (cm).
+////////////////////////////////////////////////////////////////////////
+
#include <Riostream.h>
+#include <TClass.h>
#include <TMath.h>
#include <TBuffer.h>
-#include <TClass.h>
#include <TCanvas.h>
+#if ROOT_VERSION_CODE>= 331523
+#include <TView3D.h>
+#else
#include <TView.h>
+#endif
#include <TPolyLine3D.h>
-//#include <TPolyLineShape.h>
#include <TNode.h>
#include <TPCON.h>
#include <TBRIK.h>
}// end for i
fm[0][0] = fm[1][1] = fm[2][2] = 1.0;
}
+
//----------------------------------------------------------------------
-AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &sourse) :
- TObject(sourse){
+AliITSgeomMatrix::AliITSgeomMatrix(const AliITSgeomMatrix &source) :
+TObject(source),
+fDetectorIndex(source.fDetectorIndex),
+fCylR(source.fCylR),
+fCylPhi(source.fCylPhi),
+fPath(source.fPath){
// The standard Copy constructor. This make a full / proper copy of
// this class.
// Inputs:
// Return:
// A copy constructes AliITSgeomMatrix class.
Int_t i,j;
-
- this->fDetectorIndex = sourse.fDetectorIndex;
for(i=0;i<3;i++){
- 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];
+ this->fid[i] = source.fid[i];
+ this->frot[i] = source.frot[i];
+ this->ftran[i] = source.ftran[i];
+ for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
}// end for i
- this->fPath = sourse.fPath;
}
//----------------------------------------------------------------------
-void AliITSgeomMatrix::operator=(const AliITSgeomMatrix &sourse){
+AliITSgeomMatrix& AliITSgeomMatrix::operator=(const AliITSgeomMatrix &source){
// The standard = operator. This make a full / proper copy of
// this class.
// The standard Copy constructor. This make a full / proper copy of
// none.
// Return:
// A copy of the source AliITSgeomMatrix class.
- Int_t i,j;
+ if(this == &source)return *this;
+ Int_t i,j;
- this->fDetectorIndex = sourse.fDetectorIndex;
- for(i=0;i<3;i++){
- 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
- this->fPath = sourse.fPath;
+ this->fDetectorIndex = source.fDetectorIndex;
+ this->fCylR = source.fCylR;
+ this->fCylPhi = source.fCylPhi;
+ for(i=0;i<3;i++){
+ this->fid[i] = source.fid[i];
+ this->frot[i] = source.frot[i];
+ this->ftran[i] = source.ftran[i];
+
+ for(j=0;j<3;j++) this->fm[i][j] = source.fm[i][j];
+ }
+ this->fPath = source.fPath;
+ return *this;
}
+
//----------------------------------------------------------------------
AliITSgeomMatrix::AliITSgeomMatrix(Int_t idt,const Int_t id[3],
const Double_t rot[3],const Double_t tran[3]):
TObject(),
-fDetectorIndex(0), // Detector type index (like fShapeIndex was)
+fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
fid(), // layer, ladder, detector numbers.
frot(), //! vector of rotations about x,y,z [radians].
ftran(), // Translation vector of module x,y,z.
// A properly inilized AliITSgeomMatrix class.
Int_t i;
- fDetectorIndex = idt; // a value never defined.
for(i=0;i<3;i++){
fid[i] = id[i];
frot[i] = rot[i];
Double_t matrix[3][3],
const Double_t tran[3]):
TObject(),
-fDetectorIndex(0), // Detector type index (like fShapeIndex was)
+fDetectorIndex(idt), // Detector type index (like fShapeIndex was)
fid(), // layer, ladder, detector numbers.
frot(), //! vector of rotations about x,y,z [radians].
ftran(), // Translation vector of module x,y,z.
// A properly inilized AliITSgeomMatrix class.
Int_t i,j;
- fDetectorIndex = idt; // a value never defined.
for(i=0;i<3;i++){
fid[i] = id[i];
ftran[i] = tran[i];
//----------------------------------------------------------------------
AliITSgeomMatrix::AliITSgeomMatrix(const Double_t rotd[6]/*degrees*/,
Int_t idt,const Int_t id[3],
- const Double_t tran[3]){
+ const Double_t tran[3]):
+TObject(),
+fDetectorIndex(idt),
+fCylR(0.),
+fCylPhi(0.),
+fPath(){
// This is a constructor for the AliITSgeomMatrix class. The matrix
// is defined by the 6 GEANT 3.21 rotation angles [degrees], and
// the translation vector tran [cm]. In addition the layer, ladder,
// Double_t tran[3] The translation vector
Int_t i;
- fDetectorIndex = idt; // a value never defined.
for(i=0;i<3;i++){
fid[i] = id[i];
ftran[i] = tran[i];
if(fCylPhi<0.0) fCylPhi += TMath::Pi();
this->MatrixFromSixAngles(rotd);
}
+
//----------------------------------------------------------------------
void AliITSgeomMatrix::AngleFromMatrix(){
// Computes the angles from the rotation matrix up to a phase of
- // 180 degrees.
+ // 180 degrees. The matrix used in AliITSgeomMatrix::MatrixFromAngle()
+ // and its inverse AliITSgeomMatrix::AngleFromMatrix() are defined in
+ // the following ways, R = Rz*Ry*Rx (M=R*L+T) where
+ // 1 0 0 Cy 0 +Sy Cz -Sz 0
+ // Rx= 0 Cx -Sx Ry= 0 1 0 Rz=+Sz Cz 0
+ // 0 +Sx Cx -Sy 0 Cy 0 0 1
+ // The choice of the since of S, comes from the choice between
+ // the rotation of the object or the coordinate system (view). I think
+ // that this choice is the first, the rotation of the object.
// Inputs:
// none
// Outputs:
// get angles from matrix up to a phase of 180 degrees.
rx = TMath::ATan2(fm[2][1],fm[2][2]);if(rx<0.0) rx += 2.0*TMath::Pi();
- ry = TMath::ASin(fm[0][2]); if(ry<0.0) ry += 2.0*TMath::Pi();
- rz = TMath::ATan2(fm[1][1],fm[0][0]);if(rz<0.0) rz += 2.0*TMath::Pi();
+ ry = TMath::ASin(-fm[0][2]); if(ry<0.0) ry += 2.0*TMath::Pi();
+ rz = TMath::ATan2(fm[1][0],fm[0][0]);if(rz<0.0) rz += 2.0*TMath::Pi();
frot[0] = rx;
frot[1] = ry;
frot[2] = rz;
return;
}
+
//----------------------------------------------------------------------
void AliITSgeomMatrix::MatrixFromAngle(){
// Computes the Rotation matrix from the angles [radians] kept in this
- // class.
+ // class. The matrix used in AliITSgeomMatrix::MatrixFromAngle() and
+ // its inverse AliITSgeomMatrix::AngleFromMatrix() are defined in
+ // the following ways, R = Rz*Ry*Rx (M=R*L+T) where
+ // 1 0 0 Cy 0 +Sy Cz -Sz 0
+ // Rx= 0 Cx -Sx Ry= 0 1 0 Rz=+Sz Cz 0
+ // 0 +Sx Cx -Sy 0 Cy 0 0 1
+ // The choice of the since of S, comes from the choice between
+ // the rotation of the object or the coordinate system (view). I think
+ // that this choice is the first, the rotation of the object.
// Inputs:
// none
// Outputs:
sx = TMath::Sin(frot[0]); cx = TMath::Cos(frot[0]);
sy = TMath::Sin(frot[1]); cy = TMath::Cos(frot[1]);
sz = TMath::Sin(frot[2]); cz = TMath::Cos(frot[2]);
- fm[0][0] = cz*cy; // fr[0]
- fm[0][1] = -cz*sy*sx - sz*cx; // fr[1]
- fm[0][2] = -cz*sy*cx + sz*sx; // fr[2]
- fm[1][0] = sz*cy; // fr[3]
- fm[1][1] = -sz*sy*sx + cz*cx; // fr[4]
- fm[1][2] = -sz*sy*cx - cz*sx; // fr[5]
- fm[2][0] = sy; // fr[6]
- fm[2][1] = cy*sx; // fr[7]
- fm[2][2] = cy*cx; // fr[8]
+ fm[0][0] = +cz*cy; // fr[0]
+ fm[0][1] = +cz*sy*sx - sz*cx; // fr[1]
+ fm[0][2] = +cz*sy*cx + sz*sx; // fr[2]
+ fm[1][0] = +sz*cy; // fr[3]
+ fm[1][1] = +sz*sy*sx + cz*cx; // fr[4]
+ fm[1][2] = +sz*sy*cx - cz*sx; // fr[5]
+ fm[2][0] = -sy; // fr[6]
+ fm[2][1] = +cy*sx; // fr[7]
+ fm[2][2] = +cy*cx; // fr[8]
}
+
//----------------------------------------------------------------------
void AliITSgeomMatrix::GtoLPosition(const Double_t g0[3],Double_t l[3]) const {
// Returns the local coordinates given the global coordinates [cm].
if(fCylPhi<0.0) fCylPhi += TMath::Pi();
}
//----------------------------------------------------------------------
-TPolyLine3D* AliITSgeomMatrix::CreateLocalAxis(){
+TPolyLine3D* AliITSgeomMatrix::CreateLocalAxis() const {
// This class is used as part of the documentation of this class
// Inputs:
// none.
return new TPolyLine3D(5,gf);
}
//----------------------------------------------------------------------
-TPolyLine3D* AliITSgeomMatrix::CreateLocalAxisTracking(){
+TPolyLine3D* AliITSgeomMatrix::CreateLocalAxisTracking() const {
// This class is used as part of the documentation of this class
// Inputs:
// none.
//----------------------------------------------------------------------
TNode* AliITSgeomMatrix::CreateNode(const Char_t *nodeName,
const Char_t *nodeTitle,TNode *mother,
- TShape *shape,Bool_t axis){
+ TShape *shape,Bool_t axis) const {
// Creates a node inside of the node mother out of the shape shape
// in the position, with respect to mother, indecated by "this". If axis
// is ture, it will insert an axis within this node/shape.
TNode *node1 = new TNode(name.Data(),title.Data(),shape,trans[0],trans[1],trans[2],rot);
if(axis){
Int_t i,j;
- const Float_t scale=0.5,lw=0.2;
- Float_t xchar[13][2]={{0.5*lw,1.},{0.,0.5*lw},{0.5-0.5*lw,0.5},
- {0.,0.5*lw},{0.5*lw,0.},{0.5,0.5-0.5*lw},
- {1-0.5*lw,0.},{1.,0.5*lw},{0.5+0.5*lw,0.5},
- {1.,1.-0.5*lw},{1.-0.5*lw,1.},{0.5,0.5+0.5*lw},
- {0.5*lw,1.}};
- Float_t ychar[10][2]={{.5-0.5*lw,0.},{.5+0.5*lw,0.},{.5+0.5*lw,0.5-0.5*lw},
- {1.,1.-0.5*lw},{1.-0.5*lw,1.},{0.5+0.5*lw,0.5},
- {0.5*lw,1.} ,{0.,1-0.5*lw} ,{0.5-0.5*lw,0.5},
- {.5-0.5*lw,0.}};
- Float_t zchar[11][2]={{0.,1.},{0,1.-lw},{1.-lw,1.-lw},{0.,lw} ,{0.,0.},
- {1.,0.},{1.,lw} ,{lw,lw} ,{1.,1.-lw},{1.,1.},
+ const Float_t kScale=0.5,kLw=0.2;
+ Float_t xchar[13][2]={{0.5*kLw,1.},{0.,0.5*kLw},{0.5-0.5*kLw,0.5},
+ {0.,0.5*kLw},{0.5*kLw,0.},{0.5,0.5-0.5*kLw},
+ {1-0.5*kLw,0.},{1.,0.5*kLw},{0.5+0.5*kLw,0.5},
+ {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5,0.5+0.5*kLw},
+ {0.5*kLw,1.}};
+ Float_t ychar[10][2]={{.5-0.5*kLw,0.},{.5+0.5*kLw,0.},{.5+0.5*kLw,0.5-0.5*kLw},
+ {1.,1.-0.5*kLw},{1.-0.5*kLw,1.},{0.5+0.5*kLw,0.5},
+ {0.5*kLw,1.} ,{0.,1-0.5*kLw} ,{0.5-0.5*kLw,0.5},
+ {.5-0.5*kLw,0.}};
+ Float_t zchar[11][2]={{0.,1.},{0,1.-kLw},{1.-kLw,1.-kLw},{0.,kLw} ,{0.,0.},
+ {1.,0.},{1.,kLw} ,{kLw,kLw} ,{1.,1.-kLw},{1.,1.},
{0.,1.}};
for(i=0;i<13;i++)for(j=0;j<2;j++){
- if(i<13) xchar[i][j] = scale*xchar[i][j];
- if(i<10) ychar[i][j] = scale*ychar[i][j];
- if(i<11) zchar[i][j] = scale*zchar[i][j];
+ if(i<13) xchar[i][j] = kScale*xchar[i][j];
+ if(i<10) ychar[i][j] = kScale*ychar[i][j];
+ if(i<11) zchar[i][j] = kScale*zchar[i][j];
} // end for i,j
TXTRU *axisxl = new TXTRU("x","x","text",12,2);
for(i=0;i<12;i++) axisxl->DefineVertex(i,xchar[i][0],xchar[i][1]);
- axisxl->DefineSection(0,-0.5*lw);axisxl->DefineSection(1,0.5*lw);
+ axisxl->DefineSection(0,-0.5*kLw);axisxl->DefineSection(1,0.5*kLw);
TXTRU *axisyl = new TXTRU("y","y","text",9,2);
for(i=0;i<9;i++) axisyl->DefineVertex(i,ychar[i][0],ychar[i][1]);
- axisyl->DefineSection(0,-0.5*lw);axisyl->DefineSection(1,0.5*lw);
+ axisyl->DefineSection(0,-0.5*kLw);axisyl->DefineSection(1,0.5*kLw);
TXTRU *axiszl = new TXTRU("z","z","text",10,2);
for(i=0;i<10;i++) axiszl->DefineVertex(i,zchar[i][0],zchar[i][1]);
- axiszl->DefineSection(0,-0.5*lw);axiszl->DefineSection(1,0.5*lw);
- Float_t lxy[13][2]={{-0.5*lw,-0.5*lw},{0.8,-0.5*lw},{0.8,-0.1},{1.0,0.0},
- {0.8,0.1},{0.8,0.5*lw},{0.5*lw,0.5*lw},{0.5*lw,0.8},
- {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*lw,0.8},
- {-0.5*lw,-0.5*lw}};
+ axiszl->DefineSection(0,-0.5*kLw);axiszl->DefineSection(1,0.5*kLw);
+ Float_t lxy[13][2]={{-0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
+ {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},{0.5*kLw,0.8},
+ {0.1,0.8},{0.0,1.0},{-0.1,0.8},{-0.5*kLw,0.8},
+ {-0.5*kLw,-0.5*kLw}};
TXTRU *axisxy = new TXTRU("axisxy","axisxy","text",13,2);
for(i=0;i<13;i++) axisxy->DefineVertex(i,lxy[i][0],lxy[i][1]);
- axisxy->DefineSection(0,-0.5*lw);axisxy->DefineSection(1,0.5*lw);
- Float_t lz[8][2]={{0.5*lw,-0.5*lw},{0.8,-0.5*lw},{0.8,-0.1},{1.0,0.0},
- {0.8,0.1},{0.8,0.5*lw},{0.5*lw,0.5*lw},
- {0.5*lw,-0.5*lw}};
+ axisxy->DefineSection(0,-0.5*kLw);axisxy->DefineSection(1,0.5*kLw);
+ Float_t lz[8][2]={{0.5*kLw,-0.5*kLw},{0.8,-0.5*kLw},{0.8,-0.1},{1.0,0.0},
+ {0.8,0.1},{0.8,0.5*kLw},{0.5*kLw,0.5*kLw},
+ {0.5*kLw,-0.5*kLw}};
TXTRU *axisz = new TXTRU("axisz","axisz","text",8,2);
for(i=0;i<8;i++) axisz->DefineVertex(i,lz[i][0],lz[i][1]);
- axisz->DefineSection(0,-0.5*lw);axisz->DefineSection(1,0.5*lw);
+ axisz->DefineSection(0,-0.5*kLw);axisz->DefineSection(1,0.5*kLw);
//TRotMatrix *xaxis90= new TRotMatrix("xaixis90","",90.0, 0.0, 0.0);
TRotMatrix *yaxis90= new TRotMatrix("yaixis90","", 0.0,90.0, 0.0);
TRotMatrix *zaxis90= new TRotMatrix("zaixis90","", 0.0, 0.0,90.0);
return node1;
}
//----------------------------------------------------------------------
-void AliITSgeomMatrix::MakeFigures(){
+void AliITSgeomMatrix::MakeFigures() const {
// make figures to help document this class
// Inputs:
// none.
// none.
// Return:
// none.
- const Double_t dx0=550.,dy0=550.,dz0=550.; // cm
- const Double_t dx=1.0,dy=0.300,dz=3.0,rmax=0.1; // cm
+ const Double_t kDx0=550.,kDy0=550.,kDz0=550.; // cm
+ const Double_t kDx=1.0,kDy=0.300,kDz=3.0,kRmax=0.1; // cm
Float_t l[5][3]={{1.0,0.0,0.0},{0.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,0.0},
{0.0,0.0,1.0}};
TCanvas *c = new TCanvas(kFALSE);// create a batch mode canvas.
+#if ROOT_VERSION_CODE>= 331523
+ Double_t rmin[]={-1,-1,-1};
+ Double_t rmax[]={ 1, 1, 1};
+ TView *view = new TView3D(1,rmin,rmax);
+#else
TView *view = new TView(1); // Create Cartesian coordiante view
- TBRIK *mother = new TBRIK("Mother","Mother","void",dx0,dy0,dz0);
- TBRIK *det = new TBRIK("Detector","","Si",dx,dy,dz);
+#endif
+ TBRIK *mother = new TBRIK("Mother","Mother","void",kDx0,kDy0,kDz0);
+ TBRIK *det = new TBRIK("Detector","","Si",kDx,kDy,kDz);
TPolyLine3D *axis = new TPolyLine3D(5,&(l[0][0]));
TPCON *arrow = new TPCON("arrow","","air",0.0,360.,2);
TRotMatrix *xarrow= new TRotMatrix("xarrow","",90.,0.0,0.0);
arrow->SetLineStyle(det->GetLineStyle());
arrow->SetFillColor(1); // black
arrow->SetFillStyle(4100); // window is 100% opaque
- arrow->DefineSection(0,0.0,0.0,rmax);
- arrow->DefineSection(1,2.*rmax,0.0,0.0);
- view->SetRange(-dx0,-dy0,-dz0,dx0,dy0,dz0);
+ arrow->DefineSection(0,0.0,0.0,kRmax);
+ arrow->DefineSection(1,2.*kRmax,0.0,0.0);
+ view->SetRange(-kDx0,-kDy0,-kDz0,kDx0,kDy0,kDz0);
//
TNode *node0 = new TNode("NODE0","NODE0",mother);
node0->cd();