]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALAodCluster.cxx
Fix coding violations
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALAodCluster.cxx
index 21469f0b07b06923d974cb681011f2988c9d530d..f8bfc5c3def1540494cb0a0bcb92214bdba91807 100644 (file)
@@ -67,8 +67,7 @@ void AliEMCALAodCluster::Recalibrate(AliEMCALCalibData * calibData, AliAODCaloCe
     return ;
 
   AliEMCALGeometry * emcalgeo =  AliEMCALGeometry::GetInstance(emcalGeoName) ;
-  if(!emcalgeo)
-    AliFatal("AliEMCALGeometry was not constructed\n") ;
+  if(emcalgeo){
        
   Double32_t * cellsAmpFraction = GetCellsAmplitudeFraction(); 
   Int_t iSupMod = -1;
@@ -87,12 +86,17 @@ void AliEMCALAodCluster::Recalibrate(AliEMCALCalibData * calibData, AliAODCaloCe
                                          iIphi, iIeta,iphi,ieta);      
     
     Double_t energy = emcCells->GetCellAmplitude(GetCellAbsId(i)) ;
-    AliDebug(2,Form("Recalibrate: cell %f, calib %f, fraction %f\n",energy,calibData->GetADCchannel(iSupMod,ieta,iphi),cellsAmpFraction[i]));
+    //AliDebug(2,Form("Recalibrate: cell %f, calib %f, fraction %f\n",energy,calibData->GetADCchannel(iSupMod,ieta,iphi),cellsAmpFraction[i]));
+       if(cellsAmpFraction[i]< 1e-4) cellsAmpFraction[i] = 1; //Unfolding off, took all the cell energy 
        cellsAmpFraction[i]*=energy*calibData->GetADCchannel(iSupMod,ieta,iphi);
   }
        
   SetCellsAmplitudeFraction(cellsAmpFraction);
   fRecalibrated=kTRUE; 
+    
+  }
+  else  AliFatal("AliEMCALGeometry was not constructed\n") ;
+
 }
 //____________________________________________________________________________
 void  AliEMCALAodCluster::EvalAll(Float_t logWeight, TString geoname){
@@ -156,7 +160,6 @@ void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString e
   Int_t nstat  = 0;
   Float_t wtot = 0. ;
 
-  Int_t idMax   = -1;  
   Int_t iSupMod = -1;
   Int_t iTower  = -1;
   Int_t iIphi   = -1;
@@ -177,20 +180,14 @@ void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString e
   Double_t zmean = 0.;
 
   AliEMCALGeometry * emcalgeo =  AliEMCALGeometry::GetInstance(emcalGeoName) ;
-  if(!emcalgeo)
-    AliFatal("AliEMCALGeometry was not constructed\n") ;
+  if(emcalgeo){
        
-  Double_t dist = 0;
+  Double_t dist  = TmaxInCm(E(),0);
   for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
-       if(iDigit==0) {
-               //Check if this maximum  at 0 is true!!
-               idMax = GetCellAbsId(iDigit);
-               dist  = TmaxInCm(Double_t(GetCellAmplitudeFraction(iDigit)),0);
-       }    
-
+       
        //Get from the absid the supermodule, tower and eta/phi numbers
        emcalgeo->GetCellIndex(GetCellAbsId(iDigit),iSupMod,iTower,iIphi,iIeta); 
-       emcalgeo->RelPosCellInSModule(GetCellAbsId(iDigit),idMax, dist, xyzi[0], xyzi[1], xyzi[2]);
+       emcalgeo->RelPosCellInSModule(GetCellAbsId(iDigit), dist, xyzi[0], xyzi[1], xyzi[2]);
        emcalgeo->GetCellPhiEtaIndexInSModule(iSupMod,iTower,iIphi,iIeta, iphi,ieta);
 
     Double_t ei = GetCellAmplitudeFraction(iDigit) ;
@@ -229,9 +226,9 @@ void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString e
   TVector3 gpos ;
   emcalgeo->GetGlobal(clXYZ, gpos, iSupMod);
 
-  SetPosition(0, gpos[0]) ;
-  SetPosition(1, gpos[1]) ;  
-  SetPosition(2, gpos[2]) ;
+  SetPositionAt(gpos[0],0) ;
+  SetPositionAt(gpos[1],1) ;  
+  SetPositionAt(gpos[2],2) ;
 
   //Calculate dispersion       
   for(Int_t iDigit=0; iDigit < GetNCells(); iDigit++) {
@@ -273,6 +270,11 @@ void AliEMCALAodCluster::EvalPositionAndShowerShape(Float_t logWeight, TString e
          SetDispersion(TMath::Sqrt(d)) ;
   else    
          SetDispersion(0) ;
+  }
+  else {
+    AliFatal("AliEMCALGeometry was not constructed\n") ;
+  }
+
 
 }