]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDRecParam.cxx
Bugfixes and clean-up of alignment object classes. Introduction of so called symbolic...
[u/mrichter/AliRoot.git] / TRD / AliTRDRecParam.cxx
index 07f4bf4c0bda8ba69e69ec4cd894e0f6a851adc4..053194ad4781830247689882a36a8603e77e4d69 100644 (file)
@@ -32,79 +32,101 @@ AliTRDRecParam* AliTRDRecParam::fgInstance = 0;
 Bool_t AliTRDRecParam::fgTerminated = kFALSE;
 
 //_ singleton implementation __________________________________________________
-AliTRDRecParam* AliTRDRecParam::Instance()
+AliTRDRecParam* AliTRDRecParam::Instance() 
 {
   //
   // Singleton implementation
   // Returns an instance of this class, it is created if neccessary
   // 
   
-  if (fgTerminated != kFALSE)
+  if (fgTerminated != kFALSE) {
     return 0;
+  }
 
-  if (fgInstance == 0)
+  if (fgInstance == 0) {
     fgInstance = new AliTRDRecParam();
-  
+  }  
+
   return fgInstance;
+
 }
 
+//_____________________________________________________________________________
 void AliTRDRecParam::Terminate()
 {
   //
   // Singleton implementation
-  // Deletes the instance of this class and sets the terminated flag, instances cannot be requested anymore
+  // Deletes the instance of this class and sets the terminated flag,
+  // instances cannot be requested anymore
   // This function can be called several times.
   //
   
   fgTerminated = kTRUE;
   
-  if (fgInstance != 0)
-  {
+  if (fgInstance != 0) {
     delete fgInstance;
     fgInstance = 0;
   }
+
 }
 
 //_____________________________________________________________________________
 AliTRDRecParam::AliTRDRecParam()
+  :TObject()
+  ,fClusMaxThresh(0)
+  ,fClusSigThresh(0)
+  ,fLUTOn(kFALSE)
+  ,fLUTbin(0)
+  ,fLUT(0)
+  ,fTCOn(kFALSE)
+  ,fTCnexp(0)
 {
   //
-  // constructor
+  // Constructor
   //
-  
-  fClusMaxThresh      = 0;
-  fClusSigThresh      = 0;
-  
-  fLUT                = 0;
-  fLUTOn              = kFALSE;  
-  fLUTbin = 0;
-  
+    
   Init();
+
 }
 
 //_____________________________________________________________________________
 AliTRDRecParam::~AliTRDRecParam() 
 {
   //
-  // destructor
+  // Destructor
   //
   
   if (fLUT) {
     delete [] fLUT;
-    fLUT    = 0;
+    fLUT = 0;
   }
+
 }
 
 //_____________________________________________________________________________
-AliTRDRecParam::AliTRDRecParam(const AliTRDRecParam &p):TObject(p)
+AliTRDRecParam::AliTRDRecParam(const AliTRDRecParam &p)
+  :TObject(p)
+  ,fClusMaxThresh(p.fClusMaxThresh)
+  ,fClusSigThresh(p.fClusSigThresh)
+  ,fLUTOn(p.fLUTOn)
+  ,fLUTbin(p.fLUTbin)
+  ,fLUT(0)
+  ,fTCOn(p.fTCOn)
+  ,fTCnexp(p.fTCnexp)
 {
   //
-  // copy constructor
+  // Copy constructor
   //
 
-  ((AliTRDRecParam &) p).Copy(*this);
-}
+  if (((AliTRDRecParam &) p).fLUT) {
+    delete [] ((AliTRDRecParam &) p).fLUT;
+  }
+  ((AliTRDRecParam &) p).fLUT = new Float_t[fLUTbin];
+  for (Int_t iBin = 0; iBin < fLUTbin; iBin++) {
+    ((AliTRDRecParam &) p).fLUT[iBin] = fLUT[iBin];
+  }                                                                             
 
+}
 
 //_____________________________________________________________________________
 AliTRDRecParam &AliTRDRecParam::operator=(const AliTRDRecParam &p)
@@ -114,7 +136,9 @@ AliTRDRecParam &AliTRDRecParam::operator=(const AliTRDRecParam &p)
   //
 
   if (this != &p) ((AliTRDRecParam &) p).Copy(*this);
+
   return *this;
+
 }
 
 //_____________________________________________________________________________
@@ -125,38 +149,52 @@ void AliTRDRecParam::Copy(TObject &p) const
   //
   
   AliTRDRecParam* target = dynamic_cast<AliTRDRecParam*> (&p);
-  if (!target)
+  if (!target) {
     return;
+  }  
+
+  target->fLUTOn         = fLUTOn;
+  target->fLUTbin        = fLUTbin;
+      
+  target->fClusMaxThresh = fClusMaxThresh;
+  target->fClusSigThresh = fClusSigThresh;
   
-  target->fLUTOn              = fLUTOn;
-  target->fLUTbin             = fLUTbin;
-  if (target->fLUT)    delete [] target->fLUT;
-  target->fLUT  = new Float_t[fLUTbin];
+  target->fTCOn          = fTCOn;
+  target->fTCnexp        = fTCnexp;
+
+  if (target->fLUT) {
+    delete [] target->fLUT;
+  }
+  target->fLUT = new Float_t[fLUTbin];
   for (Int_t iBin = 0; iBin < fLUTbin; iBin++) {
-    target->fLUT[iBin]  = fLUT[iBin];
+    target->fLUT[iBin] = fLUT[iBin];
   }
-      
-  target->fClusMaxThresh      = fClusMaxThresh;
-  target->fClusSigThresh      = fClusSigThresh;
-  
+
 }
 
 //_____________________________________________________________________________
 void AliTRDRecParam::Init() 
 {
   //
-  // constructor helper
+  // Constructor helper
   //
   
   // The default parameter for the clustering
-  fClusMaxThresh = 3;
-  fClusSigThresh = 1;
+  fClusMaxThresh = 3.5;
+  fClusSigThresh = 1.5;
 
   // Use the LUT
   fLUTOn         = kTRUE;
 
   // Create the LUT
   FillLUT();
+
+  // The tail cancelation
+  fTCOn          = kTRUE;
+
+  // The number of exponentials
+  fTCnexp        = 1;
+
 }
 
 //_____________________________________________________________________________
@@ -166,7 +204,7 @@ void AliTRDRecParam::FillLUT()
   // Create the LUT
   //
 
-  const Int_t kNlut  = 128;
+  const Int_t kNlut = 128;
 
   fLUTbin = kNplan * kNlut;
 
@@ -282,11 +320,13 @@ void AliTRDRecParam::FillLUT()
     }
   }; 
 
-  if (fLUT) delete [] fLUT;
+  if (fLUT) {
+    delete [] fLUT;
+  }
   fLUT = new Float_t[fLUTbin];
 
   for (Int_t iplan = 0; iplan < kNplan; iplan++) {
-    for (Int_t ilut  = 0; ilut  < kNlut; ilut++) {
+    for (Int_t ilut  = 0; ilut  <  kNlut; ilut++  ) {
       fLUT[iplan*kNlut+ilut] = lut[iplan][ilut];
     }
   }
@@ -294,17 +334,18 @@ void AliTRDRecParam::FillLUT()
 }
 
 //_____________________________________________________________________________
-Double_t AliTRDRecParam::LUTposition(Int_t iplane, Double_t ampL, Double_t ampC, Double_t ampR) const
+Double_t AliTRDRecParam::LUTposition(Int_t iplane, Double_t ampL
+                                  , Double_t ampC, Double_t ampR) const
 {
   //
   // Calculates the cluster position using the lookup table.
   // Method provided by Bogdan Vulpescu.
   //
 
-  const Int_t kNlut  = 128;
+  const Int_t kNlut = 128;
 
   Double_t pos;
-  Double_t x = 0.0;
+  Double_t x    = 0.0;
   Double_t xmin;
   Double_t xmax;
   Double_t xwid;
@@ -312,8 +353,10 @@ Double_t AliTRDRecParam::LUTposition(Int_t iplane, Double_t ampL, Double_t ampC,
   Int_t    side = 0;
   Int_t    ix;
 
-  Double_t xMin[kNplan] = { 0.006492, 0.006377, 0.006258, 0.006144, 0.006030, 0.005980 };
-  Double_t xMax[kNplan] = { 0.960351, 0.965870, 0.970445, 0.974352, 0.977667, 0.996101 };
+  Double_t xMin[kNplan] = { 0.006492, 0.006377, 0.006258
+                          , 0.006144, 0.006030, 0.005980 };
+  Double_t xMax[kNplan] = { 0.960351, 0.965870, 0.970445
+                          , 0.974352, 0.977667, 0.996101 };
 
   if      (ampL > ampR) {
     x    = (ampL - ampR) / ampC;
@@ -349,5 +392,5 @@ Double_t AliTRDRecParam::LUTposition(Int_t iplane, Double_t ampL, Double_t ampC,
   }
 
   return pos;
-}
 
+}