]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDgeometry.cxx
More histos
[u/mrichter/AliRoot.git] / TRD / AliTRDgeometry.cxx
index 1a6d1d557dc4fdbc5897639b044e3e9bc1e7cc79..fab04f79d1b6be6514526b64a6d73eb88f5522d1 100644 (file)
@@ -45,108 +45,118 @@ ClassImp(AliTRDgeometry)
   //
   // The geometry constants
   //
-  const Int_t   AliTRDgeometry::fgkNsect   = kNsect;
-  const Int_t   AliTRDgeometry::fgkNplan   = kNplan;
-  const Int_t   AliTRDgeometry::fgkNcham   = kNcham;
-  const Int_t   AliTRDgeometry::fgkNdet    = kNdet;
+  const Int_t    AliTRDgeometry::fgkNsect     = kNsect;
+  const Int_t    AliTRDgeometry::fgkNplan     = kNplan;
+  const Int_t    AliTRDgeometry::fgkNcham     = kNcham;
+  const Int_t    AliTRDgeometry::fgkNdet      = kNdet;
 
   //
   // Dimensions of the detector
   //
 
   // Parameter of the BTRD mother volumes 
-  const Float_t AliTRDgeometry::fgkSheight =  77.9; 
-  const Float_t AliTRDgeometry::fgkSwidth1 =  94.881; 
-  const Float_t AliTRDgeometry::fgkSwidth2 = 122.353;
-  const Float_t AliTRDgeometry::fgkSlength = 751.0;
+  const Float_t  AliTRDgeometry::fgkSheight   =  77.9; 
+  const Float_t  AliTRDgeometry::fgkSwidth1   =  94.881; 
+  const Float_t  AliTRDgeometry::fgkSwidth2   = 122.353;
+  const Float_t  AliTRDgeometry::fgkSlength   = 751.0;
 
   // The super module side plates
-  const Float_t AliTRDgeometry::fgkSMpltT  =   0.2;
+  const Float_t  AliTRDgeometry::fgkSMpltT    =   0.2;
 
   // Height of different chamber parts
   // Radiator
-  const Float_t AliTRDgeometry::fgkCraH    =   4.8; 
+  const Float_t  AliTRDgeometry::fgkCraH      =   4.8; 
   // Drift region
-  const Float_t AliTRDgeometry::fgkCdrH    =   3.0;
+  const Float_t  AliTRDgeometry::fgkCdrH      =   3.0;
   // Amplification region
-  const Float_t AliTRDgeometry::fgkCamH    =   0.7;
+  const Float_t  AliTRDgeometry::fgkCamH      =   0.7;
   // Readout
-  const Float_t AliTRDgeometry::fgkCroH    =   2.316;
+  const Float_t  AliTRDgeometry::fgkCroH      =   2.316;
   // Total height
-  const Float_t AliTRDgeometry::fgkCH      = AliTRDgeometry::fgkCraH
-                                           + AliTRDgeometry::fgkCdrH
-                                           + AliTRDgeometry::fgkCamH
-                                           + AliTRDgeometry::fgkCroH;  
+  const Float_t  AliTRDgeometry::fgkCH        = AliTRDgeometry::fgkCraH
+                                              + AliTRDgeometry::fgkCdrH
+                                              + AliTRDgeometry::fgkCamH
+                                              + AliTRDgeometry::fgkCroH;  
 
   // Vertical spacing of the chambers
-  const Float_t AliTRDgeometry::fgkVspace  =   1.784;
+  const Float_t  AliTRDgeometry::fgkVspace    =   1.784;
   // Horizontal spacing of the chambers
-  const Float_t AliTRDgeometry::fgkHspace  =   2.0;
+  const Float_t  AliTRDgeometry::fgkHspace    =   2.0;
   // Radial distance of the first ROC to the outer plates of the SM
-  const Float_t AliTRDgeometry::fgkVrocsm  =   1.2;
+  const Float_t  AliTRDgeometry::fgkVrocsm    =   1.2;
 
   // Thicknesses of different parts of the chamber frame
   // Lower aluminum frame
-  const Float_t AliTRDgeometry::fgkCalT    =   0.4;
+  const Float_t  AliTRDgeometry::fgkCalT      =   0.4;
   // Lower Wacosit frame sides
-  const Float_t AliTRDgeometry::fgkCclsT   =   0.21;
+  const Float_t  AliTRDgeometry::fgkCclsT     =   0.21;
   // Lower Wacosit frame front
-  const Float_t AliTRDgeometry::fgkCclfT   =   1.0;
+  const Float_t  AliTRDgeometry::fgkCclfT     =   1.0;
   // Thickness of glue around radiator
-  const Float_t AliTRDgeometry::fgkCglT    =   0.25;
+  const Float_t  AliTRDgeometry::fgkCglT      =   0.25;
   // Upper Wacosit frame
-  const Float_t AliTRDgeometry::fgkCcuT    =   0.9;
+  const Float_t  AliTRDgeometry::fgkCcuT      =   0.9;
   // Al frame of back panel
-  const Float_t AliTRDgeometry::fgkCauT    =   1.5;
+  const Float_t  AliTRDgeometry::fgkCauT      =   1.5;
   // Additional Al of the lower chamber frame
-  const Float_t AliTRDgeometry::fgkCalW    =   1.11;
+  const Float_t  AliTRDgeometry::fgkCalW      =   1.11;
 
   // Additional width of the readout chamber frames
-  const Float_t AliTRDgeometry::fgkCroW    =   0.9;
+  const Float_t  AliTRDgeometry::fgkCroW      =   0.9;
 
   // Difference of outer chamber width and pad plane width
-  const Float_t AliTRDgeometry::fgkCpadW   =   0.0;
-  const Float_t AliTRDgeometry::fgkRpadW   =   1.0;
+  const Float_t  AliTRDgeometry::fgkCpadW     =   0.0;
+  const Float_t  AliTRDgeometry::fgkRpadW     =   1.0;
 
   //
   // Thickness of the the material layers
   //
-  const Float_t AliTRDgeometry::fgkMyThick = 0.005;
-  const Float_t AliTRDgeometry::fgkRaThick = 0.3233;  
-  const Float_t AliTRDgeometry::fgkDrThick = AliTRDgeometry::fgkCdrH;    
-  const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkCamH;
-  const Float_t AliTRDgeometry::fgkXeThick = AliTRDgeometry::fgkDrThick
-                                           + AliTRDgeometry::fgkAmThick;
-  const Float_t AliTRDgeometry::fgkWrThick = 0.0002;
-  const Float_t AliTRDgeometry::fgkCuThick = 0.0072; 
-  const Float_t AliTRDgeometry::fgkGlThick = 0.05;
-  const Float_t AliTRDgeometry::fgkSuThick = 0.0919; 
-  const Float_t AliTRDgeometry::fgkRcThick = 0.0058;
-  const Float_t AliTRDgeometry::fgkRpThick = 0.0632;
-  const Float_t AliTRDgeometry::fgkRoThick = 0.0028;
+  const Float_t  AliTRDgeometry::fgkMyThick   = 0.005;
+  const Float_t  AliTRDgeometry::fgkRaThick   = 0.3233;  
+  const Float_t  AliTRDgeometry::fgkDrThick   = AliTRDgeometry::fgkCdrH;    
+  const Float_t  AliTRDgeometry::fgkAmThick   = AliTRDgeometry::fgkCamH;
+  const Float_t  AliTRDgeometry::fgkXeThick   = AliTRDgeometry::fgkDrThick
+                                              + AliTRDgeometry::fgkAmThick;
+  const Float_t  AliTRDgeometry::fgkWrThick   = 0.0002;
+  const Float_t  AliTRDgeometry::fgkCuThick   = 0.0072; 
+  const Float_t  AliTRDgeometry::fgkGlThick   = 0.05;
+  const Float_t  AliTRDgeometry::fgkSuThick   = 0.0919; 
+  const Float_t  AliTRDgeometry::fgkRcThick   = 0.0058;
+  const Float_t  AliTRDgeometry::fgkRpThick   = 0.0632;
+  const Float_t  AliTRDgeometry::fgkRoThick   = 0.0028;
 
   //
   // Position of the material layers
   //
-  //const Float_t AliTRDgeometry::fgkRaZpos  = -1.50;
-  const Float_t AliTRDgeometry::fgkRaZpos  =  0.0;
-  const Float_t AliTRDgeometry::fgkDrZpos  =  2.4;
-  const Float_t AliTRDgeometry::fgkAmZpos  =  0.0;
-  const Float_t AliTRDgeometry::fgkWrZpos  =  0.0;
-  const Float_t AliTRDgeometry::fgkCuZpos  = -0.9995;
-  const Float_t AliTRDgeometry::fgkGlZpos  = -0.5; 
-  const Float_t AliTRDgeometry::fgkSuZpos  =  0.0;
-  const Float_t AliTRDgeometry::fgkRcZpos  =  1.04;
-  const Float_t AliTRDgeometry::fgkRpZpos  =  1.0;
-  const Float_t AliTRDgeometry::fgkRoZpos  =  1.05;
+  const Float_t  AliTRDgeometry::fgkRaZpos    =  0.0;
+  const Float_t  AliTRDgeometry::fgkDrZpos    =  2.4;
+  const Float_t  AliTRDgeometry::fgkAmZpos    =  0.0;
+  const Float_t  AliTRDgeometry::fgkWrZpos    =  0.0;
+  const Float_t  AliTRDgeometry::fgkCuZpos    = -0.9995;
+  const Float_t  AliTRDgeometry::fgkGlZpos    = -0.5; 
+  const Float_t  AliTRDgeometry::fgkSuZpos    =  0.0;
+  const Float_t  AliTRDgeometry::fgkRcZpos    =  1.04;
+  const Float_t  AliTRDgeometry::fgkRpZpos    =  1.0;
+  const Float_t  AliTRDgeometry::fgkRoZpos    =  1.05;
+
+  const Int_t    AliTRDgeometry::fgkMCMmax    = 16;   
+  const Int_t    AliTRDgeometry::fgkMCMrow    = 4;   
+  const Int_t    AliTRDgeometry::fgkROBmaxC0  = 6; 
+  const Int_t    AliTRDgeometry::fgkROBmaxC1  = 8; 
+  const Int_t    AliTRDgeometry::fgkADCmax    = 21;   
+  const Int_t    AliTRDgeometry::fgkTBmax     = 60;   
+  const Int_t    AliTRDgeometry::fgkPadmax    = 18;   
+  const Int_t    AliTRDgeometry::fgkColmax    = 144;
+  const Int_t    AliTRDgeometry::fgkRowmaxC0  = 12;
+  const Int_t    AliTRDgeometry::fgkRowmaxC1  = 16;
 
   const Double_t AliTRDgeometry::fgkTime0Base = 300.65;
-  const Float_t  AliTRDgeometry::fgkTime0[6]  = { fgkTime0Base + 0 * (Cheight() + Cspace()), 
-                                                  fgkTime0Base + 1 * (Cheight() + Cspace()), 
-                                                  fgkTime0Base + 2 * (Cheight() + Cspace()), 
-                                                  fgkTime0Base + 3 * (Cheight() + Cspace()), 
-                                                  fgkTime0Base + 4 * (Cheight() + Cspace()), 
-                                                  fgkTime0Base + 5 * (Cheight() + Cspace()) };
+  const Float_t  AliTRDgeometry::fgkTime0[6]  = { fgkTime0Base + 0 * (Cheight() + Cspace()) 
+                                                , fgkTime0Base + 1 * (Cheight() + Cspace()) 
+                                                , fgkTime0Base + 2 * (Cheight() + Cspace()) 
+                                                , fgkTime0Base + 3 * (Cheight() + Cspace()) 
+                                                , fgkTime0Base + 4 * (Cheight() + Cspace()) 
+                                                , fgkTime0Base + 5 * (Cheight() + Cspace())};
 
 //_____________________________________________________________________________
 AliTRDgeometry::AliTRDgeometry()
@@ -250,7 +260,7 @@ void AliTRDgeometry::Init()
   // The rotation matrix elements
   Float_t phi = 0.0;
   for (isect = 0; isect < fgkNsect; isect++) {
-    phi = -2.0 * TMath::Pi() /  (Float_t) fgkNsect * ((Float_t) isect + 0.5);
+    phi = 2.0 * TMath::Pi() /  (Float_t) fgkNsect * ((Float_t) isect + 0.5);
     fRotA11[isect] = TMath::Cos(phi);
     fRotA12[isect] = TMath::Sin(phi);
     fRotA21[isect] = TMath::Sin(phi);
@@ -1311,151 +1321,6 @@ void AliTRDgeometry::GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed)
 
 }
 
-//_____________________________________________________________________________
-Bool_t AliTRDgeometry::Local2Global(Int_t idet, Double_t *local
-                                   , Double_t *global) const
-{
-  //
-  // Converts local pad-coordinates (row,col,time) into 
-  // global ALICE reference frame coordinates (x,y,z)
-  //
-
-  Int_t icham = GetChamber(idet);    // Chamber info (0-4)
-  Int_t isect = GetSector(idet);     // Sector info  (0-17)
-  Int_t iplan = GetPlane(idet);      // Plane info   (0-5)
-
-  return Local2Global(iplan,icham,isect,local,global);
-
-}
-//_____________________________________________________________________________
-Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
-                                  , Double_t *local, Double_t *global) const
-{
-  //
-  // Converts local pad-coordinates (row,col,time) into 
-  // global ALICE reference frame coordinates (x,y,z)
-  //
-
-  AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
-  if (!commonParam) {
-    AliError("Could not get common parameters\n");
-    return kFALSE;
-  }
-
-  AliTRDcalibDB     *calibration = AliTRDcalibDB::Instance();
-  if (!calibration) {
-    AliError("Could not get calibration data\n");
-    return kFALSE;  
-  }
-  
-  AliTRDpadPlane    *padPlane    = commonParam->GetPadPlane(iplan,icham);
-
-  // Calculate (x,y,z) position in rotated chamber
-  Int_t    row       = ((Int_t) local[0]);
-  Int_t    col       = ((Int_t) local[1]);
-  Float_t  timeSlice = local[2] + 0.5;
-  Float_t  time0     = fgkTime0[iplan];
-
-  Int_t idet = GetDetector(iplan, icham, isect);
-
-  Double_t  rot[3];
-  rot[0] = time0 - (timeSlice - calibration->GetT0(idet, col, row))
-         * calibration->GetVdrift(idet, col, row)
-         / calibration->GetSamplingFrequency();
-  rot[1] = padPlane->GetColPos(col) - 0.5 * padPlane->GetColSize(col);
-  rot[2] = padPlane->GetRowPos(row) - 0.5 * padPlane->GetRowSize(row);
-
-  // Rotate back to original position
-  return RotateBack(idet,rot,global);
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *global
-                                  , Int_t *index) const
-{
-  //
-  // Converts local pad-coordinates (row,col,time) into 
-  // global ALICE reference frame coordinates (x,y,z)
-  //
-  // index[0] = plane number
-  // index[1] = chamber number
-  // index[2] = sector number
-  //
-  // mode = 0  - local coordinate in y, z,             x - rotated global   
-  //
-
-  Int_t idet = GetDetector(index[0],index[1],index[2]); // Detector number
-  RotateBack(idet,global,local);
-
-  if (mode == 0) {
-    return kTRUE;
-  }
-
-  return kFALSE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDgeometry::Global2Detector(Double_t global[3], Int_t index[3])
-{
-  //  
-  //  Find detector for given global point - Ideal geometry 
-  //  
-  //
-  // input    = global position
-  // output   = index
-  // index[0] = plane number
-  // index[1] = chamber number
-  // index[2] = sector number
-  //
-
-  //
-  // Find sector
-  //
-  Float_t fi = TMath::ATan2(global[1],global[0]);
-  if (fi < 0) {
-    fi += 2.0 * TMath::Pi();
-  }
-  index[2] = fgkNsect - 1 - TMath::Nint((fi - GetAlpha()/2.0) / GetAlpha());
-
-  //
-  // Find plane
-  //
-  Float_t locx = global[0] * fRotA11[index[2]] + global[1] * fRotA12[index[2]];  
-  index[0] = 0;
-  Float_t max = locx - fgkTime0[0];
-  for (Int_t iplane = 1; iplane < fgkNplan; iplane++) {
-    Float_t dist = TMath::Abs(locx - fgkTime0[iplane]);
-    if (dist < max) {
-      index[0] = iplane;
-      max      = dist;
-    }
-  }
-
-  //
-  // Find chamber
-  //
-  if (TMath::Abs(global[2]) < 0.5*GetChamberLength(index[0],2)) {
-    index[1] = 2;
-  }
-  else {
-    Double_t localZ = global[2];
-    if (global[2] > 0.0) {
-      localZ   -= 0.5*(GetChamberLength(index[0],2)+GetChamberLength(index[0],1));
-      index[1]  = (TMath::Abs(localZ) < 0.5*GetChamberLength(index[0],3)) ? 1 : 0;
-    }
-    else {
-      localZ   += 0.5*(GetChamberLength(index[0],2)+GetChamberLength(index[0],3));
-      index[1]  = (TMath::Abs(localZ) < 0.5*GetChamberLength(index[0],1)) ? 3 : 4;
-    }
-  }  
-
-  return kTRUE;
-
-}
-
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Rotate(Int_t d, Double_t *pos, Double_t *rot) const
 {
@@ -1549,6 +1414,78 @@ Int_t AliTRDgeometry::GetSector(Int_t d) const
 
 }
 
+//CL
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetPadRow(Int_t irob, Int_t imcm) const
+{
+
+  // return on which row this mcm sits 
+
+  return fgkMCMrow*(irob/2) + imcm/fgkMCMrow;
+
+;
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetPadCol(Int_t irob, Int_t imcm, Int_t iadc) const
+{
+  //
+  // return which pad is connected to this adc channel. return -1 if it
+  // is one of the not directly connected adc channels (0, 1 20)
+  //
+
+  if (iadc < 2 || iadc > 19 ) return -1;
+
+  return (iadc-2) + (imcm%fgkMCMrow)*fgkPadmax + GetRobSide(irob)*fgkColmax/2;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetMCM(Int_t irow, Int_t icol) const
+{
+
+  // return on which mcm this pad is
+
+  if ( irow < 0 || icol < 0 || irow > fgkRowmaxC1 || icol > fgkColmax ) return -1;
+
+  return (icol%(fgkColmax/2))/fgkPadmax + fgkMCMrow*(irow%fgkMCMrow);
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetROB(Int_t irow, Int_t icol) const
+{
+
+  // return on which rob this pad is
+
+  return (irow/fgkMCMrow)*2 + GetColSide(icol);
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetRobSide(Int_t irob) const
+{
+
+  // return on which side this rob sits (A side = 0, B side = 1)
+
+  if ( irob < 0 || irob >= fgkROBmaxC1 ) return -1;
+
+  return irob%2;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDgeometry::GetColSide(Int_t icol) const
+{
+
+  // return on which side this column sits (A side = 0, B side = 1)
+
+  if ( icol < 0 || icol >= fgkColmax ) return -1;
+
+  return icol/(fgkColmax/2);
+
+}
+
 //_____________________________________________________________________________
 AliTRDgeometry *AliTRDgeometry::GetGeometry(AliRunLoader *runLoader)
 {