]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterSplitterMLEM.cxx
Flexible pt range for the efficiency histogramming
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterSplitterMLEM.cxx
index 853de965ab0a88671ed5d57a45a9173bd3ae62d3..ee383022c16aa3c59a5011fd369ff3d4f1d55744 100644 (file)
@@ -48,6 +48,8 @@
 #include <TRandom.h>
 #include <Riostream.h>
 
+using std::endl;
+using std::cout;
 /// \cond CLASSIMP
 ClassImp(AliMUONClusterSplitterMLEM)
 /// \endcond
@@ -114,7 +116,7 @@ AliMUONClusterSplitterMLEM::AddBin(TH2 *mlem,
   
   Int_t nx = mlem->GetNbinsX();
   Int_t ny = mlem->GetNbinsY();
-  Double_t cont1, cont = mlem->GetCellContent(jc,ic);
+  Double_t cont1, cont = mlem->GetBinContent(mlem->GetBin(jc,ic));
   AliMUONPad *pixPtr = 0;
   
   Int_t ie = TMath::Min(ic+1,ny), je = TMath::Min(jc+1,nx);
@@ -122,7 +124,7 @@ AliMUONClusterSplitterMLEM::AddBin(TH2 *mlem,
     for (Int_t j = TMath::Max(jc-1,1); j <= je; ++j) {
       if (i != ic && j != jc) continue;
       if (used[(i-1)*nx+j-1]) continue;
-      cont1 = mlem->GetCellContent(j,i);
+      cont1 = mlem->GetBinContent(mlem->GetBin(j,i));
       if (mode && cont1 > cont) continue;
       used[(i-1)*nx+j-1] = kTRUE;
       if (cont1 < fLowestPixelCharge) continue;
@@ -233,7 +235,11 @@ AliMUONClusterSplitterMLEM::Fcn1(const AliMUONCluster& cluster,
     delta /= pad->Charge(); 
     chi2 += delta;
   } // for (Int_t j=0;
-  if (iflag == 0) qAver = qTot / npads;
+  if (iflag == 0 && npads) qAver = qTot / npads;
+  if (!npads && iflag==0)
+  {
+    AliError(Form("Got npads=0. Please check"));
+  }
   f = chi2 / qAver;
 }
 
@@ -369,6 +375,9 @@ AliMUONClusterSplitterMLEM::Fit(const AliMUONCluster& cluster,
   AliMUONPad *pixPtr;
   Int_t npxclu;
   Double_t cont, cmax = 0, xseed = 0, yseed = 0, errOk[8], qq = 0;
+  
+  for ( int i = 0; i < 8; ++i ) errOk[i]=0.0;
+  
   Double_t xyseed[3][2], qseed[3], xyCand[3][2] = {{0},{0}}, sigCand[3][2] = {{0},{0}};
   
   for (Int_t ifit = 1; ifit <= nfit0; ++ifit) 
@@ -416,10 +425,10 @@ AliMUONClusterSplitterMLEM::Fit(const AliMUONCluster& cluster,
   TMath::Sort(nfit0, qseed, maxSeed, kTRUE); // in decreasing order
     
   Double_t step[3]={0.01,0.002,0.02}, fmin, chi2o = 9999, chi2n;
-  Double_t *gin = 0, func0, func1, param[8], step0[8];
+  Double_t *gin = 0, func0, func1, param[8]={0}, step0[8]={0};
   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;
+  Double_t shift[8]={0}, stepMax, derMax, parmin[8]={0}, parmax[8]={0}, func2[2]={0}, shift0;
+  Double_t delta[8]={0}, scMax, dder[8], estim, shiftSave = 0;
   Int_t min, max, nCall = 0, nLoop, idMax = 0, iestMax = 0, nFail;
   Double_t rad, dist[3] = {0};
     
@@ -437,7 +446,7 @@ AliMUONClusterSplitterMLEM::Fit(const AliMUONCluster& cluster,
        param[j] = parOk[j]; 
       }
       param[fNpar] = 0.6;
-      parmin[fNpar] = 0
+      parmin[fNpar] = 1E-9
       parmax[fNpar++] = 1; 
     }
       
@@ -818,7 +827,7 @@ AliMUONClusterSplitterMLEM::Split(const AliMUONCluster& cluster,
     {
       indx = (i-1)*nx + j - 1;
       if (used[indx]) continue;
-      cont = mlem->GetCellContent(j,i);
+      cont = mlem->GetBinContent(mlem->GetBin(j,i));
       if (cont < fLowestPixelCharge) continue;
       pix = new TObjArray(20);
       used[indx] = 1;
@@ -942,7 +951,7 @@ AliMUONClusterSplitterMLEM::Split(const AliMUONCluster& cluster,
         
         // Flag clusters for fit
         nForFit = 0;
-        while (minGroup[nForFit] >= 0 && nForFit < 3)
+        while (nForFit < 3 && minGroup[nForFit] >= 0)
         {
           if (fDebug) cout << clustNumb[minGroup[nForFit]] << " ";
           clustFit[nForFit] = clustNumb[minGroup[nForFit]];