]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONClusterFinderPeakFit.cxx
Fix for a hanging ReadPedestals - due to a probable bug in TString::ReadFile- that...
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterFinderPeakFit.cxx
index 54c1ba97a67d9020590a735ce20fe6adf3e60cba..b5a76e14505df645b6207a621e35a20ca04a3f76 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "AliMpDEManager.h"
 #include "AliMpPad.h"
-#include "AliMpStationType.h"
 #include "AliMpVSegmentation.h"
 
 #include "AliLog.h"
@@ -152,7 +151,7 @@ fNAddVirtualPads(0)
 {
   /// Constructor
  
-  fSegmentation[1] = fSegmentation[0] = 0x0; 
+  fkSegmentation[1] = fkSegmentation[0] = 0x0; 
 
   if (fPlot) fDebug = 1;
 }
@@ -178,26 +177,27 @@ AliMUONClusterFinderPeakFit::Prepare(Int_t detElemId, TClonesArray* pads[2],
   
   for ( Int_t i = 0; i < 2; ++i )
   {
-    fSegmentation[i] = seg[i];
+    fkSegmentation[i] = seg[i];
   }
   
   // Find out the DetElemId
   fDetElemId = detElemId;
   
   // find out current event number, and reset the cluster number
-  fEventNumber = AliRunLoader::GetRunLoader()->GetEventNumber();
+  AliRunLoader *runLoader = AliRunLoader::Instance();
+  fEventNumber = runLoader ? runLoader->GetEventNumber() : 0;
   fClusterNumber = -1;
   fClusterList.Delete();
   
   AliDebug(3,Form("EVT %d DE %d",fEventNumber,fDetElemId));
   
-  AliMp::StationType stationType = AliMpDEManager::GetStationType(fDetElemId);
+  AliMq::Station12Type stationType = AliMpDEManager::GetStation12Type(fDetElemId);
   
   Float_t kx3 = AliMUONConstants::SqrtKx3();
   Float_t ky3 = AliMUONConstants::SqrtKy3();
   Float_t pitch = AliMUONConstants::Pitch();
   
-  if ( stationType == AliMp::kStation1 )
+  if ( stationType == AliMq::kStation1 )
   {
     kx3 = AliMUONConstants::SqrtKx3St1();
     ky3 = AliMUONConstants::SqrtKy3St1();
@@ -278,7 +278,7 @@ AliMUONClusterFinderPeakFit::WorkOnPreCluster()
   //  AliCodeTimerAuto("")     
 
   if (fDebug) {
-    cout << " *** Event # " << AliRunLoader::GetRunLoader()->GetEventNumber() 
+    cout << " *** Event # " << fEventNumber
         << " det. elem.: " << fDetElemId << endl;
     for (Int_t j = 0; j < fPreCluster->Multiplicity(); ++j) {
       AliMUONPad* pad = fPreCluster->Pad(j);
@@ -415,7 +415,7 @@ AliMUONClusterFinderPeakFit::CheckPreclusterTwoCathodes(AliMUONCluster* cluster)
       Int_t cath = pad->Cathode();
       Int_t cath1 = TMath::Even(cath);
       // Check for edge effect (missing pads on the _other_ cathode)
-      AliMpPad mpPad = fSegmentation[cath1]->PadByPosition(pad->Position(),kFALSE);
+      AliMpPad mpPad = fkSegmentation[cath1]->PadByPosition(pad->Position(),kFALSE);
       if (!mpPad.IsValid()) continue;
       //if (nFlags == 1 && pad->Charge() < fgkZeroSuppression * 3) continue;
       if (nFlags == 1 && pad->Charge() < 20) continue;
@@ -842,9 +842,13 @@ Int_t AliMUONClusterFinderPeakFit::FindLocalMaxima(TObjArray *pixArray, Int_t *l
       if (isLocalMax[indx+j-1] > 0) { 
        localMax[nMax] = indx + j - 1; 
        maxVal[nMax++] = fHistAnode->GetCellContent(j,i);
-       if (nMax > 99) AliFatal(" Too many local maxima !!!");
+       if (nMax > 99) break;
       }
     }
+    if (nMax > 99) {
+      AliError(" Too many local maxima !!!");
+      break;
+    }
   }
   if (fDebug) cout << " Local max: " << nMax << endl;
   delete [] isLocalMax; 
@@ -886,8 +890,8 @@ void AliMUONClusterFinderPeakFit::FlagLocalMax(TH2D *hist, Int_t i, Int_t j, Int
 }
 
 //_____________________________________________________________________________
-void AliMUONClusterFinderPeakFit::FindClusterFit(AliMUONCluster& cluster, Int_t *localMax, 
-                                                Int_t *maxPos, Int_t nMax)
+void AliMUONClusterFinderPeakFit::FindClusterFit(AliMUONCluster& cluster, const Int_t *localMax, 
+                                                 const Int_t *maxPos, Int_t nMax)
 {
 /// Fit pad charge distribution with nMax hit hypothesis
 
@@ -980,7 +984,7 @@ void AliMUONClusterFinderPeakFit::FindClusterFit(AliMUONCluster& cluster, Int_t
 
 //_____________________________________________________________________________
 void AliMUONClusterFinderPeakFit::FindClusterCOG(AliMUONCluster& cluster, 
-                                                Int_t *localMax, Int_t iMax)
+                                                 const Int_t *localMax, Int_t iMax)
 {
 /// Find COG of pad charge distribution around local maximum \a iMax