]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALRecPoint.cxx
minor bug fix
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRecPoint.cxx
index 25ec2c713b4d999cfc9b01edf6142765fc6c9424..0b452642fc1f7f350c8ea51166eac5e299434988 100644 (file)
@@ -59,7 +59,7 @@ AliEMCALRecPoint::AliEMCALRecPoint()
     fMaxDigit(100), fMulDigit(0), fMaxTrack(200),
     fMulTrack(0), fDigitsList(0), fTracksList(0),
     fClusterType(-1), fCoreEnergy(0), fDispersion(0),
-    fEnergyList(0), fTimeList(0), fAbsIdList(0),
+    fEnergyList(0), fAbsIdList(0),
     fTime(0.), fNExMax(0), fCoreRadius(10),  //HG check this 
     fDETracksList(0), fMulParent(0), fMaxParent(0),
     fParentsList(0), fDEParentsList(0), fSuperModuleNumber(0),
@@ -81,7 +81,7 @@ AliEMCALRecPoint::AliEMCALRecPoint(const char *)
     fMaxDigit(100), fMulDigit(0), fMaxTrack(1000), fMulTrack(0),
     fDigitsList(new Int_t[fMaxDigit]), fTracksList(new Int_t[fMaxTrack]),
     fClusterType(-1), fCoreEnergy(0), fDispersion(0),
-    fEnergyList(new Float_t[fMaxDigit]), fTimeList(new Float_t[fMaxDigit]), 
+    fEnergyList(new Float_t[fMaxDigit]), 
     fAbsIdList(new Int_t[fMaxDigit]), fTime(-1.), fNExMax(0), fCoreRadius(10),
     fDETracksList(new Float_t[fMaxTrack]), fMulParent(0), fMaxParent(1000),
     fParentsList(new Int_t[fMaxParent]), fDEParentsList(new Float_t[fMaxParent]),
@@ -110,7 +110,7 @@ AliEMCALRecPoint::AliEMCALRecPoint(const AliEMCALRecPoint & rp)
     fDigitsList(new Int_t[rp.fMaxDigit]), fTracksList(new Int_t[rp.fMaxTrack]),
     fClusterType(rp.fClusterType), fCoreEnergy(rp.fCoreEnergy), 
     fDispersion(rp.fDispersion),
-    fEnergyList(new Float_t[rp.fMaxDigit]), fTimeList(new Float_t[rp.fMaxDigit]), 
+    fEnergyList(new Float_t[rp.fMaxDigit]),  
     fAbsIdList(new Int_t[rp.fMaxDigit]), fTime(rp.fTime), fNExMax(rp.fNExMax),fCoreRadius(rp.fCoreRadius),
     fDETracksList(new Float_t[rp.fMaxTrack]), fMulParent(rp.fMulParent), 
     fMaxParent(rp.fMaxParent), fParentsList(new Int_t[rp.fMaxParent]), 
@@ -124,8 +124,7 @@ AliEMCALRecPoint::AliEMCALRecPoint(const AliEMCALRecPoint & rp)
 
   for(Int_t i = 0; i < rp.fMulDigit; i++) {
     fEnergyList[i] = rp.fEnergyList[i];
-    fTimeList[i] = rp.fTimeList[i];
-    fAbsIdList[i] = rp.fAbsIdList[i];
+    fAbsIdList[i]  = rp.fAbsIdList[i];
   }
 
   for(Int_t i = 0; i < rp.fMulTrack; i++) fDETracksList[i] = rp.fDETracksList[i];
@@ -142,8 +141,6 @@ AliEMCALRecPoint::~AliEMCALRecPoint()
   // dtor
   if ( fEnergyList )
     delete[] fEnergyList ; 
-  if ( fTimeList )
-    delete[] fTimeList ; 
   if ( fAbsIdList )
     delete[] fAbsIdList ; 
    if ( fDETracksList)
@@ -164,37 +161,59 @@ AliEMCALRecPoint& AliEMCALRecPoint::operator= (const AliEMCALRecPoint &rp)
 
   if(&rp == this) return *this;
 
-  fGeomPtr = rp.fGeomPtr;
-  fAmp = rp.fAmp;
+  fGeomPtr     = rp.fGeomPtr;
+  fAmp         = rp.fAmp;
   fIndexInList = rp.fIndexInList;
-  fGlobPos = rp.fGlobPos;
-  fLocPos  = rp.fLocPos;
-  fMaxDigit = rp.fMaxDigit;
-  fMulDigit = rp.fMulDigit;
-  fMaxTrack = rp.fMaxTrack;
-  fMulTrack = rp.fMaxTrack;
+  fGlobPos     = rp.fGlobPos;
+  fLocPos      = rp.fLocPos;
+  fMaxDigit    = rp.fMaxDigit;
+  fMulDigit    = rp.fMulDigit;
+  fMaxTrack    = rp.fMaxTrack;
+  fMulTrack    = rp.fMulTrack;
+  
+  if(fDigitsList) delete [] fDigitsList;
+  fDigitsList = new Int_t[rp.fMaxDigit];
+  if(fTracksList) delete [] fTracksList;
+  fTracksList = new Int_t[rp.fMaxTrack];
   for(Int_t i = 0; i<fMaxDigit; i++) fDigitsList[i] = rp.fDigitsList[i];
   for(Int_t i = 0; i<fMaxTrack; i++) fTracksList[i] = rp.fTracksList[i];
+  
   fClusterType = rp.fClusterType;
   fCoreEnergy  = rp.fCoreEnergy; 
   fDispersion  = rp.fDispersion;
+  
+  
+  if(fEnergyList) delete [] fEnergyList;
+  fEnergyList = new Float_t[rp.fMaxDigit];
+  if(fAbsIdList) delete [] fAbsIdList;
+  fAbsIdList = new Int_t[rp.fMaxDigit];  
   for(Int_t i = 0; i<fMaxDigit; i++) {
     fEnergyList[i] = rp.fEnergyList[i];
-    fTimeList[i]   = rp.fTimeList[i]; 
     fAbsIdList[i]  = rp.fAbsIdList[i];
   }
-  fTime = rp.fTime;
-  fNExMax = rp.fNExMax;
+  
+  fTime       = rp.fTime;
+  fNExMax     = rp.fNExMax;
   fCoreRadius = rp.fCoreRadius;
+  
+  if(fDETracksList) delete [] fDETracksList;
+  fDETracksList = new Float_t[rp.fMaxTrack];
   for(Int_t i = 0; i < fMaxTrack; i++) fDETracksList[i] = rp.fDETracksList[i];
+
   fMulParent = rp.fMulParent;
   fMaxParent = rp.fMaxParent;
+  
+  if(fParentsList) delete [] fParentsList;
+  fParentsList = new Int_t[rp.fMaxParent];
+  if(fDEParentsList) delete [] fDEParentsList;
+  fDEParentsList = new Float_t[rp.fMaxParent];
   for(Int_t i = 0; i < fMaxParent; i++) {
-    fParentsList[i] = rp.fParentsList[i]; 
+    fParentsList[i]   = rp.fParentsList[i]; 
     fDEParentsList[i] = rp.fDEParentsList[i];
   }
+  
   fSuperModuleNumber = rp.fSuperModuleNumber;
-  fDigitIndMax = rp.fDigitIndMax;
+  fDigitIndMax       = rp.fDigitIndMax;
 
   fLambda[0] = rp.fLambda[0];
   fLambda[1] = rp.fLambda[1];
@@ -214,8 +233,7 @@ void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, const Float_t energy, con
   
   if(fEnergyList == 0)
     fEnergyList =  new Float_t[fMaxDigit]; 
-  if(fTimeList == 0)
-    fTimeList   =  new Float_t[fMaxDigit]; 
   if(fAbsIdList == 0) {
     fAbsIdList  =  new Int_t  [fMaxDigit];
   }
@@ -224,31 +242,26 @@ void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, const Float_t energy, con
     fMaxDigit*=2 ; 
     Int_t   * tempo   = new Int_t  [fMaxDigit]; 
     Float_t * tempoE  = new Float_t[fMaxDigit];
-    Float_t * tempoT  = new Float_t[fMaxDigit];
     Int_t   * tempoId = new Int_t  [fMaxDigit]; 
 
     Int_t index ;     
     for ( index = 0 ; index < fMulDigit ; index++ ){
       tempo  [index] = fDigitsList[index] ;
       tempoE [index] = fEnergyList[index] ; 
-      tempoT [index] = fTimeList  [index] ; 
       tempoId[index] = fAbsIdList [index] ; 
     }
     
     delete [] fDigitsList ;
     delete [] fEnergyList ;
-    delete [] fTimeList ;
     delete [] fAbsIdList ;
 
     fDigitsList = tempo;
     fEnergyList = tempoE; 
-    fTimeList   = tempoT;
     fAbsIdList  = tempoId;
   } // if
   
   fDigitsList[fMulDigit]   = digit.GetIndexInList()  ; 
   fEnergyList[fMulDigit]   = energy ;
-  fTimeList  [fMulDigit]   = digit.GetTime();
   fAbsIdList [fMulDigit]   = digit.GetId();
   fMulDigit++ ; 
   fAmp += energy ; 
@@ -279,15 +292,20 @@ Bool_t AliEMCALRecPoint::AreNeighbours(AliEMCALDigit * digit1, AliEMCALDigit * d
   // In case of a shared cluster, index of SM in C side, columns start at 48 and ends at 48*2-1
   // C Side impair SM, nSupMod%2=1; A side pair SM nSupMod%2=0
   if(fSharedCluster){
-    if(nSupMod1%2) relid1[1]+=AliEMCALGeoParams::fgkEMCALCols;
-    else           relid2[1]+=AliEMCALGeoParams::fgkEMCALCols;
+    //printf("Shared cluster in 2 SMs!\n");
+
+    //    if(nSupMod1%2) relid1[1]+=AliEMCALGeoParams::fgkEMCALCols;//bad
+    //    else           relid2[1]+=AliEMCALGeoParams::fgkEMCALCols;//bad
+    if(nSupMod1%2) relid2[1]+=AliEMCALGeoParams::fgkEMCALCols;
+    else           relid1[1]+=AliEMCALGeoParams::fgkEMCALCols;
   }
        
   rowdiff = TMath::Abs( relid1[0] - relid2[0] ) ;  
   coldiff = TMath::Abs( relid1[1] - relid2[1] ) ;  
 
-  if (( coldiff <= 1 )  && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0)) 
-  areNeighbours = kTRUE ;
+  //if (( coldiff <= 1 )  && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0)) 
+  if ((coldiff + rowdiff == 1 )) 
+    areNeighbours = kTRUE ;
   
   return areNeighbours;
 }
@@ -1221,6 +1239,7 @@ Int_t  AliEMCALRecPoint::GetNumberOfLocalMax(AliEMCALDigit **  maxAt, Float_t *
       digit = maxAt[iDigit] ;
           
       for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {       
+       if(iDigitN == iDigit) continue;//the same digit
         digitN = (AliEMCALDigit *) digits->At(fDigitsList[iDigitN]) ; 
        
        if ( AreNeighbours(digit, digitN) ) {
@@ -1229,8 +1248,7 @@ Int_t  AliEMCALRecPoint::GetNumberOfLocalMax(AliEMCALDigit **  maxAt, Float_t *
            // but may be digit too is not local max ?
            if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut) 
              maxAt[iDigit] = 0 ;
-         }
-         else {
+         } else {
            maxAt[iDigit] = 0 ;
            // but may be digitN too is not local max ?
            if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut) 
@@ -1249,6 +1267,7 @@ Int_t  AliEMCALRecPoint::GetNumberOfLocalMax(AliEMCALDigit **  maxAt, Float_t *
       iDigitN++ ; 
     }
   }
+
   return iDigitN ;
 }