Introduction of AliTRDtransform. Cluster coordinates are now always in tracking c.s.
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Sep 2007 11:49:52 +0000 (11:49 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 19 Sep 2007 11:49:52 +0000 (11:49 +0000)
17 files changed:
TRD/AliTRDCalibraFillHisto.cxx
TRD/AliTRDReconstructor.cxx
TRD/AliTRDcluster.cxx
TRD/AliTRDcluster.h
TRD/AliTRDclusterizerV1.cxx [deleted file]
TRD/AliTRDclusterizerV1.h [deleted file]
TRD/AliTRDclusterizerV2.cxx
TRD/AliTRDclusterizerV2.h
TRD/AliTRDpadPlane.h
TRD/AliTRDtrack.cxx
TRD/AliTRDtracker.cxx
TRD/AliTRDtracker.h
TRD/AliTRDtrackingAnalysis.cxx
TRD/AliTRDtransform.cxx [new file with mode: 0644]
TRD/AliTRDtransform.h [new file with mode: 0644]
TRD/TRDrecLinkDef.h
TRD/libTRDrec.pkg

index a2cb4e0..57b1063 100644 (file)
@@ -982,7 +982,7 @@ Int_t *AliTRDCalibraFillHisto::CalculateRowCol(AliTRDcluster *cl) const
   //Double_t offsettilt      = padplane->GetTiltOffset(offsetz);
   //Int_t    col             = padplane->GetPadColNumber(pos[1] + offsettilt,offsetz);
   //Int_t    col             = padplane->GetPadColNumber(pos[1]+offsettilt);
-  Int_t    col               = cl->GetPad(); 
+  Int_t    col               = cl->GetPadCol(); 
 
   //return
   rowcol[0]     = row;
@@ -2258,7 +2258,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRF()
     if(echec) continue;
     //if no echec: calculate with the position of the pad
     // Position of the cluster
-    Double_t       padPosition = xcenter +  cl->GetPad();
+    Double_t       padPosition = xcenter +  cl->GetPadCol();
     padPositions[k]            = padPosition;
     Nb3pc++;
     fitter.AddPoint(&time, padPosition,1);
@@ -2280,7 +2280,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRF()
     Short_t  *signals      = cl->GetSignals();              // signal
     Double_t     time      = cl->GetLocalTimeBin();         // time bin
     Float_t padPosTracklet = line[0]+line[1]*time;          // reconstruct position from fit
-    Float_t padPos         = cl->GetPad();                  // middle pad
+    Float_t padPos         = cl->GetPadCol();               // middle pad
     Double_t dpad          = padPosTracklet - padPos;       // reconstruct position relative to middle pad from fit 
     Float_t ycenter        = 0.0;                           // relative center charge
     Float_t ymin           = 0.0;                           // relative left charge
@@ -2703,7 +2703,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtrack(AliTRDtrack *t, Int_t index0, Int_
     if(echec) continue;
     //if no echec: calculate with the position of the pad
     // Position of the cluster
-    Double_t       padPosition = xcenter +  cl->GetPad();
+    Double_t       padPosition = xcenter +  cl->GetPadCol();
     padPositions[k]            = padPosition;
     Nb3pc++;
     fitter.AddPoint(&time, padPosition,1);
@@ -2735,7 +2735,7 @@ Bool_t AliTRDCalibraFillHisto::HandlePRFtrack(AliTRDtrack *t, Int_t index0, Int_
     Short_t  *signals      = cl->GetSignals();              // signal
     Double_t     time      = cl->GetLocalTimeBin();         // time bin
     Float_t padPosTracklet = line[0]+line[1]*time;          // reconstruct position from fit
-    Float_t padPos         = cl->GetPad();                  // middle pad
+    Float_t padPos         = cl->GetPadCol();               // middle pad
     Double_t dpad          = padPosTracklet - padPos;       // reconstruct position relative to middle pad from fit 
     Float_t ycenter        = 0.0;                           // relative center charge
     Float_t ymin           = 0.0;                           // relative left charge
index 7e8315c..7f4fca4 100644 (file)
@@ -193,12 +193,9 @@ void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/
                                , AliESDEvent* /*esd*/) const
 {
   //
-  // Make PID
+  // Fill ESD
   //
 
-  //AliTRDpidESD trdPID;
-  //trdPID.MakePID(esd);
-
 }
 
 //_____________________________________________________________________________
@@ -207,12 +204,9 @@ void AliTRDReconstructor::FillESD(AliRawReader* /*rawReader*/
                                , AliESDEvent* /*esd*/) const
 {
   //
-  // Make PID
+  // Fill ESD
   //
 
-  //AliTRDpidESD trdPID;
-  //trdPID.MakePID(esd);
-
 }
 
 //_____________________________________________________________________________
@@ -221,12 +215,9 @@ void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
                                , AliESDEvent* /*esd*/) const
 {
   //
-  // Make PID
+  // Fill ESD
   //
 
-  //AliTRDpidESD trdPID;
-  //trdPID.MakePID(esd);
-
 }
 
 //_____________________________________________________________________________
@@ -234,10 +225,7 @@ void AliTRDReconstructor::FillESD(AliRunLoader* /*runLoader*/
                                , AliESDEvent* /*esd*/) const
 {
   //
-  // Make PID
+  // Fill ESD
   //
 
-  //AliTRDpidESD trdPID;
-  //trdPID.MakePID(esd);
-
 }
index 9309cfd..6a4f1f2 100644 (file)
@@ -30,11 +30,13 @@ ClassImp(AliTRDcluster)
 AliTRDcluster::AliTRDcluster() 
   :AliCluster() 
   ,fDetector(0)
-  ,fTimeBin(0)
+  ,fLocalTimeBin(0)
   ,fQ(0)
   ,fNPads(0)
   ,fCenter(0)
-  ,fPad(0)
+  ,fPadCol(0)
+  ,fPadRow(0)
+  ,fPadTime(0)
 { 
   //
   // Default constructor
@@ -50,15 +52,17 @@ AliTRDcluster::AliTRDcluster()
 AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
                            , Float_t *pos, Float_t *sig
                            , Int_t *tracks, Char_t npads, Short_t *signals
-                           , UChar_t col, Char_t timebin
-                          , Float_t center, UShort_t volid)
-  :AliCluster(volid,pos[2],pos[0],pos[1],sig[0],sig[1],0.0,0x0) 
+                           , UChar_t col, UChar_t row, UChar_t time
+                           , Char_t timebin, Float_t center, UShort_t volid)
+  :AliCluster(volid,pos[0],pos[1],pos[2],sig[0],sig[1],0.0,0x0) 
   ,fDetector(det)
-  ,fTimeBin(timebin)
+  ,fLocalTimeBin(timebin)
   ,fQ(q)
   ,fNPads(npads)
   ,fCenter(center)
-  ,fPad(col)
+  ,fPadCol(col)
+  ,fPadRow(row)
+  ,fPadTime(time)
 { 
   //
   // Constructor
@@ -78,11 +82,13 @@ AliTRDcluster::AliTRDcluster(Int_t det, Float_t q
 AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
   :AliCluster(c)
   ,fDetector(c.fDetector)
-  ,fTimeBin(c.fTimeBin)
+  ,fLocalTimeBin(c.fLocalTimeBin)
   ,fQ(c.fQ)
   ,fNPads(c.fNPads)
   ,fCenter(c.fCenter)
-  ,fPad(c.fPad)
+  ,fPadCol(c.fPadCol)
+  ,fPadRow(c.fPadRow)
+  ,fPadTime(c.fPadTime)
 {
   //
   // Copy constructor 
index 5090053..7869a83 100644 (file)
@@ -20,35 +20,41 @@ class AliTRDcluster : public AliCluster {
   AliTRDcluster();
   AliTRDcluster(Int_t det, Float_t q, Float_t *pos, Float_t *sig
               , Int_t *tracks, Char_t npads, Short_t *signals
-              , UChar_t col, Char_t timebin
-              , Float_t center, UShort_t volid);
+              , UChar_t col, UChar_t row, UChar_t time
+              , Char_t timebin, Float_t center, UShort_t volid);
   AliTRDcluster(const AliTRDcluster &c);
 
   virtual void     AddTrackIndex(Int_t *i); 
 
-          Int_t    IsUsed() const               { return (fQ < 0) ? 1 : 0;    }
-          void     Use(Int_t = 0)               { fQ = -fQ;                   }
+          Int_t    IsUsed() const               { return (fQ < 0) ? 1 : 0; }
+          void     Use(Int_t = 0)               { fQ = -fQ;                }
     
-          Int_t    GetDetector() const          { return fDetector; }
-          Int_t    GetLocalTimeBin() const      { return fTimeBin;  }
-          Float_t  GetQ() const                 { return fQ;        }
-          Int_t    GetNPads() const             { return fNPads;    }
-          Float_t  GetCenter() const            { return fCenter;   }
-         Int_t    GetPad() const               { return fPad;      }
-          Short_t *GetSignals()                 { return fSignals;  }
+          Int_t    GetDetector() const          { return fDetector;        }
+          Int_t    GetLocalTimeBin() const      { return fLocalTimeBin;    }
+          Float_t  GetQ() const                 { return fQ;               }
+          Int_t    GetNPads() const             { return fNPads;           }
+          Float_t  GetCenter() const            { return fCenter;          }
+         Int_t    GetPadCol() const            { return fPadCol;          }
+         Int_t    GetPadRow() const            { return fPadRow;          }
+          Int_t    GetPadTime() const           { return fPadTime;         }
+          Short_t *GetSignals()                 { return fSignals;         }
           Float_t  GetSumS() const;
 
+          void     SetLocalTimeBin(Char_t t)    { fLocalTimeBin = t;       }
+
  protected:
   
           Int_t   fDetector;       //  TRD detector number
-          Char_t  fTimeBin;        //  Time bin number within the detector
+          Char_t  fLocalTimeBin;   //  T0-calibrated time bin number
           Float_t fQ;              //  Amplitude 
           Char_t  fNPads;          //  Number of pads in cluster
           Float_t fCenter;         //  Center of the cluster relative to the pad 
-         UChar_t fPad;            //  Central pad number
+         UChar_t fPadCol;         //  Central pad number in column direction
+         UChar_t fPadRow;         //  Central pad number in row direction
+         UChar_t fPadTime;        //  Uncalibrated time bin number
           Short_t fSignals[7];     //  Signals in the cluster
   
-  ClassDef(AliTRDcluster,4)        //  Cluster for the TRD
+  ClassDef(AliTRDcluster,5)        //  Cluster for the TRD
  
 };
 #endif
diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx
deleted file mode 100644 (file)
index 4b7f245..0000000
+++ /dev/null
@@ -1,790 +0,0 @@
-
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
-
-/* $Id$ */
-
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-// TRD cluster finder                                                        //
-//                                                                           //
-///////////////////////////////////////////////////////////////////////////////
-
-#include <TF1.h>
-#include <TTree.h>
-#include <TH1.h>
-#include <TFile.h>
-
-#include "AliRunLoader.h"
-#include "AliLoader.h"
-#include "AliRawReader.h"
-#include "AliLog.h"
-#include "AliAlignObj.h"
-
-#include "AliTRDclusterizerV1.h"
-#include "AliTRDgeometry.h"
-#include "AliTRDdataArrayF.h"
-#include "AliTRDdataArrayI.h"
-#include "AliTRDdigitsManager.h"
-#include "AliTRDpadPlane.h"
-#include "AliTRDrawData.h"
-#include "AliTRDcalibDB.h"
-#include "AliTRDSimParam.h"
-#include "AliTRDRecParam.h"
-#include "AliTRDcluster.h"
-
-#include "Cal/AliTRDCalROC.h"
-#include "Cal/AliTRDCalDet.h"
-
-ClassImp(AliTRDclusterizerV1)
-
-//_____________________________________________________________________________
-AliTRDclusterizerV1::AliTRDclusterizerV1()
-  :AliTRDclusterizer()
-  ,fDigitsManager(NULL)
-{
-  //
-  // AliTRDclusterizerV1 default constructor
-  //
-
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerV1::AliTRDclusterizerV1(const Text_t *name, const Text_t *title)
-  :AliTRDclusterizer(name,title)
-  ,fDigitsManager(new AliTRDdigitsManager())
-{
-  //
-  // AliTRDclusterizerV1 constructor
-  //
-
-  fDigitsManager->CreateArrays();
-
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerV1::AliTRDclusterizerV1(const AliTRDclusterizerV1 &c)
-  :AliTRDclusterizer(c)
-  ,fDigitsManager(NULL)
-{
-  //
-  // AliTRDclusterizerV1 copy constructor
-  //
-
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerV1::~AliTRDclusterizerV1()
-{
-  //
-  // AliTRDclusterizerV1 destructor
-  //
-
-  if (fDigitsManager) {
-    delete fDigitsManager;
-    fDigitsManager = NULL;
-  }
-
-}
-
-//_____________________________________________________________________________
-AliTRDclusterizerV1 &AliTRDclusterizerV1::operator=(const AliTRDclusterizerV1 &c)
-{
-  //
-  // Assignment operator
-  //
-
-  if (this != &c) ((AliTRDclusterizerV1 &) c).Copy(*this);
-  return *this;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDclusterizerV1::Copy(TObject &c) const
-{
-  //
-  // Copy function
-  //
-
-  ((AliTRDclusterizerV1 &) c).fDigitsManager = 0;
-
-  AliTRDclusterizer::Copy(c);
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerV1::ReadDigits()
-{
-  //
-  // Reads the digits arrays from the input aliroot file
-  //
-
-  if (!fRunLoader) {
-    AliError("No run loader available");
-    return kFALSE;
-  }
-
-  AliLoader* loader = fRunLoader->GetLoader("TRDLoader");
-  if (!loader->TreeD()) {
-    loader->LoadDigits();
-  }
-
-  // Read in the digit arrays
-  return (fDigitsManager->ReadDigits(loader->TreeD()));
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerV1::ReadDigits(TTree *digitsTree)
-{
-  //
-  // Reads the digits arrays from the input tree
-  //
-
-  // Read in the digit arrays
-  return (fDigitsManager->ReadDigits(digitsTree));
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerV1::ReadDigits(AliRawReader *rawReader)
-{
-  //
-  // Reads the digits arrays from the ddl file
-  //
-
-  AliTRDrawData raw;
-  fDigitsManager = raw.Raw2Digits(rawReader);
-
-  return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDclusterizerV1::MakeClusters()
-{
-  //
-  // Generates the cluster.
-  //
-
-  Int_t row   = 0;
-  Int_t col   = 0;
-  Int_t time  = 0;
-  Int_t icham = 0;
-  Int_t iplan = 0;
-  Int_t isect = 0;
-  Int_t iPad  = 0;
-    
-  AliTRDdataArrayI *digitsIn;
-  AliTRDdataArrayI *tracksIn;
-
-  AliTRDgeometry geo;
-
-  AliTRDcalibDB  *calibration    = AliTRDcalibDB::Instance();
-  if (!calibration) {
-    AliFatal("No AliTRDcalibDB instance available\n");
-    return kFALSE;  
-  }
-  
-  AliTRDSimParam *simParam       = AliTRDSimParam::Instance();
-  if (!simParam) {
-    AliError("No AliTRDSimParam instance available\n");
-    return kFALSE;  
-  }
-  
-  AliTRDRecParam *recParam       = AliTRDRecParam::Instance();
-  if (!recParam) {
-    AliError("No AliTRDRecParam instance available\n");
-    return kFALSE;  
-  }
-
-  // ADC thresholds
-  // Float_t ADCthreshold   = simParam->GetADCthreshold();
-  Float_t ADCthreshold   = 0;
-  // Threshold value for the maximum
-  Float_t maxThresh      = recParam->GetClusMaxThresh();
-  // Threshold value for the digit signal
-  Float_t sigThresh      = recParam->GetClusSigThresh();
-
-  // Detector wise calibration object for t0
-  const AliTRDCalDet *calT0Det         = calibration->GetT0Det();
-  // Detector wise calibration object for the gain factors
-  const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
-
-  // Iteration limit for unfolding procedure
-  const Float_t kEpsilon = 0.01;             
-  const Int_t   kNclus   = 3;  
-  const Int_t   kNsig    = 5;
-  const Int_t   kNdict   = AliTRDdigitsManager::kNDict;
-  const Int_t   kNtrack  = kNdict * kNclus;
-
-  Int_t    iUnfold       = 0;  
-  Double_t ratioLeft     = 1.0;
-  Double_t ratioRight    = 1.0;
-
-  Int_t    iClusterROC   = 0;
-
-  Double_t padSignal[kNsig];   
-  Double_t clusterSignal[kNclus];
-  Double_t clusterPads[kNclus];   
-
-  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    nTimeTotal = calibration->GetNumberOfTimeBins();
-
-  AliDebug(1,Form("Number of Time Bins = %d.\n",nTimeTotal));
-
-  // Start clustering in every chamber
-  for (icham = chamBeg; icham < chamEnd; icham++) {
-    for (iplan = planBeg; iplan < planEnd; iplan++) {
-      for (isect = sectBeg; isect < sectEnd; isect++) {
-
-        Int_t    idet    = geo.GetDetector(iplan,icham,isect);
-        Int_t    ilayer  = AliGeomManager::kTRD1 + iplan;
-        Int_t    imodule = icham + chamEnd * isect;
-        UShort_t volid   = AliGeomManager::LayerToVolUID(ilayer,imodule); 
-
-        // Get the digits
-        digitsIn = fDigitsManager->GetDigits(idet);
-       // This is to take care of switched off super modules
-        if (digitsIn->GetNtime() == 0) {
-          continue;
-       }
-        digitsIn->Expand();
-        AliTRDdataArrayI *tracksTmp = fDigitsManager->GetDictionary(idet,0);
-        tracksTmp->Expand();
-
-       Int_t nRowMax = geo.GetRowMax(iplan,icham,isect);
-       Int_t nColMax = geo.GetColMax(iplan);
-
-        AliTRDpadPlane *padPlane = geo.GetPadPlane(iplan,icham);
-
-       // Calibration object with pad wise values for t0
-        AliTRDCalROC *calT0ROC              = calibration->GetT0ROC(idet);
-       // Calibration object with pad wise values for the gain factors
-        AliTRDCalROC *calGainFactorROC      = calibration->GetGainFactorROC(idet);
-        // Calibration value for chamber wise t0
-        Float_t       calT0DetValue         = calT0Det->GetValue(idet);
-        // Calibration value for chamber wise gain factor
-        Float_t       calGainFactorDetValue = calGainFactorDet->GetValue(idet);
-
-        Int_t nClusters      = 0;
-
-       // Apply the gain and the tail cancelation via digital filter
-        AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow()
-                                                          ,digitsIn->GetNcol()
-                                                          ,digitsIn->GetNtime()); 
-        Transform(digitsIn
-                 ,digitsOut
-                 ,nRowMax,nColMax,nTimeTotal
-                 ,ADCthreshold
-                 ,calGainFactorROC
-                 ,calGainFactorDetValue);
-
-       // Input digits are not needed any more
-        digitsIn->Compress(1,0);
-
-        // Loop through the chamber and find the maxima 
-        for ( row = 0;  row <  nRowMax;    row++) {
-         for ( col = 2;  col <  nColMax;    col++) {
-            for (time = 0; time < nTimeTotal; time++) {
-
-              Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
-             // Look for the maximum
-              if (signalM >= maxThresh) {
-
-                Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time));
-                Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
-
-                if ((TMath::Abs(signalL) <= signalM) && 
-                    (TMath::Abs(signalR) <  signalM)) {
-                 if ((TMath::Abs(signalL) >= sigThresh) ||
-                     (TMath::Abs(signalR) >= sigThresh)) {
-                    // Maximum found, mark the position by a negative signal
-                    digitsOut->SetDataUnchecked(row,col-1,time,-signalM);
-                 }
-               }
-
-             }
-
-            }
-          }
-        }
-        tracksTmp->Compress(1,0);
-
-       // The index to the first cluster of a given ROC
-        Int_t firstClusterROC = -1;
-       // The number of cluster in a given ROC
-        Int_t nClusterROC     =  0;
-
-        // Now check the maxima and calculate the cluster position
-        for ( row = 0;  row <  nRowMax  ;  row++) {
-          for (time = 0; time < nTimeTotal; time++) {
-            for ( col = 1;  col <  nColMax-1;  col++) {
-
-              // Maximum found ?             
-              if (digitsOut->GetDataUnchecked(row,col,time) < 0.0) {
-
-                for (iPad = 0; iPad < kNclus; iPad++) {
-                  Int_t iPadCol = col - 1 + iPad;
-                  clusterSignal[iPad] = 
-                    TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
-                }
-
-               // Count the number of pads in the cluster
-                Int_t nPadCount = 0;
-                Int_t ii;
-               // Look to the left
-                ii = 0;
-                while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii  ,time)) >= sigThresh) {
-                  nPadCount++;
-                  ii++;
-                  if (col-ii   <        0) break;
-               }
-               // Look to the right
-                ii = 0;
-                while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh) {
-                  nPadCount++;
-                  ii++;
-                  if (col+ii+1 >= nColMax) break;
-               }
-                nClusters++;
-
-               // Look for 5 pad cluster with minimum in the middle
-                Bool_t fivePadCluster = kFALSE;
-                if (col < (nColMax - 3)) {
-                  if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) {
-                    fivePadCluster = kTRUE;
-                 }
-                  if ((fivePadCluster) && (col < (nColMax - 5))) {
-                    if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh) {
-                      fivePadCluster = kFALSE;
-                   }
-                 }
-                  if ((fivePadCluster) && (col >             1)) {
-                    if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh) {
-                      fivePadCluster = kFALSE;
-                   }
-                 }
-               }
-
-               // 5 pad cluster
-                // Modify the signal of the overlapping pad for the left part 
-               // of the cluster which remains from a previous unfolding
-                if (iUnfold) {
-                  clusterSignal[0] *= ratioLeft;
-                  iUnfold = 0;
-               }
-
-               // Unfold the 5 pad cluster
-                if (fivePadCluster) {
-                  for (iPad = 0; iPad < kNsig; iPad++) {
-                    padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
-                                                                           ,col-1+iPad
-                                                                           ,time));
-                  }
-                  // Unfold the two maxima and set the signal on 
-                  // the overlapping pad to the ratio
-                  ratioRight        = Unfold(kEpsilon,iplan,padSignal);
-                  ratioLeft         = 1.0 - ratioRight; 
-                  clusterSignal[2] *= ratioRight;
-                  iUnfold = 1;
-                }
-
-                Double_t clusterCharge = clusterSignal[0]
-                                       + clusterSignal[1]
-                                       + clusterSignal[2];
-                
-               // The position of the cluster
-                clusterPads[0] =  row + 0.5;
-               // Take the shift of the additional time bins into account
-                clusterPads[2] = time + 0.5;
-
-                if (recParam->LUTOn()) {
-                 // Calculate the position of the cluster by using the
-                 // lookup table method
-                  clusterPads[1] = recParam->LUTposition(iplan,clusterSignal[0]
-                                                              ,clusterSignal[1]
-                                                              ,clusterSignal[2]);
-               }
-               else {
-                 // Calculate the position of the cluster by using the
-                 // center of gravity method
-                 for (Int_t i = 0; i < kNsig; i++) {
-                    padSignal[i] = 0.0;
-                 }
-                 padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time)); // Central pad
-                 padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Left    pad
-                 padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Right   pad
-                 if ((col >           2) && 
-                      (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) {
-                   padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
-                 }
-                 if ((col < nColMax - 3) &&
-                      (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3])) {
-                   padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
-                 }               
-                 clusterPads[1] = GetCOG(padSignal);
-               }
-
-                Double_t q0 = clusterSignal[0];
-               Double_t q1 = clusterSignal[1];
-                Double_t q2 = clusterSignal[2];
-                Double_t clusterSigmaY2 = (q1 * (q0 + q2) + 4.0 * q0 * q2)
-                                        / (clusterCharge*clusterCharge);
-
-               //
-                // Calculate the position and the error
-               //              
-
-                // Correct for t0 (sum of chamber and pad wise values !!!)
-                Float_t  calT0ROCValue  = calT0ROC->GetValue(col,row);
-               Char_t   clusterTimeBin = ((Char_t) TMath::Nint(time - (calT0DetValue + calT0ROCValue)));
-                Double_t colSize        = padPlane->GetColSize(col);
-                Double_t rowSize        = padPlane->GetRowSize(row);
-
-                Float_t clusterPos[3];
-               clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1] + 0.5) * colSize;
-               clusterPos[1] = padPlane->GetRowPos(row) - 0.5                    * rowSize;
-                clusterPos[2] = CalcXposFromTimebin(clusterPads[2],idet,col,row);
-                Float_t clusterSig[2];
-                clusterSig[0] = (clusterSigmaY2 + 1.0/12.0) * colSize*colSize;
-                clusterSig[1] = rowSize * rowSize / 12.0;                                       
-               
-               // Store the amplitudes of the pads in the cluster for later analysis
-               Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
-               for (Int_t jPad = col-3; jPad <= col+3; jPad++) {
-                 if ((jPad <          0) || 
-                      (jPad >= nColMax-1)) {
-                    continue;
-                 }
-                 signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
-               }
-
-                // Add the cluster to the output array
-               // The track indices will be stored later 
-                AliTRDcluster *cluster = new AliTRDcluster(idet
-                                                          ,clusterCharge
-                                                          ,clusterPos
-                                                          ,clusterSig
-                                                          ,0x0
-                                                         ,((Char_t) nPadCount)
-                                                          ,signals
-                                                         ,((UChar_t) col)
-                                                          ,clusterTimeBin
-                                                          ,clusterPads[1]
-                                                          ,volid);
-               // Temporarily store the row, column and time bin of the center pad
-               // Used to later on assign the track indices
-                cluster->SetLabel( row,0);
-                cluster->SetLabel( col,1);
-                cluster->SetLabel(time,2);
-                RecPoints()->Add(cluster);
-
-               // Store the index of the first cluster in the current ROC
-                if (firstClusterROC < 0) {
-                  firstClusterROC = RecPoints()->GetEntriesFast() - 1;
-               }
-               // Count the number of cluster in the current ROC
-                nClusterROC++;
-
-              } // if: Maximum found ?
-
-            } // loop: pad columns
-          } // loop: time bins
-        } // loop: pad rows
-
-        delete digitsOut;
-
-       //
-       // Add the track indices to the found clusters
-       //
-
-       // Temporary array to collect the track indices
-        Int_t *idxTracks = new Int_t[kNtrack*nClusterROC];
-
-       // Loop through the dictionary arrays one-by-one
-       // to keep memory consumption low
-        for (Int_t iDict = 0; iDict < kNdict; iDict++) {
-
-          tracksIn = fDigitsManager->GetDictionary(idet,iDict);
-          tracksIn->Expand();
-
-         // Loop though the clusters found in this ROC
-          for (iClusterROC = 0; iClusterROC < nClusterROC; iClusterROC++) {
-            AliTRDcluster *cluster = (AliTRDcluster *)
-                                    RecPoints()->UncheckedAt(firstClusterROC+iClusterROC);
-           row  = cluster->GetLabel(0);
-           col  = cluster->GetLabel(1);
-           time = cluster->GetLabel(2);
-
-            for (iPad = 0; iPad < kNclus; iPad++) {
-              Int_t iPadCol = col - 1 + iPad;
-              Int_t index   = tracksIn->GetDataUnchecked(row,iPadCol,time) - 1;
-              idxTracks[3*iPad+iDict + iClusterROC*kNtrack] = index;     
-           }
-
-         }
-
-          // Compress the arrays
-          tracksIn->Compress(1,0);
-
-       }
-
-       // Copy the track indices into the cluster
-       // Loop though the clusters found in this ROC
-        for (iClusterROC = 0; iClusterROC < nClusterROC; iClusterROC++) {
-          AliTRDcluster *cluster = (AliTRDcluster *)
-                                  RecPoints()->UncheckedAt(firstClusterROC+iClusterROC);
-         cluster->SetLabel(-9999,0);
-         cluster->SetLabel(-9999,1);
-         cluster->SetLabel(-9999,2);
-  
-          cluster->AddTrackIndex(&idxTracks[iClusterROC*kNtrack]);
-
-       }
-
-        delete [] idxTracks;
-
-        // Write the cluster and reset the array
-       WriteClusters(idet);
-       ResetRecPoints();
-
-      } // loop: Sectors
-    } // loop: Planes
-  } // loop: Chambers
-
-  return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-Double_t AliTRDclusterizerV1::GetCOG(Double_t signal[5])
-{
-  //
-  // Get COG position
-  // Used for clusters with more than 3 pads - where LUT not applicable
-  //
-
-  Double_t sum = signal[0]
-               + signal[1]
-               + signal[2] 
-               + signal[3]
-               + signal[4];
-
-  Double_t res = (0.0 * (-signal[0] + signal[4])
-                      + (-signal[1] + signal[3])) / sum;
-
-  return res;            
-
-}
-
-//_____________________________________________________________________________
-Double_t AliTRDclusterizerV1::Unfold(Double_t eps, Int_t plane, Double_t *padSignal)
-{
-  //
-  // Method to unfold neighbouring maxima.
-  // The charge ratio on the overlapping pad is calculated
-  // until there is no more change within the range given by eps.
-  // The resulting ratio is then returned to the calling method.
-  //
-
-  AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
-  if (!calibration) {
-    AliError("No AliTRDcalibDB instance available\n");
-    return kFALSE;  
-  }
-  
-  Int_t   irc                = 0;
-  Int_t   itStep             = 0;                 // Count iteration steps
-
-  Double_t ratio             = 0.5;               // Start value for ratio
-  Double_t prevRatio         = 0.0;               // Store previous ratio
-
-  Double_t newLeftSignal[3]  = { 0.0, 0.0, 0.0 }; // Array to store left cluster signal
-  Double_t newRightSignal[3] = { 0.0, 0.0, 0.0 }; // Array to store right cluster signal
-  Double_t newSignal[3]      = { 0.0, 0.0, 0.0 };
-
-  // Start the iteration
-  while ((TMath::Abs(prevRatio - ratio) > eps) && (itStep < 10)) {
-
-    itStep++;
-    prevRatio = ratio;
-
-    // Cluster position according to charge ratio
-    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.0 - ratio)*padSignal[2] + padSignal[3] + padSignal[4]);
-
-    // Set cluster charge ratio
-    irc = calibration->PadResponse(1.0,maxLeft ,plane,newSignal);
-    Double_t ampLeft  = padSignal[1] / newSignal[1];
-    irc = calibration->PadResponse(1.0,maxRight,plane,newSignal);
-    Double_t ampRight = padSignal[3] / newSignal[1];
-
-    // Apply pad response to parameters
-    irc = calibration->PadResponse(ampLeft ,maxLeft ,plane,newLeftSignal );
-    irc = calibration->PadResponse(ampRight,maxRight,plane,newRightSignal);
-
-    // Calculate new overlapping ratio
-    ratio = TMath::Min((Double_t)1.0,newLeftSignal[2] / 
-                                    (newLeftSignal[2] + newRightSignal[0]));
-
-  }
-
-  return ratio;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDclusterizerV1::Transform(AliTRDdataArrayI *digitsIn
-                                 , AliTRDdataArrayF *digitsOut
-                                 , Int_t nRowMax, Int_t nColMax, Int_t nTimeTotal
-                                 , Float_t ADCthreshold
-                                 , AliTRDCalROC *calGainFactorROC
-                                 , Float_t calGainFactorDetValue)
-{
-  //
-  // Apply gain factor
-  // Apply tail cancelation: Transform digitsIn to digitsOut
-  //
-
-  Int_t iRow  = 0;
-  Int_t iCol  = 0;
-  Int_t iTime = 0;
-
-  AliTRDRecParam *recParam = AliTRDRecParam::Instance();
-  if (!recParam) {
-    AliError("No AliTRDRecParam instance available\n");
-    return;
-  }
-
-  Double_t *inADC  = new Double_t[nTimeTotal];  // ADC data before tail cancellation
-  Double_t *outADC = new Double_t[nTimeTotal];  // ADC data after tail cancellation
-
-  for (iRow  = 0; iRow  <  nRowMax;   iRow++ ) {
-    for (iCol  = 0; iCol  <  nColMax;   iCol++ ) {
-
-      Float_t  calGainFactorROCValue = calGainFactorROC->GetValue(iCol,iRow);
-      Double_t gain                  = calGainFactorDetValue 
-                                     * calGainFactorROCValue;
-
-      for (iTime = 0; iTime < nTimeTotal; iTime++) {
-
-       //
-       // Add gain
-       //
-       inADC[iTime]   = digitsIn->GetDataUnchecked(iRow,iCol,iTime);
-        inADC[iTime]  /= gain;
-        outADC[iTime]  = inADC[iTime];
-
-      }
-
-      // Apply the tail cancelation via the digital filter
-      if (recParam->TCOn()) {
-       DeConvExp(inADC,outADC,nTimeTotal,recParam->GetTCnexp());
-      }
-
-      for (iTime = 0; iTime < nTimeTotal; iTime++) {
-
-       // Store the amplitude of the digit if above threshold
-       if (outADC[iTime] > ADCthreshold) {
-         digitsOut->SetDataUnchecked(iRow,iCol,iTime,outADC[iTime]);
-       }
-
-      }
-
-    }
-  }
-
-  delete [] inADC;
-  delete [] outADC;
-
-  return;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDclusterizerV1::DeConvExp(Double_t *source, Double_t *target
-                                 , Int_t n, Int_t nexp) 
-{
-  //
-  // Tail cancellation by deconvolution for PASA v4 TRF
-  //
-
-  Double_t rates[2];
-  Double_t coefficients[2];
-
-  // Initialization (coefficient = alpha, rates = lambda)
-  Double_t R1 = 1.0;
-  Double_t R2 = 1.0;
-  Double_t C1 = 0.5;
-  Double_t C2 = 0.5;
-
-  if (nexp == 1) {   // 1 Exponentials
-    R1 = 1.156;
-    R2 = 0.130;
-    C1 = 0.066;
-    C2 = 0.000;
-  }
-  if (nexp == 2) {   // 2 Exponentials
-    R1 = 1.156;
-    R2 = 0.130;
-    C1 = 0.114;
-    C2 = 0.624;
-  }
-
-  coefficients[0] = C1;
-  coefficients[1] = C2;
-
-  Double_t Dt = 0.1;
-
-  rates[0] = TMath::Exp(-Dt/(R1));
-  rates[1] = TMath::Exp(-Dt/(R2));
-  
-  Int_t i = 0;
-  Int_t k = 0;
-
-  Double_t reminder[2];
-  Double_t correction;
-  Double_t result;
-
-  // Attention: computation order is important
-  correction = 0.0;
-  for (k = 0; k < nexp; k++) {
-    reminder[k] = 0.0;
-  }
-  for (i = 0; i < n; i++) {
-    result    = (source[i] - correction);    // No rescaling
-    target[i] = result;
-
-    for (k = 0; k < nexp; k++) {
-      reminder[k] = rates[k] * (reminder[k] + coefficients[k] * result);
-    }
-    correction = 0.0;
-    for (k = 0; k < nexp; k++) {
-      correction += reminder[k];
-    }
-  }
-
-}
diff --git a/TRD/AliTRDclusterizerV1.h b/TRD/AliTRDclusterizerV1.h
deleted file mode 100644 (file)
index cf4dff0..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef ALITRDCLUSTERIZERV1_H
-#define ALITRDCLUSTERIZERV1_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
-
-/* $Id$ */
-
-////////////////////////////////////////////////////////////////////////////
-//                                                                        //
-//  TRD cluster finder                                                    //
-//                                                                        //
-////////////////////////////////////////////////////////////////////////////
-
-#include "AliTRDclusterizer.h"
-
-class AliTRDdataArrayI;
-class AliTRDdataArrayF;
-class AliTRDdigitsManager;
-class AliTRDCalROC;
-class AliRawReader;
-
-class AliTRDclusterizerV1 : public AliTRDclusterizer {
-
- public:
-
-  AliTRDclusterizerV1();
-  AliTRDclusterizerV1(const Text_t* name, const Text_t* title);
-  AliTRDclusterizerV1(const AliTRDclusterizerV1 &c);
-  virtual             ~AliTRDclusterizerV1();
-  AliTRDclusterizerV1 &operator=(const AliTRDclusterizerV1 &c);
-
-  virtual void     Copy(TObject &c) const;
-  virtual Bool_t   MakeClusters();
-  virtual Bool_t   ReadDigits();
-  virtual Bool_t   ReadDigits(AliRawReader *rawReader);
-  virtual Bool_t   ReadDigits(TTree *digitsTree);
-
- protected:
-
-          void     DeConvExp(Double_t *source, Double_t *target
-                           , Int_t nTimeTotal, Int_t nexp);
-          void     Transform(AliTRDdataArrayI *digitsIn, AliTRDdataArrayF *digitsOut
-                          , Int_t nRowMax, Int_t nColMax, Int_t nTimeTotal
-                           , Float_t ADCthreshold
-                           , AliTRDCalROC *calGainFactorROC
-                           , Float_t calGainFactorDetValue);
-  virtual Double_t Unfold(Double_t eps, Int_t plane, Double_t *padSignal);
-          Double_t GetCOG(Double_t signal[5]); 
-
-  AliTRDdigitsManager *fDigitsManager;      //! TRD digits manager
-
-  ClassDef(AliTRDclusterizerV1,5)           //  TRD-Cluster finder, slow simulator
-
-};
-
-#endif
index eb1d763..6c8e122 100644 (file)
 #include "AliTRDdataArrayF.h"
 #include "AliTRDdataArrayI.h"
 #include "AliTRDdigitsManager.h"
-#include "AliTRDpadPlane.h"
 #include "AliTRDrawData.h"
 #include "AliTRDcalibDB.h"
 #include "AliTRDSimParam.h"
 #include "AliTRDRecParam.h"
 #include "AliTRDcluster.h"
-
-#include "Cal/AliTRDCalROC.h"
-#include "Cal/AliTRDCalDet.h"
-
+#include "AliTRDtransform.h"
 #include "AliTRDSignalIndex.h"
 #include "AliTRDRawStream.h"
 #include "AliTRDRawStreamV2.h"
-
 #include "AliTRDfeeParam.h"
 
+#include "Cal/AliTRDCalROC.h"
+#include "Cal/AliTRDCalDet.h"
+
 ClassImp(AliTRDclusterizerV2)
 
 //_____________________________________________________________________________
 AliTRDclusterizerV2::AliTRDclusterizerV2()
   :AliTRDclusterizer()
   ,fDigitsManager(NULL)
-  ,fGeometry(NULL)
   ,fAddLabels(kTRUE)
   ,fRawVersion(2)
   ,fIndexesOut(NULL)
   ,fIndexesMaxima(NULL)
+  ,fTransform(NULL)
 {
   //
   // AliTRDclusterizerV2 default constructor
   //
 
   fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion();
+
 }
 
 //_____________________________________________________________________________
 AliTRDclusterizerV2::AliTRDclusterizerV2(const Text_t *name, const Text_t *title)
   :AliTRDclusterizer(name,title)
   ,fDigitsManager(new AliTRDdigitsManager())
-  ,fGeometry(NULL)
   ,fAddLabels(kTRUE)
   ,fRawVersion(2)
   ,fIndexesOut(NULL)
   ,fIndexesMaxima(NULL)
+  ,fTransform(new AliTRDtransform(0))
 {
   //
   // AliTRDclusterizerV2 constructor
   //
 
   fDigitsManager->CreateArrays();
-  fGeometry = new AliTRDgeometry;
 
   fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion();
+
 }
 
 //_____________________________________________________________________________
 AliTRDclusterizerV2::AliTRDclusterizerV2(const AliTRDclusterizerV2 &c)
   :AliTRDclusterizer(c)
   ,fDigitsManager(NULL)
-  ,fGeometry(NULL)
   ,fAddLabels(kTRUE)
   ,fRawVersion(2)
   ,fIndexesOut(NULL)
   ,fIndexesMaxima(NULL)
+  ,fTransform(NULL)
 {
   //
   // AliTRDclusterizerV2 copy constructor
@@ -116,21 +115,16 @@ AliTRDclusterizerV2::~AliTRDclusterizerV2()
   // AliTRDclusterizerV2 destructor
   //
 
-  if (fDigitsManager) {
-    delete fDigitsManager;
-    fDigitsManager = NULL;
-  }
-
-  if (fGeometry)
+  if (fDigitsManager) 
     {
-      delete fGeometry;
-      fGeometry = NULL;
+      delete fDigitsManager;
+      fDigitsManager = NULL;
     }
 
   if (fIndexesOut)
     {
       delete fIndexesOut;
-      fIndexesOut = NULL;
+      fIndexesOut    = NULL;
     }
 
   if (fIndexesMaxima)
@@ -138,6 +132,13 @@ AliTRDclusterizerV2::~AliTRDclusterizerV2()
       delete fIndexesMaxima;
       fIndexesMaxima = NULL;
     }
+
+  if (fTransform)
+    {
+      delete fTransform;
+      fTransform     = NULL;
+    }
+
 }
 
 //_____________________________________________________________________________
@@ -160,11 +161,11 @@ void AliTRDclusterizerV2::Copy(TObject &c) const
   //
 
   ((AliTRDclusterizerV2 &) c).fDigitsManager = NULL;
-  ((AliTRDclusterizerV2 &) c).fGeometry = NULL;
-  ((AliTRDclusterizerV2 &) c).fAddLabels = fAddLabels;
-  ((AliTRDclusterizerV2 &) c).fRawVersion = fRawVersion;
-  ((AliTRDclusterizerV2 &) c).fIndexesOut = NULL;
+  ((AliTRDclusterizerV2 &) c).fAddLabels     = fAddLabels;
+  ((AliTRDclusterizerV2 &) c).fRawVersion    = fRawVersion;
+  ((AliTRDclusterizerV2 &) c).fIndexesOut    = NULL;
   ((AliTRDclusterizerV2 &) c).fIndexesMaxima = NULL;
+  ((AliTRDclusterizerV2 &) c).fTransform     = NULL;
   
   AliTRDclusterizer::Copy(c);
 
@@ -176,31 +177,45 @@ void AliTRDclusterizerV2::ResetHelperIndexes(AliTRDSignalIndex *indexesIn)
   // 
   // Reset the helper indexes
   //
+
   if (fIndexesOut)
     {
       // carefull here - we assume that only row number may change - most probable
       if (indexesIn->GetNrow() <= fIndexesOut->GetNrow())
        fIndexesOut->ResetContent();
       else
-       fIndexesOut->ResetContentConditional(indexesIn->GetNrow(), indexesIn->GetNcol(), indexesIn->GetNtime());
+       fIndexesOut->ResetContentConditional(indexesIn->GetNrow()
+                                           , indexesIn->GetNcol()
+                                           , indexesIn->GetNtime());
     }
   else
     {
-      fIndexesOut = new AliTRDSignalIndex(indexesIn->GetNrow(), indexesIn->GetNcol(), indexesIn->GetNtime());
+      fIndexesOut = new AliTRDSignalIndex(indexesIn->GetNrow()
+                                        , indexesIn->GetNcol() 
+                                        , indexesIn->GetNtime());
     }
   
   if (fIndexesMaxima)
     {
       // carefull here - we assume that only row number may change - most probable
-      if (indexesIn->GetNrow() <= fIndexesMaxima->GetNrow())
-       fIndexesMaxima->ResetContent();
+      if (indexesIn->GetNrow() <= fIndexesMaxima->GetNrow()) 
+        {
+         fIndexesMaxima->ResetContent();
+       }
       else
-       fIndexesMaxima->ResetContentConditional(indexesIn->GetNrow(), indexesIn->GetNcol(), indexesIn->GetNtime());
+       {
+         fIndexesMaxima->ResetContentConditional(indexesIn->GetNrow()
+                                                , indexesIn->GetNcol()
+                                                , indexesIn->GetNtime());
+       }
     }
   else
     {
-      fIndexesMaxima = new AliTRDSignalIndex(indexesIn->GetNrow(), indexesIn->GetNcol(), indexesIn->GetNtime());
+      fIndexesMaxima = new AliTRDSignalIndex(indexesIn->GetNrow()
+                                           , indexesIn->GetNcol()
+                                           , indexesIn->GetNtime());
     }
+
 }
 
 //_____________________________________________________________________________
@@ -258,19 +273,22 @@ Bool_t AliTRDclusterizerV2::MakeClusters()
   // Creates clusters from digits
   //
 
-  //propagate info from the digits manager
+  // Propagate info from the digits manager
   if (fAddLabels == kTRUE)
-    fAddLabels = fDigitsManager->UsesDictionaries();
-    
+    {
+      fAddLabels = fDigitsManager->UsesDictionaries();
+    }
+
   Bool_t fReturn = kTRUE;
   for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++)
     {
+
       AliTRDdataArrayI *digitsIn = fDigitsManager->GetDigits(i);      
       // This is to take care of switched off super modules
-      if (digitsIn->GetNtime() == 0) {
-       continue;
-      }
-      //AliInfo(Form("digitsIn->Expand() 0x%x", digitsIn));
+      if (digitsIn->GetNtime() == 0) 
+        {
+         continue;
+        }
       digitsIn->Expand();
       AliTRDSignalIndex* indexes = fDigitsManager->GetIndexes(i);
       if (indexes->IsAllocated() == kFALSE)
@@ -299,16 +317,17 @@ Bool_t AliTRDclusterizerV2::MakeClusters()
          WriteClusters(i);
          ResetRecPoints();
        }
-      //digitsIn->Compress(1,0);
-      // no compress just remove
+
+      // No compress just remove
       fDigitsManager->RemoveDigits(i);
       fDigitsManager->RemoveDictionaries(i);      
       fDigitsManager->ClearIndexes(i);
+
     }
 
   return fReturn;
-}
 
+}
 
 //_____________________________________________________________________________
 Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
@@ -317,14 +336,13 @@ Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
   // Creates clusters from raw data
   //
 
-  //AliDebug(2, "Read all");
-
   AliTRDdataArrayI *digits = 0;
   AliTRDdataArrayI *track0 = 0;
   AliTRDdataArrayI *track1 = 0;
   AliTRDdataArrayI *track2 = 0; 
 
   AliTRDSignalIndex *indexes = 0;
+
   // Create the digits manager
   if (!fDigitsManager)
     {
@@ -332,7 +350,6 @@ Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
       fDigitsManager->CreateArrays();
     }
 
-  //AliTRDRawStream input(rawReader);
   AliTRDRawStreamV2 input(rawReader);
   input.SetRawVersion( fRawVersion );
   input.Init();
@@ -341,15 +358,16 @@ Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
 
   // Loop through the digits
   Int_t lastdet = -1;
-  Int_t det    = 0;
-  Int_t it = 0;
+  Int_t det     =  0;
+  Int_t it      =  0;
   while (input.Next()) 
     {
 
-      det    = input.GetDet();
+      det = input.GetDet();
 
       if (det != lastdet) 
-       {       
+       {
+       
          if (lastdet != -1)
            {
              digits = fDigitsManager->GetDigits(lastdet);
@@ -394,7 +412,10 @@ Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
          indexes->SetLayer(input.GetLayer());
          indexes->SetDetNumber(det);
          if (indexes->IsAllocated() == kFALSE)
-           indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins());
+           {
+             indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins());
+           }
+
        }
       
       for (it = 0; it < 3; it++)
@@ -417,13 +438,16 @@ Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
                }
            }
        }
-  }
+
+    }
 
   if (lastdet != -1)
     {
       Bool_t iclusterBranch = kFALSE;
-      if (indexes->HasEntry())
-       iclusterBranch = MakeClusters(lastdet);
+      if (indexes->HasEntry()) 
+        {
+         iclusterBranch = MakeClusters(lastdet);
+        }
       if (iclusterBranch == kFALSE)
        {
          WriteClusters(lastdet);
@@ -441,6 +465,7 @@ Bool_t AliTRDclusterizerV2::Raw2Clusters(AliRawReader *rawReader)
   delete fDigitsManager;
   fDigitsManager = NULL;
   return kTRUE;
+
 }
 
 //_____________________________________________________________________________
@@ -450,9 +475,6 @@ Bool_t AliTRDclusterizerV2::Raw2ClustersChamber(AliRawReader *rawReader)
   // Creates clusters from raw data
   //
 
-  //AliDebug(1, "Raw2ClustersChamber");
-
-  // Create the digits manager
   // Create the digits manager
   if (!fDigitsManager)
     {
@@ -462,7 +484,6 @@ Bool_t AliTRDclusterizerV2::Raw2ClustersChamber(AliRawReader *rawReader)
 
   fDigitsManager->SetUseDictionaries(fAddLabels);
 
-  //AliTRDRawStream input(rawReader);
   AliTRDRawStreamV2 input(rawReader);
   input.SetRawVersion( fRawVersion );
   input.Init();
@@ -474,7 +495,9 @@ Bool_t AliTRDclusterizerV2::Raw2ClustersChamber(AliRawReader *rawReader)
     {
       Bool_t iclusterBranch = kFALSE;
       if (fDigitsManager->GetIndexes(det)->HasEntry())
-       iclusterBranch = MakeClusters(det);
+       {
+         iclusterBranch = MakeClusters(det);
+       }
       if (iclusterBranch == kFALSE)
        {
          WriteClusters(det);
@@ -488,6 +511,7 @@ Bool_t AliTRDclusterizerV2::Raw2ClustersChamber(AliRawReader *rawReader)
   delete fDigitsManager;
   fDigitsManager = NULL;
   return kTRUE;
+
 }
 
 //_____________________________________________________________________________
@@ -501,10 +525,10 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
   //   digits should be expanded beforehand!
   //   digitsIn->Expand();
   AliTRDdataArrayI *digitsIn = fDigitsManager->GetDigits(det);      
+
   // This is to take care of switched off super modules
   if (digitsIn->GetNtime() == 0) 
     {
-      //AliDebug(5, Form("digitsIn->GetNtime() == 0 [%d]", det));
       return kFALSE;
     }
 
@@ -515,38 +539,29 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
       return kFALSE;      
     }
     
-  AliTRDcalibDB  *calibration    = AliTRDcalibDB::Instance();
-  if (!calibration) {
-    AliFatal("No AliTRDcalibDB instance available\n");
-    return kFALSE;  
-  }
-  
-  AliTRDSimParam *simParam       = AliTRDSimParam::Instance();
-  if (!simParam) {
-    AliError("No AliTRDSimParam instance available\n");
-    return kFALSE;  
-  }
-  
-  AliTRDRecParam *recParam       = AliTRDRecParam::Instance();
-  if (!recParam) {
-    AliError("No AliTRDRecParam instance available\n");
-    return kFALSE;  
-  }
+  AliTRDcalibDB  *calibration = AliTRDcalibDB::Instance();
+  if (!calibration) 
+    {
+      AliFatal("No AliTRDcalibDB instance available\n");
+      return kFALSE;  
+    }
+
+  AliTRDRecParam *recParam    = AliTRDRecParam::Instance();
+  if (!recParam) 
+    {
+      AliError("No AliTRDRecParam instance available\n");
+      return kFALSE;  
+    }
 
   // ADC thresholds
-  //  Float_t ADCthreshold   = simParam->GetADCthreshold();
-  Float_t ADCthreshold   = 0; // There is no ADC threshold anymore, and simParam should not be used ni clusterizer. KO
+  // There is no ADC threshold anymore, and simParam should not be used in clusterizer. KO
+  Float_t ADCthreshold   = 0; 
 
   // Threshold value for the maximum
   Float_t maxThresh      = recParam->GetClusMaxThresh();
   // Threshold value for the digit signal
   Float_t sigThresh      = recParam->GetClusSigThresh();
 
-  // Detector wise calibration object for t0
-  const AliTRDCalDet *calT0Det         = calibration->GetT0Det();
-  // Detector wise calibration object for the gain factors
-  const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
-
   // Iteration limit for unfolding procedure
   const Float_t kEpsilon = 0.01;             
   const Int_t   kNclus   = 3;  
@@ -558,7 +573,6 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
 
   Double_t padSignal[kNsig];   
   Double_t clusterSignal[kNclus];
-  Double_t clusterPads[kNclus];   
 
   Int_t icham = indexesIn->GetChamber();
   Int_t iplan = indexesIn->GetPlane();
@@ -566,63 +580,57 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
 
   // Start clustering in the chamber
 
-  Int_t    idet    = fGeometry->GetDetector(iplan,icham,isect);
+  Int_t idet  = AliTRDgeometry::GetDetector(iplan,icham,isect);
   if (idet != det)
     {
       AliError("Strange Detector number Missmatch!");
       return kFALSE;
     }
 
+  // TRD space point transformation
+  fTransform->SetDetector(det);
+
   Int_t    ilayer  = AliGeomManager::kTRD1 + iplan;
   Int_t    imodule = icham + AliTRDgeometry::Ncham() * isect;
   UShort_t volid   = AliGeomManager::LayerToVolUID(ilayer,imodule); 
 
-  //Int_t nRowMax = digitsIn->GetNrow();
-  Int_t nColMax = digitsIn->GetNcol();
+  Int_t nColMax    = digitsIn->GetNcol();
   Int_t nTimeTotal = digitsIn->GetNtime();
 
-  AliTRDpadPlane *padPlane = fGeometry->GetPadPlane(iplan,icham);
-
-  // Calibration object with pad wise values for t0
-  AliTRDCalROC *calT0ROC              = calibration->GetT0ROC(idet);
+  // Detector wise calibration object for the gain factors
+  const AliTRDCalDet *calGainFactorDet      = calibration->GetGainFactorDet();
   // Calibration object with pad wise values for the gain factors
-  AliTRDCalROC *calGainFactorROC      = calibration->GetGainFactorROC(idet);
-  // Calibration value for chamber wise t0
-  Float_t       calT0DetValue         = calT0Det->GetValue(idet);
+  AliTRDCalROC       *calGainFactorROC      = calibration->GetGainFactorROC(idet);
   // Calibration value for chamber wise gain factor
-  Float_t       calGainFactorDetValue = calGainFactorDet->GetValue(idet);
+  Float_t             calGainFactorDetValue = calGainFactorDet->GetValue(idet);
 
-  Int_t nClusters      = 0;
+  Int_t nClusters = 0;
 
-  // Apply the gain and the tail cancelation via digital filter
   AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow()
-                                                    ,digitsIn->GetNcol()
-                                                    ,digitsIn->GetNtime()); 
-
-//   AliInfo(Form("nrows %d cols %d time %d", 
-//            digitsIn->GetNrow()
-//            ,digitsIn->GetNcol()
-//            ,digitsIn->GetNtime())); 
+                                                    ,digitsIn->GetNcol()
+                                                   ,digitsIn->GetNtime()); 
 
   ResetHelperIndexes(indexesIn);
 
-  Transform(digitsIn
-           ,digitsOut
-           ,indexesIn
-           ,fIndexesOut
-           ,nTimeTotal
-           ,ADCthreshold
-           ,calGainFactorROC
-           ,calGainFactorDetValue);    
+  // Apply the gain and the tail cancelation via digital filter
+  TailCancelation(digitsIn
+                ,digitsOut  
+                ,indexesIn
+                ,fIndexesOut
+                ,nTimeTotal
+                 ,ADCthreshold
+                 ,calGainFactorROC
+                 ,calGainFactorDetValue);      
        
-  Int_t row   = 0;
-  Int_t col   = 0;
-  Int_t time  = 0;
-  Int_t iPad  = 0;
+  Int_t row  = 0;
+  Int_t col  = 0;
+  Int_t time = 0;
+  Int_t iPad = 0;
     
   fIndexesOut->ResetCounters();
   while (fIndexesOut->NextRCTbinIndex(row, col, time))
     {
+
       Float_t signalM = TMath::Abs(digitsOut->GetDataUnchecked(row,col,time));
            
       // Look for the maximum
@@ -632,8 +640,7 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
          if (col + 1 >= nColMax || col-1 < 0)
            continue;
 
-         Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1  ,time));
-
+         Float_t signalL = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time));
          Float_t signalR = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time));
 
          if ((TMath::Abs(signalL) <= signalM) && 
@@ -646,8 +653,10 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
                  digitsOut->SetDataUnchecked(row,col,time,-signalM);
                  fIndexesMaxima->AddIndexTBin(row,col,time);
                }
-           }   
-       }           
+           }
+
+       }
+
     }
               
   // The index to the first cluster of a given ROC
@@ -659,181 +668,203 @@ Bool_t AliTRDclusterizerV2::MakeClusters(Int_t det)
   fIndexesMaxima->ResetCounters();
   while (fIndexesMaxima->NextRCTbinIndex(row, col, time)) 
     {
+
       // Maximum found ?             
-      if (digitsOut->GetDataUnchecked(row,col,time) < 0.0) {
+      if (digitsOut->GetDataUnchecked(row,col,time) < 0.0) 
+        {
 
-       for (iPad = 0; iPad < kNclus; iPad++) {
-         Int_t iPadCol = col - 1 + iPad;
-         clusterSignal[iPad] = 
-           TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
-       }
+         for (iPad = 0; iPad < kNclus; iPad++) 
+            {
+             Int_t iPadCol = col - 1 + iPad;
+             clusterSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row,iPadCol,time));
+           }
 
-       // Count the number of pads in the cluster
-       Int_t nPadCount = 0;
-       Int_t ii;
-       // Look to the left
-       ii = 0;
-       while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii  ,time)) >= sigThresh) {
-         nPadCount++;
-         ii++;
-         if (col-ii   <        0) break;
-       }
-       // Look to the right
-       ii = 0;
-       while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh) {
-         nPadCount++;
-         ii++;
-         if (col+ii+1 >= nColMax) break;
-       }
-       nClusters++;
-
-       // Look for 5 pad cluster with minimum in the middle
-       Bool_t fivePadCluster = kFALSE;
-       if (col < (nColMax - 3)) {
-         if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) {
-           fivePadCluster = kTRUE;
-         }
-         if ((fivePadCluster) && (col < (nColMax - 5))) {
-           if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh) {
-             fivePadCluster = kFALSE;
+         // Count the number of pads in the cluster
+         Int_t nPadCount = 0;
+         Int_t ii;
+         // Look to the left
+         ii = 0;
+         while (TMath::Abs(digitsOut->GetDataUnchecked(row,col-ii  ,time)) >= sigThresh) 
+            {
+             nPadCount++;
+             ii++;
+             if (col-ii   <        0) break;
            }
-         }
-         if ((fivePadCluster) && (col >             1)) {
-           if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh) {
-             fivePadCluster = kFALSE;
+         // Look to the right
+         ii = 0;
+         while (TMath::Abs(digitsOut->GetDataUnchecked(row,col+ii+1,time)) >= sigThresh) 
+            {
+             nPadCount++;
+             ii++;
+             if (col+ii+1 >= nColMax) break;
+           }
+         nClusters++;
+
+         // Look for 5 pad cluster with minimum in the middle
+         Bool_t fivePadCluster = kFALSE;
+         if (col < (nColMax - 3)) 
+            {
+             if (digitsOut->GetDataUnchecked(row,col+2,time) < 0) 
+                {
+                 fivePadCluster = kTRUE;
+               }
+             if ((fivePadCluster) && (col < (nColMax - 5))) 
+                {
+                 if (digitsOut->GetDataUnchecked(row,col+4,time) >= sigThresh) 
+                    {
+                     fivePadCluster = kFALSE;
+                   }
+               }
+             if ((fivePadCluster) && (col >             1)) 
+                {
+                 if (digitsOut->GetDataUnchecked(row,col-2,time) >= sigThresh) 
+                    {
+                     fivePadCluster = kFALSE;
+                   }
+               }
            }
-         }
-       }
 
-       // 5 pad cluster
-       // Modify the signal of the overlapping pad for the left part 
-       // of the cluster which remains from a previous unfolding
-       if (iUnfold) {
-         clusterSignal[0] *= ratioLeft;
-         iUnfold = 0;
-       }
+         // 5 pad cluster
+         // Modify the signal of the overlapping pad for the left part 
+         // of the cluster which remains from a previous unfolding
+         if (iUnfold) 
+            {
+             clusterSignal[0] *= ratioLeft;
+             iUnfold = 0;
+           }
 
-       // Unfold the 5 pad cluster
-       if (fivePadCluster) {
-         for (iPad = 0; iPad < kNsig; iPad++) {
-           padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
-                                                                    ,col-1+iPad
-                                                                    ,time));
-         }
-         // Unfold the two maxima and set the signal on 
-         // the overlapping pad to the ratio
-         ratioRight        = Unfold(kEpsilon,iplan,padSignal);
-         ratioLeft         = 1.0 - ratioRight; 
-         clusterSignal[2] *= ratioRight;
-         iUnfold = 1;
-       }
+         // Unfold the 5 pad cluster
+         if (fivePadCluster) 
+            {
+             for (iPad = 0; iPad < kNsig; iPad++) 
+                {
+                 padSignal[iPad] = TMath::Abs(digitsOut->GetDataUnchecked(row
+                                                                         ,col-1+iPad
+                                                                         ,time));
+               }
+             // Unfold the two maxima and set the signal on 
+             // the overlapping pad to the ratio
+             ratioRight        = Unfold(kEpsilon,iplan,padSignal);
+             ratioLeft         = 1.0 - ratioRight; 
+             clusterSignal[2] *= ratioRight;
+             iUnfold = 1;
+           }
 
-       Double_t clusterCharge = clusterSignal[0]
-         + clusterSignal[1]
-         + clusterSignal[2];
-                
-       // The position of the cluster
-       clusterPads[0] =  row + 0.5;
-       // Take the shift of the additional time bins into account
-       clusterPads[2] = time + 0.5;
-
-       if (recParam->LUTOn()) {
-         // Calculate the position of the cluster by using the
-         // lookup table method
-         clusterPads[1] = recParam->LUTposition(iplan,clusterSignal[0]
-                                                ,clusterSignal[1]
-                                                ,clusterSignal[2]);
-       }
-       else {
-         // Calculate the position of the cluster by using the
-         // center of gravity method
-         for (Int_t i = 0; i < kNsig; i++) {
-           padSignal[i] = 0.0;
-         }
-         padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time)); // Central pad
-         padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Left    pad
-         padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Right   pad
-         if ((col >           2) && 
-             (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) {
-           padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
-         }
-         if ((col < nColMax - 3) &&
-             (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3])) {
-           padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
-         }               
-         clusterPads[1] = GetCOG(padSignal);
-       }
+         // The position of the cluster in COL direction relative to the center pad (pad units)
+          Double_t clusterPosCol = 0.0;
+         if (recParam->LUTOn()) 
+            {
+             // Calculate the position of the cluster by using the
+             // lookup table method
+             clusterPosCol = recParam->LUTposition(iplan
+                                                   ,clusterSignal[0]
+                                                   ,clusterSignal[1]
+                                                  ,clusterSignal[2]);
+           }
+         else 
+            {
+             // Calculate the position of the cluster by using the
+             // center of gravity method
+             for (Int_t i = 0; i < kNsig; i++) 
+                {
+                 padSignal[i] = 0.0;
+               }
+             padSignal[2] = TMath::Abs(digitsOut->GetDataUnchecked(row,col  ,time)); // Central pad
+             padSignal[1] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-1,time)); // Left    pad
+             padSignal[3] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+1,time)); // Right   pad
+             if ((col >           2) && 
+                 (TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time)) < padSignal[1])) 
+                {
+                 padSignal[0] = TMath::Abs(digitsOut->GetDataUnchecked(row,col-2,time));
+               }
+             if ((col < nColMax - 3) &&
+                 (TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time)) < padSignal[3])) 
+                {
+                 padSignal[4] = TMath::Abs(digitsOut->GetDataUnchecked(row,col+2,time));
+               }  
+             clusterPosCol = GetCOG(padSignal);
+           }
 
-       Double_t q0 = clusterSignal[0];
-       Double_t q1 = clusterSignal[1];
-       Double_t q2 = clusterSignal[2];
-       Double_t clusterSigmaY2 = (q1 * (q0 + q2) + 4.0 * q0 * q2)
-         / (clusterCharge*clusterCharge);
-
-       //
-       // Calculate the position and the error
-       //              
-
-       // Correct for t0 (sum of chamber and pad wise values !!!)
-       Float_t  calT0ROCValue  = calT0ROC->GetValue(col,row);
-       Char_t   clusterTimeBin = ((Char_t) TMath::Nint(time - (calT0DetValue + calT0ROCValue)));
-       Double_t colSize        = padPlane->GetColSize(col);
-       Double_t rowSize        = padPlane->GetRowSize(row);
-
-       Float_t clusterPos[3];
-       clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1] + 0.5) * colSize;
-       clusterPos[1] = padPlane->GetRowPos(row) - 0.5                    * rowSize;
-       clusterPos[2] = CalcXposFromTimebin(clusterPads[2],idet,col,row);
-       Float_t clusterSig[2];
-       clusterSig[0] = (clusterSigmaY2 + 1.0/12.0) * colSize*colSize;
-       clusterSig[1] = rowSize * rowSize / 12.0;                                       
-               
-       // Store the amplitudes of the pads in the cluster for later analysis
-       Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
-       for (Int_t jPad = col-3; jPad <= col+3; jPad++) {
-         if ((jPad <          0) || 
-             (jPad >= nColMax-1)) {
-           continue;
-         }
-         signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
-       }
+         // Store the amplitudes of the pads in the cluster for later analysis
+         Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
+         for (Int_t jPad = col-3; jPad <= col+3; jPad++) 
+            {
+             if ((jPad <          0) || 
+                 (jPad >= nColMax-1)) 
+                {
+                 continue;
+               }
+             signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
+           }
 
-       // Add the cluster to the output array
-       // The track indices will be stored later 
-       AliTRDcluster *cluster = new AliTRDcluster(idet
-                                                  ,clusterCharge
-                                                  ,clusterPos
-                                                  ,clusterSig
-                                                  ,0x0
-                                                  ,((Char_t) nPadCount)
-                                                  ,signals
-                                                  ,((UChar_t) col)
-                                                  ,clusterTimeBin
-                                                  ,clusterPads[1]
-                                                  ,volid);
-       // Temporarily store the row, column and time bin of the center pad
-       // Used to later on assign the track indices
-       cluster->SetLabel( row,0);
-       cluster->SetLabel( col,1);
-       cluster->SetLabel(time,2);
-       RecPoints()->Add(cluster);
-
-       // Store the index of the first cluster in the current ROC
-       if (firstClusterROC < 0) {
-         firstClusterROC = RecPoints()->GetEntriesFast() - 1;
-       }
-       // Count the number of cluster in the current ROC
-       nClusterROC++;
+          // Transform the local cluster coordinates into calibrated 
+          // space point positions defined in the local tracking system.
+          // Here the calibration for T0, Vdrift and ExB is applied as well.
+         Double_t clusterXYZ[6];
+         clusterXYZ[0] = clusterPosCol;
+         clusterXYZ[1] = clusterSignal[0];
+         clusterXYZ[2] = clusterSignal[1];
+         clusterXYZ[3] = clusterSignal[2];
+         clusterXYZ[4] = 0.0;
+         clusterXYZ[5] = 0.0;
+          Int_t    clusterRCT[3];
+          clusterRCT[0] = row;
+          clusterRCT[1] = col;
+          clusterRCT[2] = 0;
+         fTransform->Transform(clusterXYZ,clusterRCT,((UInt_t) time),0);
+
+         // Add the cluster to the output array
+         // The track indices will be stored later 
+          Float_t clusterPos[3];
+          clusterPos[0] = clusterXYZ[0];
+          clusterPos[1] = clusterXYZ[1];
+          clusterPos[2] = clusterXYZ[2];
+         Float_t clusterSig[2];
+         clusterSig[0] = clusterXYZ[4];
+         clusterSig[1] = clusterXYZ[5];
+          Double_t clusterCharge  = clusterXYZ[3];
+         Char_t   clusterTimeBin = ((Char_t) clusterRCT[2]);
+         AliTRDcluster *cluster = new AliTRDcluster(idet
+                                                   ,clusterCharge
+                                                   ,clusterPos
+                                                   ,clusterSig
+                                                   ,0x0
+                                                   ,((Char_t) nPadCount)
+                                                   ,signals
+                                                   ,((UChar_t) col)
+                                                   ,((UChar_t) row)
+                                                   ,((UChar_t) time)
+                                                   ,clusterTimeBin
+                                                   ,clusterPosCol
+                                                   ,volid);
+
+         // Temporarily store the row, column and time bin of the center pad
+         // Used to later on assign the track indices
+         cluster->SetLabel( row,0);
+         cluster->SetLabel( col,1);
+         cluster->SetLabel(time,2);
+
+         RecPoints()->Add(cluster);
+
+         // Store the index of the first cluster in the current ROC
+         if (firstClusterROC < 0) 
+            {
+             firstClusterROC = RecPoints()->GetEntriesFast() - 1;
+           }
 
-      } // if: Maximum found ?
+         // Count the number of cluster in the current ROC
+         nClusterROC++;
+
+        } // if: Maximum found ?
 
     }
+
   delete digitsOut;
-  //delete fIndexesOut;
-  //delete fIndexesMaxima;
 
-  if (fAddLabels)
-    AddLabels(idet, firstClusterROC, nClusterROC);
+  if (fAddLabels) 
+    {
+      AddLabels(idet, firstClusterROC, nClusterROC);
+    }
 
   // Write the cluster and reset the array
   WriteClusters(idet);
@@ -850,16 +881,16 @@ Bool_t AliTRDclusterizerV2::AddLabels(Int_t idet, Int_t firstClusterROC, Int_t n
   // Add the track indices to the found clusters
   //
   
-  const Int_t   kNclus   = 3;  
-  const Int_t   kNdict   = AliTRDdigitsManager::kNDict;
-  const Int_t   kNtrack  = kNdict * kNclus;
+  const Int_t   kNclus  = 3;  
+  const Int_t   kNdict  = AliTRDdigitsManager::kNDict;
+  const Int_t   kNtrack = kNdict * kNclus;
 
-  Int_t    iClusterROC   = 0;
+  Int_t iClusterROC = 0;
 
-  Int_t row   = 0;
-  Int_t col   = 0;
-  Int_t time  = 0;
-  Int_t iPad  = 0;
+  Int_t row  = 0;
+  Int_t col  = 0;
+  Int_t time = 0;
+  Int_t iPad = 0;
 
   // Temporary array to collect the track indices
   Int_t *idxTracks = new Int_t[kNtrack*nClusterROC];
@@ -869,8 +900,8 @@ Bool_t AliTRDclusterizerV2::AddLabels(Int_t idet, Int_t firstClusterROC, Int_t n
   AliTRDdataArrayI *tracksIn = 0;
   for (Int_t iDict = 0; iDict < kNdict; iDict++) {
 
-    tracksIn = fDigitsManager->GetDictionary(idet,iDict);
     // tracksIn should be expanded beforehand!
+    tracksIn = fDigitsManager->GetDictionary(idet,iDict);
 
     // Loop though the clusters found in this ROC
     for (iClusterROC = 0; iClusterROC < nClusterROC; iClusterROC++) {
@@ -889,10 +920,6 @@ Bool_t AliTRDclusterizerV2::AddLabels(Int_t idet, Int_t firstClusterROC, Int_t n
 
     }
 
-    // Compress the arrays
-    // no do not compress - we will delete them when we are done with the detector
-    //tracksIn->Compress(1,0);
-
   }
 
   // Copy the track indices into the cluster
@@ -912,6 +939,7 @@ Bool_t AliTRDclusterizerV2::AddLabels(Int_t idet, Int_t firstClusterROC, Int_t n
   delete [] idxTracks;
 
   return kTRUE;
+
 }
 
 //_____________________________________________________________________________
@@ -984,8 +1012,8 @@ Double_t AliTRDclusterizerV2::Unfold(Double_t eps, Int_t plane, Double_t *padSig
     irc = calibration->PadResponse(ampRight,maxRight,plane,newRightSignal);
 
     // Calculate new overlapping ratio
-    ratio = TMath::Min((Double_t)1.0,newLeftSignal[2] / 
-                                    (newLeftSignal[2] + newRightSignal[0]));
+    ratio = TMath::Min((Double_t) 1.0
+                      ,newLeftSignal[2] / (newLeftSignal[2] + newRightSignal[0]));
 
   }
 
@@ -994,18 +1022,18 @@ Double_t AliTRDclusterizerV2::Unfold(Double_t eps, Int_t plane, Double_t *padSig
 }
 
 //_____________________________________________________________________________
-void AliTRDclusterizerV2::Transform(AliTRDdataArrayI *digitsIn
-                                   , AliTRDdataArrayF *digitsOut
-                                   , AliTRDSignalIndex *indexesIn
-                                   , AliTRDSignalIndex *indexesOut
-                                    , Int_t nTimeTotal
-                                   , Float_t ADCthreshold
-                                   , AliTRDCalROC *calGainFactorROC
-                                   , Float_t calGainFactorDetValue)
+void AliTRDclusterizerV2::TailCancelation(AliTRDdataArrayI *digitsIn
+                                       , AliTRDdataArrayF *digitsOut
+                                       , AliTRDSignalIndex *indexesIn
+                                       , AliTRDSignalIndex *indexesOut
+                                        , Int_t nTimeTotal
+                                       , Float_t ADCthreshold
+                                       , AliTRDCalROC *calGainFactorROC
+                                       , Float_t calGainFactorDetValue)
 {
   //
-  // Apply gain factor
-  // Apply tail cancelation: Transform digitsIn to digitsOut
+  // Applies the tail cancelation and gain factors: 
+  // Transform digitsIn to digitsOut
   //
 
   Int_t iRow  = 0;
@@ -1013,10 +1041,11 @@ void AliTRDclusterizerV2::Transform(AliTRDdataArrayI *digitsIn
   Int_t iTime = 0;
 
   AliTRDRecParam *recParam = AliTRDRecParam::Instance();
-  if (!recParam) {
-    AliError("No AliTRDRecParam instance available\n");
-    return;
-  }
+  if (!recParam) 
+    {
+      AliError("No AliTRDRecParam instance available\n");
+      return;
+    }
 
   Double_t *inADC  = new Double_t[nTimeTotal];  // ADC data before tail cancellation
   Double_t *outADC = new Double_t[nTimeTotal];  // ADC data after tail cancellation
@@ -1029,18 +1058,17 @@ void AliTRDclusterizerV2::Transform(AliTRDdataArrayI *digitsIn
 
       for (iTime = 0; iTime < nTimeTotal; iTime++) 
        {         
-         //
-         // Add gain
-         //
+         // Apply gain gain factor
          inADC[iTime]   = digitsIn->GetDataUnchecked(iRow,iCol,iTime);
          inADC[iTime]  /= gain;
          outADC[iTime]  = inADC[iTime];
        }
 
       // Apply the tail cancelation via the digital filter
-      if (recParam->TCOn()) {
-       DeConvExp(inADC,outADC,nTimeTotal,recParam->GetTCnexp());
-      }
+      if (recParam->TCOn()) 
+        {
+         DeConvExp(inADC,outADC,nTimeTotal,recParam->GetTCnexp());
+        }
 
       indexesIn->ResetTbinCounter();
       while (indexesIn->NextTbinIndex(iTime))
@@ -1049,17 +1077,15 @@ void AliTRDclusterizerV2::Transform(AliTRDdataArrayI *digitsIn
          if (outADC[iTime] > ADCthreshold) 
            {
              digitsOut->SetDataUnchecked(iRow,iCol,iTime,outADC[iTime]);
-             //AliDebug(5, Form("add index %d", indexesIn->GetDetNumber()));
              indexesOut->AddIndexTBin(iRow,iCol,iTime);
            }     
        } //while itime
+
     }//while irow icol
   
   delete [] inADC;
   delete [] outADC;
 
-  //AliDebug(5, Form("Stop %d", indexesIn->GetDetNumber()));
-
   return;
 
 }
@@ -1076,55 +1102,58 @@ void AliTRDclusterizerV2::DeConvExp(Double_t *source, Double_t *target
   Double_t coefficients[2];
 
   // Initialization (coefficient = alpha, rates = lambda)
-  Double_t R1 = 1.0;
-  Double_t R2 = 1.0;
-  Double_t C1 = 0.5;
-  Double_t C2 = 0.5;
+  Double_t r1 = 1.0;
+  Double_t r2 = 1.0;
+  Double_t c1 = 0.5;
+  Double_t c2 = 0.5;
 
   if (nexp == 1) {   // 1 Exponentials
-    R1 = 1.156;
-    R2 = 0.130;
-    C1 = 0.066;
-    C2 = 0.000;
+    r1 = 1.156;
+    r2 = 0.130;
+    c1 = 0.066;
+    c2 = 0.000;
   }
   if (nexp == 2) {   // 2 Exponentials
-    R1 = 1.156;
-    R2 = 0.130;
-    C1 = 0.114;
-    C2 = 0.624;
+    r1 = 1.156;
+    r2 = 0.130;
+    c1 = 0.114;
+    c2 = 0.624;
   }
 
-  coefficients[0] = C1;
-  coefficients[1] = C2;
+  coefficients[0] = c1;
+  coefficients[1] = c2;
 
-  Double_t Dt = 0.1;
+  Double_t dt = 0.1;
 
-  rates[0] = TMath::Exp(-Dt/(R1));
-  rates[1] = TMath::Exp(-Dt/(R2));
+  rates[0] = TMath::Exp(-dt/(r1));
+  rates[1] = TMath::Exp(-dt/(r2));
   
   Int_t i = 0;
   Int_t k = 0;
 
   Double_t reminder[2];
-  Double_t correction;
-  Double_t result;
+  Double_t correction = 0.0;
+  Double_t result     = 0.0;
 
   // Attention: computation order is important
-  correction = 0.0;
   for (k = 0; k < nexp; k++) {
     reminder[k] = 0.0;
   }
+
   for (i = 0; i < n; i++) {
+
     result    = (source[i] - correction);    // No rescaling
     target[i] = result;
 
     for (k = 0; k < nexp; k++) {
       reminder[k] = rates[k] * (reminder[k] + coefficients[k] * result);
     }
+
     correction = 0.0;
     for (k = 0; k < nexp; k++) {
       correction += reminder[k];
     }
+
   }
 
 }
index 4307f27..320ea89 100644 (file)
@@ -19,7 +19,7 @@ class AliTRDdigitsManager;
 class AliTRDCalROC;
 class AliRawReader;
 class AliTRDSignalIndex;
-class AliTRDgeometry;
+class AliTRDtransform;
 
 class AliTRDclusterizerV2 : public AliTRDclusterizer {
 
@@ -41,40 +41,38 @@ class AliTRDclusterizerV2 : public AliTRDclusterizer {
   virtual Bool_t   ReadDigits(TTree *digitsTree);
 
   virtual Bool_t   AddLabels(Int_t idet, Int_t firstClusterROC, Int_t nClusterROC);
-  virtual Bool_t   SetAddLabels(Bool_t kset) { fAddLabels = kset; return fAddLabels;} // should we assign labels to clusters
-  virtual void     SetRawVersion(Int_t iver) { fRawVersion = iver;} // set the expected raw data version
+  virtual Bool_t   SetAddLabels(Bool_t kset) { fAddLabels = kset; 
+                                               return fAddLabels;  } // should we assign labels to clusters
+  virtual void     SetRawVersion(Int_t iver) { fRawVersion = iver; } // set the expected raw data version
 
  protected:
 
           void     DeConvExp(Double_t *source, Double_t *target
                            , Int_t nTimeTotal, Int_t nexp);
-         void     Transform(AliTRDdataArrayI *digitsIn
-                          , AliTRDdataArrayF *digitsOut
-                          , AliTRDSignalIndex *indexesIn
-                          , AliTRDSignalIndex *indexesOut
-                          , Int_t nTimeTotal
-                          , Float_t ADCthreshold
-                          , AliTRDCalROC *calGainFactorROC
-                          , Float_t calGainFactorDetValue);
-/*           void     Transform(AliTRDdataArrayI *digitsIn, AliTRDdataArrayF *digitsOut */
-/*                        , Int_t nRowMax, Int_t nColMax, Int_t nTimeTotal */
-/*                            , Float_t ADCthreshold */
-/*                            , AliTRDCalROC *calGainFactorROC */
-/*                            , Float_t calGainFactorDetValue); */
+         void     TailCancelation(AliTRDdataArrayI *digitsIn
+                                 , AliTRDdataArrayF *digitsOut 
+                                 , AliTRDSignalIndex *indexesIn
+                                , AliTRDSignalIndex *indexesOut
+                                , Int_t nTimeTotal
+                                , Float_t ADCthreshold
+                                , AliTRDCalROC *calGainFactorROC
+                                , Float_t calGainFactorDetValue);
   virtual Double_t Unfold(Double_t eps, Int_t plane, Double_t *padSignal);
           Double_t GetCOG(Double_t signal[5]); 
 
   virtual void     ResetHelperIndexes(AliTRDSignalIndex *indexesIn);
 
-  AliTRDdigitsManager *fDigitsManager;      //! TRD digits manager
-  AliTRDgeometry      *fGeometry;           //! default TRD geometry
+  AliTRDdigitsManager *fDigitsManager;       //! TRD digits manager
 
-  Bool_t              fAddLabels;           // should clusters have MC labels?
-  Int_t               fRawVersion;          // expected raw version of the data - default is 2
+  Bool_t               fAddLabels;           //  Should clusters have MC labels?
+  Int_t                fRawVersion;          //  Expected raw version of the data - default is 2
 
-  AliTRDSignalIndex   *fIndexesOut;          //! helper indexes for clusterization
-  AliTRDSignalIndex   *fIndexesMaxima;       //! helper indexes for clusterization
-  ClassDef(AliTRDclusterizerV2,1)           //  TRD-Cluster finder, slow simulator
+  AliTRDSignalIndex   *fIndexesOut;          //! Helper indexes for clusterization
+  AliTRDSignalIndex   *fIndexesMaxima;       //! Helper indexes for clusterization
+
+  AliTRDtransform     *fTransform;           //! Transforms the reconstructed space points
+
+  ClassDef(AliTRDclusterizerV2,3)            //  TRD clusterfinder
 
 };
 
index dd881ae..fa7ee75 100644 (file)
@@ -102,7 +102,7 @@ class AliTRDpadPlane : public TObject {
   Double_t GetColSize(Int_t col) const       { if ((col == 0) || (col == fNcols-1))
                                                  return fWidthOPad;
                                                else
-                                                  return fWidthIPad; };
+                                                 return fWidthIPad;  };
 
   Double_t GetLengthRim() const              { return fLengthRim;    };
   Double_t GetWidthRim() const               { return fWidthRim;     };
index 84086fb..6a8af33 100644 (file)
@@ -69,19 +69,17 @@ AliTRDtrack::AliTRDtrack()
       fdEdxPlane[i][j] = 0.0;
     }
     fTimBinPlane[i] = -1;
-               // A.Bercuci additions
-               fMom[i] = -1.;
-               fSnp[i] = 0.;
-               fTgl[i] = 0.;
-       }
+    fMom[i]         = -1.;
+    fSnp[i]         = 0.;
+    fTgl[i]         = 0.;
+  }
 
   for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
     fIndex[i]       = 0;
     fIndexBackup[i] = 0;
     fdQdl[i]        = 0;
-               //A.Bercuci additions
-               fClusters[i]    = 0x0;
-       }
+    fClusters[i]    = 0x0;
+  }
 
   for (Int_t i = 0; i < 3; i++) {
     fBudget[i] = 0;
@@ -114,7 +112,7 @@ AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
   // The main AliTRDtrack constructor.
   //
 
-  Double_t cnv   = 1.0/(GetBz() * kB2C);
+  Double_t cnv   = 1.0 / (GetBz() * kB2C);
 
   Double_t pp[5] = { p[0]    
                    , p[1]
@@ -122,32 +120,31 @@ AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
                    , p[3]
                    , p[4]*cnv      };
 
-  Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[5];
-  Double_t c32 = x*cov[13] - cov[8];
-  Double_t c20 = x*cov[10] - cov[3];
-  Double_t c21 = x*cov[11] - cov[4];
-  Double_t c42 = x*cov[14] - cov[12];
+  Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
+  Double_t c32 =   x*cov[13] -     cov[ 8];
+  Double_t c20 =   x*cov[10] -     cov[ 3];
+  Double_t c21 =   x*cov[11] -     cov[ 4];
+  Double_t c42 =   x*cov[14] -     cov[12];
 
-  Double_t cc[15] = { cov[0 ]
-                    , cov[1 ],     cov[2 ]
+  Double_t cc[15] = { cov[ 0]
+                    , cov[ 1],     cov[ 2]
                     , c20,         c21,         c22
-                    , cov[6 ],     cov[7 ],     c32,     cov[9 ]
+                    , cov[ 6],     cov[ 7],     c32,     cov[ 9]
                     , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
 
   Set(x,alpha,pp,cc);
   SetNumberOfClusters(1);
-  fIndex[0] = index;
-       fClusters[0] = c;       // A.Bercuci additions
+  fIndex[0]    = index;
+  fClusters[0] = c;
 
   for (Int_t i = 0; i < kNplane; i++) {
     for (Int_t j = 0; j < kNslice; j++) {
       fdEdxPlane[i][j] = 0.0;
     }
     fTimBinPlane[i] = -1;
-               // A.Bercuci additions
-               fMom[i] = -1.;
-               fSnp[i] = 0.;
-               fTgl[i] = 0.;
+    fMom[i]         = -1.;
+    fSnp[i]         =  0.;
+    fTgl[i]         =  0.;
   }
 
   Double_t q = TMath::Abs(c->GetQ());
@@ -157,13 +154,12 @@ AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
     q *= TMath::Sqrt((1-s*s)/(1+t*t));
   }
 
-  fdQdl[0]     = q;    
+  fdQdl[0] = q;        
   for (UInt_t i = 1; i < kMAXCLUSTERSPERTRACK; i++) {
     fdQdl[i]        = 0;
     fIndex[i]       = 0;
     fIndexBackup[i] = 0;
-               // A.Bercuci additions
-               fClusters[i]    = 0x0;
+    fClusters[i]    = 0x0;
   }
 
   for (Int_t i = 0; i < 3;i++) {
@@ -201,10 +197,9 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
     }
     fTimBinPlane[i] = t.fTimBinPlane[i];
     fTracklets[i]   = t.fTracklets[i];
-               // A.Bercuci additions
-               fMom[i] = t.fMom[i];
-               fSnp[i] = t.fSnp[i];
-               fTgl[i] = t.fTgl[i];
+    fMom[i]         = t.fMom[i];
+    fSnp[i]         = t.fSnp[i];
+    fTgl[i]         = t.fTgl[i];
   }
 
   Int_t n = t.GetNumberOfClusters(); 
@@ -214,17 +209,19 @@ AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
     fIndex[i]       = t.fIndex[i];
     fIndexBackup[i] = t.fIndex[i];
     fdQdl[i]        = t.fdQdl[i];
-               // A.Bercuci additions
-               if(fClusterOwner && t.fClusters[i]) fClusters[i] = new AliTRDcluster(*(t.fClusters[i]));
-               else fClusters[i] = t.fClusters[i];
-       }
+    if (fClusterOwner && t.fClusters[i]) {
+      fClusters[i] = new AliTRDcluster(*(t.fClusters[i]));
+    }
+    else {
+      fClusters[i] = t.fClusters[i];
+    }
+  }
 
   for (UInt_t i = n; i < kMAXCLUSTERSPERTRACK; i++) {
     fdQdl[i]        = 0;
     fIndex[i]       = 0;
     fIndexBackup[i] = 0;
-               // A.Bercuci additions
-               fClusters[i]    = 0x0;
+    fClusters[i]    = 0x0;
   }
 
   for (Int_t i = 0; i < 3;i++) {
@@ -266,18 +263,16 @@ AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/)
       fdEdxPlane[i][j] = 0.0;
     }
     fTimBinPlane[i] = -1;
-               // A.Bercuci additions
-               fMom[i] = -1.;
-               fSnp[i] = 0.;
-               fTgl[i] = 0.;
+    fMom[i]         = -1.;
+    fSnp[i]         =  0.;
+    fTgl[i]         =  0.;
   }
 
   for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
     fdQdl[i]        = 0;
     fIndex[i]       = 0;
     fIndexBackup[i] = 0;
-               // A.Bercuci additions
-               fClusters[i]    = 0x0;
+    fClusters[i]    = 0x0;
   }
   
   for (Int_t i = 0; i < 3; i++) { 
@@ -325,10 +320,9 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
       fdEdxPlane[i][j] = t.GetTRDsignals(i,j);
     }
     fTimBinPlane[i] = t.GetTRDTimBin(i);
-               // A.Bercuci additions
-               fMom[i] = -1.;
-               fSnp[i] = 0.;
-               fTgl[i] = 0.;
+    fMom[i]         = -1.;
+    fSnp[i]         =  0.;
+    fTgl[i]         =  0.;
   }
 
   const AliExternalTrackParam *par = &t;
@@ -341,12 +335,10 @@ AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
   }
   Set(par->GetX(),par->GetAlpha(),par->GetParameter(),par->GetCovariance());
 
-  
   for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
     fdQdl[i]     = 0;
-       // A.Bercuci additions
-               fClusters[i] = 0x0;
-       }
+    fClusters[i] = 0x0;
+  }
 
   for (Int_t i = 0; i < 3; i++) {
     fBudget[i] = 0;
@@ -375,13 +367,13 @@ AliTRDtrack::~AliTRDtrack()
     delete fBackupTrack;
   }
   fBackupTrack = 0x0;
-  if (fClusterOwner){
-    UInt_t icluster=0;
-               while(icluster<kMAXCLUSTERSPERTRACK && fClusters[icluster]){
-                       delete fClusters[icluster];
-                       fClusters[icluster] = 0x0;
-                       icluster++;
-               }
+  if (fClusterOwner) {
+    UInt_t icluster = 0;
+    while ((icluster < kMAXCLUSTERSPERTRACK) && fClusters[icluster]) {
+      delete fClusters[icluster];
+      fClusters[icluster] = 0x0;
+      icluster++;
+    }
   }
 
 }
@@ -401,22 +393,22 @@ Float_t AliTRDtrack::StatusForTOF()
 
   // This part of the function is never reached ????
   // What defines these parameters ????
-  Int_t status = 0;
-  if (GetNumberOfClusters()                <  20)  return 0;
-  if ((fN                                  > 110) && 
-      (fChi2/(Float_t(fN))                 <   3)) return 3; // Gold
-  if ((fNLast                              >  30) &&
-      (fChi2Last/(Float_t(fNLast))         <   3)) return 3; // Gold
-  if ((fNLast                              >  20) &&
-      (fChi2Last/(Float_t(fNLast))         <   2)) return 3; // Gold
-  if ((fNLast/(fNExpectedLast+3.0)         > 0.8) && 
-      (fChi2Last/Float_t(fNLast)           <   5) && 
-      (fNLast                              >  20)) return 2; // Silber
-  if ((fNLast                              >   5) &&
-      (((fNLast+1.0)/(fNExpectedLast+1.0)) > 0.8) && 
-      (fChi2Last/(fNLast-5.0)              <   6)) return 1; 
-  
-  return status;
+  //Int_t status = 0;
+  //if (GetNumberOfClusters()                <  20)  return 0;
+  //if ((fN                                  > 110) && 
+  //    (fChi2/(Float_t(fN))                 <   3)) return 3; // Gold
+  //if ((fNLast                              >  30) &&
+  //    (fChi2Last/(Float_t(fNLast))         <   3)) return 3; // Gold
+  //if ((fNLast                              >  20) &&
+  //    (fChi2Last/(Float_t(fNLast))         <   2)) return 3; // Gold
+  //if ((fNLast/(fNExpectedLast+3.0)         > 0.8) && 
+  //    (fChi2Last/Float_t(fNLast)           <   5) && 
+  //    (fNLast                              >  20)) return 2; // Silver
+  //if ((fNLast                              >   5) &&
+  //    (((fNLast+1.0)/(fNExpectedLast+1.0)) > 0.8) && 
+  //    (fChi2Last/(fNLast-5.0)              <   6)) return 1; 
+  //
+  //return status;
 
 }
 
@@ -450,16 +442,16 @@ void AliTRDtrack::CookdEdx(Double_t low, Double_t up)
   //
 
   // Array to sort the dEdx values according to amplitude
-
-       Float_t sorted[kMAXCLUSTERSPERTRACK];
-       fdEdx = 0.;
+  Float_t sorted[kMAXCLUSTERSPERTRACK];
+  fdEdx = 0.;
        
   // Require at least 10 clusters for a dedx measurement
   if (fNdedx < 10) return;
 
-
   // Can fdQdl be negative ????
-  for (Int_t i = 0; i < fNdedx; i++) sorted[i] = TMath::Abs(fdQdl[i]);
+  for (Int_t i = 0; i < fNdedx; i++) {
+    sorted[i] = TMath::Abs(fdQdl[i]);
+  }
   // Sort the dedx values by amplitude
   Int_t *index = new Int_t[fNdedx];
   TMath::Sort(fNdedx, sorted, index, kFALSE);
@@ -467,10 +459,13 @@ void AliTRDtrack::CookdEdx(Double_t low, Double_t up)
   // Sum up the truncated charge between lower and upper bounds 
   Int_t nl = Int_t(low * fNdedx);
   Int_t nu = Int_t( up * fNdedx);
-  for (Int_t i = nl; i <= nu; i++) fdEdx += sorted[index[i]];
-       fdEdx /= (nu - nl + 1.0);
+  for (Int_t i = nl; i <= nu; i++) {
+    fdEdx += sorted[index[i]];
+  }
+  fdEdx /= (nu - nl + 1.0);
+
+  delete[] index;
 
-       delete[] index;
 }                     
 
 //_____________________________________________________________________________
@@ -479,95 +474,110 @@ void AliTRDtrack::CookdEdxTimBin()
   //
   // Set fdEdxPlane and fTimBinPlane and also get the 
   // Time bin for Max. Cluster
-       //
-       // Authors:
+  //
+  // Authors:
   // Prashant Shukla (shukla@physi.uni-heidelberg.de)
   // Alexandru Bercuci (A.Bercuci@gsi.de)
+  //
 
-
-       Double_t  maxcharge[AliESDtrack::kNPlane]; // max charge in chamber
-       // number of clusters attached to track per chamber and slice
-       Int_t     nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
-       //number of time bins in chamber
-       Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
-       Int_t plane;   // plane of current cluster
-       Int_t tb;      // time bin of current cluster
-       Int_t slice;   // curent slice
-       AliTRDcluster *cluster = 0x0; // pointer to current cluster
-
-       // Reset class and local contors/variables
+  Double_t  maxcharge[AliESDtrack::kNPlane]; // max charge in chamber
+  // Number of clusters attached to track per chamber and slice
+  Int_t     nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
+  // Number of time bins in chamber
+  Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
+  Int_t plane;                  // Plane of current cluster
+  Int_t tb;                     // Time bin of current cluster
+  Int_t slice;                  // Current slice
+  AliTRDcluster *cluster = 0x0; // Pointer to current cluster
+
+  // Reset class and local counters/variables
   for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
-               fTimBinPlane[iPlane] = -1;
-    maxcharge[iPlane] = 0.;
-               for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
+    fTimBinPlane[iPlane] = -1;
+    maxcharge[iPlane]    = 0.;
+    for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
       fdEdxPlane[iPlane][iSlice] = 0.;
       nCluster[iPlane][iSlice]   = 0;
     }
   }
 
-       // start looping over clusters attached to this track
-       for (Int_t iClus = 0; iClus < GetNumberOfClusters(); iClus++) {
+  // Start looping over clusters attached to this track
+  for (Int_t iClus = 0; iClus < GetNumberOfClusters(); iClus++) {
+
     cluster = fClusters[iClus]; //(AliTRDcluster*)tracker->GetCluster(fIndex[iClus]);
     if(!cluster) continue;
 
-               // Read info from current cluster
-               plane  = AliTRDgeometry::GetPlane(cluster->GetDetector());
+    // Read info from current cluster
+    plane  = AliTRDgeometry::GetPlane(cluster->GetDetector());
     if (plane < 0 || plane >= AliESDtrack::kNPlane) {
       AliError(Form("Wrong plane %d", plane));
       continue;
     }
 
-               tb     = cluster->GetLocalTimeBin();
-    if(tb == 0 || tb >= ntb){
-                       AliWarning(Form("time bin 0 or > %d in cluster %d", ntb, iClus));
-                       AliInfo(Form("dQ/dl %f", fdQdl[iClus]));
-                       continue;
-               }
+    tb     = cluster->GetLocalTimeBin();
+    if ((tb == 0) || (tb >= ntb)) {
+      AliWarning(Form("time bin 0 or > %d in cluster %d", ntb, iClus));
+      AliInfo(Form("dQ/dl %f", fdQdl[iClus]));
+      continue;
+    }
        
-    slice   = tb * AliESDtrack::kNSlice / ntb;
-    
-               fdEdxPlane[plane][slice] += fdQdl[iClus];
-    if(fdQdl[iClus] > maxcharge[plane]) {
-      maxcharge[plane] = fdQdl[iClus];
+    slice = tb * AliESDtrack::kNSlice / ntb;
+
+    fdEdxPlane[plane][slice] += fdQdl[iClus];
+    if (fdQdl[iClus] > maxcharge[plane]) {
+      maxcharge[plane]    = fdQdl[iClus];
       fTimBinPlane[plane] = tb;
     }
-    nCluster[plane][slice]++;
-  } // End of loop over cluster
 
+    nCluster[plane][slice]++;
 
+  } // End of loop over cluster
        
   // Normalize fdEdxPlane to number of clusters and set track segments
   for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
     for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
-      if (nCluster[iPlane][iSlice]) fdEdxPlane[iPlane][iSlice] /= nCluster[iPlane][iSlice];
+      if (nCluster[iPlane][iSlice]) {
+        fdEdxPlane[iPlane][iSlice] /= nCluster[iPlane][iSlice];
+      }
     }
-       }
-}
+  }
 
+}
 
 //_____________________________________________________________________________
 void   AliTRDtrack::SetTrackSegmentDirMom(const Int_t plane)
 {
-       if(plane<0 || plane>= kNplane){
-               AliError(Form("Trying to access out of range plane (%d)", plane));
-               return;
-       }
+  //
+  // Set the momenta for a track segment in a given plane
+  //
+
+  if ((plane <       0) || 
+      (plane>= kNplane)) {
+    AliError(Form("Trying to access out of range plane (%d)", plane));
+    return;
+  }
        
-       fSnp[plane] = GetSnp();
-       fTgl[plane] = GetTgl();
-       Double_t p[3]; GetPxPyPz(p);
-       fMom[plane] = TMath::Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
+  fSnp[plane] = GetSnp();
+  fTgl[plane] = GetTgl();
+  Double_t p[3]; 
+  GetPxPyPz(p);
+  fMom[plane] = TMath::Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
+
 }
 
 //_____________________________________________________________________________
 Float_t        AliTRDtrack::GetTrackLengthPlane(Int_t plane) const
 {
-       if(plane < 0 || plane >= kNplane) return 0.;
-  return (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())/TMath::Sqrt((1.
-- fSnp[plane]*fSnp[plane]) / (1. + fTgl[plane]*fTgl[plane]));
+  //
+  // Calculate the track length of a track segment in a given plane
+  //
 
-}
+  if ((plane < 0) || (plane >= kNplane)) return 0.;
 
+  return (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())
+        / TMath::Sqrt((1.0 - fSnp[plane]*fSnp[plane]) 
+                    / (1.0 + fTgl[plane]*fTgl[plane]));
+
+}
 
 //_____________________________________________________________________________
 Int_t AliTRDtrack::CookPID(AliESDtrack *esd)
@@ -583,13 +593,13 @@ Int_t AliTRDtrack::CookPID(AliESDtrack *esd)
   //
   // Author
   // Alex Bercuci (A.Bercuci@gsi.de) 2nd May 2007
+  //
 
-
-       AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
-       if (!calibration) {
-               AliError("No access to calibration data");
-               return -1;
-       }
+  AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
+  if (!calibration) {
+    AliError("No access to calibration data");
+    return -1;
+  }
        
        // Retrieve the CDB container class with the probability distributions
        const AliTRDCalPID *pd = calibration->GetPIDLQObject();
@@ -647,8 +657,6 @@ Int_t AliTRDtrack::CookPID(AliESDtrack *esd)
        return 0;
 }
 
-
-
 //_____________________________________________________________________________
 Bool_t AliTRDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
 {
@@ -758,25 +766,25 @@ Bool_t AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq, Int_t index
   //Double_t cov[3] = {c->GetSigmaY2()+errang, 0.0, c->GetSigmaZ2()*100.0 };
   Double_t sy2    = c->GetSigmaY2() * 4.0;
   Double_t sz2    = c->GetSigmaZ2() * 4.0;
-  Double_t cov[3] = {sy2 + h01*h01*sz2, h01*(sy2-sz2), sz2 + h01*h01*sy2 };
+  Double_t cov[3] = { sy2 + h01*h01*sz2, h01*(sy2-sz2), sz2 + h01*h01*sy2 };
 
   if (!AliExternalTrackParam::Update(p,cov)) {
     return kFALSE;
   }
 
-  Int_t n = GetNumberOfClusters();
+  Int_t n   = GetNumberOfClusters();
   fIndex[n] = index;
   SetNumberOfClusters(n+1);
-       
-       
+
   SetChi2(GetChi2()+chisq);
 
-  return kTRUE;     
+  return kTRUE;
 
 }        
 
 //_____________________________________________________________________________
-Int_t AliTRDtrack::UpdateMI(AliTRDcluster *c, Double_t chisq, Int_t index, Double_t h01, Int_t /*plane*/)
+Int_t AliTRDtrack::UpdateMI(AliTRDcluster *c, Double_t chisq, Int_t index
+                          , Double_t h01, Int_t /*plane*/)
 {
   //
   // Assignes found cluster to the track and updates track information
@@ -844,16 +852,15 @@ Int_t AliTRDtrack::UpdateMI(AliTRDcluster *c, Double_t chisq, Int_t index, Doubl
     return kFALSE;
   }
 
-       // Register cluster to track
-  Int_t n = GetNumberOfClusters();
-  fIndex[n] = index;
-       fClusters[n] = c; // A.Bercuci 25.07.07
+  // Register cluster to track
+  Int_t n      = GetNumberOfClusters();
+  fIndex[n]    = index;
+  fClusters[n] = c;
   SetNumberOfClusters(n+1);
   SetChi2(GetChi2() + chisq);
 
   return kTRUE;
 
-
 }                     
 
 // //_____________________________________________________________________________
@@ -1086,7 +1093,8 @@ Int_t AliTRDtrack::PropagateToX(Double_t xr, Double_t step)
 {
   //
   // Propagate track to given x  position 
-  // Works inside of the 20 degree segmentation (local cooordinate frame for TRD , TPC, TOF)
+  // Works inside of the 20 degree segmentation
+  // (local cooordinate frame for TRD , TPC, TOF)
   // 
   // Material budget from geo manager
   // 
@@ -1100,7 +1108,7 @@ Int_t AliTRDtrack::PropagateToX(Double_t xr, Double_t step)
   const Double_t kTalphac = TMath::Tan(kAlphac*0.5);
 
   // Critical alpha  - cross sector indication
-  Double_t dir = (GetX()>xr) ? -1.0 : 1.0;
+  Double_t dir = (GetX() > xr) ? -1.0 : 1.0;
 
   // Direction +-
   for (Double_t x = GetX()+dir*step; dir*x < dir*xr; x += dir*step) {
@@ -1148,7 +1156,7 @@ Int_t   AliTRDtrack::PropagateToR(Double_t r,Double_t step)
 
   Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
   // Direction +-
-  Double_t dir    = (radius>r) ? -1.0 : 1.0;   
+  Double_t dir    = (radius > r) ? -1.0 : 1.0;   
 
   for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) {
 
@@ -1197,7 +1205,7 @@ Int_t AliTRDtrack::GetSector() const
   //
 
   return Int_t(TVector2::Phi_0_2pi(GetAlpha()) / AliTRDgeometry::GetAlpha())
-         % AliTRDgeometry::kNsect;
+             % AliTRDgeometry::kNsect;
 
 }
 
index c258d16..f2dabe0 100644 (file)
@@ -330,156 +330,6 @@ Int_t  AliTRDtracker::GlobalToLocalID(Int_t gid)
 }
 
 //_____________________________________________________________________________
-Bool_t  AliTRDtracker::Transform(AliTRDcluster *cluster)
-{
-  //
-  // Transform from cluster system to tracking system
-  //
-
-  // Magic constants for geo manager transformation
-  const Double_t kX0shift  = 2.52;
-
-  //
-  // Apply alignment and calibration to transform cluster
-  //
-  Int_t detector = cluster->GetDetector();
-  Int_t plane    = fGeom->GetPlane(cluster->GetDetector());
-  Int_t chamber  = fGeom->GetChamber(cluster->GetDetector());
-  Int_t sector   = fGeom->GetSector(cluster->GetDetector());
-
-  Double_t dxAmp  = (Double_t) fGeom->CamHght();               // Amplification region
-  Double_t driftX = TMath::Max(cluster->GetX()-dxAmp*0.5,0.0); // Drift distance
-
-  //
-  // ExB correction
-  //
-  Double_t vdrift = AliTRDcalibDB::Instance()->GetVdrift(cluster->GetDetector(),0,0);
-  Double_t exB    = AliTRDcalibDB::Instance()->GetOmegaTau(vdrift,-AliTracker::GetBz()*0.1);
-
-  AliTRDpadPlane    *padPlane    = fGeom->GetPadPlane(plane,chamber);
-  Double_t zshiftIdeal = 0.5*(padPlane->GetRow0()+padPlane->GetRowEnd());
-  Double_t localPos[3];
-  Double_t localPosTracker[3];
-  localPos[0] = -cluster->GetX();
-  localPos[1] =  cluster->GetY() - driftX * exB;
-  localPos[2] =  cluster->GetZ() - zshiftIdeal;
-
-  cluster->SetY(cluster->GetY() - driftX*exB);
-  Double_t xplane = (Double_t) AliTRDgeometry::GetTime0(plane); 
-  cluster->SetX(xplane - cluster->GetX());
-
-  TGeoHMatrix *matrix = fGeom->GetCorrectionMatrix(cluster->GetDetector());
-  if (!matrix) {
-    // No matrix found - if somebody used geometry with holes
-    AliError("Invalid Geometry - Default Geometry used\n");
-    return kTRUE;   
-  }
-  matrix->LocalToMaster(localPos,localPosTracker);  
-
-  if (AliTRDReconstructor::StreamLevel() > 1) {
-    (* fDebugStreamer) << "Transform"
-                       << "Cl.="      << cluster
-                       << "matrix.="  << matrix
-                       << "Detector=" << detector
-                       << "Sector="   << sector
-                       << "Plane="    << plane
-                       << "Chamber="  << chamber
-                       << "lx0="      << localPosTracker[0]
-                       << "ly0="      << localPosTracker[1]
-                       << "lz0="      << localPosTracker[2]
-                       << "\n";
-  }
-
-  cluster->SetX(localPosTracker[0]+kX0shift);
-  cluster->SetY(localPosTracker[1]);
-  cluster->SetZ(localPosTracker[2]);
-
-  return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-// Bool_t  AliTRDtracker::Transform(AliTRDcluster *cluster)
-//{
-//   //
-//   // Is this still needed ????
-//   //
-//   const Double_t kDriftCorrection  = 1.01;                 // drift coeficient correction
-//   const Double_t kTime0Cor         = 0.32;                 // time0 correction
-//   //
-//   const Double_t kX0shift           = 2.52; 
-//   const Double_t kX0shift5          = 3.05; 
-
-//   //
-//   // apply alignment and calibration to transform cluster
-//   //
-//   //
-//   Int_t detector = cluster->GetDetector();
-//   Int_t plane   = fGeom->GetPlane(cluster->GetDetector());
-//   Int_t chamber = fGeom->GetChamber(cluster->GetDetector());
-//   Int_t sector  = fGeom->GetSector(cluster->GetDetector());
-
-//   Double_t dxAmp  = (Double_t) fGeom->CamHght();          // Amplification region
-//   Double_t driftX = TMath::Max(cluster->GetX()-dxAmp*0.5,0.);  // drift distance
-//   //
-//   // ExB correction
-//   //
-//   Double_t vdrift = AliTRDcalibDB::Instance()->GetVdrift(cluster->GetDetector(),0,0);
-//   Double_t exB =   AliTRDcalibDB::Instance()->GetOmegaTau(vdrift,-AliTracker::GetBz()*0.1);
-//   //
-
-//   AliTRDCommonParam* commonParam = AliTRDCommonParam::Instance();  
-//   AliTRDpadPlane * padPlane = commonParam->GetPadPlane(plane,chamber);
-//   Double_t zshiftIdeal  = 0.5*(padPlane->GetRow0()+padPlane->GetRowEnd());
-//   Double_t localPos[3], globalPos[3], localPosTracker[3], localPosTracker2[3];
-//   localPos[2] = -cluster->GetX();
-//   localPos[0] =  cluster->GetY() - driftX*exB;
-//   localPos[1] =  cluster->GetZ() -zshiftIdeal;
-//   TGeoHMatrix * matrix =  fGeom->GetGeoMatrix(cluster->GetDetector());
-//   matrix->LocalToMaster(localPos, globalPos);
-  
-//   Double_t sectorAngle = 20.*(sector%18)+10;
-//   TGeoHMatrix  rotSector;
-//   rotSector.RotateZ(sectorAngle);
-//   rotSector.LocalToMaster(globalPos, localPosTracker);
-//   //
-//   //
-//   TGeoHMatrix  matrix2(*matrix);
-//   matrix2.MultiplyLeft(&rotSector);
-//   matrix2.LocalToMaster(localPos,localPosTracker2);
-//   //
-//   //
-//   //
-//   cluster->SetY(cluster->GetY() - driftX*exB);
-//   Double_t xplane = (Double_t) AliTRDgeometry::GetTime0(plane); 
-//   cluster->SetX(xplane- kDriftCorrection*(cluster->GetX()-kTime0Cor));
-//   (*fDebugStreamer)<<"Transform"<<
-//     "Cl.="<<cluster<<
-//     "matrix.="<<matrix<<
-//     "matrix2.="<<&matrix2<<
-//     "Detector="<<detector<<
-//     "Sector="<<sector<<
-//     "Plane="<<plane<<
-//     "Chamber="<<chamber<<
-//     "lx0="<<localPosTracker[0]<<
-//     "ly0="<<localPosTracker[1]<<
-//     "lz0="<<localPosTracker[2]<<
-//     "lx2="<<localPosTracker2[0]<<
-//     "ly2="<<localPosTracker2[1]<<
-//     "lz2="<<localPosTracker2[2]<<
-//     "\n";
-//   //
-//   if (plane==5)
-//      cluster->SetX(localPosTracker[0]+kX0shift5);
-//   else
-//     cluster->SetX(localPosTracker[0]+kX0shift);
-    
-//   cluster->SetY(localPosTracker[1]);
-//   cluster->SetZ(localPosTracker[2]);
-//   return kTRUE;
-// }
-
-//_____________________________________________________________________________
 Bool_t AliTRDtracker::AdjustSector(AliTRDtrack *track) 
 {
   //
@@ -1463,13 +1313,12 @@ Int_t AliTRDtracker::LoadClusters(TTree *cTree)
     Int_t plane          = fGeom->GetPlane(detector);
     Int_t trackingSector = sector;
 
-    //if (c->GetLabel(0) > 0) {
     if (c->GetQ() > 10) {
       Int_t chamber = fGeom->GetChamber(detector);
       fHoles[chamber][trackingSector] = kFALSE;
     }
 
-    Int_t gtb = fTrSec[trackingSector]->CookTimeBinIndex(plane,localTimeBin);
+    Int_t gtb   = fTrSec[trackingSector]->CookTimeBinIndex(plane,localTimeBin);
     if (gtb < 0) {
       continue; 
     }
@@ -1477,12 +1326,11 @@ Int_t AliTRDtracker::LoadClusters(TTree *cTree)
 
     index = ncl;
 
-    // Apply pos correction
-    Transform(c);  
     fHXCl->Fill(c->GetX());
 
     fTrSec[trackingSector]->GetLayer(layer)->SetX(c->GetX());
     fTrSec[trackingSector]->GetLayer(layer)->InsertCluster(c,index);
+
   }
 
   return 0;
index 89a0fba..0d40e8d 100644 (file)
@@ -54,7 +54,6 @@ class AliTRDtracker : public AliTracker {
 
   TH2D *fHMinD;
   TH1D *fHDeltaX;
-
   TH1D *fHXCl;
 
   void InitLogHists();
@@ -63,53 +62,53 @@ class AliTRDtracker : public AliTracker {
  public:
 
   enum { kMaxLayersPerSector   = 1000
-        , kMaxTimeBinIndex      = 216
-        , kMaxClusterPerTimeBin = 2300
-        , kZones                = 5
-        , kTrackingSectors      = 18   };
+       , kMaxTimeBinIndex      = 216
+       , kMaxClusterPerTimeBin = 2300
+       , kZones                = 5
+       , kTrackingSectors      = 18   };
   
   AliTRDtracker();
   AliTRDtracker(const AliTRDtracker &t);
   AliTRDtracker(const TFile *in);
   virtual         ~AliTRDtracker(); 
-  AliTRDtracker   &operator=(const AliTRDtracker &/*t*/)  { return *this;                 } 
+  AliTRDtracker   &operator=(const AliTRDtracker &/*t*/) { return *this;          } 
   
-  void     SetAddTRDseeds()                       { fAddTRDseeds = kTRUE;         }
-  void     SetNoTilt()                            { fNoTilt      = kTRUE;         }
+  void             SetAddTRDseeds()               { fAddTRDseeds = kTRUE;         }
+  void             SetNoTilt()                    { fNoTilt      = kTRUE;         }
   
-  Int_t    GetTimeBinsPerPlane() const            { return fTimeBinsPerPlane;     }   
-  Double_t GetMaxChi2() const                     { return fgkMaxChi2;            }
-  Float_t  GetLabelFraction() const               { return fgkLabelFraction;      }
-  Float_t  GetMinClustersInTrack() const          { return fgkMinClustersInTrack; }
-  Int_t    GetLastPlane(AliTRDtrack *track);
-  Double_t GetTiltFactor(const AliTRDcluster *c);
-  Bool_t   GetTrackPoint(Int_t index, AliTrackPoint& p) const;
-  Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
-  Double_t GetX(Int_t sec, Int_t pl) const        { return fTrSec[sec]->GetLayer(pl)->GetX();            }
-  Int_t    GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const 
-    { return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
-  Double_t GetLayerNumber(Int_t sec, Double_t x) const 
-    { return fTrSec[sec]->GetLayerNumber(x);               }
-  AliCluster    *GetCluster(Int_t index) const    { if (index >= fNclusters) return NULL; 
-  return (AliCluster *) fClusters->UncheckedAt(index); }
+  Int_t            GetTimeBinsPerPlane() const    { return fTimeBinsPerPlane;     }   
+  Double_t         GetMaxChi2() const             { return fgkMaxChi2;            }
+  Float_t          GetLabelFraction() const       { return fgkLabelFraction;      }
+  Float_t          GetMinClustersInTrack() const  { return fgkMinClustersInTrack; }
+  Int_t            GetLastPlane(AliTRDtrack *track);
+  Double_t         GetTiltFactor(const AliTRDcluster *c);
+  Bool_t           GetTrackPoint(Int_t index, AliTrackPoint& p) const;
+  Double_t         GetX(Int_t sec, Int_t plane, Int_t localTB) const;
+  Double_t         GetX(Int_t sec, Int_t pl) const
+                                                  { return fTrSec[sec]->GetLayer(pl)->GetX();            }
+  Int_t            GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const 
+                                                  { return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
+  Double_t         GetLayerNumber(Int_t sec, Double_t x) const 
+                                                  { return fTrSec[sec]->GetLayerNumber(x);               }
+  AliCluster      *GetCluster(Int_t index) const  { if (index >= fNclusters) return NULL; 
+                                                    return (AliCluster *) fClusters->UncheckedAt(index); }
   
-  static  Int_t    Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);    
-  Int_t    Clusters2Tracks(AliESDEvent *event);
-  Int_t    PropagateBack(AliESDEvent *event);
-  Int_t    RefitInward(AliESDEvent *event);
+  static Int_t     Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);    
+  Int_t            Clusters2Tracks(AliESDEvent *event);
+  Int_t            PropagateBack(AliESDEvent *event);
+  Int_t            RefitInward(AliESDEvent *event);
   
   virtual void     CookLabel(AliKalmanTrack *t, Float_t wrong) const;
   
-  Int_t    LocalToGlobalID(Int_t lid);
-  Int_t    GlobalToLocalID(Int_t gid);
-  Bool_t   Transform(AliTRDcluster *cluster);
+  Int_t            LocalToGlobalID(Int_t lid);
+  Int_t            GlobalToLocalID(Int_t gid);
   
-  Int_t    LoadClusters(TTree *cTree);
-  void     UnloadClusters();
+  Int_t            LoadClusters(TTree *cTree);
+  void             UnloadClusters();
   virtual void     UseClusters(const AliKalmanTrack *t, Int_t from = 0) const;  
-  Int_t    ReadClusters(TObjArray *array, TTree *in) const;
-  AliTRDcluster *GetCluster(AliTRDtrack *track, Int_t plane, Int_t timebin, UInt_t &index);
-  Int_t    FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack *track
+  Int_t            ReadClusters(TObjArray *array, TTree *in) const;
+  AliTRDcluster   *GetCluster(AliTRDtrack *track, Int_t plane, Int_t timebin, UInt_t &index);
+  Int_t            FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack *track
                               , Int_t *clusters, AliTRDtracklet &tracklet);
   
  protected:
@@ -119,34 +118,29 @@ class AliTRDtracker : public AliTracker {
   public: 
     
     AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho
-                          , Double_t x0, Int_t tbIndex, Int_t plane); 
+                        , Double_t x0, Int_t tbIndex, Int_t plane); 
     AliTRDpropagationLayer(const AliTRDpropagationLayer &/*p*/);
-    ~AliTRDpropagationLayer() { 
-      if (fTimeBinIndex >= 0) { 
-       delete[] fClusters; 
-       delete[] fIndex; 
-      }     
-    }
+    ~AliTRDpropagationLayer() {  if (fTimeBinIndex >= 0) { 
+                                   delete[] fClusters; 
+                                  delete[] fIndex; 
+                                 } 
+                               }
     AliTRDpropagationLayer &operator=(const AliTRDpropagationLayer &/*p*/) 
-      {return *this;}
+                                                              { return *this; }
 
-    operator Int_t() const {return fN;}
+    operator Int_t() const                                    { return fN;    }
     AliTRDcluster  *operator[](Int_t i) {return fClusters[i];}
     
-    void SetZmax(Int_t cham, Double_t center, Double_t w) { 
-      fZc[cham] = center;  
-      fZmax[cham]    = w; 
-    }
-    void SetYmax(Double_t w, Double_t wsensitive) {
-      fYmax          = w;
-      fYmaxSensitive = wsensitive;
-    }
+    void     SetZmax(Int_t cham, Double_t center, Double_t w) { fZc[cham]      = center; 
+                                                                fZmax[cham]    = w;           }
+    void     SetYmax(Double_t w, Double_t wsensitive)         { fYmax          = w;
+                                                                fYmaxSensitive = wsensitive;  }
 
-    void SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
-    void SetHoles(Bool_t* holes);
-    void SetHole(Double_t Zmax, Double_t Ymax
-                , Double_t rho = 1.29e-3, Double_t x0 = 36.66
-                , Double_t Yc = 0.0, Double_t Zc = 0.0);
+    void     SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
+    void     SetHoles(Bool_t* holes);
+    void     SetHole(Double_t Zmax, Double_t Ymax
+                  , Double_t rho = 1.29e-3, Double_t x0 = 36.66
+                  , Double_t Yc = 0.0, Double_t Zc = 0.0);
     
     Double_t GetYmax() const           { return fYmax;                  }
     Double_t GetZmax(Int_t c) const    { return fZmax[c];               }
@@ -168,7 +162,7 @@ class AliTRDtracker : public AliTracker {
     Int_t    Find(Float_t y) const; 
     Int_t    FindNearestCluster(Float_t y, Float_t z, Float_t maxroad, Float_t maxroadz) const;
  
-    void SetX(Double_t x) {fX = x;}
+    void     SetX(Double_t x)          { fX = x; }
 
     
   private:     
index 356dd08..64022b3 100644 (file)
@@ -424,7 +424,7 @@ void  AliTRDtrackingAnalysis::DrawRecPointResolution(int startEvent, int stopEve
 
        AliTRDcluster *cls = (AliTRDcluster*)module->At(j);
        if (cls->GetQ() < 10) continue;
-       fTracker->Transform(cls);
+       //fTracker->Transform(cls);
        fClPos->Fill(cls->GetZ(), cls->GetY());
                
        int plane = fGeo->GetPlane(cls->GetDetector());
diff --git a/TRD/AliTRDtransform.cxx b/TRD/AliTRDtransform.cxx
new file mode 100644 (file)
index 0000000..143136b
--- /dev/null
@@ -0,0 +1,332 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Transforms clusters into space points with calibrated positions       //
+//  defined in the local tracking system                                  //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include <TGeoMatrix.h>
+
+#include "AliLog.h"
+#include "AliTracker.h"
+#include "AliCodeTimer.h"
+
+#include "AliTRDtransform.h"
+#include "AliTRDcluster.h"
+#include "AliTRDgeometry.h"
+#include "AliTRDpadPlane.h"
+#include "AliTRDCommonParam.h"
+#include "AliTRDcalibDB.h"
+#include "Cal/AliTRDCalDet.h"
+#include "Cal/AliTRDCalROC.h"
+
+ClassImp(AliTRDtransform)
+
+//_____________________________________________________________________________
+//AliTRDtransform::AliTRDtransform()
+//  :AliTransform()
+AliTRDtransform::AliTRDtransform()
+  :TObject()
+  ,fGeo(0x0)
+  ,fDetector(0)
+  ,fParam(0x0)
+  ,fCalibration(0x0)
+  ,fCalVdriftROC(0x0)
+  ,fCalT0ROC(0x0)
+  ,fCalVdriftDet(0x0)
+  ,fCalT0Det(0x0)
+  ,fCalVdriftDetValue(0)
+  ,fCalT0DetValue(0)
+  ,fSamplingFrequency(0)
+  ,fPadPlane(0x0)
+  ,fZShiftIdeal(0)
+  ,fMatrix(0x0)
+{
+  //
+  // AliTRDtransform default constructor
+  //
+
+}
+
+//_____________________________________________________________________________
+//AliTRDtransform::AliTRDtransform(Int_t det)
+//  :AliTransform()
+AliTRDtransform::AliTRDtransform(Int_t det)
+  :TObject()
+  ,fGeo(0x0)
+  ,fDetector(0)
+  ,fParam(0x0)
+  ,fCalibration(0x0)
+  ,fCalVdriftROC(0x0)
+  ,fCalT0ROC(0x0)
+  ,fCalVdriftDet(0x0)
+  ,fCalT0Det(0x0)
+  ,fCalVdriftDetValue(0)
+  ,fCalT0DetValue(0)
+  ,fSamplingFrequency(0)
+  ,fPadPlane(0x0)
+  ,fZShiftIdeal(0)
+  ,fMatrix(0x0)
+{
+  //
+  // AliTRDtransform constructor for a given detector
+  //
+
+  fGeo               = new AliTRDgeometry();
+  fGeo->ReadGeoMatrices();
+
+  fParam             = AliTRDCommonParam::Instance();
+  if (!fParam) {
+    AliError("Could not get common parameters\n");
+  }
+  fSamplingFrequency = fParam->GetSamplingFrequency();
+
+  fCalibration       = AliTRDcalibDB::Instance();
+  if (!fCalibration) {
+    AliError("Cannot find calibration object");
+  }
+
+  // Get the calibration objects for the global calibration
+  fCalVdriftDet      = fCalibration->GetVdriftDet();
+  fCalT0Det          = fCalibration->GetT0Det();
+
+  SetDetector(det);
+
+}
+
+//_____________________________________________________________________________
+//AliTRDtransform::AliTRDtransform(const AliTRDtransform &t)
+//  :AliTransform(t)
+AliTRDtransform::AliTRDtransform(const AliTRDtransform &t)
+  :TObject(t)
+  ,fGeo(0x0)
+  ,fDetector(t.fDetector)
+  ,fParam(0x0)
+  ,fCalibration(0x0)
+  ,fCalVdriftROC(0x0)
+  ,fCalT0ROC(0x0)
+  ,fCalVdriftDet(0x0)
+  ,fCalT0Det(0x0)
+  ,fCalVdriftDetValue(0)
+  ,fCalT0DetValue(0)
+  ,fSamplingFrequency(0)
+  ,fPadPlane(0x0)
+  ,fZShiftIdeal(0)
+  ,fMatrix(0x0)
+{
+  //
+  // AliTRDtransform copy constructor
+  //
+
+  if (fGeo) {
+    delete fGeo;
+  }
+  fGeo               = new AliTRDgeometry();
+  fGeo->ReadGeoMatrices();
+
+  fParam             = AliTRDCommonParam::Instance();
+  if (!fParam) {
+    AliError("Could not get common parameters\n");
+  }
+  fSamplingFrequency = fParam->GetSamplingFrequency();
+
+  fCalibration = AliTRDcalibDB::Instance();
+  if (!fCalibration) {
+    AliError("Cannot find calibration object");
+  }
+  fCalVdriftDet      = fCalibration->GetVdriftDet();
+  fCalT0Det          = fCalibration->GetT0Det();
+
+}
+
+//_____________________________________________________________________________
+AliTRDtransform::~AliTRDtransform()
+{
+  //
+  // AliTRDtransform destructor
+  //
+
+  if (fGeo) {
+    delete fGeo;
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtransform::SetDetector(Int_t det)
+{
+  //
+  // Set to a new detector number and update the calibration objects
+  // and values accordingly
+  //
+
+  fDetector          = det;
+
+  // Get the calibration objects for the pad-by-pad calibration
+  fCalVdriftROC      = fCalibration->GetVdriftROC(det);
+  fCalT0ROC          = fCalibration->GetT0ROC(det);
+
+  // Get the detector wise defined calibration values
+  fCalVdriftDetValue = fCalVdriftDet->GetValue(det);
+  fCalT0DetValue     = fCalT0Det->GetValue(det);
+
+  // Shift needed to define Z-position relative to middle of chamber
+  Int_t pla          = fGeo->GetPlane(det);
+  Int_t cha          = fGeo->GetChamber(det);
+  fPadPlane          = fGeo->GetPadPlane(pla,cha);
+  fZShiftIdeal       = 0.5 * (fPadPlane->GetRow0() + fPadPlane->GetRowEnd());
+
+  // Get the current transformation matrix
+  fMatrix            = fGeo->GetCorrectionMatrix(det);
+  if (!fMatrix) {
+    AliError("No transformation matrix available\n");
+  }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtransform::Transform(Double_t *x, Int_t *i, UInt_t time
+                             , Int_t  /*coordinateType*/)
+{
+  //
+  // Transforms the local cluster coordinates into calibrated 
+  // space point positions defined in the local tracking system.
+  //
+  // Here the calibration for T0, Vdrift and ExB is applied as well.
+  //
+  // Input:
+  //   x[0] = COL-position relative to the center pad (pad units)
+  //   x[1] = cluster signal in left pad
+  //   x[2] = cluster signal in middle pad
+  //   x[3] = cluster signal in right pad
+  //   i[0] = ROW pad number
+  //   i[1] = COL pad number
+  //   time = time bin number (uncalibrated for t0)
+  //
+  // Output:
+  //   x[0] = X-positions in tracking CS
+  //   x[1] = Y-positions in tracking CS
+  //   x[2] = Z-positions in tracking CS
+  //   x[3] = total cluster charge
+  //   x[4] = error in Y-direction
+  //   x[5] = error in Z-direction
+  //   i[2] = time bin number (calibrated for t0)
+  //
+
+  Double_t posLocal[3];
+  Double_t posTracking[3];
+
+  Int_t row = i[0];
+  Int_t col = i[1];
+
+  // Parameter to adjust the X position
+  const Double_t kX0shift = 2.52;
+
+  // Calibration values
+  Double_t vdrift      = fCalVdriftDetValue * fCalVdriftROC->GetValue(col,row);
+  Double_t t0          = fCalT0DetValue     + fCalT0ROC->GetValue(col,row);
+
+  // T0 correction
+  Double_t timeT0Cal   = time - t0;
+  // Calculate the X-position,
+  Double_t xLocal      = (timeT0Cal + 0.5) / fSamplingFrequency * vdrift; 
+
+  // Length of the amplification region
+  Double_t ampLength   = (Double_t) AliTRDgeometry::CamHght();
+  // The drift distance
+  Double_t driftLength = TMath::Max(xLocal - 0.5*ampLength,0.0);
+  // ExB correction
+  Double_t exbCorr     = fCalibration->GetOmegaTau(vdrift
+                                                  ,-0.1*AliTracker::GetBz());
+
+  // Pad dimensions
+  Double_t rowSize     = fPadPlane->GetRowSize(row);
+  Double_t colSize     = fPadPlane->GetColSize(col);
+
+  // Invert the X-position,
+  // apply ExB correction to the Y-position
+  // and move to the Z-position relative to the middle of the chamber
+  posLocal[0] = -xLocal;
+  posLocal[1] =  (fPadPlane->GetColPos(col) - (x[0] + 0.5) * colSize) - driftLength * exbCorr;
+  posLocal[2] =  (fPadPlane->GetRowPos(row) -         0.5  * rowSize) - fZShiftIdeal;
+
+  // Go to tracking coordinates
+  fMatrix->LocalToMaster(posLocal,posTracking);
+
+  // The total charge of the cluster
+  Double_t q0             = x[1];
+  Double_t q1             = x[2];
+  Double_t q2             = x[3];
+  Double_t clusterCharge  = q0 + q1 + q2; 
+  Double_t clusterSigmaY2 = 0.0;
+  if (clusterCharge > 0.0) {
+    clusterSigmaY2 = (q1 * (q0 + q2) + 4.0 * q0 * q2)
+                  / (clusterCharge*clusterCharge);
+  }
+
+  // Output values
+  x[0] = posTracking[0] + kX0shift;
+  x[1] = posTracking[1];
+  x[2] = posTracking[2];
+  x[3] = clusterCharge;
+  x[4] = colSize*colSize * (clusterSigmaY2 + 1.0/12.0);
+  x[5] = rowSize*rowSize / 12.0;                                       
+  i[2] = TMath::Nint(timeT0Cal);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDtransform::Recalibrate(AliTRDcluster *c, Bool_t setDet)
+{
+  //
+  // Recalibrates the position of a given cluster
+  // If <setDet> is TRUE, the detector number is set for each cluster
+  // automatically. Otherwise, AliTRDtransform::SetDetector() has to
+  // be used.
+  //
+
+  if (setDet) {
+    SetDetector(c->GetDetector());
+  }
+
+  // Transform the local cluster coordinates into recalibrated 
+  // space point positions defined in the local tracking system.
+  // Here the calibration for T0, Vdrift and ExB is applied as well.
+  Double_t clusterXYZ[6];
+  clusterXYZ[0] = c->GetCenter();
+  clusterXYZ[1] = 0.0;
+  clusterXYZ[2] = 0.0;
+  clusterXYZ[3] = 0.0;
+  clusterXYZ[4] = 0.0;
+  clusterXYZ[5] = 0.0;
+  Int_t    clusterRCT[3];
+  clusterRCT[0] = c->GetPadRow();
+  clusterRCT[1] = c->GetPadCol();
+  clusterRCT[2] = 0;
+  Int_t time    = c->GetPadTime();
+  Transform(clusterXYZ,clusterRCT,((UInt_t) time),0);
+
+  // Set the recalibrated coordinates
+  c->SetX(clusterXYZ[0]);
+  c->SetY(clusterXYZ[1]);
+  c->SetZ(clusterXYZ[2]);
+  c->SetLocalTimeBin(((Char_t) clusterRCT[2]));
+
+}
diff --git a/TRD/AliTRDtransform.h b/TRD/AliTRDtransform.h
new file mode 100644 (file)
index 0000000..d2d158d
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef ALITRDTRANSFORM_H
+#define ALITRDTRANSFORM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////////////
+//                                                                        //
+//  Transforms clusters into space points with calibrated positions       //
+//  defined in the local tracking system                                  //
+//                                                                        //
+////////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+//#include "../TPC/AliTransform.h"
+
+class TGeoHMatrix;
+
+class AliTRDgeometry;
+class AliTRDcluster;
+class AliTRDCommonParam;
+class AliTRDcalibDB;
+class AliTRDCalROC;
+class AliTRDCalDet;
+class AliTRDpadPlane;
+
+//class AliTRDtransform : public AliTransform {
+class AliTRDtransform : public TObject {
+
+ public:
+
+  AliTRDtransform();
+  AliTRDtransform(Int_t det);
+  AliTRDtransform(const AliTRDtransform &t);
+  ~AliTRDtransform();
+  AliTRDtransform &operator=(const AliTRDtransform &t) { *(new(this) AliTRDtransform(t));
+                                                          return *this; }
+
+  virtual void     Transform(Double_t *x
+                           , Int_t    *i
+                           , UInt_t    time
+                           , Int_t     coordinateType);
+  virtual void     Recalibrate(AliTRDcluster *c, Bool_t setDet = kTRUE);
+
+          void     SetDetector(Int_t det);
+
+ protected:
+
+  AliTRDgeometry          *fGeo;                 //  TRD geometry
+  Int_t                    fDetector;            //  Detector number
+
+  AliTRDCommonParam       *fParam;               //  TRD common parameters
+
+        AliTRDcalibDB     *fCalibration;         //  TRD calibration interface object
+        AliTRDCalROC      *fCalVdriftROC;        //  Pad wise Vdrift calibration object
+        AliTRDCalROC      *fCalT0ROC;            //  Pad wise T0 calibration object
+  const AliTRDCalDet      *fCalVdriftDet;        //  ROC wise Vdrift calibration object
+  const AliTRDCalDet      *fCalT0Det;            //  ROC wise T0 calibration object
+  Double_t                 fCalVdriftDetValue;   //  ROC wise Vdrift calibration value
+  Double_t                 fCalT0DetValue;       //  ROC wise T0 calibration value
+
+  Double_t                 fSamplingFrequency;   //  ADC sampling frequency
+
+  AliTRDpadPlane          *fPadPlane;            //  The current pad plane object
+  Double_t                 fZShiftIdeal;         //  Needed to define Z-position relative to middle of chamber
+
+  TGeoHMatrix             *fMatrix;              //  Transformation matrix for a given chamber
+
+  ClassDef(AliTRDtransform,1)                    //  Transforms clusters
+
+};
+
+#endif
index 50238d3..c45041a 100644 (file)
 #pragma link C++ class  AliTRDclusterMI+;
 
 #pragma link C++ class  AliTRDclusterizer+;
-#pragma link C++ class  AliTRDclusterizerV1+;
 #pragma link C++ class  AliTRDclusterizerV2+;
 
 #pragma link C++ class  AliTRDclusterCorrection+;
 
+#pragma link C++ class  AliTRDtransform+;
+
 #pragma link C++ class  AliTRDtrack+;
 #pragma link C++ class  AliTRDtracklet+;
 #pragma link C++ class  AliTRDtracker+;
index 35fa0d5..230687f 100644 (file)
@@ -1,9 +1,9 @@
 SRCS= AliTRDcluster.cxx \
       AliTRDclusterMI.cxx \
       AliTRDclusterizer.cxx \
-      AliTRDclusterizerV1.cxx \
       AliTRDclusterizerV2.cxx \
       AliTRDclusterCorrection.cxx \
+      AliTRDtransform.cxx \
       AliTRDtracklet.cxx \
       AliTRDtrack.cxx \
       AliTRDtracker.cxx \