]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDpidLQ.cxx
Add pad gain correction + the x position 0 <-> time bin 0 - x increases TOWARDS inter...
[u/mrichter/AliRoot.git] / TRD / AliTRDpidLQ.cxx
index b500c4e62f00d3098c7dd6d3c6c6a0f50795a88f..c3e0f05b5313528dd7bda2ec3bb62ea3a8f6557b 100644 (file)
@@ -13,9 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -39,7 +37,6 @@ $Log$
 #include <TParticle.h>
 
 #include "AliRun.h"
-#include "AliTRD.h"
 #include "AliTRDpidLQ.h"
 #include "AliTRDcluster.h"
 #include "AliTRDtrack.h"
@@ -95,7 +92,7 @@ AliTRDpidLQ::AliTRDpidLQ(const char* name, const char* title)
 }
 
 //_____________________________________________________________________________
-AliTRDpidLQ::AliTRDpidLQ(const AliTRDpidLQ &p)
+AliTRDpidLQ::AliTRDpidLQ(const AliTRDpidLQ &p):AliTRDpid(p)
 {
   //
   // AliTRDpidLQ copy constructor
@@ -132,7 +129,7 @@ AliTRDpidLQ &AliTRDpidLQ::operator=(const AliTRDpidLQ &p)
 }
 
 //_____________________________________________________________________________
-void AliTRDpidLQ::Copy(TObject &p)
+void AliTRDpidLQ::Copy(TObject &p) const
 {
   //
   // Copy function
@@ -180,8 +177,8 @@ Bool_t AliTRDpidLQ::AssignLikelihood(AliTRDtrack *t)
   //
 
   const Int_t kNpla = AliTRDgeometry::Nplan();
-  Float_t charge[kNpla];
-  Int_t   nCluster[kNpla];
+  Float_t * charge = new Float_t[kNpla];
+  Int_t   * nCluster = new Int_t[kNpla];
 
   Float_t  lhPi = 0;
   Float_t  lhEl = 0;
@@ -196,7 +193,7 @@ Bool_t AliTRDpidLQ::AssignLikelihood(AliTRDtrack *t)
   TH1F   *hTmpPi;
 
   t->SetLikelihoodElectron(-1.);
-  if (isnan(t->GetP())) return kFALSE;
+  if (TMath::IsNaN(t->GetP())) return kFALSE;
   Float_t mom = t->GetP();
 
   // Calculate the total charge in each plane
@@ -235,11 +232,17 @@ Bool_t AliTRDpidLQ::AssignLikelihood(AliTRDtrack *t)
     }
   }
   else {
+    delete [] charge;
+    delete [] nCluster;
     return kTRUE;
   }
 
   pSum = pEl + pPi;
-  if (pSum <= 0) return kFALSE;
+  if (pSum <= 0) {
+    delete [] charge;
+    delete [] nCluster;
+    return kFALSE;
+  }
   lhEl = pEl / pSum;
   lhPi = pPi / pSum;
 
@@ -248,14 +251,14 @@ Bool_t AliTRDpidLQ::AssignLikelihood(AliTRDtrack *t)
   // Assign the likelihoods 
   t->SetLikelihoodElectron(lhEl);
 
+  delete [] charge;
+  delete [] nCluster;
   return kTRUE;  
 
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDpidLQ::CreateHistograms(const Int_t   nmom
-                                   , const Float_t minmom
-                                   , const Float_t maxmom)
+Bool_t AliTRDpidLQ::CreateHistograms(Int_t   nmom, Float_t minmom, Float_t maxmom)
 {
   //
   // Creates the histograms
@@ -302,7 +305,7 @@ Bool_t AliTRDpidLQ::CreateHistograms(const Int_t   nmom
 
 //   Bool_t status = kTRUE;
 
-//   if (isnan(t->GetP())) return kFALSE;
+//   if (TMath::IsNaN(t->GetP())) return kFALSE;
 
 //   Float_t        mom     = t->GetP();
 //   Int_t          ipid    = MCpid(t);
@@ -338,15 +341,19 @@ Bool_t AliTRDpidLQ::FillSpectra(const AliTRDtrack *t)
 
   const Int_t kNpla = AliTRDgeometry::Nplan();
 
-  if (isnan(t->GetP())) return kFALSE;
+  if (TMath::IsNaN(t->GetP())) return kFALSE;
 
-  Float_t charge[kNpla];
-  Int_t   nCluster[kNpla];
+  Float_t * charge = new Float_t[kNpla];
+  Int_t   * nCluster = new Int_t[kNpla];
   Float_t mom  = t->GetP();
   Int_t   ipid = MCpid(t);
   TH1F   *hTmp = NULL;
 
-  if (!SumCharge(t,charge,nCluster)) return kFALSE;
+  if (!SumCharge(t,charge,nCluster)) {
+    delete [] charge;
+    delete [] nCluster;
+    return kFALSE;
+  }
 
   Int_t index = GetIndex(mom,ipid);
   if (index > -1) {
@@ -359,6 +366,8 @@ Bool_t AliTRDpidLQ::FillSpectra(const AliTRDtrack *t)
     }
   }  
 
+  delete [] charge;
+  delete [] nCluster;
   return kTRUE;
 
 }
@@ -370,7 +379,7 @@ Int_t AliTRDpidLQ::GetIndex(const AliTRDtrack *t)
   // Returns the histogram index
   //
 
-  if (isnan(t->GetP())) return -1;
+  if (TMath::IsNaN(t->GetP())) return -1;
   Float_t mom  = t->GetP();
   Int_t   ipid = MCpid(t);
 
@@ -379,7 +388,7 @@ Int_t AliTRDpidLQ::GetIndex(const AliTRDtrack *t)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpidLQ::GetIndex(const Float_t mom, const Int_t ipid)
+Int_t AliTRDpidLQ::GetIndex(Float_t mom, Int_t ipid)
 {
   //
   // Returns the histogram index
@@ -392,7 +401,7 @@ Int_t AliTRDpidLQ::GetIndex(const Float_t mom, const Int_t ipid)
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDpidLQ::GetIndex(const Int_t imom, const Int_t ipid)
+Int_t AliTRDpidLQ::GetIndex(Int_t imom, Int_t ipid)
 {
   //
   // Returns the histogram index