X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSgeom.cxx;h=502f8b0716c010abe6b23d0f4dc8388f51369293;hb=c244e7e48f3e3a6b31bc0d9486ccad542352fe84;hp=37b63ef83a74cbeb2a9eec6a49bcf029c4448abc;hpb=325d8c323fb12f8effc6e57005b9e3118c49bea7;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSgeom.cxx b/ITS/AliITSgeom.cxx index 37b63ef83a7..502f8b0716c 100644 --- a/ITS/AliITSgeom.cxx +++ b/ITS/AliITSgeom.cxx @@ -23,7 +23,7 @@ // version: 0.0.1 // // Updated May 27 1999. // // Added Cylindrical random and global based changes. // -// Added function PrintComparison. // +// // // Modified and added functions Feb. 7 2006 // /////////////////////////////////////////////////////////////////////// @@ -546,77 +546,7 @@ Int_t AliITSgeom::GetLastDet(Int_t dtype)const{ Warning("GetLastDet","undefined detector type %d",dtype); return 0; } -//______________________________________________________________________ -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;ifNmodules;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 @@ -657,266 +587,7 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const{ 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; - - wb->setf(ios::scientific); - *wb << fTrans << " "; - *wb << fNmodules << " "; - *wb << fNlayers << " "; - for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(r); - for(j=0;j<3;j++){ - t[j] += tran[j]; - r[j] += rot[j]; - } // end for j - g->SetTranslation(t); - g->SetAngles(r); - } // end for i - return; -} -//______________________________________________________________________ -void AliITSgeom::GlobalCylindericalChange(const Float_t *tran, - const Float_t *rot){ - // This function performs a cylindrical translation and rotation of - // each ITS element by a fixed about in radius, rphi, and z from its - // default position by an amount determined by the three element arrays - // tran and rot. If every element of tran and - // rot are zero then there is no change made the geometry. The - // change is global in that the exact same distance change in translation - // and rotation is done to every detector element in the exact same way. - // The units of the translation are those of the Monte Carlo, usually cm, - // and those of the rotation are in radians. The elements of tran - // are tran[0] = r, tran[1] = rphi, and tran[2] = z. - // The elements of rot are rot[0] = rx, rot[1] = ry, and - // rot[2] = rz. A change in r will results in the increase of the - // radius of each layer by the same about. A change in rphi will results in - // the rotation of each layer by a different angle but by the same - // circumferential distance. A change in z will result in a translation - // of the ITS as a hole up or down the beam line. A change in the angles - // will result in the inclination of the ITS with respect to the beam - // line, except for an effective rotation about the beam axis which will - // just rotate the ITS as a hole about the beam axis. - // Intputs: - // Float_t *tran A 3 element array representing the global - // translations. the elements are r,theta,z in - // cm/radians. - // Float_t *rot A 3 element array representing the global rotation - // angles about the three axis x,y,z in radians - // Outputs: - // none. - // Return: - // none. - Int_t i,j; - Double_t t[3],ro[3],r,r0,phi,rphi; - AliITSgeomMatrix *g; - - fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. - for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(ro); - r = r0= TMath::Hypot(t[1],t[0]); - phi = TMath::ATan2(t[1],t[0]); - rphi = r0*phi; - r += tran[0]; - rphi += tran[1]; - phi = rphi/r0; - t[0] = r*TMath::Cos(phi); - t[1] = r*TMath::Sin(phi); - t[2] += tran[2]; - for(j=0;j<3;j++){ - ro[j] += rot[j]; - } // end for j - g->SetTranslation(t); - g->SetAngles(ro); - } // end for i - return; -} -//______________________________________________________________________ -void AliITSgeom::RandomChange(const Float_t *stran,const Float_t *srot){ - // This function performs a Gaussian random displacement and/or - // rotation about the present global position of each active - // volume/detector of the ITS. The sigma of the random displacement - // is determined by the three element array stran, for the - // x y and z translations, and the three element array srot, - // for the three rotation about the axis x y and z. - // Intputs: - // Float_t *stran A 3 element array representing the global - // translations variances. The elements are x, - // y,z in cm. - // Float_t *srot A 3 element array representing the global rotation - // angles variances about the three axis x,y,z in - // radians. - // Outputs: - // none. - // Return: - // none. - Int_t i,j; - Double_t t[3],r[3]; - AliITSgeomMatrix *g; - fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. - for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(r); - for(j=0;j<3;j++){ - t[j] += gRandom->Gaus(0.0,stran[j]); - r[j] += gRandom->Gaus(0.0, srot[j]); - } // end for j - g->SetTranslation(t); - g->SetAngles(r); - } // end for i - return; -} -//______________________________________________________________________ -void AliITSgeom::RandomCylindericalChange(const Float_t *stran, - const Float_t *srot){ - // This function performs a Gaussian random displacement and/or - // rotation about the present global position of each active - // volume/detector of the ITS. The sigma of the random displacement - // is determined by the three element array stran, for the - // r rphi and z translations, and the three element array srot, - // for the three rotation about the axis x y and z. This random change - // in detector position allow for the simulation of a random uncertainty - // in the detector positions of the ITS. - // Intputs: - // Float_t *stran A 3 element array representing the global - // translations variances. The elements are r, - // theta,z in cm/radians. - // Float_t *srot A 3 element array representing the global rotation - // angles variances about the three axis x,y,z in - // radians. - // Outputs: - // none. - // Return: - // none. - Int_t i,j; - Double_t t[3],ro[3],r,r0,phi,rphi; - TRandom ran; - AliITSgeomMatrix *g; - - fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true. - for(i=0;iGetGeomMatrix(i); - g->GetTranslation(t); - g->GetAngles(ro); - r = r0= TMath::Hypot(t[1],t[0]); - phi = TMath::ATan2(t[1],t[0]); - rphi = r0*phi; - r += ran.Gaus(0.0,stran[0]); - rphi += ran.Gaus(0.0,stran[1]); - phi = rphi/r0; - t[0] = r*TMath::Cos(phi); - t[1] = r*TMath::Sin(phi); - t[2] += ran.Gaus(0.0,stran[2]); - for(j=0;j<3;j++){ - ro[j] += ran.Gaus(0.0, srot[j]); - } // end for j - g->SetTranslation(t); - g->SetAngles(ro); - } // end for i - return; -} -//______________________________________________________________________ -void AliITSgeom::GeantToTracking(const AliITSgeom &source){ - // Copy the geometry data but change it to go between the ALICE - // Global coordinate system to that used by the ITS tracking. A slightly - // different coordinate system is used when tracking. This coordinate - // system is only relevant when the geometry represents the cylindrical - // ALICE ITS geometry. For tracking the Z axis is left alone but X-> -Y - // and Y-> X such that X always points out of the ITS cylinder for every - // layer including layer 1 (where the detectors are mounted upside down). - //Begin_Html - /* - - */ - //End_Html - // Input: - // AliITSgeom &source The AliITSgeom class with which to make this - // a copy of. - // Output: - // none. - // Return: - // none. - Int_t i,j,k,l,id[3]; - Double_t r0[3][3],r1[3][3]; - Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}}; - Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}}; - - *this = source; // copy everything - for(i=0;iGetIndex(id); - GetGeomMatrix(i)->GetMatrix(r0); - if(id[0]==1){ // Layer 1 is treated different from the others. - for(j=0;j<3;j++) for(k=0;k<3;k++){ - r1[j][k] = 0.; - for(l=0;l<3;l++) r1[j][k] += a0[j][l]*r0[l][k]; - } // end for j,k - }else{ - for(j=0;j<3;j++) for(k=0;k<3;k++){ - r1[j][k] = 0.; - for(l=0;l<3;l++) r1[j][k] += a1[j][l]*r0[l][k]; - } // end for j,k - } // end if - GetGeomMatrix(i)->SetMatrix(r1); - } // end for i - this->fTrans = (this->fTrans && 0xfffe) + 1; // set bit 0 true. - return; -} //______________________________________________________________________ Int_t AliITSgeom::GetNearest(const Double_t g[3],Int_t lay)const{ // Finds the Detector (Module) that is nearest the point g [cm] in @@ -985,7 +656,7 @@ void AliITSgeom::GetNearest27(const Double_t g[3],Int_t n[27],Int_t lay)const{ } //_______________________________________________________________________ void AliITSgeom::DetLToTrackingV2(Int_t md,Float_t xin,Float_t zin, - Float_t &yout,Float_t &zout) { + Float_t &yout,Float_t &zout) const { //Conversion from local coordinates on detectors to local //coordinates used for tracking ("v2") @@ -1010,7 +681,7 @@ void AliITSgeom::DetLToTrackingV2(Int_t md,Float_t xin,Float_t zin, } //_______________________________________________________________________ void AliITSgeom::TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin, - Float_t &xout,Float_t &zout) { + Float_t &xout,Float_t &zout) const { //Conversion from local coordinates used for tracking ("v2") to //local detector coordinates // Inputs: