]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDpidLQ.cxx
1D removed, AliRICHParam as static
[u/mrichter/AliRoot.git] / TRD / AliTRDpidLQ.cxx
index b500c4e62f00d3098c7dd6d3c6c6a0f50795a88f..61a2e7f494ed224176d79ce101385f4017ef5336 100644 (file)
@@ -13,9 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -95,7 +93,7 @@ AliTRDpidLQ::AliTRDpidLQ(const char* name, const char* title)
 }
 
 //_____________________________________________________________________________
-AliTRDpidLQ::AliTRDpidLQ(const AliTRDpidLQ &p)
+AliTRDpidLQ::AliTRDpidLQ(const AliTRDpidLQ &p):AliTRDpid(p)
 {
   //
   // AliTRDpidLQ copy constructor
@@ -180,8 +178,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 +194,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 +233,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,6 +252,8 @@ Bool_t AliTRDpidLQ::AssignLikelihood(AliTRDtrack *t)
   // Assign the likelihoods 
   t->SetLikelihoodElectron(lhEl);
 
+  delete [] charge;
+  delete [] nCluster;
   return kTRUE;  
 
 }
@@ -302,7 +308,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 +344,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 +369,8 @@ Bool_t AliTRDpidLQ::FillSpectra(const AliTRDtrack *t)
     }
   }  
 
+  delete [] charge;
+  delete [] nCluster;
   return kTRUE;
 
 }
@@ -370,7 +382,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);