]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALUnfolding.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALUnfolding.cxx
index 1416e5b2d65abac83a82fb7a1fabe02ef88b51eb..c9d603fd07de7b6f1ef114adaa2e7e6dec4dedd9 100644 (file)
@@ -579,7 +579,7 @@ Bool_t AliEMCALUnfolding::UnfoldClusterV2(AliEMCALRecPoint * iniTower,
 
       for(iDigit = 0 ; iDigit < rpUFOne->GetMultiplicity(); iDigit ++) {
         digit = dynamic_cast<AliEMCALDigit*>( fDigitsArr->At( digitsList[iDigit] ) ) ;
-        recPoint->AddDigit( *digit, energyList[iDigit], kFALSE ) ; //FIXME, need to study the shared case
+        if(digit) recPoint->AddDigit( *digit, energyList[iDigit], kFALSE ) ; //FIXME, need to study the shared case
       }//digit loop
       fNumberOfECAClusters++ ; 
     } else {//recPoint empty -> remove from list
@@ -593,7 +593,8 @@ Bool_t AliEMCALUnfolding::UnfoldClusterV2(AliEMCALRecPoint * iniTower,
   //print energy of new unfolded clusters
   AliDebug(5,Form("  nUnfoldedClusters %d, fNumberOfECAClusters %d",nUnfoldedClusters,fNumberOfECAClusters ));
   for(Int_t inewclus=0; inewclus<nUnfoldedClusters;inewclus++){
-    AliDebug(5,Form("  Unfolded cluster %d E %f",inewclus,dynamic_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters-1-inewclus)) ->GetEnergy() ));
+               AliEMCALRecPoint * rp = dynamic_cast<AliEMCALRecPoint *>(fRecPoints->At(fNumberOfECAClusters-1-inewclus));
+    if(rp) AliDebug(5,Form("  Unfolded cluster %d E %f",inewclus, rp->GetEnergy() ));
   }
 
   //clear tables  
@@ -778,10 +779,16 @@ Bool_t AliEMCALUnfolding::FindFitV2(AliEMCALRecPoint * recPoint, AliEMCALDigit *
   Int_t iphi    =  0 ;//x direction
   Int_t ieta    =  0 ;//z direstion
 
-  for(iDigit = 0; iDigit < nDigits; iDigit++){
+  for(iDigit = 0; iDigit < nDigits; iDigit++)
+  {
     digit = maxAt[iDigit];
-    if(digit==0) AliError("energy of digit = 0!");
-    fGeom->GetCellIndex(digit->GetId(),iSupMod,iTower,iIphi,iIeta); 
+    if(!digit)
+    {
+      AliError("Null digit pointer");
+      continue;
+    }
+    
+    fGeom->GetCellIndex(digit->GetId(),iSupMod,iTower,iIphi,iIeta);
     fGeom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
                                       iIphi, iIeta,iphi,ieta);