]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterFinderAZ.cxx
Additional protection in case of negative indexes. More investigation is needed
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderAZ.cxx
index 58f912bdd03f566868eb996fc7c6e8bd58a39144..1aaed48bdcef79b7424ec04b9a76dc6f8c068535 100644 (file)
@@ -28,7 +28,6 @@
 #include "AliMUONClusterDrawAZ.h"
 #include "AliMUONVGeometryDESegmentation.h"
 #include "AliMUONGeometryModuleTransformer.h"
-#include "AliHeader.h"
 #include "AliRun.h"
 #include "AliMUON.h"
 #include "AliMUONDigit.h"
@@ -110,7 +109,7 @@ void AliMUONClusterFinderAZ::FindRawClusters()
 // To provide the same interface as in AliMUONClusterFinderVS
 
   ResetRawClusters(); 
-  EventLoop (gAlice->GetHeader()->GetEvent(), fInput->Chamber());
+  EventLoop (gAlice->GetEvNumber(), fInput->Chamber());
 }
 
 //_____________________________________________________________________________
@@ -234,7 +233,7 @@ next:
     */
     for (Int_t i=0; i<nMax; i++) {
       if (nMax > 1) FindCluster(localMax, maxPos[i]);
-      if (!MainLoop(iSimple)) cout << " MainLoop failed " << endl;
+      if (!MainLoop(iSimple)) AliWarning(Form(" MainLoop failed "));
       if (i < nMax-1) {
        for (Int_t j=0; j<fnPads[0]+fnPads[1]; j++) {
          if (fPadIJ[1][j] == 0) continue; // pad charge was not modified
@@ -604,7 +603,10 @@ Bool_t AliMUONClusterFinderAZ::CheckPrecluster(Int_t *nShown)
     beg++;
   } // while
   npad = fnPads[0] + fnPads[1];
-  if (npad > 500) { cout << " ***** Too large cluster. Give up. " << npad << endl; return kFALSE; }
+  if (npad > 500) { 
+    AliWarning(Form(" *** Too large cluster. Give up. %d ", npad));
+    return kFALSE; 
+  }
   // Back up charge value
   for (Int_t j = 0; j < npad; j++) fXyq[6][j] = fXyq[2][j];
 
@@ -817,9 +819,8 @@ void AliMUONClusterFinderAZ::AdjustPixel(Float_t wxmin, Float_t wymin)
     if (fDebug) cout << " Different " << pixPtr->Size(0) << " " << wxy[0] << " "
                     << pixPtr->Size(1) << " " << wxy[1] <<endl;
     
-    //if (n2[0] > 2 || n2[1] > 2) { cout << n2[0] << " " << n2[1] << endl; AliFatal("Too large pixel.");}
     if (n2[0] > 2 || n2[1] > 2) { 
-      cout << n2[0] << " " << n2[1] << endl; 
+      //cout << n2[0] << " " << n2[1] << endl; 
       if (n2[0] > 2 && n1[0] < 999) n1[0]--;
       if (n2[1] > 2 && n1[1] < 999) n1[1]--;
     }
@@ -1560,7 +1561,7 @@ TObject* AliMUONClusterFinderAZ::BinToPix(TH2D *mlem, Int_t jc, Int_t ic)
     if (pixPtr->Charge() < 0.5) continue;
     if (TMath::Abs(pixPtr->Coord(0)-xc)<1.e-4 && TMath::Abs(pixPtr->Coord(1)-yc)<1.e-4) return (TObject*) pixPtr;
   }
-  AliWarning(Form(" Something wrong ??? %f %f %f %f", xc, yc));
+  AliError(Form(" Something wrong ??? %f %f ", xc, yc));
   return NULL;
 }
 
@@ -1933,7 +1934,8 @@ Int_t AliMUONClusterFinderAZ::Fit(Int_t iSimple, Int_t nfit, Int_t *clustFit, TO
   } //if (!iSimple && nfit < nfitMax)
   */
 
-  Double_t *gin = 0, func0, func1, param[8], param0[2][8], deriv[2][8], step0[8];
+  Double_t *gin = 0, func0, func1, param[8], step0[8];
+  Double_t param0[2][8]={{0},{0}}, deriv[2][8]={{0},{0}}; 
   Double_t shift[8], stepMax, derMax, parmin[8], parmax[8], func2[2], shift0;
   Double_t delta[8], scMax, dder[8], estim, shiftSave = 0;
   Int_t min, max, nCall = 0, memory[8] = {0}, nLoop, idMax = 0, iestMax = 0, nFail;
@@ -1978,7 +1980,7 @@ Int_t AliMUONClusterFinderAZ::Fit(Int_t iSimple, Int_t nfit, Int_t *clustFit, TO
        deriv[max][j] = (func1 - func0) / delta[j] * 10; // first derivative
        //cout << j << " " << deriv[max][j] << endl;
        dder[j] = param0[0][j] != param0[1][j] ? (deriv[0][j] - deriv[1][j]) / 
-                                                (param0[0][j] - param0[1][j]) : 0; // second derivative
+         (param0[0][j] - param0[1][j]) : 0; // second derivative
       }
       param[fNpar-1] -= delta[fNpar-1] / 10;
       if (nCall > 2000) break;
@@ -2551,6 +2553,7 @@ void AliMUONClusterFinderAZ::AddVirtualPad()
     if (maxpad[0][0] < 0) iPad = 1;
 
     for (iPad=0; iPad<2; iPad++) {
+      if (maxpad[cath][iPad] < 0) continue;
       if (iPad && !iAddX && !iAddY) break;
       if (iPad && fXyq[2][maxpad[cath][1]] / sigmax[cath] < 0.5) break;