From 085bb6ed422515db630a2686475b02a1b81d605f Mon Sep 17 00:00:00 2001 From: nilsen Date: Fri, 9 Jun 2000 17:11:55 +0000 Subject: [PATCH] Bug fixes, coding conventions, and new features --- ITS/AliITSgeom.cxx | 547 +++++++++++++++++++++++++++------------------ ITS/AliITSgeom.h | 86 +++---- 2 files changed, 376 insertions(+), 257 deletions(-) diff --git a/ITS/AliITSgeom.cxx b/ITS/AliITSgeom.cxx index 22e577c68bc..84823008326 100644 --- a/ITS/AliITSgeom.cxx +++ b/ITS/AliITSgeom.cxx @@ -58,8 +58,8 @@ Introduction of the Copyright and cvs Log //////////////////////////////////////////////////////////////////////// -// The structure ITS_geom: -// The structure ITS_geom has been defined to hold all of the +// The structure AliITSgeomS: +// The structure AliITSgeomS has been defined to hold all of the // information necessary to do the coordinate transformations for one // detector between the ALICE Cartesian global and the detector local // coordinate systems. The rotations are implemented in the following @@ -167,11 +167,11 @@ pixel coordinate system. // active detector volumes for each ladder. This array is typically // created and filled by the AliITSgeom creator function. // -// ITS_geom **fg -// A pointer to an array of pointers pointing to the ITS_geom +// AliITSgeomS **fGm +// A pointer to an array of pointers pointing to the AliITSgeomS // structure containing the coordinate transformation information. -// The ITS_geom structure corresponding to layer=lay, ladder=lad, -// and detector=det is gotten by fg[lay-1][(fNlad[lay-1]*(lad-1)+det-1)]. +// The AliITSgeomS structure corresponding to layer=lay, ladder=lad, +// and detector=det is gotten by fGm[lay-1][(fNlad[lay-1]*(lad-1)+det-1)]. // In this way a lot of space is saved over trying to keep a three // dimensional array fNlayersXmax(fNlad)Xmax(fNdet), since the number // of detectors typically increases with layer number. @@ -275,7 +275,10 @@ pixel coordinate system. #include #include #include "AliITSgeom.h" -#include "AliITSgeomSPD.h" +#include "AliITSgeomSPD300.h" +#include "AliITSgeomSPD425.h" +#include "AliITSgeomSDD.h" +#include "AliITSgeomSSD.h" #include "TRandom.h" ClassImp(AliITSgeom) @@ -291,7 +294,7 @@ AliITSgeom::AliITSgeom(){ fNlayers = 0; fNlad = 0; fNdet = 0; - fg = 0; + fGm = 0; fShape = 0; return; } @@ -300,23 +303,23 @@ AliITSgeom::AliITSgeom(){ AliITSgeom::~AliITSgeom(){ //////////////////////////////////////////////////////////////////////// // The destructor for the AliITSgeom class. If the arrays fNlad, -// fNdet, or fg have had memory allocated to them, there pointer values +// fNdet, or fGm have had memory allocated to them, there pointer values // are non zero, then this memory space is freed and they are set // to zero. In addition, fNlayers is set to zero. The destruction of // TObjArray fShape is, by default, handled by the TObjArray destructor. //////////////////////////////////////////////////////////////////////// // Default destructor. // if arrays exist delete them. Then set everything to zero. - if(fg!=0){ - for(Int_t i=0;ifr[3*a+d] = lr[3*a+d] = si*lr[3*a+d]; } // end for a // get angles from matrix up to a phase of 180 degrees. - oor = atan2(lr[7],lr[8]);if(oor<0.0) oor += 2.0*PI; - pr = asin(lr[2]); if(pr<0.0) pr += 2.0*PI; - qr = atan2(lr[3],lr[0]);if(qr<0.0) qr += 2.0*PI; + oor = atan2(lr[7],lr[8]);if(oor<0.0) oor += 2.0*pi; + pr = asin(lr[2]); if(pr<0.0) pr += 2.0*pi; + qr = atan2(lr[3],lr[0]);if(qr<0.0) qr += 2.0*pi; g->frx = oor; g->fry = pr; g->frz = qr; @@ -444,7 +447,7 @@ AliITSgeom::AliITSgeom(const char *filename){ } //________________________________________________________________________ -AliITSgeom::AliITSgeom(AliITSgeom &source){ +AliITSgeom::AliITSgeom(const AliITSgeom &source){ //////////////////////////////////////////////////////////////////////// // The copy constructor for the AliITSgeom class. It calls the // = operator function. See the = operator function for more details. @@ -456,7 +459,7 @@ AliITSgeom::AliITSgeom(AliITSgeom &source){ } //________________________________________________________________________ -void AliITSgeom::operator=(AliITSgeom &source){ +/*void AliITSgeom::operator=(const AliITSgeom &source){ //////////////////////////////////////////////////////////////////////// // The = operator function for the AliITSgeom class. It makes an // independent copy of the class in such a way that any changes made @@ -469,10 +472,10 @@ void AliITSgeom::operator=(AliITSgeom &source){ if(this == &source) return; // don't assign to ones self. // if there is an old structure allocated delete it first. - if(fg != 0){ - for(i=0;ifx0; y = g[1] - gl->fy0; @@ -634,10 +680,10 @@ void AliITSgeom::LtoG(Int_t lay,Int_t lad,Int_t det, // three elements are l[0]=x, l[1]=y, and l[2]=z, similarly for g. //////////////////////////////////////////////////////////////////////// Double_t x,y,z; - ITS_geom *gl; + AliITSgeomS *gl; lay--; lad--; det--; - gl = &(fg[lay][fNdet[lay]*lad+det]); + gl = &(fGm[lay][fNdet[lay]*lad+det]); x = gl->fr[0]*l[0] + gl->fr[3]*l[1] + gl->fr[6]*l[2]; y = gl->fr[1]*l[0] + gl->fr[4]*l[1] + gl->fr[7]*l[2]; @@ -799,10 +845,10 @@ void AliITSgeom::GtoLMomentum(Int_t lay,Int_t lad,Int_t det, // three elements are g[0]=x, g[1]=y, and g[2]=z, similarly for l. //////////////////////////////////////////////////////////////////////// Double_t px,py,pz; - ITS_geom *gl; + AliITSgeomS *gl; lay--; lad--; det--; - gl = &(fg[lay][fNdet[lay]*lad+det]); + gl = &(fGm[lay][fNdet[lay]*lad+det]); px = g[0]; py = g[1]; @@ -845,10 +891,10 @@ void AliITSgeom::LtoGMomentum(Int_t lay,Int_t lad,Int_t det, // three elements are l[0]=x, l[1]=y, and l[2]=z, similarly for g. //////////////////////////////////////////////////////////////////////// Double_t px,py,pz; - ITS_geom *gl; + AliITSgeomS *gl; lay--; lad--; det--; - gl = &(fg[lay][fNdet[lay]*lad+det]); + gl = &(fGm[lay][fNdet[lay]*lad+det]); px = gl->fr[0]*l[0] + gl->fr[3]*l[1] + gl->fr[6]*l[2]; py = gl->fr[1]*l[0] + gl->fr[4]*l[1] + gl->fr[7]*l[2]; @@ -909,20 +955,20 @@ void AliITSgeom::GtoLErrorMatrix(const Int_t index,Double_t **g,Double_t **l){ // matrix l[i][l] = T[i][j]*g[j][k]*T[l][k] (sum over repeated indexes). // Where T[l][k] is the transpose of T[k][l]. //////////////////////////////////////////////////////////////////////// - Double_t R[3][3],Rt[3][3]; + Double_t lR[3][3],lRt[3][3]; Int_t lay,lad,det,i,j,k,n; - ITS_geom *gl; + AliITSgeomS *gl; GetModuleId(index,lay,lad,det); lay--;lad--;det--; - gl = &(fg[lay][fNdet[lay]*lad+det]); + gl = &(fGm[lay][fNdet[lay]*lad+det]); for(i=0;i<3;i++)for(j=0;j<3;j++){ - R[i][j] = Rt[j][i] = gl->fr[3*i+j]; + lR[i][j] = lRt[j][i] = gl->fr[3*i+j]; } // end for i,j for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)for(n=0;n<3;n++){ - l[i][n] = R[i][j]*g[j][k]*Rt[k][n]; + l[i][n] = lR[i][j]*g[j][k]*lRt[k][n]; } // end for i,j,k,l return; } @@ -937,20 +983,20 @@ void AliITSgeom::LtoGErrorMatrix(const Int_t index,Double_t **l,Double_t **g){ // matrix g[i][l] = T[j][i]*l[j][k]*T[k][l] (sum over repeated indexes). // Where T[j][i] is the transpose of T[i][j]. //////////////////////////////////////////////////////////////////////// - Double_t R[3][3],Rt[3][3]; + Double_t lR[3][3],lRt[3][3]; Int_t lay,lad,det,i,j,k,n; - ITS_geom *gl; + AliITSgeomS *gl; GetModuleId(index,lay,lad,det); lay--;lad--;det--; - gl = &(fg[lay][fNdet[lay]*lad+det]); + gl = &(fGm[lay][fNdet[lay]*lad+det]); for(i=0;i<3;i++)for(j=0;j<3;j++){ - R[i][j] = Rt[j][i] = gl->fr[3*i+j]; + lR[i][j] = lRt[j][i] = gl->fr[3*i+j]; } // end for i,j for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<3;k++)for(n=0;n<3;n++){ - g[i][n] = Rt[i][j]*l[j][k]*R[k][n]; + g[i][n] = lRt[i][j]*l[j][k]*lR[k][n]; } // end for i,j,k,l return; } @@ -1016,15 +1062,15 @@ void AliITSgeom::GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Double_t *mat){ //////////////////////////////////////////////////////////////////////// // Returns, in the Double_t array pointed to by mat, the full rotation // matrix for the give detector defined by layer, ladder, and detector. -// It returns all nine elements of fr in the ITS_geom structure. See the -// description of the ITS_geom structure for further details of this +// It returns all nine elements of fr in the AliITSgeomS structure. See the +// description of the AliITSgeomS structure for further details of this // rotation matrix. //////////////////////////////////////////////////////////////////////// Int_t i; - ITS_geom *g; + AliITSgeomS *g; lay--; lad--; det--; // shift to base 0 - g = &(fg[lay][fNdet[lay]*lad+det]); + g = &(fGm[lay][fNdet[lay]*lad+det]); for(i=0;i<9;i++) mat[i] = g->fr[i]; return; } @@ -1033,8 +1079,8 @@ void AliITSgeom::GetRotMatrix(Int_t index,Double_t *mat){ //////////////////////////////////////////////////////////////////////// // Returns, in the Double_t array pointed to by mat, the full rotation // matrix for the give detector defined by the module index number. -// It returns all nine elements of fr in the ITS_geom structure. See the -// description of the ITS_geom structure for further details of this +// It returns all nine elements of fr in the AliITSgeomS structure. See the +// description of the AliITSgeomS structure for further details of this // rotation matrix. //////////////////////////////////////////////////////////////////////// Int_t lay,lad,det; @@ -1048,8 +1094,8 @@ void AliITSgeom::GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat){ //////////////////////////////////////////////////////////////////////// // Returns, in the Float_t array pointed to by mat, the full rotation // matrix for the give detector defined by layer, ladder, and detector. -// It returns all nine elements of fr in the ITS_geom structure. See the -// description of the ITS_geom structure for further details of this +// It returns all nine elements of fr in the AliITSgeomS structure. See the +// description of the AliITSgeomS structure for further details of this // rotation matrix. //////////////////////////////////////////////////////////////////////// Int_t i; @@ -1065,8 +1111,8 @@ void AliITSgeom::GetRotMatrix(Int_t index,Float_t *mat){ //////////////////////////////////////////////////////////////////////// // Returns, in the Float_t array pointed to by mat, the full rotation // matrix for the give detector defined by module index number. -// It returns all nine elements of fr in the ITS_geom structure. See the -// description of the ITS_geom structure for further details of this +// It returns all nine elements of fr in the AliITSgeomS structure. See the +// description of the AliITSgeomS structure for further details of this // rotation matrix. //////////////////////////////////////////////////////////////////////// Int_t i,lay,lad,det; @@ -1077,6 +1123,56 @@ void AliITSgeom::GetRotMatrix(Int_t index,Float_t *mat){ for(i=0;i<9;i++) mat[i] = (Float_t) matd[i]; return; } + +//___________________________________________________________________________ +Int_t AliITSgeom::GetStartDet(Int_t id){ + ///////////////////////////////////////////////////////////////////////// + // returns the starting module index value for a give type of detector id + ///////////////////////////////////////////////////////////////////////// + Int_t first; + switch(id) + { + case 0: + first = GetModuleIndex(1,1,1); + break; + case 1: + first = GetModuleIndex(3,1,1); + break; + case 2: + first = GetModuleIndex(5,1,1); + break; + default: + printf(" undefined detector type\n"); + first = 0; + + } + return first; +} + +//___________________________________________________________________________ +Int_t AliITSgeom::GetLastDet(Int_t id){ + ///////////////////////////////////////////////////////////////////////// + // returns the last module index value for a give type of detector id + ///////////////////////////////////////////////////////////////////////// + Int_t last; + switch(id) + { + case 0: + last = GetLastSPD(); + break; + case 1: + last = GetLastSDD(); + break; + case 2: + last = GetLastSSD(); + break; + default: + printf(" undefined detector type\n"); + last = 0; + } + return last; +} + //___________________________________________________________________________ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ //////////////////////////////////////////////////////////////////////// @@ -1084,7 +1180,7 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ // print to a file pointed to by the file pointer fp the difference // between two AliITSgeom classes. The format of the file is basicly, // define d? to be the difference between the same element of the two -// classes. For example dfrx = this->fg[i][j].frx - other->fg[i][j].frx. +// classes. For example dfrx = this->fGm[i][j].frx - other->fGm[i][j].frx. // if(at least one of dfx0, dfy0, dfz0,dfrx,dfry,dfrz are non zero) then print // layer ladder detector dfx0 dfy0 dfz0 dfrx dfry dfrz // if(at least one of the 9 elements of dfr[] are non zero) then print @@ -1100,14 +1196,14 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ Int_t i,j,k,l; Double_t xt,yt,zt,xo,yo,zo; Double_t rxt,ryt,rzt,rxo,ryo,rzo; // phi in radians - ITS_geom *gt,*go; + AliITSgeomS *gt,*go; Bool_t t; for(i=0;ifNlayers;i++){ for(j=0;jfNlad[i];j++) for(k=0;kfNdet[i];k++){ l = this->fNdet[i]*j+k; // resolved index - gt = &(this->fg[i][l]); - go = &(other->fg[i][l]); + gt = &(this->fGm[i][l]); + go = &(other->fGm[i][l]); xt = gt->fx0; yt = gt->fy0; zt = gt->fz0; xo = go->fx0; yo = go->fy0; zo = go->fz0; rxt = gt->frx; ryt = gt->fry; rzt = gt->frz; @@ -1146,13 +1242,13 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ // to by the file pointer fp. This can be set to stdout if you want. //////////////////////////////////////////////////////////////////////// Int_t i,j,k,l; - ITS_geom *gt; + AliITSgeomS *gt; i = lay-1; j = lad-1; k = det-1; l = this->fNdet[i]*j+k; // resolved index - gt = &(this->fg[i][l]); + gt = &(this->fGm[i][l]); fprintf(fp,"%1.1d %2.2d %2.2d Trans=%f %f %f rot=%f %f %f Shape=%d\n", i+1,j+1,k+1,gt->fx0,gt->fy0,gt->fz0,gt->frx,gt->fry,gt->frz, gt->fShapeIndex); @@ -1162,7 +1258,7 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ return; } //___________________________________________________________________________ -ofstream & AliITSgeom::PrintGeom(ofstream &R__b){ +ofstream & AliITSgeom::PrintGeom(ofstream &lRb){ //////////////////////////////////////////////////////////////////////// // The default Streamer function "written by ROOT" doesn't write out // the arrays referenced by pointers. Therefore, a specific Streamer function @@ -1174,26 +1270,26 @@ ofstream & AliITSgeom::PrintGeom(ofstream &R__b){ // Stream an object of class AliITSgeom. Int_t i,j,k; - R__b.setf(ios::scientific); - R__b << fNlayers << " "; - for(i=0;i> fNlayers; + lRb >> fNlayers; if(fNlad!=0) delete[] fNlad; if(fNdet!=0) delete[] fNdet; fNlad = new Int_t[fNlayers]; fNdet = new Int_t[fNlayers]; - for(i=0;i> fNlad[i]; - for(i=0;i> fNdet[i]; - if(fg!=0){ - for(i=0;i> fNlad[i]; + for(i=0;i> fNdet[i]; + if(fGm!=0){ + for(i=0;i> fg[i][j].fShapeIndex; - R__b >> fg[i][j].fx0; - R__b >> fg[i][j].fy0; - R__b >> fg[i][j].fz0; - R__b >> fg[i][j].frx; - R__b >> fg[i][j].fry; - R__b >> fg[i][j].frz; - for(k=0;k<9;k++) R__b >> fg[i][j].fr[k]; + lRb >> fGm[i][j].fShapeIndex; + lRb >> fGm[i][j].fx0; + lRb >> fGm[i][j].fy0; + lRb >> fGm[i][j].fz0; + lRb >> fGm[i][j].frx; + lRb >> fGm[i][j].fry; + lRb >> fGm[i][j].frz; + for(k=0;k<9;k++) lRb >> fGm[i][j].fr[k]; } // end for j } // end for i -// R__b >> fShape; - return R__b; -} -//___________________________________________________________________________ -void AliITSgeom::Streamer(TBuffer &R__b){ -//////////////////////////////////////////////////////////////////////// -// The default Streamer function "written by ROOT" doesn't write out -// the arrays referenced by pointers. Therefore, a specific Streamer function -// has to be written. This function should not be modified but instead added -// on to so that older versions can still be read. The proper handling of -// the version dependent streamer function hasn't been written do to the lack -// of finding an example at the time of writing. -//////////////////////////////////////////////////////////////////////// - // Stream an object of class AliITSgeom. - Int_t i,j,k; - - if (R__b.IsReading()) { - Version_t R__v = R__b.ReadVersion(); if (R__v) { } - TObject::Streamer(R__b); - R__b >> fNlayers; - if(fNlad!=0) delete[] fNlad; - if(fNdet!=0) delete[] fNdet; - fNlad = new Int_t[fNlayers]; - fNdet = new Int_t[fNlayers]; - for(i=0;i> fNlad[i]; - for(i=0;i> fNdet[i]; - if(fg!=0){ - for(i=0;i> fg[i][j].fShapeIndex; - R__b >> fg[i][j].fx0; - R__b >> fg[i][j].fy0; - R__b >> fg[i][j].fz0; - R__b >> fg[i][j].frx; - R__b >> fg[i][j].fry; - R__b >> fg[i][j].frz; - for(k=0;k<9;k++) R__b >> fg[i][j].fr[k]; - } // end for j - } // end for i - R__b >> fShape; - } else { - R__b.WriteVersion(AliITSgeom::IsA()); - TObject::Streamer(R__b); - R__b << fNlayers; - for(i=0;i> fShape; + return lRb; } //______________________________________________________________________ // The following routines modify the transformation of "this" @@ -1304,14 +1339,14 @@ void AliITSgeom::SetByAngles(Int_t lay,Int_t lad,Int_t det, // This function computes a new rotation matrix based on the angles // rx, ry, and rz (in radians) for a give detector on the give ladder // in the give layer. A new -// fg[layer-1][(fNlad[layer-1]*(ladder-1)+detector-1)].fr[] array is +// fGm[layer-1][(fNlad[layer-1]*(ladder-1)+detector-1)].fr[] array is // computed. //////////////////////////////////////////////////////////////////////// - ITS_geom *g; + AliITSgeomS *g; Double_t sx,cx,sy,cy,sz,cz; lay--; lad--; det--; // set to zero base now. - g = &(fg[lay][fNdet[lay]*lad+det]); + g = &(fGm[lay][fNdet[lay]*lad+det]); sx = sin(rx); cx = cos(rx); sy = sin(ry); cy = cos(ry); @@ -1385,12 +1420,12 @@ void AliITSgeom::GlobalChange(Float_t *tran,Float_t *rot){ Int_t i,j,k,l; Double_t rx,ry,rz; Double_t sx,cx,sy,cy,sz,cz; - ITS_geom *gl; + AliITSgeomS *gl; for(i=0;ifx0 += tran[0]; gl->fy0 += tran[1]; gl->fz0 += tran[2]; @@ -1441,12 +1476,12 @@ void AliITSgeom::GlobalCylindericalChange(Float_t *tran,Float_t *rot){ Int_t i,j,k,l; Double_t rx,ry,rz,r,phi,rphi; // phi in radians Double_t sx,cx,sy,cy,sz,cz,r0; - ITS_geom *gl; + AliITSgeomS *gl; for(i=0;ify0,gl->fx0); phi = atan2(gl->fy0,gl->fx0); rphi = r0*phi; @@ -1491,12 +1526,12 @@ void AliITSgeom::RandomChange(Float_t *stran,Float_t *srot){ Double_t rx,ry,rz; Double_t sx,cx,sy,cy,sz,cz; TRandom ran; - ITS_geom *gl; + AliITSgeomS *gl; for(i=0;ifx0 += ran.Gaus(0.0,stran[0]); gl->fy0 += ran.Gaus(0.0,stran[1]); gl->fz0 += ran.Gaus(0.0,stran[2]); @@ -1537,12 +1572,12 @@ void AliITSgeom::RandomCylindericalChange(Float_t *stran,Float_t *srot){ Double_t rx,ry,rz,r,phi,x,y; // phi in radians Double_t sx,cx,sy,cy,sz,cz,r0; TRandom ran; - ITS_geom *gl; + AliITSgeomS *gl; for(i=0;ifx0; y = gl->fy0; r = r0= TMath::Hypot(y,x); @@ -1581,18 +1616,19 @@ void AliITSgeom::GeantToTracking(AliITSgeom &source){ // y coordinate system for layer 1 is rotated about the z axis 180 degrees // so that it points in the same direction as it does in all of the other // layers. +// Fixed for bug and new calulation of tracking coordiantes. BSN June 8 2000. //////////////////////////////////////////////////////////////////////////// Double_t oor,pr,qr; Int_t i,j,k; - Double_t PI = TMath::Pi(); + Double_t pi = TMath::Pi(); if(this == &source) return; // don't assign to ones self. // if there is an old structure allocated delete it first. - if(fg != 0){ - for(i=0;i> fNlayers; + if(fNlad!=0) delete[] fNlad; + if(fNdet!=0) delete[] fNdet; + fNlad = new Int_t[fNlayers]; + fNdet = new Int_t[fNlayers]; + printf("AliITSgeomStreamer fNlad\n"); + for(i=0;i> fNlad[i]; + printf("AliITSgeomStreamer fNdet\n"); + for(i=0;i> fNdet[i]; + if(fGm!=0){ + for(i=0;i> fGm[i][j].fShapeIndex; + lRb >> fGm[i][j].fx0; + lRb >> fGm[i][j].fy0; + lRb >> fGm[i][j].fz0; + lRb >> fGm[i][j].frx; + lRb >> fGm[i][j].fry; + lRb >> fGm[i][j].frz; + for(k=0;k<9;k++) lRb >> fGm[i][j].fr[k]; + } // end for j + } // end for i + /* + if(fShape!=0){ + delete fShape; + } // end if + printf("AliITSgeomStreamer reading fShape\n"); + lRb >> fShape; + */ + //if (fShape) fShape->Streamer(lRb); + } else { + lRb.WriteVersion(AliITSgeom::IsA()); + TObject::Streamer(lRb); + lRb << fNlayers; + for(i=0;iStreamer(lRb); + } // end if reading + printf("AliITSgeomStreamer Finished\n"); +} diff --git a/ITS/AliITSgeom.h b/ITS/AliITSgeom.h index 0f6b1a8c7a8..876324f765f 100644 --- a/ITS/AliITSgeom.h +++ b/ITS/AliITSgeom.h @@ -19,12 +19,12 @@ ///////////////////////////////////////////////////////////////////////// #include #include "TObjArray.h" -#include "AliITSgeomSPD.h" -#include "AliITSgeomSDD.h" -#include "AliITSgeomSSD.h" +//#include "AliITSgeomSPD.h" +//#include "AliITSgeomSDD.h" +//#include "AliITSgeomSSD.h" -struct ITS_geom { +struct AliITSgeomS { Int_t fShapeIndex; // Shape index for this volume Float_t fx0,fy0,fz0; // Translation vector Float_t frx,fry,frz; // Rotation about axis, angle radians @@ -35,54 +35,51 @@ struct ITS_geom { class AliITSgeom : public TObject { - private: - Int_t fNlayers; // The number of layers. - Int_t *fNlad; // Array of the number of ladders/layer(layer) - Int_t *fNdet; // Array of the number of detectors/ladder(layer) - ITS_geom **fg; // Structure of translation and rotation. - TObjArray *fShape; // Array of shapes and detector information. - public: - AliITSgeom(); // Default constructor - AliITSgeom(const char *filename); // Constructor - AliITSgeom(AliITSgeom &source); // Copy constructor - void operator=(AliITSgeom &source);// = operator - virtual ~AliITSgeom(); // Default destructor - // this is a dummy routine for now. - Int_t GetNdetectors(Int_t layer) const {return fNdet[layer-1];} - Int_t GetNladders(Int_t layer) const {return fNlad[layer-1];} - Int_t GetNlayers() const {return fNlayers;} + AliITSgeom(); // Default constructor + AliITSgeom(const char *filename); // Constructor + AliITSgeom(const AliITSgeom &source); // Copy constructor + // void operator=(const AliITSgeom &source);// = operator + AliITSgeom& operator=(const AliITSgeom &source);// = operator + + virtual ~AliITSgeom(); // Default destructor + + Int_t GetNdetectors(Int_t layer) const {return fNdet[layer-1];}// return number of detector a ladder has + Int_t GetNladders(Int_t layer) const {return fNlad[layer-1];}// return number of laders a layer has + Int_t GetNlayers() const {return fNlayers;} // return number of layer the ITS has void GetAngles(Int_t lay,Int_t lad,Int_t det, Float_t &rx,Float_t &ry,Float_t &rz)const { - rx = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].frx; - ry = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fry; - rz = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].frz;} + rx = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].frx; + ry = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fry; + rz = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].frz;} // Get agnles of roations for a give module void GetTrans(Int_t lay,Int_t lad,Int_t det, Float_t &x,Float_t &y,Float_t &z)const { - x = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0; - y = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0; - z = fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0;} + x = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0; + y = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0; + z = fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0;} // get translation for a given module void SetByAngles(Int_t lay,Int_t lad,Int_t det, Float_t rx,Float_t ry,Float_t rz); void SetByAngles(Int_t index,Double_t angl[]); void SetTrans(Int_t lay,Int_t lad,Int_t det, Float_t x,Float_t y,Float_t z){ - fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0 = x; - fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0 = y; - fg[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0 = z;} + fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fx0 = x; + fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fy0 = y; + fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1].fz0 = z;}// Set translation vector for a give module void SetTrans(Int_t index,Double_t x[]); void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Float_t *mat); void GetRotMatrix(Int_t lay,Int_t lad,Int_t det,Double_t *mat); void GetRotMatrix(Int_t index,Float_t *mat); void GetRotMatrix(Int_t index,Double_t *mat); - Int_t GetStartSPD() {return GetModuleIndex(1,1,1);} - Int_t GetLastSPD() {return GetModuleIndex(2,fNlad[1],fNdet[1]);} - Int_t GetStartSDD() {return GetModuleIndex(3,1,1);} - Int_t GetLastSDD() {return GetModuleIndex(4,fNlad[3],fNdet[3]);} - Int_t GetStartSSD() {return GetModuleIndex(5,1,1);} - Int_t GetLastSSD() {return GetModuleIndex(6,fNlad[5],fNdet[5]);} + Int_t GetStartDet(Int_t dtype ); + Int_t GetLastDet(Int_t dtype); + Int_t GetStartSPD() {return GetModuleIndex(1,1,1);} // return starting index for SPD + Int_t GetLastSPD() {return GetModuleIndex(2,fNlad[1],fNdet[1]);}// return Ending index for SPD + Int_t GetStartSDD() {return GetModuleIndex(3,1,1);} // return starting index for SDD + Int_t GetLastSDD() {return GetModuleIndex(4,fNlad[3],fNdet[3]);}// return Ending index for SDD + Int_t GetStartSSD() {return GetModuleIndex(5,1,1);} // return starting index for SSD + Int_t GetLastSSD() {return GetModuleIndex(6,fNlad[5],fNdet[5]);}// return Ending index for SSD Int_t GetIndexMax() {return GetModuleIndex(fNlayers,fNlad[fNlayers-1], - fNdet[fNlayers-1])+1;} + fNdet[fNlayers-1])+1;}// return Ending index for all ITS void GtoL(Int_t lay,Int_t lad,Int_t det,const Float_t *g,Float_t *l); void GtoL(const Int_t *id,const Float_t *g,Float_t *l); void GtoL(const Int_t index,const Float_t *g,Float_t *l); @@ -121,11 +118,13 @@ class AliITSgeom : public TObject { void PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det); ofstream &PrintGeom(ofstream &out); ifstream &ReadGeom(ifstream &in); - virtual Int_t IsVersion() const {return 1;} - void AddShape(TObject *shp){fShape->AddLast(shp);} + virtual Int_t IsVersion() const {return 1;} // return version number + void AddShape(TObject *shp){fShape->AddLast(shp);} // Add Shapes virtual TObject *GetShape(Int_t lay,Int_t lad,Int_t det) - const {return fShape->At(fg[lay-1][fNdet[lay-1]*(lad-1)+det-1]. - fShapeIndex);} + const {return fShape->At(fGm[lay-1][fNdet[lay-1]*(lad-1)+det-1]. + fShapeIndex);} // return specific TShape + + TObjArray *Shape() {return fShape;} // return Shapes array void GeantToTracking(AliITSgeom &source); // This converts the geometry // transformations from that used by the ITS and it's Monte Carlo to that @@ -137,6 +136,13 @@ class AliITSgeom : public TObject { // This allocates and fills gt with the geometry transforms between the // global coordinate system to the local coordinate system used to do // tracking. + + private: + Int_t fNlayers; // The number of layers. + Int_t *fNlad; // Array of the number of ladders/layer(layer) + Int_t *fNdet; // Array of the number of detectors/ladder(layer) + AliITSgeomS **fGm; // Structure of translation and rotation. + TObjArray *fShape; // Array of shapes and detector information. ClassDef(AliITSgeom,1) // ITS geometry class }; -- 2.43.0