-//______________________________________________________________________
-ofstream & AliITSgeom::PrintGeom(ofstream &rb)const{
- // Stream out an object of class AliITSgeom to standard output.
- // Intputs:
- // ofstream &rb The output streaming buffer.
- // Outputs:
- // none.
- // Return:
- // ofstream &rb The output streaming buffer.
- Int_t i,nshapes;
-
- rb.setf(ios::scientific);
- rb << fTrans << " ";
- rb << fNmodules << " ";
- rb << fNlayers << " ";
- for(i=0;i<fNlayers;i++) rb << fNlad[i] << " ";
- for(i=0;i<fNlayers;i++) rb << fNdet[i] << "\n";
- for(i=0;i<fNmodules;i++) {
- rb <<setprecision(16) << *(GetGeomMatrix(i)) << "\n";
- } // end for i
- nshapes = fShape.GetEntries();
- rb << nshapes <<endl;
- for(i=0;i<nshapes;i++) if(fShape.At(i)!=0) switch (i){
- case kSPD:
- rb << kSPD <<","<< (AliITSgeomSPD*)(fShape.At(kSPD));
- break;
- case kSDD:
- rb << kSDD <<","<< (AliITSgeomSDD*)(fShape.At(kSDD));
- break;
- case kSSD:
- rb << kSSD <<","<< (AliITSgeomSSD*)(fShape.At(kSSD));
- break;
- case kSSDp:
- rb << kSSDp <<","<< (AliITSgeomSSD*)(fShape.At(kSSDp));
- break;
- case kSDDp:
- rb << kSDDp <<","<< (AliITSgeomSDD*)(fShape.At(kSDDp));
- break;
- } // end for i / switch
- return rb;
-}
-//______________________________________________________________________
-ifstream & AliITSgeom::ReadGeom(ifstream &rb){
- // Stream in an object of class AliITSgeom from standard input.
- // Intputs:
- // ifstream &rb The input streaming buffer.
- // Outputs:
- // none.
- // Return:
- // ifstream &rb The input streaming buffer.
- Int_t i,j;
-
- fGm.Clear();
-
- rb >> fTrans >> fNmodules >> fNlayers;
- fNlad.Set(fNlayers);
- fNdet.Set(fNlayers);
- for(i=0;i<fNlayers;i++) rb >> fNlad[i];
- for(i=0;i<fNlayers;i++) rb >> fNdet[i];
- fGm.Expand(fNmodules);
- fGm.SetOwner(kTRUE);
- for(i=0;i<fNmodules;i++){
- if(i<0||i>=fGm.GetSize()){
- Error("ReadGeom","i<0||i>=fGm.GetSize()=%d",
- i,fGm.GetSize());
- return rb;
- } // end if
- fGm.AddAt(new AliITSgeomMatrix,i);
- rb >> *(GetGeomMatrix(i));
- } // end for i
- rb >> i;
- fShape.Expand(i);
- fShape.SetOwner(kTRUE);
- for(i=0;i<fShape.GetEntries();i++) {
- rb >> j;
- switch (j){
- case kSPD:{
- AliITSgeomSPD *s = new AliITSgeomSPD();
- rb >> *s;
- fShape.AddAt(s,kSPD);}
- break;
- case kSDD:{
- AliITSgeomSDD *s = new AliITSgeomSDD();
- rb >> *s;
- fShape.AddAt(s,kSDD);}
- break;
- case kSSD:{
- AliITSgeomSSD *s = new AliITSgeomSSD();
- rb >> *s;
- fShape.AddAt(s,kSSD);}
- break;
- case kSSDp:{
- AliITSgeomSSD *s = new AliITSgeomSSD();
- rb >> *s;
- fShape.AddAt(s,kSSDp);}
- break;
- case kSDDp:{
- AliITSgeomSDD *s = new AliITSgeomSDD();
- rb >> *s;
- fShape.AddAt(s,kSDDp);}
- break;
- } // end switch
- } // end for i
- return rb;
-}
-//______________________________________________________________________
-// The following routines modify the transformation of "this"
-// geometry transformations in a number of different ways.
-//______________________________________________________________________
-void AliITSgeom::GlobalChange(const Float_t *tran,const Float_t *rot){
- // This function performs a Cartesian translation and rotation of
- // the full ITS 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 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] = x, tran[1] = y, and tran[2] = z.
- // The elements of rot are rot[0] = rx, rot[1] = ry, and
- // rot[2] = rz. A change in x will move the hole ITS in the ALICE
- // global x direction, the same for a change in y. 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 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:
- // 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;i<fNmodules;i++){
- g = this->GetGeomMatrix(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;i<fNmodules;i++){
- g = this->GetGeomMatrix(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;i<fNmodules;i++){
- g = this->GetGeomMatrix(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;i<fNmodules;i++){
- g = this->GetGeomMatrix(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
- /*
- <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
- */
- //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.}};