]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDgeometry.cxx
Dimitri just makes it work
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.cxx
index 624005957fcdf2eb2d954dce8f0d9e8e4db20808..0988e5866307d992502e42462f9809c012c2b777 100644 (file)
 
 /*
 $Log$
+Revision 1.4  2000/06/08 18:32:58  cblume
+Make code compliant to coding conventions
+
+Revision 1.3  2000/06/07 16:25:37  cblume
+Try to remove compiler warnings on Sun and HP
+
+Revision 1.2  2000/05/08 16:17:27  cblume
+Merge TRD-develop
+
+Revision 1.1.4.1  2000/05/08 14:45:55  cblume
+Bug fix in RotateBack(). Geometry update
+
+Revision 1.1  2000/02/28 19:00:44  cblume
+Add new TRD classes
+
 */
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -25,6 +40,7 @@ $Log$
 
 #include "AliTRDgeometry.h"
 #include "AliTRDrecPoint.h"
+#include "AliMC.h"
 
 ClassImp(AliTRDgeometry)
 
@@ -42,6 +58,9 @@ AliTRDgeometry::AliTRDgeometry():AliGeometry()
 //_____________________________________________________________________________
 AliTRDgeometry::~AliTRDgeometry()
 {
+  //
+  // AliTRDgeometry destructor
+  //
 
 }
 
@@ -136,82 +155,82 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
   //    UL10       (PE)    --- The cooling devices
   //    UL11       (Water) --- The cooling water
 
-  const Int_t npar_cha = 3;
+  const Int_t kNparCha = 3;
 
-  Float_t par_dum[3];
-  Float_t par_cha[npar_cha];
+  Float_t parDum[3];
+  Float_t parCha[kNparCha];
 
   Float_t xpos, ypos, zpos;
 
   // The aluminum frames - readout + electronics (Al)
   // The inner chambers
-  gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],par_dum,0);
+  gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0);
   // The middle chambers
-  gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],par_dum,0);
+  gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0);
   // The outer chambers
-  gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],par_dum,0);
+  gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0);
 
   // The inner part of the aluminum frames (Air)
   // The inner chambers
-  gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],par_dum,0);
+  gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0);
   // The middle chambers
-  gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],par_dum,0);
+  gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0);
   // The outer chambers
-  gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],par_dum,0);
+  gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0);
 
   // The carbon frames - radiator + driftchamber (C)
   // The inner chambers
-  gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],par_dum,0);
+  gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0);
   // The middle chambers
-  gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],par_dum,0);
+  gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0);
   // The outer chambers
-  gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],par_dum,0);
+  gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0);
 
   // The inner part of the carbon frames (Air)
   // The inner chambers
-  gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],par_dum,0);
+  gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0);
   // The middle chambers
-  gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],par_dum,0);
+  gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0);
   // The outer chambers
-  gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],par_dum,0);
+  gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0);
 
   // The material layers inside the chambers
-  par_cha[0] = -1.;
-  par_cha[1] = -1.;
+  parCha[0] = -1.;
+  parCha[1] = -1.;
   // G10 layer (radiator seal)
-  par_cha[2] = kSeThick/2;
-  gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],par_cha,npar_cha);
+  parCha[2] = kSeThick/2;
+  gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha);
   // CO2 layer (radiator)
-  par_cha[2] = kRaThick/2;
-  gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],par_cha,npar_cha);
+  parCha[2] = kRaThick/2;
+  gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha);
   // PE layer (radiator)
-  par_cha[2] = kPeThick/2;
-  gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],par_cha,npar_cha);
+  parCha[2] = kPeThick/2;
+  gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha);
   // Mylar layer (entrance window + HV cathode) 
-  par_cha[2] = kMyThick/2;
-  gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],par_cha,npar_cha);
+  parCha[2] = kMyThick/2;
+  gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha);
   // Xe/Isobutane layer (drift volume, sensitive) 
-  par_cha[2] = kDrThick/2.;
-  gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],par_cha,npar_cha);
+  parCha[2] = kDrThick/2.;
+  gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha);
   // Xe/Isobutane layer (amplification volume, not sensitive)
-  par_cha[2] = kAmThick/2.;
-  gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],par_cha,npar_cha);
+  parCha[2] = kAmThick/2.;
+  gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha);
   
   // Cu layer (pad plane)
-  par_cha[2] = kCuThick/2;
-  gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],par_cha,npar_cha);
+  parCha[2] = kCuThick/2;
+  gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha);
   // G10 layer (support structure)
-  par_cha[2] = kSuThick/2;
-  gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],par_cha,npar_cha);
+  parCha[2] = kSuThick/2;
+  gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha);
   // Cu layer (FEE + signal lines)
-  par_cha[2] = kFeThick/2;
-  gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],par_cha,npar_cha);
+  parCha[2] = kFeThick/2;
+  gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha);
   // PE layer (cooling devices)
-  par_cha[2] = kCoThick/2;
-  gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],par_cha,npar_cha);
+  parCha[2] = kCoThick/2;
+  gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha);
   // Water layer (cooling)
-  par_cha[2] = kWaThick/2;
-  gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],par_cha,npar_cha);
+  parCha[2] = kWaThick/2;
+  gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha);
 
   // Position the layers in the chambers
   xpos = 0;
@@ -275,7 +294,7 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed)
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global)
+Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) const
 {
   //
   // Converts local pad-coordinates (row,col,time) into 
@@ -286,30 +305,13 @@ Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global)
   Int_t        isect     = GetSector(idet);     // Sector info  (0-17)
   Int_t        iplan     = GetPlane(idet);      // Plane info   (0-5)
 
-  Float_t      padRow    = local[0];            // Pad Row position
-  Float_t      padCol    = local[1];            // Pad Column position
-  Float_t      timeSlice = local[2];            // Time "position"
-
-  Float_t      row0      = GetRow0(iplan,icham,isect);
-  Float_t      col0      = GetCol0(iplan);
-  Float_t      time0     = GetTime0(iplan);
-
-  Float_t      rot[3];
-
-  // calculate (x,y) position in rotated chamber
-  rot[1] = col0  + padCol    * fColPadSize;
-  rot[0] = time0 + timeSlice * fTimeBinSize;
-  // calculate z-position:
-  rot[2] = row0  + padRow    * fRowPadSize;
-
-  // Rotate back to original position
-  return RotateBack(idet,rot,global);
+  return Local2Global(iplan,icham,isect,local,global);
 
 }
  
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
-                                  , Float_t *local, Float_t *global)
+                                  , Float_t *local, Float_t *global) const
 {
   //
   // Converts local pad-coordinates (row,col,time) into 
@@ -329,8 +331,8 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
   Float_t      rot[3];
 
   // calculate (x,y,z) position in rotated chamber
-  rot[1] = col0  + padCol    * fColPadSize;
   rot[0] = time0 + timeSlice * fTimeBinSize;
+  rot[1] = col0  + padCol    * fColPadSize;
   rot[2] = row0  + padRow    * fRowPadSize;
 
   // Rotate back to original position
@@ -360,7 +362,7 @@ Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot)
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos)
+Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
 {
   //
   // Rotates a chambers from the position of sector 0 into its
@@ -372,16 +374,16 @@ Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos)
 
   Float_t phi    =  2.0 * kPI /  (Float_t) kNsect * ((Float_t) sector + 0.5);
 
-  rot[0] =  pos[0] * TMath::Cos(phi) + pos[1] * TMath::Sin(phi);
-  rot[1] = -pos[0] * TMath::Sin(phi) + pos[1] * TMath::Cos(phi);
-  rot[2] =  pos[2];
+  pos[0] =  rot[0] * TMath::Cos(phi) + rot[1] * TMath::Sin(phi);
+  pos[1] = -rot[0] * TMath::Sin(phi) + rot[1] * TMath::Cos(phi);
+  pos[2] =  rot[2];
 
   return kTRUE;
 
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s)
+Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const
 {
   //
   // Convert plane / chamber / sector into detector number
@@ -392,7 +394,7 @@ Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetPlane(Int_t d)
+Int_t AliTRDgeometry::GetPlane(Int_t d) const
 {
   //
   // Reconstruct the plane number from the detector number
@@ -403,7 +405,7 @@ Int_t AliTRDgeometry::GetPlane(Int_t d)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetChamber(Int_t d)
+Int_t AliTRDgeometry::GetChamber(Int_t d) const
 {
   //
   // Reconstruct the chamber number from the detector number
@@ -414,7 +416,7 @@ Int_t AliTRDgeometry::GetChamber(Int_t d)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDgeometry::GetSector(Int_t d)
+Int_t AliTRDgeometry::GetSector(Int_t d) const
 {
   //
   // Reconstruct the sector number from the detector number
@@ -425,18 +427,19 @@ Int_t AliTRDgeometry::GetSector(Int_t d)
 }
 
 //_____________________________________________________________________________
-void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat)
+void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat) const
 {
   // 
   // Returns the global coordinate and error matrix of a AliTRDrecPoint
   //
 
   GetGlobal(p,pos);
+  mat.Zero();
 
 }
 
 //_____________________________________________________________________________
-void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos)
+void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) const
 {
   // 
   // Returns the global coordinate and error matrix of a AliTRDrecPoint
@@ -446,9 +449,9 @@ void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos)
 
   Float_t global[3];
   Float_t local[3];
-  local[0] = pos.X();
-  local[1] = pos.Y();
-  local[2] = pos.Z();
+  local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
+  local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
+  local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
 
   if (Local2Global(detector,local,global)) {
     pos.SetX(global[0]);