]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCseed.cxx
further mem leak fix
[u/mrichter/AliRoot.git] / TPC / AliTPCseed.cxx
index a8d4909f0b6daecc86ce253da36c1a9222846f4a..f2ae14b588994c8ff04135a08d1ea7540bf8ae43 100644 (file)
@@ -1144,16 +1144,20 @@ Float_t  AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, I
   if (AliTPCcalibDB::Instance()->GetParameters()){
     gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000;  //relative gas gain
   }
-    //
-    // extract time-dependent correction for pressure and temperature variations
-    //
-    UInt_t runNumber = 1;
-    Float_t corrTimeGain = 1;
-    TObjArray * timeGainSplines = 0x0;
-    //
-    AliTPCTransform * trans = AliTPCcalibDB::Instance()->GetTransform();
-    const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam();
-    if (trans) {
+  //
+  // extract time-dependent correction for pressure and temperature variations
+  //
+  UInt_t runNumber = 1;
+  Float_t corrTimeGain = 1;
+  TObjArray * timeGainSplines = 0x0;
+  TGraphErrors * grPadEqual = 0x0;
+  //
+  AliTPCTransform * trans = AliTPCcalibDB::Instance()->GetTransform();
+  const AliTPCRecoParam * recoParam = AliTPCcalibDB::Instance()->GetTransform()->GetCurrentRecoParam();
+  //
+  if (recoParam->GetNeighborRowsDedx() == 0) rowThres = 0;
+  //
+  if (trans) {
       runNumber = trans->GetCurrentRunNumber();
       //AliTPCcalibDB::Instance()->SetRun(runNumber);
       timeGainSplines = AliTPCcalibDB::Instance()->GetTimeGainSplinesRun(runNumber);
@@ -1163,11 +1167,14 @@ Float_t  AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, I
        AliSplineFit * fitFPcosmic = (AliSplineFit *) timeGainSplines->At(1);
        if (fitMIP) {
          corrTimeGain =  AliTPCcalibDButil::EvalGraphConst(fitMIP, time); /*fitMIP->Eval(time);*/
-      } else {
+       } else {
          if (fitFPcosmic) corrTimeGain = AliTPCcalibDButil::EvalGraphConst(fitFPcosmic, time); /*fitFPcosmic->Eval(time); */
        }
+       //
+       if (type==1) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQMAX_PADREGIONGAIN_BEAM_ALL");
+       if (type==0) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQTOT_PADREGIONGAIN_BEAM_ALL");
       }
-    }   
+  }   
   
   const Float_t kClusterShapeCut = 1.5; // IMPPRTANT TO DO: move value to AliTPCRecoParam
   const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
@@ -1176,7 +1183,7 @@ Float_t  AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, I
   //
   for (Int_t irow=i1; irow<i2; irow++){
     AliTPCclusterMI* cluster = GetClusterPointer(irow);
-    if (!cluster) {
+    if (!cluster && irow > 1 && irow < 157) {
       Bool_t isClBefore = kFALSE;
       Bool_t isClAfter  = kFALSE;
       for(Int_t ithres = 1; ithres <= rowThres; ithres++) {
@@ -1186,8 +1193,8 @@ Float_t  AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, I
        if (clusterAfter) isClAfter = kTRUE;
       }
       if (isClBefore && isClAfter) nclBelowThr++;
-      continue;
     }
+    if (!cluster) continue;
     //
     //
     if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
@@ -1259,12 +1266,7 @@ Float_t  AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, I
     // pad region equalization outside of cluster param
     //
     Float_t gainEqualPadRegion = 1;
-    if (timeGainSplines) { //1 - max charge  or 0- total charge in cluster 
-      TGraphErrors * grPadEqual = 0x0;
-      if (type==1) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQMAX_PADREGIONGAIN_BEAM_ALL");
-      if (type==0) grPadEqual = (TGraphErrors * ) timeGainSplines->FindObject("TGRAPHERRORS_MEANQTOT_PADREGIONGAIN_BEAM_ALL");
-      if (grPadEqual) gainEqualPadRegion = grPadEqual->Eval(ipad);
-    }
+    if (grPadEqual) gainEqualPadRegion = grPadEqual->Eval(ipad);
     //
     amp[ncl]=charge;
     amp[ncl]/=gainGG;
@@ -1300,6 +1302,7 @@ Float_t  AliTPCseed::CookdEdxAnalytical(Double_t low, Double_t up, Int_t type, I
     suma2+=ampWithBelow[icl]*ampWithBelow[icl];
     sumn++;
   }
+  delete [] ampWithBelow;
   Float_t mean =suma/sumn;
   Float_t rms  =TMath::Sqrt(TMath::Abs(suma2/sumn-mean*mean));
   //