]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALRecPoint.cxx
Update to select in centrality (Giacomo)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRecPoint.cxx
index 733198228e51096f1fbf1204f75466fce9d70cd0..4a638d0efd2f0c30f735ca133310cbd29aab51e7 100644 (file)
@@ -176,12 +176,12 @@ AliEMCALRecPoint& AliEMCALRecPoint::operator= (const AliEMCALRecPoint &rp)
   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;
+  fCoreEnergy  = rp.fCoreEnergy; 
+  fDispersion  = rp.fDispersion;
   for(Int_t i = 0; i<fMaxDigit; i++) {
     fEnergyList[i] = rp.fEnergyList[i];
-    fTimeList[i] = rp.fTimeList[i]; 
-    fAbsIdList[i] = rp.fAbsIdList[i];
+    fTimeList[i]   = rp.fTimeList[i]; 
+    fAbsIdList[i]  = rp.fAbsIdList[i];
   }
   fTime = rp.fTime;
   fNExMax = rp.fNExMax;
@@ -207,7 +207,7 @@ AliEMCALRecPoint& AliEMCALRecPoint::operator= (const AliEMCALRecPoint &rp)
 }
 
 //____________________________________________________________________________
-void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t Energy, Bool_t shared)
+void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t energy, Bool_t shared)
 {
   // Adds a digit to the RecPoint
   // and accumulates the total amplitude and the multiplicity 
@@ -222,10 +222,10 @@ void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t Energy, Bool_t sh
 
   if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists 
     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   * 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++ ){
@@ -242,16 +242,16 @@ void AliEMCALRecPoint::AddDigit(AliEMCALDigit & digit, Float_t Energy, Bool_t sh
 
     fDigitsList = tempo;
     fEnergyList = tempoE; 
-    fTimeList = tempoT;
-    fAbsIdList = tempoId;
+    fTimeList   = tempoT;
+    fAbsIdList  = tempoId;
   } // if
   
   fDigitsList[fMulDigit]   = digit.GetIndexInList()  ; 
-  fEnergyList[fMulDigit]   = Energy ;
+  fEnergyList[fMulDigit]   = energy ;
   fTimeList[fMulDigit]     = digit.GetTimeR() ;
   fAbsIdList[fMulDigit]    = digit.GetId();
   fMulDigit++ ; 
-  fAmp += Energy ; 
+  fAmp += energy ; 
        
   if(shared) fSharedCluster = kTRUE;
        
@@ -441,12 +441,13 @@ Int_t AliEMCALRecPoint::Compare(const TObject * obj) const
 //}
 
 //____________________________________________________________________________
-void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) 
+void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits, const Bool_t justClusters
 {
   // Evaluates cluster parameters
        
   // First calculate the index of digit with maximum amplitude and get 
   // the supermodule number where it sits.
+    
   fDigitIndMax       = GetMaximalEnergyIndex();
   fSuperModuleNumber = fGeomPtr->GetSuperModuleNumber(GetAbsIdMaxDigit());
   
@@ -464,7 +465,8 @@ void AliEMCALRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits)
   EvalParents(digits);
        
   //Called last because it sets the global position of the cluster?
-  EvalLocal2TrackingCSTransform();
+  //Do not call it when recalculating clusters out of standard reconstruction
+  if(!justClusters) EvalLocal2TrackingCSTransform();
 
 }
 
@@ -835,23 +837,24 @@ Double_t phiSlope, TClonesArray * digits)
        
   for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++) {
     digit = dynamic_cast<AliEMCALDigit *>(digits->At(fDigitsList[iDigit])) ;
-    dist = deff;
-    //fGeomPtr->RelPosCellInSModule(digit->GetId(), idMax, dist, xyzi[0], xyzi[1], xyzi[2]);
-    fGeomPtr->RelPosCellInSModule(digit->GetId(), dist, xyzi[0], xyzi[1], xyzi[2]);
-    
-    if(logWeight > 0.0)  w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ));
-    else                 w = fEnergyList[iDigit]; // just energy
-    
-    if(w>0.0) {
-      wtot += w ;
-      nstat++;
-      for(i=0; i<3; i++ ) {
-        clXYZ[i]    += (w*xyzi[i]);
-        clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
+    if(digit){
+      dist = deff;
+      //fGeomPtr->RelPosCellInSModule(digit->GetId(), idMax, dist, xyzi[0], xyzi[1], xyzi[2]);
+      fGeomPtr->RelPosCellInSModule(digit->GetId(), dist, xyzi[0], xyzi[1], xyzi[2]);
+      
+      if(logWeight > 0.0)  w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ));
+      else                 w = fEnergyList[iDigit]; // just energy
+      
+      if(w>0.0) {
+        wtot += w ;
+        nstat++;
+        for(i=0; i<3; i++ ) {
+          clXYZ[i]    += (w*xyzi[i]);
+          clRmsXYZ[i] += (w*xyzi[i]*xyzi[i]);
+        }
       }
-    }
-  }
+    }else AliError("Digit null");
+  }//loop
   //  cout << " wtot " << wtot << endl;
   if ( wtot > 0 ) { 
     //    xRMS   = TMath::Sqrt(x2m - xMean*xMean);
@@ -931,21 +934,22 @@ Bool_t AliEMCALRecPoint::EvalLocalPositionFromDigits(const Double_t esum, const
 
   for(Int_t iDigit=0; iDigit<digits->GetEntries(); iDigit++) {
     digit = dynamic_cast<AliEMCALDigit *>(digits->At(iDigit));
-
-    //geo->RelPosCellInSModule(digit->GetId(), idMax, deff, xyzi[0], xyzi[1], xyzi[2]);
-    geo->RelPosCellInSModule(digit->GetId(), deff, xyzi[0], xyzi[1], xyzi[2]);
-
-    if(w0 > 0.0)  w = TMath::Max( 0., w0 + TMath::Log(ed[iDigit] / esum));
-    else          w = ed[iDigit]; // just energy
-
-    if(w>0.0) {
-      wtot += w ;
-      nstat++;
-      for(i=0; i<3; i++ ) {
-        clXYZ[i] += (w*xyzi[i]);
+    if(digit){
+      //geo->RelPosCellInSModule(digit->GetId(), idMax, deff, xyzi[0], xyzi[1], xyzi[2]);
+      geo->RelPosCellInSModule(digit->GetId(), deff, xyzi[0], xyzi[1], xyzi[2]);
+      
+      if(w0 > 0.0)  w = TMath::Max( 0., w0 + TMath::Log(ed[iDigit] / esum));
+      else          w = ed[iDigit]; // just energy
+      
+      if(w>0.0) {
+        wtot += w ;
+        nstat++;
+        for(i=0; i<3; i++ ) {
+          clXYZ[i] += (w*xyzi[i]);
+        }
       }
-    }
-  }
+    }else AliError("Digit null");
+  }//loop
   //  cout << " wtot " << wtot << endl;
   if (wtot > 0) { 
     for(i=0; i<3; i++ ) {
@@ -1455,9 +1459,12 @@ Double_t AliEMCALRecPoint::TmaxInCm(const Double_t e , const Int_t key)
   // key  =  0(gamma, default)
   //     !=  0(electron)
   const Double_t ca   = 4.82;  // shower max parameter - first guess; ca=TMath::Log(1000./8.07)
-  const Double_t x0   = 1.23;  // radiation lenght (cm)
   Double_t tmax = 0.;    // position of electromagnetic shower max in cm
 
+  Double_t x0   = 1.31;  // radiation lenght (cm)
+  //If old geometry in use
+  if(!((fGeomPtr->GetEMCGeometry()->GetGeoName()).Contains("V1"))) x0 = 1.28;
+
   if(e>0.1) {
     tmax = TMath::Log(e) + ca;
     if      (key==0) tmax += 0.5; 
@@ -1489,24 +1496,24 @@ void AliEMCALRecPoint::Print(Option_t *opt) const
   TString message ; 
   message  = "AliEMCALRecPoint:\n" ;
   message +=  " digits # = " ; 
-  Info("Print", message.Data()) ; 
+  AliInfo(message.Data()) ; 
 
   Int_t iDigit;
   for(iDigit=0; iDigit<fMulDigit; iDigit++)
     printf(" %d ", fDigitsList[iDigit] ) ;  
   printf("\n");
 
-  Info("Print", " Energies = ") ;
+  AliInfo(" Energies = ") ;
   for(iDigit=0; iDigit<fMulDigit; iDigit++) 
     printf(" %f ", fEnergyList[iDigit] ) ;
   printf("\n");
 
-  Info("Print", "\n Abs Ids = ") ;
+  AliInfo("\n Abs Ids = ") ;
   for(iDigit=0; iDigit<fMulDigit; iDigit++) 
     printf(" %i ", fAbsIdList[iDigit] ) ;
   printf("\n");
 
-  Info("Print", " Primaries  ") ;
+  AliInfo(" Primaries  ") ;
   for(iDigit = 0;iDigit < fMulTrack; iDigit++)
     printf(" %d ", fTracksList[iDigit]) ;
 
@@ -1519,7 +1526,7 @@ void AliEMCALRecPoint::Print(Option_t *opt) const
   message += "       Core radius     = %f" ; 
   message += "       Number of primaries %d" ; 
   message += "       Stored at position %d" ; 
-  Info("Print", message.Data(), fClusterType, fMulDigit, fAmp, fCoreEnergy, fCoreRadius, fMulTrack, GetIndexInList() ) ;  
+  AliInfo(Form(message.Data(), fClusterType, fMulDigit, fAmp, fCoreEnergy, fCoreRadius, fMulTrack, GetIndexInList()) ) ;  
 }
 
 //___________________________________________________________