+//______________________________________________________________________
+Bool_t AliITSgeom::IsInside(Int_t module,Double_t point[3])const{
+ // Determins if the give point is inside of the module as defined
+ // by this set of coordinate transforms.
+ // Inputs:
+ // Int_t module The module to be checked
+ // Double_t point[3] A 3 vector global point
+ // Outputs:
+ // none.
+ // Return:
+ // kTRUE if point is inside of module, kFALSE otherwise.
+ Double_t l[3],dx,dy,dz;
+ AliITSDetector idet = (AliITSDetector)(this->GetGeomMatrix(module)->
+ GetDetectorIndex());
+
+ this->GtoL(module,point,l);
+ switch(idet){
+ case kSPD:{
+ AliITSgeomSPD *spd = (AliITSgeomSPD*)(fShape.At((Int_t)idet));
+ dx = spd->GetDx();
+ dy = spd->GetDy();
+ dz = spd->GetDz();}
+ break;
+ case kSDD: case kSDDp:{
+ AliITSgeomSDD *sdd = (AliITSgeomSDD*)(fShape.At((Int_t)idet));
+ dx = sdd->GetDx();
+ dy = sdd->GetDy();
+ dz = sdd->GetDz();}
+ break;
+ case kSSD: case kSSDp:{
+ AliITSgeomSSD *ssd = (AliITSgeomSSD*)(fShape.At((Int_t)idet));
+ dx = ssd->GetDx();
+ dy = ssd->GetDy();
+ dz = ssd->GetDz();}
+ break;
+ default: // Detector not defined.
+ return kFALSE;
+ break;
+ }// end switch
+ if(TMath::Abs(l[0])>dx) return kFALSE;
+ if(TMath::Abs(l[2])>dz) return kFALSE;
+ if(TMath::Abs(l[1])>dy) return kFALSE;
+ return kTRUE;
+}
+//______________________________________________________________________
+void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other)const{
+ // This function was primarily created for diagnostic reasons. It
+ // print to a file pointed to by the file pointer fp the difference
+ // between two AliITSgeom classes. The format of the file is basically,
+ // define d? to be the difference between the same element of the two
+ // classes. For example dfrx = this->GetGeomMatrix(i)->frx
+ // - other->GetGeomMatrix(i)->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
+ // layer ladder detector dfr[0] dfr[1] dfr[2]
+ // dfr[3] dfr[4] dfr[5]
+ // dfr[6] dfr[7] dfr[8]
+ // Only non zero values are printed to save space. The differences are
+ // typical written to a file because there are usually a lot of numbers
+ // printed out and it is usually easier to read them in some nice editor
+ // rather than zooming quickly past you on a screen. fprintf is used to
+ // do the printing. The fShapeIndex difference is not printed at this time.
+ // Inputs:
+ // FILE *fp A file pointer to an opened file for writing
+ // in which the results of the comparison will
+ // be written.
+ // AliITSgeom *other The other AliITSgeom class to which this one is
+ // being compared.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Int_t i,j,idt[3],ido[3];
+ Double_t tt[3],to[3]; // translation
+ Double_t rt[3],ro[3]; // phi in radians
+ Double_t mt[3][3],mo[3][3]; // matrices
+ AliITSgeomMatrix *gt,*go;
+ Bool_t t;
+
+ for(i=0;i<this->fNmodules;i++){
+ gt = this->GetGeomMatrix(i);
+ go = other->GetGeomMatrix(i);
+ gt->GetIndex(idt);
+ go->GetIndex(ido);
+ t = kFALSE;
+ for(i=0;i<3;i++) t = t&&idt[i]!=ido[i];
+ if(t) fprintf(fp,"%4.4d %1.1d %2.2d %2.2d %1.1d %2.2d %2.2d\n",i,
+ idt[0],idt[1],idt[2],ido[0],ido[1],ido[2]);
+ gt->GetTranslation(tt);
+ go->GetTranslation(to);
+ gt->GetAngles(rt);
+ go->GetAngles(ro);
+ t = kFALSE;
+ for(i=0;i<3;i++) t = t&&tt[i]!=to[i];
+ if(t) fprintf(fp,"%1.1d %2.2d %2.2d dTrans=%f %f %f drot=%f %f %f\n",
+ idt[0],idt[1],idt[2],
+ tt[0]-to[0],tt[1]-to[1],tt[2]-to[2],
+ rt[0]-ro[0],rt[1]-ro[1],rt[2]-ro[2]);
+ t = kFALSE;
+ gt->GetMatrix(mt);
+ go->GetMatrix(mo);
+ for(i=0;i<3;i++)for(j=0;j<3;j++) t = mt[i][j] != mo[i][j];
+ if(t){
+ fprintf(fp,"%1.1d %2.2d %2.2d dfr= %e %e %e\n",
+ idt[0],idt[1],idt[2],
+ mt[0][0]-mo[0][0],mt[0][1]-mo[0][1],mt[0][2]-mo[0][2]);
+ fprintf(fp," dfr= %e %e %e\n",
+ mt[1][0]-mo[1][0],mt[1][1]-mo[1][1],mt[1][2]-mo[1][2]);
+ fprintf(fp," dfr= %e %e %e\n",
+ mt[2][0]-mo[2][0],mt[2][1]-mo[2][1],mt[2][2]-mo[2][2]);
+ } // end if t
+ } // end for i
+ return;
+}
+//______________________________________________________________________
+void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const{
+ // This function prints out the coordinate transformations for
+ // the particular detector defined by layer, ladder, and detector
+ // to the file pointed to by the File pointer fp. fprintf statements
+ // are used to print out the numbers. The format is
+ // layer ladder detector Trans= fx0 fy0 fz0 rot= frx fry frz
+ // Shape=fShapeIndex
+ // dfr= fr[0] fr[1] fr[2]
+ // dfr= fr[3] fr[4] fr[5]
+ // dfr= fr[6] fr[7] fr[8]
+ // By indicating which detector, some control over the information
+ // is given to the user. The output it written to the file pointed
+ // to by the file pointer fp. This can be set to stdout if you want.
+ // Inputs:
+ // FILE *fp A file pointer to an opened file for
+ // writing in which the results of the
+ // comparison will be written.
+ // Int_t lay The layer number. Starting from 1.
+ // Int_t lad The ladder number. Starting from 1.
+ // Int_t det The detector number. Starting from 1.
+ // Outputs:
+ // none
+ // Return:
+ // none.
+ AliITSgeomMatrix *gt;
+ Double_t t[3],r[3],m[3][3];
+
+ gt = this->GetGeomMatrix(GetModuleIndex(lay,lad,det));
+ gt->GetTranslation(t);
+ gt->GetAngles(r);
+ fprintf(fp,"%1.1d %2.2d %2.2d Trans=%f %f %f rot=%f %f %f Shape=%d\n",
+ lay,lad,det,t[0],t[1],t[2],r[0],r[1],r[2],
+ gt->GetDetectorIndex());
+ gt->GetMatrix(m);
+ fprintf(fp," dfr= %e %e %e\n",m[0][0],m[0][1],m[0][2]);
+ fprintf(fp," dfr= %e %e %e\n",m[1][0],m[1][1],m[1][2]);
+ fprintf(fp," dfr= %e %e %e\n",m[2][0],m[2][1],m[2][2]);
+ return;
+}
+//______________________________________________________________________
+void AliITSgeom::PrintGeom(ostream *wb)const{
+ // Stream out an object of class AliITSgeom to standard output.
+ // Intputs:
+ // ofstream *wb The output streaming buffer.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Int_t i,nshapes;
+
+ wb->setf(ios::scientific);
+ *wb << fTrans << " ";
+ *wb << fNmodules << " ";
+ *wb << fNlayers << " ";
+ for(i=0;i<fNlayers;i++) *wb << fNlad[i] << " ";
+ for(i=0;i<fNlayers;i++) *wb << fNdet[i] << "\n";