X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSgeom.cxx;h=287e67870e6a5bb3ee18e035a9c132941929d1e8;hb=bc7bc94b850b090b057aee92a89f00f46fa2fda3;hp=bee4a80502246706b61d4d8e119f323b088d4386;hpb=023ae34bddd5e368420a6f37f069b61b7d98fa4a;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSgeom.cxx b/ITS/AliITSgeom.cxx index bee4a805022..287e67870e6 100644 --- a/ITS/AliITSgeom.cxx +++ b/ITS/AliITSgeom.cxx @@ -125,6 +125,7 @@ pixel coordinate system. // example. //////////////////////////////////////////////////////////////////////// #include +#include #include #include @@ -164,6 +165,7 @@ fShape(0,0) // Array of shapes and detector information. fShape.SetOwner(kTRUE); return; } + //______________________________________________________________________ AliITSgeom::AliITSgeom(Int_t itype,Int_t nlayers,const Int_t *nlads, const Int_t *ndets,Int_t mods): @@ -182,13 +184,15 @@ fShape(5,0) // Array of shapes and detector information. // Int_t itype the type of transformation kept. // bit 0 => Standard GEANT // bit 1 => ITS tracking - // bit 2 => A change in the coordinate system has been made. - // others are still to be defined as needed. - // Int_t nlayers The number of ITS layers also set the size of the arrays - // Int_t *nlads an array of the number of ladders for each layer. This - // array must be nlayers long. - // Int_t *ndets an array of the number of detectors per ladder for each + // bit 2 => A change in the coordinate system + // has been made. others are still to be defined + // as needed. + // Int_t nlayers The number of ITS layers also set the size of + // the arrays + // Int_t *nlads an array of the number of ladders for each // layer. This array must be nlayers long. + // Int_t *ndets an array of the number of detectors per ladder + // for each layer. This array must be nlayers long. // Int_t mods The number of modules. Typically the sum of all the // detectors on every layer and ladder. // Outputs: @@ -208,13 +212,15 @@ void AliITSgeom::Init(Int_t itype,Int_t nlayers,const Int_t *nlads, // Int_t itype the type of transformation kept. // bit 0 => Standard GEANT // bit 1 => ITS tracking - // bit 2 => A change in the coordinate system has been made. - // others are still to be defined as needed. - // Int_t nlayers The number of ITS layers also set the size of the arrays - // Int_t *nlads an array of the number of ladders for each layer. This - // array must be nlayers long. - // Int_t *ndets an array of the number of detectors per ladder for each + // bit 2 => A change in the coordinate system + // has been made. others are still to be defined + // as needed. + // Int_t nlayers The number of ITS layers also set the size of + // the arrays + // Int_t *nlads an array of the number of ladders for each // layer. This array must be nlayers long. + // Int_t *ndets an array of the number of detectors per ladder + // for each layer. This array must be nlayers long. // Int_t mods The number of modules. Typically the sum of all the // detectors on every layer and ladder. // Outputs: @@ -347,9 +353,15 @@ void AliITSgeom::ReadNewFile(const char *filename){ for(i=0;i> j; - fVersion.Resize(j); - for(j=0;j> fVersion[j]; + while(isspace(fp->peek())) fp->get(); // skip spaces + if(isdigit(fp->peek())){ // new TString + *fp >> j; + fVersion.Resize(j); + for(j=0;j> fVersion[j]; + }else{ + fVersion.Resize(20); + for(j=0;isprint(fp->peek())&&j<20;j++) *fp >> fVersion[j]; + } // end if isdigit break; case 1: // fTrans *fp >> fTrans; @@ -434,7 +446,7 @@ void AliITSgeom::ReadNewFile(const char *filename){ return; } //______________________________________________________________________ -void AliITSgeom::WriteNewFile(const char *filename){ +void AliITSgeom::WriteNewFile(const char *filename)const{ // Writes AliITSgeom, AliITSgeomMatrix, and the defined // AliITSgeomS*D classes to a file in a format that // is more readable and commendable. @@ -458,8 +470,9 @@ void AliITSgeom::WriteNewFile(const char *filename){ *fp << ", kSDD=" << (Int_t) kSDD << ", kSSD=" << (Int_t) kSSD; *fp << ", kSSDp=" << (Int_t) kSSDp << ", and kSDDp=" << (Int_t) kSDDp; *fp << "*/" << endl; - *fp << "Version "<< fVersion.Length()<<" " << fVersion.Data() << endl;//This should be consistent - // with the geometry version. + *fp << "Version "<< fVersion.Length()<<" " << fVersion.Data() << endl;// + // This should be consistent + // with the geometry version. *fp << "fTrans " << fTrans << endl; *fp << "fNmodules " << fNmodules << endl; *fp << "fNlayers " << fNlayers << endl; @@ -555,9 +568,12 @@ fShape(0,0) // TObjArray of detector geom. &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t); if(l>lm) lm = l; if(l<1 || l>fNlayers) { - printf("error in file %s layer=%d min. is 1 max is %d\n", - filename,l,fNlayers); - continue; + printf("error in file %s layer=%d min. is 1 max is %d" + " Trying new format\n",filename,l,fNlayers); + fclose(pf); + ReadNewFile(filename); + return; + //continue; }// end if l fNmodules++; if(l<=fNlayers&&fNlad[l-1]fNlayers) { - Warning("AliITSgeom","error in file %s layer=%d min. is 1 max is %d", - filename,l,fNlayers); + Warning("AliITSgeom","error in file %s layer=%d" + " min. is 1 max is %d",filename,l,fNlayers); continue; }// end if l id[0] = l;id[1] = a;id[2] = d; @@ -619,7 +635,19 @@ fShape(0,0) // TObjArray of detector geom. fclose(pf); } //______________________________________________________________________ -AliITSgeom::AliITSgeom(const AliITSgeom &source) : TObject(source){ +AliITSgeom::AliITSgeom(const AliITSgeom &source) : +TObject(source), +fVersion(source.fVersion), // Transformation version. +fTrans(source.fTrans), // Flag to keep track of which transformation +fNmodules(source.fNmodules),// The total number of modules +fNlayers(source.fNlayers), // The number of layers. +fNlad(source.fNlad), // Array of the number of ladders/layer(layer) +fNdet(source.fNdet), // Array of the number of detector/ladder(layer) +fGm(source.fGm.GetSize(),source.fGm.LowerBound()),// Structure of + // translation and rotation. +fShape(source.fShape.GetSize(),source.fShape.LowerBound())// Array of shapes + // and detector information. +{ // The copy constructor for the AliITSgeom class. It calls the // = operator function. See the = operator function for more details. // Inputs: @@ -629,8 +657,35 @@ AliITSgeom::AliITSgeom(const AliITSgeom &source) : TObject(source){ // none. // Return: // none. + Int_t i,n; - *this = source; // Just use the = operator for now. + n = source.fGm.GetLast()+1; + for(i=source.fGm.LowerBound();ifVersion = source.fVersion; this->fTrans = source.fTrans; this->fNmodules = source.fNmodules; - this->fNlayers = source.fNlayers; - this->fNlad.Set(fNlayers,source.fNlad.GetArray()); - this->fNdet.Set(fNlayers,source.fNdet.GetArray()); - this->fShape.Expand(source.fShape.GetEntriesFast()); - for(i=0;ifShape.AddAt(new TObject(*(source.fShape.At(i))),i); - this->fShape.SetOwner(kTRUE); + this->fNlayers = source.fNlayers; + this->fNlad = source.fNlad; + this->fNdet = source.fNdet; this->fGm.Expand(this->fNmodules); - this->fGm.SetOwner(kTRUE); - for(i=0;ifNmodules;i++) - if(i<0||i>=fGm.GetSize()){ - Error("ReadNewFile","i<0||i>=fGm.GetSize()=%d", - i,fGm.GetSize()); - return *this; - } // end if - this->fGm.AddAt(new TObject(*(source.fGm.At(i))),i); + for(i=source.fGm.LowerBound();ifShape.Expand(source.fShape.GetEntriesFast()); + for(i=source.fShape.LowerBound();i=0 (no undefined // values. See AliITSgeom.h for list of AliITSDetecor enumerated types. @@ -782,7 +852,7 @@ Int_t AliITSgeom::GetNDetTypes(Int_t &max){ return id+1; } //______________________________________________________________________ -Int_t AliITSgeom::GetNDetTypes(TArrayI &maxs,AliITSDetector *types){ +Int_t AliITSgeom::GetNDetTypes(TArrayI &maxs,AliITSDetector *types)const{ // Finds and returns the number of detector types used and the // number of each detector type. Only counts id >=0 (no undefined // values. See AliITSgeom.h for list of AliITSDetecor enumerated types. @@ -817,12 +887,13 @@ Int_t AliITSgeom::GetNDetTypes(TArrayI &maxs,AliITSDetector *types){ return id; } //______________________________________________________________________ -Int_t AliITSgeom::GetStartDet(Int_t dtype){ +Int_t AliITSgeom::GetStartDet(Int_t dtype)const{ // returns the starting module index value for a give type of detector id. // This assumes that the detector types are different on different layers // and that they are not mixed up. // Inputs: - // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD. + // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, + // and 2 for SSD. // Outputs: // none. // Return: @@ -847,26 +918,28 @@ Int_t AliITSgeom::GetStartDet(Int_t dtype){ return 0; } //______________________________________________________________________ -Int_t AliITSgeom::GetLastDet(Int_t dtype){ +Int_t AliITSgeom::GetLastDet(Int_t dtype)const{ // returns the last module index value for a give type of detector id. // This assumes that the detector types are different on different layers // and that they are not mixed up. // Inputs: - // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD. + // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, + // and 2 for SSD. // Outputs: // Return: // the module index for the last occurrence of that detector type. - switch(dtype){ - case 0: - return GetLastSPD(); + switch((AliITSDetector)dtype){ + case kSPD: + return GetModuleIndex(3,1,1)-1; break; - case 1: - return GetLastSDD(); + case kSDD: + return GetModuleIndex(5,1,1)-1; break; - case 2: - return GetLastSSD(); + case kSSD: + return GetIndexMax()-1; break; + case kSSDp: case kSDDp: case kND: default: Warning("GetLastDet","undefined detector type %d",dtype); return 0; @@ -876,7 +949,51 @@ Int_t AliITSgeom::GetLastDet(Int_t dtype){ return 0; } //______________________________________________________________________ -void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ +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, @@ -895,8 +1012,9 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ // 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. + // 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: @@ -946,7 +1064,7 @@ void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other){ return; } //______________________________________________________________________ -void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ +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 @@ -960,8 +1078,9 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ // 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. + // 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. @@ -985,109 +1104,109 @@ void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det){ return; } //______________________________________________________________________ -ofstream & AliITSgeom::PrintGeom(ofstream &rb){ +void AliITSgeom::PrintGeom(ostream *wb)const{ // Stream out an object of class AliITSgeom to standard output. // Intputs: - // ofstream &rb The output streaming buffer. + // ofstream *wb The output streaming buffer. // Outputs: // none. // Return: - // ofstream &rb The output streaming buffer. + // none. Int_t i,nshapes; - rb.setf(ios::scientific); - rb << fTrans << " "; - rb << fNmodules << " "; - rb << fNlayers << " "; - for(i=0;isetf(ios::scientific); + *wb << fTrans << " "; + *wb << fNmodules << " "; + *wb << fNlayers << " "; + for(i=0;i> fTrans >> fNmodules >> fNlayers; + *rb >> fTrans >> fNmodules >> fNlayers; fNlad.Set(fNlayers); fNdet.Set(fNlayers); - for(i=0;i> fNlad[i]; - for(i=0;i> fNdet[i]; + for(i=0;i> fNlad[i]; + for(i=0;i> fNdet[i]; fGm.Expand(fNmodules); fGm.SetOwner(kTRUE); for(i=0;i=fGm.GetSize()){ Error("ReadGeom","i<0||i>=fGm.GetSize()=%d", i,fGm.GetSize()); - return rb; + return; } // end if fGm.AddAt(new AliITSgeomMatrix,i); - rb >> *(GetGeomMatrix(i)); + *rb >> *(GetGeomMatrix(i)); } // end for i - rb >> i; + *rb >> i; fShape.Expand(i); fShape.SetOwner(kTRUE); for(i=0;i> j; + *rb >> j; switch (j){ case kSPD:{ AliITSgeomSPD *s = new AliITSgeomSPD(); - rb >> *s; + *rb >> *s; fShape.AddAt(s,kSPD);} break; case kSDD:{ AliITSgeomSDD *s = new AliITSgeomSDD(); - rb >> *s; + *rb >> *s; fShape.AddAt(s,kSDD);} break; case kSSD:{ AliITSgeomSSD *s = new AliITSgeomSSD(); - rb >> *s; + *rb >> *s; fShape.AddAt(s,kSSD);} break; case kSSDp:{ AliITSgeomSSD *s = new AliITSgeomSSD(); - rb >> *s; + *rb >> *s; fShape.AddAt(s,kSSDp);} break; case kSDDp:{ AliITSgeomSDD *s = new AliITSgeomSDD(); - rb >> *s; + *rb >> *s; fShape.AddAt(s,kSDDp);} break; } // end switch } // end for i - return rb; + return; } //______________________________________________________________________ // The following routines modify the transformation of "this" @@ -1111,8 +1230,8 @@ void AliITSgeom::GlobalChange(const Float_t *tran,const Float_t *rot){ // 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 x,y,z in cm. + // Float_t *tran A 3 element array representing the global + // translations. the elements are x,y,z in cm. // Float_t *rot A 3 element array representing the global rotation // angles about the three axis x,y,z in radians // Outputs: @@ -1160,8 +1279,9 @@ void AliITSgeom::GlobalCylindericalChange(const Float_t *tran, // 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 *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: @@ -1203,10 +1323,12 @@ void AliITSgeom::RandomChange(const Float_t *stran,const Float_t *srot){ // 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 *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. + // angles variances about the three axis x,y,z in + // radians. // Outputs: // none. // Return: @@ -1241,10 +1363,12 @@ void AliITSgeom::RandomCylindericalChange(const Float_t *stran, // 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 *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. + // angles variances about the three axis x,y,z in + // radians. // Outputs: // none. // Return: @@ -1277,7 +1401,7 @@ void AliITSgeom::RandomCylindericalChange(const Float_t *stran, return; } //______________________________________________________________________ -void AliITSgeom::GeantToTracking(AliITSgeom &source){ +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 @@ -1323,7 +1447,7 @@ void AliITSgeom::GeantToTracking(AliITSgeom &source){ return; } //______________________________________________________________________ -Int_t AliITSgeom::GetNearest(const Double_t g[3],Int_t lay){ +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 // ALICE Global coordinates. If layer !=0 then the search is restricted // to Detectors (Modules) in that particular layer. @@ -1350,7 +1474,7 @@ Int_t AliITSgeom::GetNearest(const Double_t g[3],Int_t lay){ return in; } //______________________________________________________________________ -void AliITSgeom::GetNearest27(const Double_t g[3],Int_t n[27],Int_t lay){ +void AliITSgeom::GetNearest27(const Double_t g[3],Int_t n[27],Int_t lay)const{ // Finds 27 Detectors (Modules) that are nearest the point g [cm] in // ALICE Global coordinates. If layer !=0 then the search is restricted // to Detectors (Modules) in that particular layer. The number 27 comes @@ -1389,7 +1513,7 @@ void AliITSgeom::GetNearest27(const Double_t g[3],Int_t n[27],Int_t lay){ for(i=0;i<27;i++) n[i] = in[i]; } //---------------------------------------------------------------------- -Double_t AliITSgeom::GetAverageRadiusOfLayer(Int_t layer,Double_t &range){ +Double_t AliITSgeom::GetAverageRadiusOfLayer(Int_t layer,Double_t &range)const{ // Loops over all modules for a given layer and computes the // average cylindrical radius (about the z axis) and the range of // radii covered by this layer. Units, [cm] the Alice default unit. @@ -1401,28 +1525,40 @@ Double_t AliITSgeom::GetAverageRadiusOfLayer(Int_t layer,Double_t &range){ // The average radii for this layer. Double_t r=0.0,rmin=1.0e6,rmax=-1.0,rp,t[3],l[3],dl[3]; Int_t n=0,i,j,lay,lad,det; + AliITSDetector idet; for(i=0;iGetDx(); - dl[1] = ((AliITSgeomSPD*)GetShape(i))->GetDy(); - dl[2] = ((AliITSgeomSPD*)GetShape(i))->GetDz(); + if(IsShapeDefined((Int_t)idet)) { + switch(idet){ + case kSPD:{ + dl[0] = ((AliITSgeomSPD*)GetShape(idet))->GetDx(); + dl[1] = ((AliITSgeomSPD*)GetShape(idet))->GetDy(); + dl[2] = ((AliITSgeomSPD*)GetShape(idet))->GetDz(); } break; - case 1: case 4:{ - dl[0] = ((AliITSgeomSDD*)GetShape(i))->GetDx(); - dl[1] = ((AliITSgeomSDD*)GetShape(i))->GetDy(); - dl[2] = ((AliITSgeomSDD*)GetShape(i))->GetDz(); + case kSDD: case kSDDp:{ + dl[0] = ((AliITSgeomSDD*)GetShape(idet))->GetDx(); + dl[1] = ((AliITSgeomSDD*)GetShape(idet))->GetDy(); + dl[2] = ((AliITSgeomSDD*)GetShape(idet))->GetDz(); } break; - case 2: case 3:{ - dl[0] = ((AliITSgeomSSD*)GetShape(i))->GetDx(); - dl[1] = ((AliITSgeomSSD*)GetShape(i))->GetDy(); - dl[2] = ((AliITSgeomSSD*)GetShape(i))->GetDz(); + case kSSD: case kSSDp:{ + dl[0] = ((AliITSgeomSSD*)GetShape(idet))->GetDx(); + dl[1] = ((AliITSgeomSSD*)GetShape(idet))->GetDy(); + dl[2] = ((AliITSgeomSSD*)GetShape(idet))->GetDz(); } break; + case kND:{ + Warning("GetAverageRadiusOfLayer", + "idet=kND undefined detector type"); + continue; + }break; + default:{ + Warning("GetAverageRadiusOfLayer", + "idet=%d not a defined value",(Int_t)idet); + continue; + }break; }// end switch. } // end of n++; @@ -1446,24 +1582,83 @@ Double_t AliITSgeom::GetAverageRadiusOfLayer(Int_t layer,Double_t &range){ return r; } //_______________________________________________________________________ -void AliITSgeom::DetLToTrackingV2(Int_t md, Float_t xin, Float_t zin, Float_t &yout, Float_t &zout) { +void AliITSgeom::DetLToTrackingV2(Int_t md,Float_t xin,Float_t zin, + Float_t &yout,Float_t &zout) { - //Conversion from local coordinates on detectors to local - //coordinates used for tracking ("v2") - Float_t x,y,z; Double_t rt[9];GetTrans(md,x,y,z);GetRotMatrix(md,rt); - Double_t al=TMath::ATan2(rt[1],rt[0])+TMath::Pi(); - yout=-(-xin+(x*TMath::Cos(al)+y*TMath::Sin(al))); - if(md<(GetModuleIndex(2,1,1)-1))yout*=-1; zout=-zin+(Double_t)z; -} + //Conversion from local coordinates on detectors to local + //coordinates used for tracking ("v2") + // Inputs: + // Int_t md Module number + // Float_t xin Standard local coordinate x + // Float_t zin Standard local coordinate z + // Output: + // Float_t yout Tracking local coordinate y + // Float_t zout Tracking local coordinate z + // Return: + // none. + Float_t x,y,z; + Double_t rt[9],al; + GetTrans(md,x,y,z); + GetRotMatrix(md,rt); + al = TMath::ATan2(rt[1],rt[0])+TMath::Pi(); + yout = -(-xin+(x*((Float_t)TMath::Cos(al))+y*((Float_t)TMath::Sin(al)))); + if(md<(GetModuleIndex(2,1,1))) yout *= -1; + zout = -zin+z; +} //_______________________________________________________________________ -void AliITSgeom::TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,Float_t &xout,Float_t &zout) { - //Conversion from local coordinates used for tracking ("v2") to - //local detector coordinates - - Float_t x,y,z; Double_t rt[9];GetTrans(md,x,y,z);GetRotMatrix(md,rt); - Double_t al=TMath::ATan2(rt[1],rt[0])+TMath::Pi(); - xout=yin;if(md<(GetModuleIndex(2,1,1)-1))xout=-xout; - xout+=(x*TMath::Cos(al)+y*TMath::Sin(al)); - zout=-zin+(Double_t)z; +void AliITSgeom::TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin, + Float_t &xout,Float_t &zout) { + //Conversion from local coordinates used for tracking ("v2") to + //local detector coordinates + // Inputs: + // Int_t md Module number + // Float_t yin Tracking local coordinate y + // Float_t zin Tracking local coordinate z + // Output: + // Float_t xout Standard local coordinate x + // Float_t zout Standard local coordinate z + // Return: + // none. + Float_t x,y,z; + Double_t rt[9],al; + + GetTrans(md,x,y,z); + GetRotMatrix(md,rt); + al = TMath::ATan2(rt[1],rt[0])+TMath::Pi(); + xout = yin; + if(md<(GetModuleIndex(2,1,1))) xout = -xout; + xout += (x*((Float_t)TMath::Cos(al))+y*((Float_t)TMath::Sin(al))); + zout = -zin+z; +} +//---------------------------------------------------------------------- +ostream &operator<<(ostream &os,AliITSgeom &p){ + // Standard output streaming function. + // Inputs: + // ostream os The output stream + // AliITSgeom p The AliITSgeom class to be printed out + // Outputs: + // none. + // Return: + // The input stream + + p.PrintGeom(&os); + return os; } +//---------------------------------------------------------------------- +istream &operator>>(istream &is,AliITSgeom &r){ + // Standard input streaming function. + // Inputs: + // istream is The input stream + // AliITSgeom p The AliITSgeom class to be filled from this + // input stream + // Outputs: + // none. + // Return: + // The input stream + + r.ReadGeom(&is); + return is; +} +//---------------------------------------------------------------------- +