AliTRDpadPlane in digitization scheme implemented
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 May 2005 10:13:39 +0000 (10:13 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 May 2005 10:13:39 +0000 (10:13 +0000)
16 files changed:
TRD/AliTRDclusterizer.cxx
TRD/AliTRDclusterizer.h
TRD/AliTRDclusterizerMI.cxx
TRD/AliTRDclusterizerMI.h
TRD/AliTRDclusterizerV1.cxx
TRD/AliTRDclusterizerV1.h
TRD/AliTRDdigitizer.cxx
TRD/AliTRDdisplayDigits3D.C
TRD/AliTRDgeometry.cxx
TRD/AliTRDgeometry.h
TRD/AliTRDpadPlane.cxx
TRD/AliTRDpadPlane.h
TRD/AliTRDparameter.cxx
TRD/AliTRDparameter.h
TRD/AliTRDtracker.cxx
TRD/AliTRDv1.cxx

index 25dfa90..37b0c7c 100644 (file)
@@ -261,8 +261,8 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
 
 
 //_____________________________________________________________________________
-void AliTRDclusterizer::AddCluster(Float_t *pos, Int_t det, Float_t amp
-                                  , Int_t *tracks, Float_t *sig, Int_t iType)
+void AliTRDclusterizer::AddCluster(Double_t *pos, Int_t det, Double_t amp
+                                , Int_t *tracks, Double_t *sig, Int_t iType)
 {
   //
   // Add a cluster for the TRD
index 9c3f559..176c3c8 100644 (file)
@@ -35,20 +35,20 @@ class AliTRDclusterizer : public TNamed {
   virtual Bool_t  OpenOutput();
   virtual Bool_t  MakeClusters() = 0;
   virtual Bool_t  WriteClusters(Int_t det);
-  virtual void     SetParameter(AliTRDparameter *par)      { fPar           = par; };
-  void     SetVerbose(Int_t v = 1)                 { fVerbose       = v;   };
+  virtual void    SetParameter(AliTRDparameter *par)      { fPar           = par; };
+  void            SetVerbose(Int_t v = 1)                 { fVerbose       = v;   };
 
-  AliTRDparameter *GetParameter()                    const { return fPar;          };
+  AliTRDparameter *GetParameter()                   const { return fPar;          };
 
   TObjArray*      RecPoints() {if (!fRecPoints) fRecPoints = new TObjArray(400); return fRecPoints;}
-  virtual void    AddCluster(Float_t *pos, Int_t det, Float_t amp, Int_t *tracks
-                            , Float_t *sig, Int_t iType);
+  virtual void    AddCluster(Double_t *pos, Int_t det, Double_t amp, Int_t *tracks
+                          , Double_t *sig, Int_t iType);
   void            ResetRecPoints() {if (fRecPoints) fRecPoints->Delete();}
 
 
  protected:
 
-  AliRunLoader * fRunLoader;       //! Run Loader
+  AliRunLoader    *fRunLoader;     //! Run Loader
   
   TTree           *fClusterTree;   //! Tree with the cluster
   AliTRDparameter *fPar;           //  TRD digitization parameter object
index bcf3a5a..136fcef 100644 (file)
@@ -38,6 +38,7 @@
 #include "AliTRDdigitsManager.h"
 #include "AliTRDparameter.h"
 #include "AliTRDclusterMI.h"
+#include "AliTRDpadPlane.h"
 
 ClassImp(AliTRDclusterizerMI)
 
@@ -66,20 +67,29 @@ AliTRDclusterizerMI::~AliTRDclusterizerMI()
   //
 }
 
-
+//_____________________________________________________________________________
 AliTRDclusterMI *  AliTRDclusterizerMI::AddCluster()
 {
+  //
+  // Adds cluster
+  //
+
   AliTRDclusterMI *c = new AliTRDclusterMI();
   fClusterContainer->Add(c);
   return c;
+
 }
 
-void AliTRDclusterizerMI::SetCluster(AliTRDclusterMI * cl,Float_t *pos, Int_t det, Float_t amp
-                 ,Int_t *tracks, Float_t *sig, Int_t iType, Float_t sigmay, Float_t relpad)
+//_____________________________________________________________________________
+void AliTRDclusterizerMI::SetCluster(AliTRDclusterMI * cl,Double_t *pos
+                                   , Int_t det, Double_t amp
+                                  , Int_t *tracks, Double_t *sig, Int_t iType
+                                   , Double_t sigmay, Double_t relpad)
 {
   //
+  // Sets cluster
   //
-  //
+
   cl->SetDetector(det);
   cl->AddTrackIndex(tracks);
   cl->SetQ(amp);
@@ -93,14 +103,18 @@ void AliTRDclusterizerMI::SetCluster(AliTRDclusterMI * cl,Float_t *pos, Int_t de
   cl->fRmsY = sigmay;
 }
 
-void AliTRDclusterizerMI::MakeCluster(Float_t * padSignal, Float_t * pos, Float_t &sigma, Float_t & relpad)
+//_____________________________________________________________________________
+void AliTRDclusterizerMI::MakeCluster(Double_t * padSignal, Double_t * pos
+                                    , Double_t &sigma, Double_t & relpad)
 {
   //
-  //  
-  Float_t sum   = 0;
-  Float_t sumx  = 0;
-  Float_t sumx2 = 0;
-  Float_t signal[3]={padSignal[0],padSignal[1],padSignal[2]};
+  // Does something with the cluster  
+  //
+
+  Double_t sum   = 0;
+  Double_t sumx  = 0;
+  Double_t sumx2 = 0;
+  Double_t signal[3]={padSignal[0],padSignal[1],padSignal[2]};
   if ( signal[0]<2){
     signal[0] = 0.015*(signal[1]*signal[1])/(signal[2]+0.5);
     if (signal[0]>2) signal[0]=2;
@@ -152,8 +166,8 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
     printf("Create the default parameter object.\n");
   }
 
-  Float_t timeBinSize = fPar->GetDriftVelocity()
-                      / fPar->GetSamplingFrequency();
+  Double_t timeBinSize = fPar->GetDriftVelocity()
+                       / fPar->GetSamplingFrequency();
   // Half of ampl.region
   const Float_t kAmWidth = AliTRDgeometry::AmThick()/2.; 
 
@@ -176,23 +190,23 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
   Int_t sigThresh = fPar->GetClusSigThresh();   
 
   // Iteration limit for unfolding procedure
-  const Float_t kEpsilon = 0.01;             
+  const Double_t kEpsilon = 0.01;             
 
-  const Int_t   kNclus   = 3;  
-  const Int_t   kNsig    = 5;
-  const Int_t   kNtrack  = 3 * kNclus;
+  const Int_t    kNclus   = 3;  
+  const Int_t    kNsig    = 5;
+  const Int_t    kNtrack  = 3 * kNclus;
 
-  Int_t   iType          = 0;
-  Int_t   iUnfold        = 0;
+  Int_t    iType          = 0;
+  Int_t    iUnfold        = 0;
 
-  Float_t ratioLeft      = 1.0;
-  Float_t ratioRight     = 1.0;
+  Double_t ratioLeft      = 1.0;
+  Double_t ratioRight     = 1.0;
 
-  Float_t padSignal[kNsig];   
-  Float_t clusterSignal[kNclus];
-  Float_t clusterPads[kNclus];   
-  Int_t   clusterDigit[kNclus];
-  Int_t   clusterTracks[kNtrack];   
+  Double_t padSignal[kNsig];   
+  Double_t clusterSignal[kNclus];
+  Double_t clusterPads[kNclus];   
+  Int_t    clusterDigit[kNclus];
+  Int_t    clusterTracks[kNtrack];   
 
   Int_t chamBeg = 0;
   Int_t chamEnd = AliTRDgeometry::Ncham();
@@ -226,10 +240,7 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
         Int_t   nTimeBefore = fPar->GetTimeBefore();
         Int_t   nTimeTotal  = fPar->GetTimeTotal();  
 
-        Float_t row0        = fPar->GetRow0(iplan,icham,isect);
-        Float_t col0        = fPar->GetCol0(iplan);
-        Float_t rowSize     = fPar->GetRowPadSize(iplan,icham,isect);
-        Float_t colSize     = fPar->GetColPadSize(iplan);
+        AliTRDpadPlane *padPlane = fPar->GetPadPlane(iplan,icham);
 
         // Get the digits
         digits = fDigitsManager->GetDigits(idet);
@@ -372,9 +383,9 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
                   iUnfold = 1;
                 }
 
-                Float_t clusterCharge = clusterSignal[0]
-                                      + clusterSignal[1]
-                                      + clusterSignal[2];
+                Double_t clusterCharge = clusterSignal[0]
+                                       + clusterSignal[1]
+                                       + clusterSignal[2];
                 
                // The position of the cluster
                 clusterPads[0] = row + 0.5;
@@ -385,7 +396,11 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
 
                  // Calculate the position of the cluster by using the
                  // lookup table method
-                  clusterPads[1] = col + 0.5
+//                   clusterPads[1] = col + 0.5
+//                                  + fPar->LUTposition(iplan,clusterSignal[0]
+//                                                           ,clusterSignal[1]
+//                                                       ,clusterSignal[2]);
+                  clusterPads[1] = 0.5
                                  + fPar->LUTposition(iplan,clusterSignal[0]
                                                           ,clusterSignal[1]
                                                          ,clusterSignal[2]);
@@ -395,45 +410,53 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
 
                  // Calculate the position of the cluster by using the
                  // center of gravity method
-                  clusterPads[1] = col + 0.5 
+//                   clusterPads[1] = col + 0.5 
+//                                  + (clusterSignal[2] - clusterSignal[0]) 
+//                              / clusterCharge;
+                  clusterPads[1] = 0.5 
                                  + (clusterSignal[2] - clusterSignal[0]) 
                                 / clusterCharge;
 
                }
 
-                Float_t q0 = clusterSignal[0];
-               Float_t q1 = clusterSignal[1];
-                Float_t q2 = clusterSignal[2];
-                Float_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) /
+                Double_t q0 = clusterSignal[0];
+               Double_t q1 = clusterSignal[1];
+                Double_t q2 = clusterSignal[2];
+                Double_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) /
                                          (clusterCharge*clusterCharge);
 
-                // Correct for ExB displacement
-                if (fPar->ExBOn()) { 
-                  Int_t   local_time_bin = (Int_t) clusterPads[2];
-                  Float_t driftLength    = local_time_bin * timeBinSize + kAmWidth;
-                  Float_t colSize        = fPar->GetColPadSize(iplan);
-                  Float_t deltaY         = omegaTau*driftLength/colSize;
-                  clusterPads[1]         = clusterPads[1] - deltaY;
-                }
-                                       
-
                // Calculate the position and the error
-                Float_t clusterPos[3];
-                clusterPos[0] = clusterPads[1] * colSize + col0;
-                clusterPos[1] = clusterPads[0] * rowSize + row0;
+                Double_t clusterPos[3];
+//                 clusterPos[0] = clusterPads[1] * colSize + col0;
+//                 clusterPos[1] = clusterPads[0] * rowSize + row0;
+                clusterPos[0] = padPlane->GetColPos(col) - clusterPads[1];
+                clusterPos[1] = padPlane->GetRowPos(row) - clusterPads[0];
                 clusterPos[2] = clusterPads[2];
-                Float_t clusterSig[2];
+                Double_t clusterSig[2];
+                Double_t colSize = padPlane->GetColSize(col);
+                Double_t rowSize = padPlane->GetRowSize(row);
                 clusterSig[0] = (clusterSigmaY2 + 1./12.) * colSize*colSize;
                 clusterSig[1] = rowSize * rowSize / 12.;
+
+                // Correct for ExB displacement
+                if (fPar->ExBOn()) { 
+                  Int_t    local_time_bin = (Int_t) clusterPads[2];
+                  Double_t driftLength    = local_time_bin * timeBinSize + kAmWidth;
+                  Double_t deltaY         = omegaTau * driftLength;
+                  clusterPos[1]           = clusterPos[1] - deltaY;
+                }
+
                //
                //
                AliTRDclusterMI * cluster = AddCluster();
-               Float_t sigma, relpos;
+               Double_t sigma, relpos;
                MakeCluster(clusterSignal, clusterPos, sigma,relpos);
 
-               clusterPos[0] = clusterPads[1] * colSize + col0;
-                clusterPos[1] = clusterPads[0] * rowSize + row0;
+//                clusterPos[0] = clusterPads[1] * colSize + col0;
+//                 clusterPos[1] = clusterPads[0] * rowSize + row0;
                 clusterPos[2] = clusterPads[2];
+                clusterPos[0] = padPlane->GetColPos(col) - clusterPads[1];
+                clusterPos[1] = padPlane->GetRowPos(row) - clusterPads[0];
                SetCluster(cluster, clusterPos,idet,clusterCharge,clusterTracks,clusterSig,iType,sigma,relpos);
                 // Add the cluster to the output array 
                //                fTRD->AddCluster(clusterPos
@@ -483,7 +506,7 @@ Bool_t AliTRDclusterizerMI::MakeClusters()
 }
 
 //_____________________________________________________________________________
-Float_t AliTRDclusterizerMI::Unfold(Float_t eps, Int_t plane, Float_t* padSignal)
+Double_t AliTRDclusterizerMI::Unfold(Double_t eps, Int_t plane, Double_t* padSignal)
 {
   //
   // Method to unfold neighbouring maxima.
@@ -492,15 +515,15 @@ Float_t AliTRDclusterizerMI::Unfold(Float_t eps, Int_t plane, Float_t* padSignal
   // The resulting ratio is then returned to the calling method.
   //
 
-  Int_t   irc               = 0;
-  Int_t   itStep            = 0;      // Count iteration steps
+  Int_t   irc                = 0;
+  Int_t   itStep             = 0;      // Count iteration steps
 
-  Float_t ratio             = 0.5;    // Start value for ratio
-  Float_t prevRatio         = 0;      // Store previous ratio
+  Double_t ratio             = 0.5;    // Start value for ratio
+  Double_t prevRatio         = 0;      // Store previous ratio
 
-  Float_t newLeftSignal[3]  = {0};    // Array to store left cluster signal
-  Float_t newRightSignal[3] = {0};    // Array to store right cluster signal
-  Float_t newSignal[3]      = {0};
+  Double_t newLeftSignal[3]  = {0};    // Array to store left cluster signal
+  Double_t newRightSignal[3] = {0};    // Array to store right cluster signal
+  Double_t newSignal[3]      = {0};
 
   // Start the iteration
   while ((TMath::Abs(prevRatio - ratio) > eps) && (itStep < 10)) {
@@ -509,23 +532,23 @@ Float_t AliTRDclusterizerMI::Unfold(Float_t eps, Int_t plane, Float_t* padSignal
     prevRatio = ratio;
 
     // Cluster position according to charge ratio
-    Float_t maxLeft  = (ratio*padSignal[2] - padSignal[0]) 
-                     / (padSignal[0] + padSignal[1] + ratio*padSignal[2]);
-    Float_t maxRight = (padSignal[4] - (1-ratio)*padSignal[2]) 
-                     / ((1-ratio)*padSignal[2] + padSignal[3] + padSignal[4]);
+    Double_t maxLeft  = (ratio*padSignal[2] - padSignal[0]) 
+                      / (padSignal[0] + padSignal[1] + ratio*padSignal[2]);
+    Double_t maxRight = (padSignal[4] - (1-ratio)*padSignal[2]) 
+                      / ((1-ratio)*padSignal[2] + padSignal[3] + padSignal[4]);
 
     // Set cluster charge ratio
     irc = fPar->PadResponse(1.0,maxLeft ,plane,newSignal);
-    Float_t ampLeft  = padSignal[1] / newSignal[1];
+    Double_t ampLeft  = padSignal[1] / newSignal[1];
     irc = fPar->PadResponse(1.0,maxRight,plane,newSignal);
-    Float_t ampRight = padSignal[3] / newSignal[1];
+    Double_t ampRight = padSignal[3] / newSignal[1];
 
     // Apply pad response to parameters
     irc = fPar->PadResponse(ampLeft ,maxLeft ,plane,newLeftSignal );
     irc = fPar->PadResponse(ampRight,maxRight,plane,newRightSignal);
 
     // Calculate new overlapping ratio
-    ratio = TMath::Min((Float_t)1.0,newLeftSignal[2] / 
+    ratio = TMath::Min((Double_t)1.0,newLeftSignal[2] / 
                           (newLeftSignal[2] + newRightSignal[0]));
 
   }
index 7f0a40d..e305d8f 100644 (file)
@@ -22,20 +22,22 @@ class AliTRDclusterizerMI : public AliTRDclusterizerV1 {
   AliTRDclusterizerMI(const Text_t* name, const Text_t* title);
   virtual ~AliTRDclusterizerMI();
   virtual Bool_t   MakeClusters(); 
-  void MakeCluster(Float_t * padSignal, Float_t * pos, Float_t &sigma, Float_t & relpad);
-  virtual void AddCluster(Float_t*, int, float, Int_t*, Float_t*, int) {};
+  void MakeCluster(Double_t * padSignal, Double_t * pos, Double_t &sigma, Double_t & relpad);
+  virtual void AddCluster(Double_t*, int, float, Int_t*, Double_t*, int) {};
   AliTRDclusterMI *  AddCluster();
-  void SetCluster(AliTRDclusterMI * cl, Float_t *pos, Int_t det, Float_t amp
-                 , Int_t *tracks, Float_t *sig, Int_t iType, Float_t sigmay,Float_t relpos);
+  virtual void    AddCluster(Double_t*, Int_t, Double_t, Int_t*, Double_t*, Int_t) { };
+  void SetCluster(AliTRDclusterMI * cl, Double_t *pos, Int_t det, Double_t amp
+                 , Int_t *tracks, Double_t *sig, Int_t iType, Double_t sigmay,Double_t relpos);
  protected:
 
  private:
   //  AliTRDclusterizerMI &operator=(const AliTRDclusterizerMI &c){;}
   //AliTRDclusterizerMI(const AliTRDclusterizerMI &c){;}
   TObjArray * fClusterContainer;
-  virtual Float_t  Unfold(Float_t eps, Int_t plane, Float_t *padSignal);
+  virtual Double_t Unfold(Double_t eps, Int_t plane, Double_t *padSignal);
 
   ClassDef(AliTRDclusterizerMI,1)           // TRD-Cluster finder, slow simulator
+
 };
 
 #endif
index ce4318d..fbb10a0 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliTRDdataArrayI.h"
 #include "AliTRDdigitsManager.h"
 #include "AliTRDparameter.h"
+#include "AliTRDpadPlane.h"
 
 ClassImp(AliTRDclusterizerV1)
 
@@ -192,24 +193,24 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
   const Int_t   kNsig    = 5;
   const Int_t   kNtrack  = 3 * kNclus;
 
-  Int_t   iType          = 0;
-  Int_t   iUnfold        = 0;
+  Int_t    iType         = 0;
+  Int_t    iUnfold       = 0;
 
-  Float_t ratioLeft      = 1.0;
-  Float_t ratioRight     = 1.0;
+  Double_t ratioLeft     = 1.0;
+  Double_t ratioRight    = 1.0;
 
-  Float_t padSignal[kNsig];   
-  Float_t clusterSignal[kNclus];
-  Float_t clusterPads[kNclus];   
-  Int_t   clusterDigit[kNclus];
-  Int_t   clusterTracks[kNtrack];   
+  Double_t padSignal[kNsig];   
+  Double_t clusterSignal[kNclus];
+  Double_t clusterPads[kNclus];   
+  Int_t    clusterDigit[kNclus];
+  Int_t    clusterTracks[kNtrack];   
 
-  Int_t chamBeg = 0;
-  Int_t chamEnd = AliTRDgeometry::Ncham();
-  Int_t planBeg = 0;
-  Int_t planEnd = AliTRDgeometry::Nplan();
-  Int_t sectBeg = 0;
-  Int_t sectEnd = AliTRDgeometry::Nsect();
+  Int_t    chamBeg = 0;
+  Int_t    chamEnd = AliTRDgeometry::Ncham();
+  Int_t    planBeg = 0;
+  Int_t    planEnd = AliTRDgeometry::Nplan();
+  Int_t    sectBeg = 0;
+  Int_t    sectEnd = AliTRDgeometry::Nsect();
 
   // Start clustering in every chamber
   for (Int_t icham = chamBeg; icham < chamEnd; icham++) {
@@ -231,15 +232,12 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                 ,icham,iplan,isect);
        }
 
-        Int_t   nRowMax     = fPar->GetRowMax(iplan,icham,isect);
-        Int_t   nColMax     = fPar->GetColMax(iplan);
-        Int_t   nTimeBefore = fPar->GetTimeBefore();
-        Int_t   nTimeTotal  = fPar->GetTimeTotal();  
+        Int_t    nRowMax     = fPar->GetRowMax(iplan,icham,isect);
+        Int_t    nColMax     = fPar->GetColMax(iplan);
+        Int_t    nTimeBefore = fPar->GetTimeBefore();
+        Int_t    nTimeTotal  = fPar->GetTimeTotal();  
 
-        Float_t row0        = fPar->GetRow0(iplan,icham,isect);
-        Float_t col0        = fPar->GetCol0(iplan);
-        Float_t rowSize     = fPar->GetRowPadSize(iplan,icham,isect);
-        Float_t colSize     = fPar->GetColPadSize(iplan);
+        AliTRDpadPlane *padPlane = fPar->GetPadPlane(iplan,icham);
 
         // Get the digits
         digits = fDigitsManager->GetDigits(idet);
@@ -383,9 +381,9 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                   iUnfold = 1;
                 }
 
-                Float_t clusterCharge = clusterSignal[0]
-                                      + clusterSignal[1]
-                                      + clusterSignal[2];
+                Double_t clusterCharge = clusterSignal[0]
+                                       + clusterSignal[1]
+                                       + clusterSignal[2];
                 
                // The position of the cluster
                 clusterPads[0] = row + 0.5;
@@ -396,7 +394,11 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
 
                  // Calculate the position of the cluster by using the
                  // lookup table method
-                  clusterPads[1] = col + 0.5
+//                   clusterPads[1] = col + 0.5
+//                                  + fPar->LUTposition(iplan,clusterSignal[0]
+//                                                           ,clusterSignal[1]
+//                                                       ,clusterSignal[2]);
+                  clusterPads[1] = 0.5
                                  + fPar->LUTposition(iplan,clusterSignal[0]
                                                           ,clusterSignal[1]
                                                          ,clusterSignal[2]);
@@ -406,27 +408,21 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
 
                  // Calculate the position of the cluster by using the
                  // center of gravity method
-                  clusterPads[1] = col + 0.5 
+//                   clusterPads[1] = col + 0.5 
+//                                  + (clusterSignal[2] - clusterSignal[0]) 
+//                              / clusterCharge;
+                  clusterPads[1] = 0.5 
                                  + (clusterSignal[2] - clusterSignal[0]) 
                                 / clusterCharge;
 
                }
 
-                Float_t q0 = clusterSignal[0];
-               Float_t q1 = clusterSignal[1];
-                Float_t q2 = clusterSignal[2];
-                Float_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) /
-                                         (clusterCharge*clusterCharge);
+                Double_t q0 = clusterSignal[0];
+               Double_t q1 = clusterSignal[1];
+                Double_t q2 = clusterSignal[2];
+                Double_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) /
+                                          (clusterCharge*clusterCharge);
 
-                // Correct for ExB displacement
-                if (fPar->ExBOn()) { 
-                  Int_t   local_time_bin = (Int_t) clusterPads[2];
-                  Float_t driftLength    = local_time_bin * timeBinSize + kAmWidth;
-                  Float_t colSize        = fPar->GetColPadSize(iplan);
-                  Float_t deltaY         = omegaTau*driftLength/colSize;
-                  clusterPads[1]         = clusterPads[1] - deltaY;
-                }
-                                       
                 if (fVerbose > 1) {
                   printf("-----------------------------------------------------------\n");
                   printf("Create cluster no. %d\n",nClusters);
@@ -450,21 +446,33 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
                 }
 
                // Calculate the position and the error
-                Float_t clusterPos[3];
-                clusterPos[0] = clusterPads[1] * colSize + col0;
-                clusterPos[1] = clusterPads[0] * rowSize + row0;
+                Double_t clusterPos[3];
+//                 clusterPos[0] = clusterPads[1] * colSize + col0;
+//                 clusterPos[1] = clusterPads[0] * rowSize + row0;
+                clusterPos[0] = padPlane->GetColPos(col) - clusterPads[1];
+                clusterPos[1] = padPlane->GetRowPos(row) - clusterPads[0];
                 clusterPos[2] = clusterPads[2];
-                Float_t clusterSig[2];
+                Double_t clusterSig[2];
+                Double_t colSize = padPlane->GetColSize(col);
+                Double_t rowSize = padPlane->GetRowSize(row);
                 clusterSig[0] = (clusterSigmaY2 + 1./12.) * colSize*colSize;
                 clusterSig[1] = rowSize * rowSize / 12.;
 
+                // Correct for ExB displacement
+                if (fPar->ExBOn()) { 
+                  Int_t    local_time_bin = (Int_t) clusterPads[2];
+                  Double_t driftLength    = local_time_bin * timeBinSize + kAmWidth;
+                  Double_t deltaY         = omegaTau * driftLength;
+                  clusterPos[1]           = clusterPos[1] - deltaY;
+                }
+                                       
                 // Add the cluster to the output array 
                 AddCluster(clusterPos
-                          ,idet
-                          ,clusterCharge
-                          ,clusterTracks
-                          ,clusterSig
-                          ,iType);
+                         ,idet
+                         ,clusterCharge
+                         ,clusterTracks
+                         ,clusterSig
+                         ,iType);
 
               }
             } 
@@ -474,7 +482,7 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
        // Compress the arrays
         digits->Compress(1,0);
         track0->Compress(1,0);
-        track1->Compress(1,0);
+ track1->Compress(1,0);
         track2->Compress(1,0);
 
         // Write the cluster and reset the array
@@ -506,7 +514,7 @@ Bool_t AliTRDclusterizerV1::MakeClusters()
 }
 
 //_____________________________________________________________________________
-Float_t AliTRDclusterizerV1::Unfold(Float_t eps, Int_t plane, Float_t* padSignal)
+Double_t AliTRDclusterizerV1::Unfold(Double_t eps, Int_t plane, Double_t* padSignal)
 {
   //
   // Method to unfold neighbouring maxima.
@@ -515,15 +523,15 @@ Float_t AliTRDclusterizerV1::Unfold(Float_t eps, Int_t plane, Float_t* padSignal
   // The resulting ratio is then returned to the calling method.
   //
 
-  Int_t   irc               = 0;
-  Int_t   itStep            = 0;      // Count iteration steps
+  Int_t   irc                = 0;
+  Int_t   itStep             = 0;      // Count iteration steps
 
-  Float_t ratio             = 0.5;    // Start value for ratio
-  Float_t prevRatio         = 0;      // Store previous ratio
+  Double_t ratio             = 0.5;    // Start value for ratio
+  Double_t prevRatio         = 0;      // Store previous ratio
 
-  Float_t newLeftSignal[3]  = {0};    // Array to store left cluster signal
-  Float_t newRightSignal[3] = {0};    // Array to store right cluster signal
-  Float_t newSignal[3]      = {0};
+  Double_t newLeftSignal[3]  = {0};    // Array to store left cluster signal
+  Double_t newRightSignal[3] = {0};    // Array to store right cluster signal
+  Double_t newSignal[3]      = {0};
 
   // Start the iteration
   while ((TMath::Abs(prevRatio - ratio) > eps) && (itStep < 10)) {
@@ -532,23 +540,23 @@ Float_t AliTRDclusterizerV1::Unfold(Float_t eps, Int_t plane, Float_t* padSignal
     prevRatio = ratio;
 
     // Cluster position according to charge ratio
-    Float_t maxLeft  = (ratio*padSignal[2] - padSignal[0]) 
-                     / (padSignal[0] + padSignal[1] + ratio*padSignal[2]);
-    Float_t maxRight = (padSignal[4] - (1-ratio)*padSignal[2]) 
-                     / ((1-ratio)*padSignal[2] + padSignal[3] + padSignal[4]);
+    Double_t maxLeft  = (ratio*padSignal[2] - padSignal[0]) 
+                      / (padSignal[0] + padSignal[1] + ratio*padSignal[2]);
+    Double_t maxRight = (padSignal[4] - (1-ratio)*padSignal[2]) 
+                      / ((1-ratio)*padSignal[2] + padSignal[3] + padSignal[4]);
 
     // Set cluster charge ratio
     irc = fPar->PadResponse(1.0,maxLeft ,plane,newSignal);
-    Float_t ampLeft  = padSignal[1] / newSignal[1];
+    Double_t ampLeft  = padSignal[1] / newSignal[1];
     irc = fPar->PadResponse(1.0,maxRight,plane,newSignal);
-    Float_t ampRight = padSignal[3] / newSignal[1];
+    Double_t ampRight = padSignal[3] / newSignal[1];
 
     // Apply pad response to parameters
     irc = fPar->PadResponse(ampLeft ,maxLeft ,plane,newLeftSignal );
     irc = fPar->PadResponse(ampRight,maxRight,plane,newRightSignal);
 
     // Calculate new overlapping ratio
-    ratio = TMath::Min((Float_t)1.0,newLeftSignal[2] / 
+    ratio = TMath::Min((Double_t)1.0,newLeftSignal[2] / 
                           (newLeftSignal[2] + newRightSignal[0]));
 
   }
index 37aeeaa..5d5e461 100644 (file)
@@ -34,9 +34,10 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer {
 
  private:
 
-  virtual Float_t  Unfold(Float_t eps, Int_t plane, Float_t *padSignal);
+  virtual Double_t Unfold(Double_t eps, Int_t plane, Double_t *padSignal);
 
   ClassDef(AliTRDclusterizerV1,5)           // TRD-Cluster finder, slow simulator
+
 };
 
 #endif
index cdc05c5..1b33a30 100644 (file)
@@ -71,6 +71,7 @@
 #include "AliTRDdigitsManager.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDparameter.h"
+#include "AliTRDpadPlane.h"
 
 ClassImp(AliTRDdigitizer)
 
@@ -566,37 +567,39 @@ Bool_t AliTRDdigitizer::MakeDigits()
   ///////////////////////////////////////////////////////////////
 
   // Number of pads included in the pad response
-  const Int_t kNpad  = 3;
+  const Int_t kNpad      = 3;
 
   // Number of track dictionary arrays
-  const Int_t kNDict = AliTRDdigitsManager::kNDict;
+  const Int_t kNDict     = AliTRDdigitsManager::kNDict;
 
   // Half the width of the amplification region
   const Float_t kAmWidth = AliTRDgeometry::AmThick() / 2.;
   // Width of the drit region
   const Float_t kDrWidth = AliTRDgeometry::DrThick();
 
-  Int_t   iRow, iCol, iTime, iPad;
-  Int_t   iDict  = 0;
-  Int_t   nBytes = 0;
+  Int_t    iRow, iCol, iTime, iPad;
+  Int_t    iDict  = 0;
+  Int_t    nBytes = 0;
 
-  Int_t   totalSizeDigits = 0;
-  Int_t   totalSizeDict0  = 0;
-  Int_t   totalSizeDict1  = 0;
-  Int_t   totalSizeDict2  = 0;
+  Int_t    totalSizeDigits = 0;
+  Int_t    totalSizeDict0  = 0;
+  Int_t    totalSizeDict1  = 0;
+  Int_t    totalSizeDict2  = 0;
 
-  Int_t   timeBinTRFend = 1;
+  Int_t    timeBinTRFend   = 1;
 
-  Float_t pos[3];
-  Float_t rot[3];
-  Float_t xyz[3];
-  Float_t padSignal[kNpad];
-  Float_t signalOld[kNpad];
+  Double_t pos[3];
+  Double_t rot[3];
+  Double_t xyz[3];
+  Double_t padSignal[kNpad];
+  Double_t signalOld[kNpad];
 
-  AliTRDdataArrayF *signals = 0;
-  AliTRDdataArrayI *digits  = 0;
+  AliTRDdataArrayF *signals  = 0;
+  AliTRDdataArrayI *digits   = 0;
   AliTRDdataArrayI *dictionary[kNDict];
 
+  AliTRDpadPlane   *padPlane = 0;
+
   // Create a default parameter class if none is defined
   if (!fPar) {
     fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
@@ -695,21 +698,19 @@ Bool_t AliTRDdigitizer::MakeDigits()
       Int_t   plane         = fGeo->GetPlane(detector);
       Int_t   sector        = fGeo->GetSector(detector);
       Int_t   chamber       = fGeo->GetChamber(detector);
-      Int_t   nRowMax       = fPar->GetRowMax(plane,chamber,sector);
-      Int_t   nColMax       = fPar->GetColMax(plane);
       Int_t   nTimeMax      = fPar->GetTimeMax();
       Int_t   nTimeBefore   = fPar->GetTimeBefore();
       Int_t   nTimeAfter    = fPar->GetTimeAfter();
       Int_t   nTimeTotal    = fPar->GetTimeTotal();
-      Float_t row0          = fPar->GetRow0(plane,chamber,sector);
-      Float_t col0          = fPar->GetCol0(plane);
       Float_t time0         = fPar->GetTime0(plane);
-      Float_t rowPadSize    = fPar->GetRowPadSize(plane,chamber,sector);
-      Float_t colPadSize    = fPar->GetColPadSize(plane);
       Float_t driftvelocity = fPar->GetDriftVelocity();
       Float_t samplingRate  = fPar->GetSamplingFrequency();
-      Float_t divideRow     = 1.0 / rowPadSize;
-      Float_t divideCol     = 1.0 / colPadSize;
+
+      padPlane              = fPar->GetPadPlane(plane,chamber);
+      Float_t row0          = padPlane->GetRow0();
+      Float_t col0          = padPlane->GetCol0();
+      Int_t   nRowMax       = padPlane->GetNrows();
+      Int_t   nColMax       = padPlane->GetNcols();
 
       if (fDebug > 1) {
         printf("Analyze hit no. %d ",iHit);
@@ -723,8 +724,8 @@ Bool_t AliTRDdigitizer::MakeDigits()
              ,nTimeBefore,nTimeAfter,nTimeTotal);
         printf("row0 = %f, col0 = %f, time0 = %f\n"
               ,row0,col0,time0);
-        printf("rowPadSize = %f, colPadSize = %f, SamplingRate = %f\n"
-              ,rowPadSize,colPadSize,samplingRate); 
+        printf("samplingRate = %f\n"
+              ,samplingRate); 
       }
        
       // Don't analyze test hits and switched off detectors
@@ -805,10 +806,10 @@ Bool_t AliTRDdigitizer::MakeDigits()
        }
 
         // The driftlength. It is negative if the hit is between pad plane and anode wires.
-        Float_t driftlength = time0 - rot[0];
+        Double_t driftlength = time0 - rot[0];
 
         // Normalised drift length
-        Float_t absdriftlength = TMath::Abs(driftlength);
+        Double_t absdriftlength = TMath::Abs(driftlength);
         if (fPar->ExBOn()) absdriftlength /= TMath::Sqrt(fPar->GetLorentzFactor());
 
         // Loop over all electrons of this hit
@@ -824,12 +825,12 @@ Bool_t AliTRDdigitizer::MakeDigits()
          // outside the chamber volume. A real fix would actually need
          // a more clever implementation of the TR hit generation
           if (q < 0.0) {
-            Float_t zz = xyz[2] - row0;
-            if ((zz < 0.0) || (zz > rowPadSize*nRowMax)) {
+           if ((xyz[2] < padPlane->GetRowEnd()) ||
+                (xyz[2] > padPlane->GetRow0())) {
               if (iEl == 0) {
                 printf("<AliTRDdigitizer::MakeDigits> ");
-                printf("Hit outside of sensitive volume, row (Q = %d)\n",((Int_t) q));
-                //printf("zz=%f, xyz=%f, row0=%f, max=%f\n",zz,xyz[2],row0,rowPadSize*nRowMax);
+                printf("Hit outside of sensitive volume, row (z=%f, row0=%f, rowE=%f)\n"
+                      ,xyz[2],padPlane->GetRow0(),padPlane->GetRowEnd());
              }
               continue;
            }
@@ -838,8 +839,6 @@ Bool_t AliTRDdigitizer::MakeDigits()
               if (iEl == 0) {
                 printf("<AliTRDdigitizer::MakeDigits> ");
                 printf("Hit outside of sensitive volume, time (Q = %d)\n",((Int_t) q));
-                /*printf("track %d: tt=%f, xyz=%f, min=%f, max=%f\n",
-                 iTrack,tt,xyz[0],time0-kDrWidth-kAmWidth,time0+kAmWidth);*/
              }
               continue;
            }
@@ -862,40 +861,39 @@ Bool_t AliTRDdigitizer::MakeDigits()
 
           // The electron position after diffusion and ExB in pad coordinates.
           // The pad row (z-direction)
-          Float_t rowDist   = xyz[2] - row0;
-          Int_t   rowE      = ((Int_t) (rowDist * divideRow));
-          if ((rowE < 0) || (rowE >= nRowMax)) continue;
-          Float_t rowOffset = ((((Float_t) rowE) + 0.5) * rowPadSize) - rowDist;
+          Int_t    rowE      = padPlane->GetPadRowNumber(xyz[2]);
+          if (rowE < 0) continue;
+          Double_t rowOffset = padPlane->GetPadRowOffset(rowE,xyz[2]);
 
           // The pad column (rphi-direction)
-          Float_t col0tilt  = fPar->Col0Tilted(col0,rowOffset,plane);
-          Float_t colDist   = xyz[1] - col0tilt;
-          Int_t   colE      = ((Int_t) (colDist * divideCol));
-          if ((colE < 0) || (colE >= nColMax)) continue;
-          Float_t colOffset = ((((Float_t) colE) + 0.5) * colPadSize) - colDist;
+          Int_t    colE      = padPlane->GetPadColNumber(xyz[1],rowOffset);
+          if (colE < 0) continue;
+          Double_t colOffset = padPlane->GetPadColOffset(colE,xyz[1]);
 
          // Convert the position to drift time, using either constant drift velocity or
           // time structure of drift cells (non-isochronity, GARFIELD calculation).
-         Float_t drifttime;
+         Double_t drifttime;
          if (fPar->TimeStructOn()) {
            // Get z-position with respect to anode wire:
-           Float_t Z  =  xyz[2] - row0 + fPar->GetAnodeWireOffset();
+           //Double_t Z  =  xyz[2] - row0 + fPar->GetAnodeWireOffset();
+           Double_t Z  =  row0 - xyz[2] + fPar->GetAnodeWireOffset();
            Z -= ((Int_t)(2*Z))/2.;
            if (Z>0.25)   Z  = 0.5-Z;
            // use drift time map (GARFIELD)
             drifttime = fPar->TimeStruct(time0 - xyz[0] + kAmWidth, Z);
-         } else {
+         } 
+          else {
            // use constant drift velocity
            drifttime = TMath::Abs(time0 - xyz[0]) / driftvelocity;
          }
 
           // The time bin (always positive)
-         Int_t timeE  = ((Int_t) (drifttime * samplingRate));
+         Int_t    timeE      = ((Int_t) (drifttime * samplingRate));
          // The distance of the position to the middle of the timebin
-         Float_t timeOffset = ((((Float_t) timeE) + 0.5) / samplingRate) - drifttime;
+         Double_t timeOffset = ((((Float_t) timeE) + 0.5) / samplingRate) - drifttime;
  
           // Apply the gas gain including fluctuations
-          Float_t ggRndm = 0.0;
+          Double_t ggRndm = 0.0;
           do {
             ggRndm = gRandom->Rndm();
          } while (ggRndm <= 0);
@@ -905,7 +903,9 @@ Bool_t AliTRDdigitizer::MakeDigits()
           if (fPar->PRFOn()) {
            // The distance of the electron to the center of the pad 
            // in units of pad width
-            Float_t dist = - colOffset * divideCol;
+            //Double_t dist = - colOffset / padPlane->GetColSize(colE);
+            Double_t dist = (0.5 * padPlane->GetRowSize(colE) - colOffset) 
+                          / padPlane->GetColSize(colE);
             if (!(fPar->PadResponse(signal,dist,plane,padSignal))) continue;
          }
          else {
@@ -922,13 +922,11 @@ Bool_t AliTRDdigitizer::MakeDigits()
               iTimeBin++                                                       ) {
 
            // Apply the time response
-            Float_t timeResponse = 1.0;
-            Float_t crossTalk    = 0.0;
-            Float_t time         = (iTimeBin - timeE) / samplingRate + timeOffset;
+            Double_t timeResponse = 1.0;
+            Double_t crossTalk    = 0.0;
+            Double_t time         = (iTimeBin - timeE) / samplingRate + timeOffset;
             if (fPar->TRFOn()) {
               timeResponse = fPar->TimeResponse(time);
-              //printf("iTimeBin = %d, time = %f, timeResponse = %f\n"
-             //             ,iTimeBin,time,timeResponse);
            }
             if (fPar->CTOn()) {
               crossTalk    = fPar->CrossTalk(time);
@@ -992,12 +990,12 @@ Bool_t AliTRDdigitizer::MakeDigits()
   }
 
   // The coupling factor
-  Float_t coupling = fPar->GetPadCoupling() 
-                   * fPar->GetTimeCoupling();
+  Double_t coupling = fPar->GetPadCoupling() 
+                    * fPar->GetTimeCoupling();
 
   // The conversion factor
-  Float_t convert  = kEl2fC
-                   * fPar->GetChipGain();
+  Double_t convert  = kEl2fC
+                    * fPar->GetChipGain();
 
   // Loop through all chambers to finalize the digits
   Int_t iDetBeg = 0;
index 3a50a4a..dd7cc9e 100644 (file)
@@ -150,16 +150,16 @@ Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2
 
             if (amp > thresh) {
           
-              Float_t glb[3];
-              Float_t loc[3];
+              Double_t glb[3];
+              Double_t loc[3];
 
               loc[0] = row;
               loc[1] = col;
               loc[2] = time;
               geo->Local2Global(idet,loc,glb,par);
-              Float_t x = glb[0];
-              Float_t y = glb[1];
-              Float_t z = glb[2];
+              Double_t x = glb[0];
+              Double_t y = glb[1];
+              Double_t z = glb[2];
 
               if      (type == 1) {
                 pmSignal->SetPoint(isignal,x,y,z);
index f3516fc..0b25936 100644 (file)
@@ -27,6 +27,7 @@
 #include "AliRunLoader.h"
 #include "AliTRDgeometry.h"
 #include "AliTRDparameter.h"
+#include "AliTRDpadPlane.h"
 
 #include "AliRun.h"
 #include "AliTRD.h"
@@ -252,8 +253,8 @@ void AliTRDgeometry::CreateGeometry(Int_t* )
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
-                                   , Float_t *global
+Bool_t AliTRDgeometry::Local2Global(Int_t idet, Double_t *local
+                                   , Double_t *global
                                    , AliTRDparameter *par) const
 {
   //
@@ -271,7 +272,7 @@ Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local
  
 //_____________________________________________________________________________
 Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
-                                  , Float_t *local, Float_t *global
+                                  , Double_t *local, Double_t *global
                                   , AliTRDparameter *par) const
 {
   //
@@ -284,34 +285,29 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect
     return kFALSE;
   }
 
-  Int_t    idet      = GetDetector(iplan,icham,isect); // Detector number
+  AliTRDpadPlane *padPlane = par->GetPadPlane(iplan,icham);
 
-  Float_t  padRow    = local[0]+0.5;                   // Pad Row position
-  Float_t  padCol    = local[1]+0.5;                   // Pad Column position
-  Float_t  timeSlice = local[2]+0.5;                   // Time "position"
-
-  Float_t  row0      = par->GetRow0(iplan,icham,isect);
-  Float_t  col0      = par->GetCol0(iplan);
+  // 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     = par->GetTime0(iplan);
 
-  Float_t  rot[3];
-
-  // calculate (x,y,z) position in rotated chamber
+  Double_t  rot[3];
   rot[0] = time0 - (timeSlice - par->GetTimeBefore()) 
          * par->GetDriftVelocity()/par->GetSamplingFrequency();
-  rot[1] = col0  + padCol                    
-         * par->GetColPadSize(iplan);
-  rot[2] = row0  + padRow                    
-         * par->GetRowPadSize(iplan,icham,isect);
+  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
+  Int_t idet = GetDetector(iplan,icham,isect); 
   return RotateBack(idet,rot,global);
 
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::Global2Local(Int_t mode, Float_t *local, Float_t *global
-                                  , Int_t* index,  AliTRDparameter *par) const
+Bool_t AliTRDgeometry::Global2Local(Int_t mode, Double_t *local, Double_t *global
+                                   , Int_t* index,  AliTRDparameter *par) const
 {
   //
   // Converts local pad-coordinates (row,col,time) into 
@@ -353,8 +349,9 @@ Bool_t AliTRDgeometry::Global2Local(Int_t mode, Float_t *local, Float_t *global
 
 }
 
-//___________________________________________________________________
-Bool_t   AliTRDgeometry::Global2Detector(Float_t global[3], Int_t index[3], AliTRDparameter *par)
+//_____________________________________________________________________________
+Bool_t AliTRDgeometry::Global2Detector(Double_t global[3], Int_t index[3]
+                                      , AliTRDparameter *par)
 {
   //  
   // input    = global position
@@ -389,7 +386,7 @@ Bool_t   AliTRDgeometry::Global2Detector(Float_t global[3], Int_t index[3], AliT
 
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
+Bool_t AliTRDgeometry::Rotate(Int_t d, Double_t *pos, Double_t *rot) const
 {
   //
   // Rotates all chambers in the position of sector 0 and transforms
@@ -408,7 +405,7 @@ Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const
+Bool_t AliTRDgeometry::RotateBack(Int_t d, Double_t *rot, Double_t *pos) const
 {
   //
   // Rotates a chambers from the position of sector 0 into its
index e31d56a..533ecc3 100644 (file)
@@ -29,14 +29,16 @@ class AliTRDgeometry : public AliGeometry {
   virtual Int_t    IsVersion() const = 0;
   virtual void     Init();
   virtual Bool_t   Impact(const TParticle* ) const { return kTRUE; };
-  virtual Bool_t   Local2Global(Int_t d, Float_t *local, Float_t *global, AliTRDparameter *par) const;
-  virtual Bool_t   Local2Global(Int_t p, Int_t c, Int_t s, Float_t *local, Float_t *global, AliTRDparameter *par) const;
+  virtual Bool_t   Local2Global(Int_t d, Double_t *local, Double_t *global, AliTRDparameter *par) const;
+  virtual Bool_t   Local2Global(Int_t p, Int_t c, Int_t s
+                                , Double_t *local, Double_t *global, AliTRDparameter *par) const;
 
-  virtual Bool_t   Global2Local(Int_t mode, Float_t *local, Float_t *global, Int_t* index,  AliTRDparameter *par) const;
-  virtual Bool_t   Global2Detector(Float_t global[3], Int_t index[3],  AliTRDparameter *par);
+  virtual Bool_t   Global2Local(Int_t mode, Double_t *local, Double_t *global
+                               , Int_t* index,  AliTRDparameter *par) const;
+  virtual Bool_t   Global2Detector(Double_t global[3], Int_t index[3],  AliTRDparameter *par);
 
-  virtual Bool_t   Rotate(Int_t d, Float_t *pos, Float_t *rot) const;
-  virtual Bool_t   RotateBack(Int_t d, Float_t *rot, Float_t *pos) const;
+  virtual Bool_t   Rotate(Int_t d, Double_t *pos, Double_t *rot) const;
+  virtual Bool_t   RotateBack(Int_t d, Double_t *rot, Double_t *pos) const;
 
   static  Int_t    Nsect()   { return fgkNsect; };
   static  Int_t    Nplan()   { return fgkNplan; };
@@ -76,7 +78,7 @@ class AliTRDgeometry : public AliGeometry {
   virtual Int_t    GetChamber(Int_t d) const;
   virtual Int_t    GetSector(Int_t d)  const;
 
-          Float_t  GetChamberWidth(Int_t p) const { return fCwidth[p];     };
+          Float_t  GetChamberWidth(Int_t p) const           { return fCwidth[p];     };
           Float_t  GetChamberLength(Int_t p, Int_t c) const { return fClength[p][c]; }; 
 
   virtual void     GetGlobal(const AliRecPoint* , TVector3& , TMatrix& ) const { }; 
index cdc9665..079fa81 100644 (file)
@@ -236,6 +236,11 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
   };
 
   //
+  // Store tilting angle as tangens (opposite direction!)
+  //
+  fTiltingAngle = TMath::Tan(TMath::Pi()/180.0 * -fTiltingAngle);
+
+  //
   // The positions of the borders of the pads
   //
   // Row direction
@@ -245,6 +250,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
   Double_t row = fGeo->GetChamberLength(p,0)
               + fGeo->GetChamberLength(p,1)
                + fGeo->GetChamberLength(p,2) / 2.
+               - fGeo->RpadW()
                - fLengthRim;
   for (Int_t ic = 0; ic < c; ic++) {
     row -= fGeo->GetChamberLength(p,ic);
@@ -252,7 +258,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
   for (Int_t ir = 0; ir < fNrows; ir++) {
     fPadRow[ir] = row;
     row -= fRowSpacing;
-    if (ir == 1) {
+    if (ir == 0) {
       row -= fLengthOPad;
     }
     else {
@@ -270,7 +276,7 @@ AliTRDpadPlane::AliTRDpadPlane(Int_t p, Int_t c):TObject()
   for (Int_t ic = 0; ic < fNcols; ic++) {
     fPadCol[ic] = col;
     col -= fColSpacing;
-    if (ic == 1) {
+    if (ic == 0) {
       col -= fWidthOPad;
     }
     else {
@@ -375,7 +381,7 @@ void AliTRDpadPlane::Copy(TObject &p) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
+Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z) const
 {
   //
   // Finds the pad row number for a given global z-position
@@ -386,11 +392,13 @@ Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
   Int_t nbelow = 0;
   Int_t middle = 0;
 
-  if ((z > fPadRow[0]) ||
-      (z < fPadRow[0] - fLength + 2.0*fLengthRim)) {
+  if ((z > GetRow0()) || (z < GetRowEnd())) {
+
     row = -1;
+
   }
   else {
+
     nabove = fNrows+1;
     nbelow = 0;
     while (nabove - nbelow > 1) {
@@ -400,6 +408,7 @@ Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
       else                        nbelow = middle;
     }
     row = nbelow - 1;
+
   }
 
   return row;
@@ -407,22 +416,33 @@ Int_t AliTRDpadPlane::GetPadRowNumber(const Double_t z)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpadPlane::GetPadColNumber(const Double_t rphi)
+Int_t AliTRDpadPlane::GetPadColNumber(const Double_t rphi
+                                    , const Double_t rowOffset) const
 {
   //
   // Finds the pad column number for a given global rphi-position
   //
 
-  Int_t col    = 0;
-  Int_t nabove = 0;
-  Int_t nbelow = 0;
-  Int_t middle = 0;
+  Int_t    col       = 0;
+  Int_t    nabove    = 0;
+  Int_t    nbelow    = 0;
+  Int_t    middle    = 0;
+  Double_t rphiShift = 0;
+
+  if ((rphi > GetCol0()) || (rphi < GetColEnd())) {
 
-  if ((rphi > fPadCol[0]) ||
-      (rphi < fPadCol[0] - fWidth + 2.0*fWidthRim)) {
     col = -1;
+
   }
   else {
+
+    //
+    // Take the tilting angle into account by shifting the hit position
+    // into the opposite direction
+    //
+
+    rphiShift = rphi + fTiltingAngle * rowOffset;
+
     nabove = fNcols+1;
     nbelow = 0;
     while (nabove - nbelow > 1) {
@@ -432,40 +452,12 @@ Int_t AliTRDpadPlane::GetPadColNumber(const Double_t rphi)
       else                           nbelow = middle;
     }
     col = nbelow - 1;
-  }
-
-  return col;
 
-}
+    //printf("rphi=%f, rphiShift=%f, col=%d, colH=%f\n"
+    //   ,rphi,rphiShift,col,fPadCol[col]);
 
-//_____________________________________________________________________________
-Double_t AliTRDpadPlane::GetPadRowOffset(const Int_t row, const Double_t z)
-{
-  //
-  // Calculates the distance to the pad border in row direction
-  //
-
-  if ((row < 0) || (row >= fNrows)) {
-    return -1.0;
   }
-  else {
-    return fPadRow[row] - z;
-  }
-
-}
 
-//_____________________________________________________________________________
-Double_t AliTRDpadPlane::GetPadColOffset(const Int_t col, const Double_t rphi)
-{
-  //
-  // Calculates the distance to the pad border in column direction
-  //
-
-  if ((col < 0) || (col >= fNcols)) {
-    return -1.0;
-  }
-  else {
-    return fPadCol[col] - rphi;
-  }
+  return col;
 
 }
index 3c15b78..2a7b58e 100644 (file)
@@ -32,12 +32,44 @@ class AliTRDpadPlane : public TObject {
   AliTRDpadPlane    &operator=(const AliTRDpadPlane &p);
   virtual void       Copy(TObject &p) const;
 
-  Int_t    GetPadRowNumber(const Double_t z);
-  Int_t    GetPadColNumber(const Double_t rphi);
+  Int_t    GetPadRowNumber(const Double_t z) const;
+  Int_t    GetPadColNumber(const Double_t rphi, const Double_t rowOffset) const;
 
-  Double_t GetPadRowOffset(const Int_t row, const Double_t z);
-  Double_t GetPadColOffset(const Int_t col, const Double_t rphi);
+  Double_t GetPadRowOffset(const Int_t row, const Double_t z) const
+                                             { if ((row < 0) || (row >= fNrows))
+                                                 return -1.0;
+                                               else 
+                                                 return fPadRow[row] - z;    };
+
+  Double_t GetPadColOffset(const Int_t col, const Double_t rphi) const
+                                             { if ((col < 0) || (col >= fNcols))
+                                                 return -1.0;
+                                               else
+                                                 return fPadCol[col] - rphi; };
+
+  Double_t GetTiltingAngle() const           { return fTiltingAngle; };
+
+  Int_t    GetNrows() const                  { return fNrows;        };
+  Int_t    GetNcols() const                  { return fNcols;        };
+
+  Double_t GetRow0() const                   { return fPadRow[0];    };
+  Double_t GetCol0() const                   { return fPadCol[0];    };
+
+  Double_t GetRowEnd() const                 { return fPadRow[fNrows-1]  - fLengthOPad; };
+  Double_t GetColEnd() const                 { return fPadCol[fNcols-11] - fWidthOPad;  };
+
+  Double_t GetRowPos(const Int_t row) const  { return fPadRow[row];  };
+  Double_t GetColPos(const Int_t col) const  { return fPadCol[col];  };
   
+  Double_t GetRowSize(const Int_t row) const { if ((row == 0) || (row == fNrows-1))
+                                                 return fLengthOPad;
+                                               else
+                                                 return fLengthIPad; };
+  Double_t GetColSize(const Int_t col) const { if ((col == 0) || (col == fNcols-1))
+                                                 return fWidthOPad;
+                                               else
+                                                 return fWidthIPad;  };
+
  protected:
 
   AliTRDgeometry *fGeo;       //! TRD geometry       
index d5db963..57f112c 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "AliTRDparameter.h"
 #include "AliTRDgeometryFull.h"
+#include "AliTRDpadPlane.h"
 
 ClassImp(AliTRDparameter)
 
@@ -39,6 +40,7 @@ AliTRDparameter::AliTRDparameter():TNamed()
   //
 
   fGeo                = 0;
+  fPadPlaneArray      = 0;
   fPRFsmp             = 0;
   fTRFsmp             = 0;
   fCTsmp              = 0;
@@ -58,7 +60,6 @@ AliTRDparameter::AliTRDparameter():TNamed()
   fPadCoupling        = 0.0;
   fTimeCoupling       = 0.0;
   fField              = 0.0;
-  fTiltingAngle       = 0.0;
   fPRFbin             = 0;
   fPRFlo              = 0.0;
   fPRFhi              = 0.0;
@@ -99,6 +100,8 @@ AliTRDparameter::AliTRDparameter(const Text_t *name, const Text_t *title)
   //
 
   fGeo                = new AliTRDgeometryFull();
+  fPadPlaneArray      = new TObjArray(AliTRDgeometry::Nplan() 
+                                    * AliTRDgeometry::Ncham());
   fPRFsmp             = 0;
   fTRFsmp             = 0;
   fCTsmp              = 0;
@@ -119,7 +122,6 @@ AliTRDparameter::AliTRDparameter(const Text_t *name, const Text_t *title)
   fPadCoupling        = 0.0;
   fTimeCoupling       = 0.0;
   fField              = 0.0;
-  fTiltingAngle       = 0.0;
   fPRFbin             = 0;
   fPRFlo              = 0.0;
   fPRFhi              = 0.0;
@@ -197,6 +199,12 @@ AliTRDparameter::~AliTRDparameter()
     fGeo    = 0;
   }
 
+  if (fPadPlaneArray) {
+    fPadPlaneArray->Delete();
+    delete fPadPlaneArray;
+    fPadPlaneArray = 0;
+  }
+
   if (fTimeStruct1) {
     delete [] fTimeStruct1;
     fTimeStruct1 = 0;
@@ -254,7 +262,6 @@ void AliTRDparameter::Copy(TObject &p) const
   ((AliTRDparameter &) p).fTRFOn              = fTRFOn;
   ((AliTRDparameter &) p).fCTOn               = fCTOn;
   ((AliTRDparameter &) p).fTCOn               = fTCOn;
-  ((AliTRDparameter &) p).fTiltingAngle       = fTiltingAngle;
   ((AliTRDparameter &) p).fPRFbin             = fPRFbin;
   ((AliTRDparameter &) p).fPRFlo              = fPRFlo;
   ((AliTRDparameter &) p).fPRFhi              = fPRFhi;
@@ -314,59 +321,30 @@ void AliTRDparameter::Init()
   //
   // Initializes the parameter
   //
-  // The maximum number of pads
-  // and the position of pad 0,0,0
-  //
-  // chambers seen from the top:
-  //     +----------------------------+
-  //     |                            |
-  //     |                            |      ^
-  //     |                            |  rphi|
-  //     |                            |      |
-  //     |0                           |      |
-  //     +----------------------------+      +------>
-  //                                             z
-  // chambers seen from the side:            ^
-  //     +----------------------------+ drift|
-  //     |0                           |      |
-  //     |                            |      |
-  //     +----------------------------+      +------>
-  //                                             z
-  //
-  // IMPORTANT: time bin 0 is now the first one in the drift region
-  // closest to the readout !!!
-  //
+
+  Int_t iplan;
+  Int_t icham;
 
   //
   // ----------------------------------------------------------------------------
-  // The pad definition
+  // The pad planes
   // ----------------------------------------------------------------------------
   //
-
-  // The pad size in column direction (rphi-direction)
-
-  //SetColPadSize(0,0.65);
-  //SetColPadSize(1,0.68);
-  //SetColPadSize(2,0.71);
-  //SetColPadSize(3,0.74);
-  //SetColPadSize(4,0.77);
-  //SetColPadSize(5,0.80);
-
-  SetColPadSize(0,0.664);
-  SetColPadSize(1,0.695);
-  SetColPadSize(2,0.726);
-  SetColPadSize(3,0.756);
-  SetColPadSize(4,0.788);
-  SetColPadSize(5,0.818);
-
-  // The pad row (z-direction)
-  SetNRowPad();
+  for (iplan = 0; iplan < AliTRDgeometry::Nplan(); iplan++) {
+    for (icham = 0; icham < AliTRDgeometry::Ncham(); icham++) {
+      Int_t ipp = iplan + icham * AliTRDgeometry::Nplan();
+      fPadPlaneArray->AddAt(new AliTRDpadPlane(iplan,icham),ipp);
+    }
+  }
 
   // !CHANGED!
   // Time position of anode wire plane
-  for (Int_t iplan = 0; iplan < AliTRDgeometry::Nplan(); iplan++) {
-    fTime0[iplan] = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght() + AliTRDgeometry::CdrHght()
-       + AliTRDgeometry::CamHght()/2. + iplan * (AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace());
+  for (iplan = 0; iplan < AliTRDgeometry::Nplan(); iplan++) {
+    fTime0[iplan] = AliTRDgeometry::Rmin() 
+                  + AliTRDgeometry::CraHght() 
+                  + AliTRDgeometry::CdrHght()
+                 + AliTRDgeometry::CamHght()/2. 
+                  + iplan * (AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace());
   }
 
   //
@@ -435,9 +413,6 @@ void AliTRDparameter::Init()
   // Distance of first Anode wire from first pad edge
   fAnodeWireOffset = 0.25;
 
-  // The tilting angle for the readout pads
-  SetTiltingAngle(2.0);
-
   // The magnetic field strength in Tesla
   Double_t x[3] = { 0.0, 0.0, 0.0 };
   Double_t b[3];
@@ -509,89 +484,63 @@ void AliTRDparameter::ReInit()
 }
 
 //_____________________________________________________________________________
-void AliTRDparameter::SetNRowPad(Int_t p, Int_t c, Int_t npad)
+AliTRDpadPlane *AliTRDparameter::GetPadPlane(Int_t p, Int_t c) const
 {
   //
-  // Redefines the number of pads in raw direction for
-  // a given plane and chamber number
+  // Returns the pad plane for a given plane <p> and chamber <c> number
   //
 
-  for (Int_t isect = 0; isect < AliTRDgeometry::Nsect(); isect++) {
-
-    fRowMax[p][c][isect] = npad;
-
-    fRowPadSize[p][c][isect] = (fGeo->GetChamberLength(p,c) 
-                               - 2.* AliTRDgeometry::RpadW())
-                             / ((Float_t) npad);
-
-  }
+  Int_t ipp = p + c * AliTRDgeometry::Nplan();
+  return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp));
 
 }
 
 //_____________________________________________________________________________
-void AliTRDparameter::SetNRowPad()
+Int_t AliTRDparameter::GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const
 {
   //
-  // Defines the number of pads in row direction
+  // Returns the number of rows on the pad plane
   //
 
-  Int_t isect;
-  Int_t icham;
-  Int_t iplan;
-
-  Int_t rowMax[kNplan][kNcham] = { { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 }
-                                 , { 16, 16, 12, 16, 16 } };
+  return GetPadPlane(p,c)->GetNrows();
 
-  Float_t rpadW = AliTRDgeometry::RpadW();
+}
 
-  for (isect = 0; isect < kNsect; isect++) {
-    for (icham = 0; icham < kNcham; icham++) {
-      for (iplan = 0; iplan < kNplan; iplan++) {
+//_____________________________________________________________________________
+Int_t AliTRDparameter::GetColMax(Int_t p) const
+{
+  //
+  // Returns the number of rows on the pad plane
+  //
 
-        fRowMax[iplan][icham][isect]     = rowMax[iplan][icham];
+  return GetPadPlane(p,0)->GetNcols();
 
-        fRowPadSize[iplan][icham][isect] = (fGeo->GetChamberLength(iplan,icham) 
-                                            - 2.*rpadW)
-                                         / ((Float_t) rowMax[iplan][icham]);
+}
 
-        Float_t row0 = rpadW - fGeo->GetChamberLength(iplan,0)
-                            - fGeo->GetChamberLength(iplan,1)
-                             - fGeo->GetChamberLength(iplan,2) / 2.;
-        for (Int_t ic = 0; ic < icham; ic++) {
-          row0 += fGeo->GetChamberLength(iplan,ic);
-        }
+//_____________________________________________________________________________
+Double_t AliTRDparameter::GetRow0(Int_t p, Int_t c, Int_t /*s*/) const
+{
+  //
+  // Returns the position of the border of the first pad in a row
+  //
 
-        fRow0[iplan][icham][isect]          = row0;
-       // For new chamber ordering
-        //fRow0[iplan][kNcham-icham-1][isect] = row0;
-
-      }
-    }
-  }
+  return GetPadPlane(p,c)->GetRow0();
 
 }
 
 //_____________________________________________________________________________
-void AliTRDparameter::SetColPadSize(Int_t p, Float_t s)
+Double_t AliTRDparameter::GetCol0(Int_t p) const
 {
   //
-  // Redefines the pad size in column direction
+  // Returns the position of the border of the first pad in a column
   //
 
-  Float_t cpadW  = AliTRDgeometry::CpadW();
-
-  fColPadSize[p] = s;
-  fCol0[p]       = - fGeo->GetChamberWidth(p)/2. + cpadW;
-  fColMax[p]     = ((Int_t) ((fGeo->GetChamberWidth(p) - 2.*cpadW) / s));
+  return GetPadPlane(p,0)->GetCol0();
 
 }
 
 //_____________________________________________________________________________
-Float_t AliTRDparameter::CrossTalk(Float_t time) const
+Double_t AliTRDparameter::CrossTalk(Double_t time) const
 {
   //
   // Applies the pad-pad capacitive cross talk
@@ -610,11 +559,17 @@ Float_t AliTRDparameter::CrossTalk(Float_t time) const
 //_____________________________________________________________________________
 void AliTRDparameter::PrintDriftVelocity()
 {
-  printf("<AliTRDparameter::PrintDriftVelocity> Driftvelocity = %.3f\n", fDriftVelocity);
+  //
+  // Prints the used drift velocity
+  //
+
+  printf("<AliTRDparameter::PrintDriftVelocity> Driftvelocity = %.3f\n"
+        ,fDriftVelocity);
+
 }
 
 //_____________________________________________________________________________
-Float_t AliTRDparameter::TimeStruct(Float_t dist, Float_t z) const
+Double_t AliTRDparameter::TimeStruct(Double_t dist, Double_t z) const
 {
   //
   // Applies the time structure of the drift cells (by C.Lippmann).
@@ -688,7 +643,7 @@ Float_t AliTRDparameter::TimeStruct(Float_t dist, Float_t z) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDparameter::Diffusion(Float_t driftlength, Float_t *xyz)
+Int_t AliTRDparameter::Diffusion(Double_t driftlength, Double_t *xyz)
 {
   //
   // Applies the diffusion smearing to the position of a single electron
@@ -706,7 +661,7 @@ Int_t AliTRDparameter::Diffusion(Float_t driftlength, Float_t *xyz)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDparameter::ExB(Float_t driftlength, Float_t *xyz) const
+Int_t AliTRDparameter::ExB(Double_t driftlength, Double_t *xyz) const
 {
   //
   // Applies E x B effects to the position of a single electron
@@ -721,8 +676,8 @@ Int_t AliTRDparameter::ExB(Float_t driftlength, Float_t *xyz) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDparameter::PadResponse(Float_t signal, Float_t dist
-                                 , Int_t plane, Float_t *pad) const
+Int_t AliTRDparameter::PadResponse(Double_t signal, Double_t dist
+                                 , Int_t plane, Double_t *pad) const
 {
   //
   // Applies the pad response
@@ -762,7 +717,7 @@ Int_t AliTRDparameter::PadResponse(Float_t signal, Float_t dist
 }
 
 //_____________________________________________________________________________
-Float_t AliTRDparameter::TimeResponse(Float_t time) const
+Double_t AliTRDparameter::TimeResponse(Double_t time) const
 {
   //
   // Applies the preamp shaper time response
@@ -780,19 +735,6 @@ Float_t AliTRDparameter::TimeResponse(Float_t time) const
 }
 
 //_____________________________________________________________________________
-Float_t AliTRDparameter::Col0Tilted(Float_t col0, Float_t rowOffset
-                                  , Int_t plane)
-{
-  //
-  // Calculates col0 for tilted pads
-  //
-
-  Float_t diff = fTiltingAngle * rowOffset;
-  return (col0 + TMath::Power(-1.0,(plane+1)) * diff);
-
-}
-
-//_____________________________________________________________________________
 void AliTRDparameter::SampleTRF()
 {
   //
@@ -1062,12 +1004,14 @@ void AliTRDparameter::SampleTimeStruct()
 
   if ( fDriftVelocity < fVDsmp[0] ) {
     printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-    printf("<AliTRDparameter::SampleTimeStruct> Drift Velocity too small (%.3f<%.3f)\n", fDriftVelocity, fVDsmp[0]);
+    printf("<AliTRDparameter::SampleTimeStruct> Drift Velocity too small (%.3f<%.3f)\n"
+          , fDriftVelocity, fVDsmp[0]);
     printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
     fDriftVelocity = fVDsmp[0];
   } else if ( fDriftVelocity > fVDsmp[7] ) {
     printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-    printf("<AliTRDparameter::SampleTimeStruct> Drift Velocity too large (%.3f>%.3f)\n", fDriftVelocity,fVDsmp[6]);
+    printf("<AliTRDparameter::SampleTimeStruct> Drift Velocity too large (%.3f>%.3f)\n"
+          , fDriftVelocity,fVDsmp[6]);
     printf("<AliTRDparameter::SampleTimeStruct> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
     fDriftVelocity = fVDsmp[7];
   }
@@ -2035,28 +1979,6 @@ void AliTRDparameter::FillLUT()
 }
 
 //_____________________________________________________________________________
-void AliTRDparameter::SetTiltingAngle(Float_t v)
-{
-  //
-  // Set the tilting angle for the readout pads
-  //
-
-  fTiltingAngle = TMath::Tan(TMath::Pi()/180.0 * v);
-
-}
-
-//_____________________________________________________________________________
-Float_t AliTRDparameter::GetTiltingAngle() const
-{
-  //
-  // Get the tilting angle for the readout pads
-  //
-
-  return 180.0 / TMath::Pi() * TMath::ATan(fTiltingAngle);
-
-}
-
-//_____________________________________________________________________________
 Float_t AliTRDparameter::GetDiffusionL(Float_t vd, Float_t b)
 {
   //
index 6de410c..f40195f 100644 (file)
@@ -13,7 +13,9 @@
 
 #include "TNamed.h"
 
+class TObjArray;
 class AliTRDgeometry;
+class AliTRDpadPlane;
 
 class AliTRDparameter : public TNamed {
 
@@ -31,16 +33,13 @@ class AliTRDparameter : public TNamed {
   virtual void     Init();
   virtual void     ReInit();
  
-  virtual void     SetNRowPad();
-  virtual void     SetNRowPad(Int_t p, Int_t c, Int_t npad);
-  virtual void     SetColPadSize(Int_t p, Float_t s);
   virtual void     SetSamplingFrequency(Float_t freq)             { fSamplingFrequency = freq;
                                                                     ReInit();                   };
   virtual void     SetDriftVelocity(Float_t vd)                   { fDriftVelocity     = vd;
                                                                     SampleTimeStruct();         };
   virtual void     SetExpandTimeBin(Int_t nbefore, Int_t nafter)
                                                                   { fTimeBefore = nbefore;
-                                                                    fTimeAfter  = nafter; };
+                                                                    fTimeAfter  = nafter;       };
 
   virtual void     SetGasGain(Float_t gasgain)                    { fGasGain        = gasgain;  };
   virtual void     SetNoise(Float_t noise)                        { fNoise          = noise;    };
@@ -63,7 +62,6 @@ class AliTRDparameter : public TNamed {
   virtual void     SetNexponential(Int_t nexp)                    { fTCnexp         = nexp;     };
   virtual void     SetPadCoupling(Float_t v)                      { fPadCoupling    = v;        };
   virtual void     SetTimeCoupling(Float_t v)                     { fTimeCoupling   = v;        };
-  virtual void     SetTiltingAngle(Float_t v);
 
   virtual void     SetLUT(Int_t lutOn = 1)                        { fLUTOn          = lutOn;    };
   virtual void     SetClusMaxThresh(Int_t thresh)                 { fClusMaxThresh  = thresh;   };
@@ -71,24 +69,13 @@ class AliTRDparameter : public TNamed {
 
   virtual void     SetAnodeWireOffset(Float_t offset = 0.25)      { fAnodeWireOffset = offset;};
   
-          Int_t    GetRowMax(Int_t p, Int_t c, Int_t s)     
-                                                            const { return fRowMax[p][c][s]; };
-          Int_t    GetColMax(Int_t p)                       const { return fColMax[p];       };
-          Int_t    GetTimeMax()                             const { return fTimeMax;         };
-          Int_t    GetTimeBefore()                          const { return fTimeBefore;      }; 
-          Int_t    GetTimeAfter()                           const { return fTimeAfter;       }; 
+          Int_t    GetTimeMax()                             const { return fTimeMax;           };
+          Int_t    GetTimeBefore()                          const { return fTimeBefore;        }; 
+          Int_t    GetTimeAfter()                           const { return fTimeAfter;         }; 
           Int_t    GetTimeTotal()                           const { return fTimeMax 
                                                                          + fTimeBefore 
-                                                                         + fTimeAfter; };
-
-          Float_t  GetRow0(Int_t p, Int_t c, Int_t s)       
-                                                            const { return fRow0[p][c][s]; };
-          Float_t  GetCol0(Int_t p)                         const { return fCol0[p];       };
-          Float_t  GetTime0(Int_t p)                        const { return fTime0[p];      };
-
-          Float_t  GetRowPadSize(Int_t p, Int_t c, Int_t s) 
-                                                            const { return fRowPadSize[p][c][s]; };
-          Float_t  GetColPadSize(Int_t p)                   const { return fColPadSize[p];       };
+                                                                         + fTimeAfter;         };
+          Float_t  GetTime0(Int_t p)                        const { return fTime0[p];          };
 
           Float_t  GetGasGain()                             const { return fGasGain;           };
           Float_t  GetNoise()                               const { return fNoise;             };
@@ -110,7 +97,6 @@ class AliTRDparameter : public TNamed {
           Float_t  GetLorentzFactor()                       const { return fLorentzFactor;     };
           Float_t  GetAnodeWireOffset()                     const { return fAnodeWireOffset;   };
           Int_t    GetTCnexp()                              const { return fTCnexp;            };
-          Float_t  GetTiltingAngle() const;
   virtual Float_t  GetDiffusionL(Float_t vd, Float_t b);
   virtual Float_t  GetDiffusionT(Float_t vd, Float_t b);
   virtual Float_t  GetOmegaTau(Float_t vd, Float_t b);
@@ -118,6 +104,12 @@ class AliTRDparameter : public TNamed {
   virtual Int_t    GetClusMaxThresh()                       const { return fClusMaxThresh; };
   virtual Int_t    GetClusSigThresh()                       const { return fClusSigThresh; };
 
+  virtual AliTRDpadPlane *GetPadPlane(Int_t p, Int_t c) const;
+          Int_t    GetRowMax(Int_t p, Int_t c, Int_t /*s*/) const;
+          Int_t    GetColMax(Int_t p) const;
+          Double_t GetRow0(Int_t p, Int_t c, Int_t /*s*/) const;
+          Double_t GetCol0(Int_t p) const;
+
           void     PrintDriftVelocity();
 
           Bool_t   TimeStructOn()                           const { return fTimeStructOn;  };
@@ -130,32 +122,23 @@ class AliTRDparameter : public TNamed {
           Bool_t   TCOn()                                   const { return fTCOn;          };
           Bool_t   LUTOn()                                  const { return fLUTOn;         };
 
-  virtual Int_t    Diffusion(Float_t driftlength, Float_t *xyz);
-  virtual Int_t    ExB(Float_t driftlength, Float_t *xyz) const;  
-  virtual Float_t  Col0Tilted(Float_t col0, Float_t rowOffset, Int_t plane);
-  virtual Int_t    PadResponse(Float_t signal, Float_t dist, Int_t plane, Float_t *pad) const;
-  virtual Float_t  CrossTalk(Float_t time) const; 
-  virtual Float_t  TimeResponse(Float_t time) const;  
-  virtual Float_t  TimeStruct(Float_t time, Float_t z) const;  
-  virtual Double_t LUTposition(Int_t iplane, Double_t ampL, Double_t ampC, Double_t ampR) const;
+  virtual Int_t     Diffusion(Double_t driftlength, Double_t *xyz);
+  virtual Int_t     ExB(Double_t driftlength, Double_t *xyz) const;  
+  virtual Int_t     PadResponse(Double_t signal, Double_t dist, Int_t plane, Double_t *pad) const;
+  virtual Double_t  CrossTalk(Double_t time) const; 
+  virtual Double_t  TimeResponse(Double_t time) const;  
+  virtual Double_t  TimeStruct(Double_t time, Double_t z) const;  
+  virtual Double_t  LUTposition(Int_t iplane, Double_t ampL, Double_t ampC, Double_t ampR) const;
 
  protected:
 
   AliTRDgeometry      *fGeo;                                //! TRD geometry       
+  TObjArray           *fPadPlaneArray;                      //  Array of pad plane objects
 
-  // Pad plane geometry
-  Int_t                fRowMax[kNplan][kNcham][kNsect];     //  Number of pad-rows
-  Int_t                fColMax[kNplan];                     //  Number of pad-columns
   Int_t                fTimeMax;                            //  Number of timebins in the drift region
   Int_t                fTimeBefore;                         //  Number of timebins before the drift region
-  Int_t                fTimeAfter;                          //  Number of timebins after the drift region
-
-  Float_t              fRow0[kNplan][kNcham][kNsect];       //  Row-position of pad 0
-  Float_t              fCol0[kNplan];                       //  Column-position of pad 0
   Float_t              fTime0[kNplan];                      //  Time-position of pad 0
-
-  Float_t              fRowPadSize[kNplan][kNcham][kNsect]; //  Pad size in z-direction
-  Float_t              fColPadSize[kNplan];                 //  Pad size in rphi-direction
+  Int_t                fTimeAfter;                          //  Number of timebins after the drift region
 
   // Digitization parameter
   Float_t              fField;                              //  Magnetic field
@@ -200,7 +183,6 @@ class AliTRDparameter : public TNamed {
   Float_t              fSamplingFrequency;                  //  Sampling Frequency in MHz
   Float_t              fPadCoupling;                        //  Pad coupling factor
   Float_t              fTimeCoupling;                       //  Time coupling factor (image charge of moving ions)
-  Float_t              fTiltingAngle;                       //  Tilting angle of the readout pads
 
   // Clusterization parameter
   Int_t                fClusMaxThresh;                      //  Threshold value for cluster maximum
@@ -219,7 +201,7 @@ class AliTRDparameter : public TNamed {
   virtual void         FillLUT();
   virtual void         SampleTimeStruct();
 
-  ClassDef(AliTRDparameter,5)                               //  TRD parameter class
+  ClassDef(AliTRDparameter,6)                               //  TRD parameter class
 
 };
 
index 36d3845..71f7038 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "AliTRDgeometry.h"
 #include "AliTRDparameter.h"
+#include "AliTRDpadPlane.h"
 #include "AliTRDgeometryFull.h"
 #include "AliTRDcluster.h" 
 #include "AliTRDtrack.h"
@@ -140,7 +141,6 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker()
 
   savedir->cd();  
 
-
   //  fGeom->SetT0(fTzero);
 
   fNclusters = 0;
@@ -158,7 +158,8 @@ AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker()
     }
   }
 
-  Float_t tiltAngle = TMath::Abs(fPar->GetTiltingAngle()); 
+  AliTRDpadPlane *padPlane = fPar->GetPadPlane(0,0);
+  Float_t tiltAngle = TMath::Abs(padPlane->GetTiltingAngle()); 
   if(tiltAngle < 0.1) {
     fNoTilt = kTRUE;
   }
@@ -218,6 +219,7 @@ AliTRDtracker::~AliTRDtracker()
   for(Int_t geomS = 0; geomS < kTrackingSectors; geomS++) {
     delete fTrSec[geomS];
   }
+
 }   
 
 //_____________________________________________________________________
@@ -1938,6 +1940,8 @@ AliTRDtracker::AliTRDtrackingSector::AliTRDtrackingSector(AliTRDgeometry* geo, I
   // AliTRDtrackingSector Constructor
   //
 
+  AliTRDpadPlane *padPlane = 0;
+
   fGeom = geo;
   fPar = par;
   fGeomSector = gs;
@@ -2093,11 +2097,18 @@ AliTRDtracker::AliTRDtrackingSector::AliTRDtrackingSector(AliTRDgeometry* geo, I
     }
 
     ymax          = fGeom->GetChamberWidth(plane)/2.;
-    ymaxsensitive = (fPar->GetColPadSize(plane)*fPar->GetColMax(plane)-4)/2.;
+    //
+    // Modidified for new pad plane class, 22.04.05 (C.B.)
+    // ymaxsensitive = (fPar->GetColPadSize(plane)*fPar->GetColMax(plane)-4)/2.;
+    padPlane = fPar->GetPadPlane(plane,0);
+    ymaxsensitive = (padPlane->GetColSize(1)*padPlane->GetNcols()-4)/2.;
     
     for(Int_t ch = 0; ch < kNchambers; ch++) {
       zmax[ch] = fGeom->GetChamberLength(plane,ch)/2;
-      Float_t pad = fPar->GetRowPadSize(plane,ch,0);
+      //
+      // Modidified for new pad plane class, 22.04.05 (C.B.)
+      //Float_t pad = fPar->GetRowPadSize(plane,ch,0);
+      Float_t pad = padPlane->GetRowSize(1);
       Float_t row0 = fPar->GetRow0(plane,ch,0);
       Int_t nPads = fPar->GetRowMax(plane,ch,0);
       zmaxsensitive[ch] = Float_t(nPads)*pad/2.;      
@@ -2539,7 +2550,8 @@ Double_t AliTRDtracker::GetTiltFactor(const AliTRDcluster* c) {
 //  Returns correction factor for tilted pads geometry 
 //
 
-  Double_t h01 = sin(TMath::Pi() / 180.0 * fPar->GetTiltingAngle());
+  AliTRDpadPlane *padPlane = fPar->GetPadPlane(0,0);
+  Double_t h01 = sin(TMath::Pi() / 180.0 * padPlane->GetTiltingAngle());
   Int_t det = c->GetDetector();    
   Int_t plane = fGeom->GetPlane(det);
 
index c75f85d..2d21299 100644 (file)
@@ -504,7 +504,7 @@ void AliTRDv1::StepManagerErmilova()
   Int_t    qTot;
 
   Float_t  hits[3];
-  Double_t  random[1];
+  Double_t random[1];
   Float_t  charge;
   Float_t  aMass;
 
@@ -587,7 +587,7 @@ void AliTRDv1::StepManagerErmilova()
       cIdChamber[0] = cIdCurrent[2];
       cIdChamber[1] = cIdCurrent[3];
       Int_t idChamber = (atoi(cIdChamber) % kNdetsec);
-      cha = ((Int_t) idChamber / kNplan);
+      cha = kNcham - ((Int_t) idChamber / kNplan) - 1;
       pla = ((Int_t) idChamber % kNplan);
 
       // Check on selected volumes
@@ -760,7 +760,7 @@ void AliTRDv1::StepManagerFixedStep()
   cIdChamber[0] = cIdCurrent[2];
   cIdChamber[1] = cIdCurrent[3];
   Int_t idChamber = (atoi(cIdChamber) % kNdetsec);
-  cha = ((Int_t) idChamber / kNplan);
+  cha = kNcham - ((Int_t) idChamber / kNplan) - 1;
   pla = ((Int_t) idChamber % kNplan);
 
   // Check on selected volumes