]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSEmcRecPoint.cxx
- update AliTRDtrackletMCM to carry 3 labels and assign them in AliTRDmcmSim
[u/mrichter/AliRoot.git] / PHOS / AliPHOSEmcRecPoint.cxx
index 9fd7a8e5292d2f64c042a438b7e994c7787721c6..9b11b71ad715e5d3f141ac7007e8ab9e54456b61 100644 (file)
  *
  * Revision 1.55  2007/01/19 20:31:19  kharlov
  * Improved formatting for Print()
- *
- * Revision 1.54  2006/08/28 10:01:56  kharlov
- * Effective C++ warnings fixed (Timur Pocheptsov)
- *
- * Revision 1.53  2005/12/20 14:28:47  hristov
- * Additional protection
- *
- * Revision 1.52  2005/05/28 14:19:04  schutz
- * Compilation warnings fixed by T.P.
- *
  */
 
 //_________________________________________________________________________
 //  RecPoint implementation for PHOS-EMC 
 //  An EmcRecPoint is a cluster of digits   
-//*--
-//*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
+//--
+//-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
 
 
 // --- ROOT system ---
@@ -66,6 +56,7 @@
 #include "AliPHOSGeometry.h"
 #include "AliPHOSDigit.h"
 #include "AliPHOSEmcRecPoint.h"
+#include "AliPHOSReconstructor.h"
  
 ClassImp(AliPHOSEmcRecPoint)
 
@@ -122,7 +113,7 @@ AliPHOSEmcRecPoint::~AliPHOSEmcRecPoint()
 }
 
 //____________________________________________________________________________
-void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
+void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy, Float_t time)
 {
   // Adds a digit to the RecPoint
   // and accumulates the total amplitude and the multiplicity 
@@ -156,11 +147,24 @@ void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
     delete [] tempoE ; 
   } // if
   
+  //time
+  Bool_t isMax=kTRUE ;
+  for(Int_t index = 0 ; index < fMulDigit ; index++ ){
+    if(fEnergyList[index]>Energy){
+      isMax=kFALSE ;
+      break ;
+    }
+  }
+  if(isMax){
+    fTime=time ;
+  }
+  //Alternative time calculation - still to be validated
+  // fTime = (fTime*fAmp + time*Energy)/(fAmp+Energy) ;
+
   fDigitsList[fMulDigit]   = digit.GetIndexInList()  ; 
   fEnergyList[fMulDigit]   = Energy ;
   fMulDigit++ ; 
   fAmp += Energy ; 
-
   EvalPHOSMod(&digit) ;
 }
 
@@ -258,15 +262,15 @@ void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/
       AliError(Form("Cannot find Run Loader in Default Event Folder"));
       return;
     }
-  AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
-  if (gime == 0x0) 
+  AliPHOSLoader* phosLoader = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
+  if (phosLoader == 0x0) 
     {
       AliError(Form("Cannot find PHOS Loader from Run Loader"));
       return;
     }
   
   
-  const TClonesArray * digits = gime->Digits() ;
+  const TClonesArray * digits = phosLoader->Digits() ;
   
   switch (event) {
     
@@ -355,7 +359,7 @@ void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/
 }
 
 //____________________________________________________________________________
-void  AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 &vInc)
+void  AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
 {
   // Calculates the dispersion of the shower at the origine of the RecPoint
   //DP: should we correct dispersion for non-perpendicular hit????????
@@ -430,7 +434,7 @@ void  AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits
  
 }
 //______________________________________________________________________________
-void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits)
+void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, Float_t coreRadius, TClonesArray * digits)
 {
   // This function calculates energy in the core, 
   // i.e. within a radius rad = 3cm around the center. Beyond this radius
@@ -438,8 +442,6 @@ void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits
   // should be less than 2%
 //DP: non-perpendicular incidence??????????????
 
-  Float_t coreRadius = 3 ;
-
   Float_t x = 0 ;
   Float_t z = 0 ;
 
@@ -491,7 +493,7 @@ void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits
 }
 
 //____________________________________________________________________________
-void  AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits, TVector3 &vInc)
+void  AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
 {
   // Calculates the axis of the shower ellipsoid
 
@@ -541,8 +543,7 @@ void  AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits,
 //   //Apply correction due to non-perpendicular incidence
 //   Double_t CosX ;
 //   Double_t CosZ ;
-//   AliPHOSGetter * gime = AliPHOSGetter::Instance() ; 
-//   AliPHOSGeometry * phosgeom =  (AliPHOSGeometry*)gime->PHOSGeometry();
+//   AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
 //   Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ;
   
 //   CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
@@ -570,7 +571,7 @@ void  AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits,
 }
 
 //____________________________________________________________________________
-void  AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits, TVector3 &vInc)
+void  AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
 {
   // Calculate the shower moments in the eigen reference system
   // M2x, M2z, M3x, M4z
@@ -738,8 +739,8 @@ void  AliPHOSEmcRecPoint::EvalPrimaries(TClonesArray * digits)
     Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack" ) ;
     nprimaries = fMaxTrack; //skip the rest
   }
-  for(fMulTrack=1; fMulTrack<=nprimaries ; fMulTrack++){
-    tempo[fMulTrack-1] = digit->GetPrimary(fMulTrack) ;
+  for(fMulTrack=0; fMulTrack<nprimaries ; fMulTrack++){
+    tempo[fMulTrack] = digit->GetPrimary(fMulTrack+1) ;
   }
 
   //Now add other digits contributions
@@ -768,7 +769,6 @@ void  AliPHOSEmcRecPoint::EvalPrimaries(TClonesArray * digits)
       }
     }
   } // all digits
-
   if(fMulTrack > 0){
     if(fTracksList)delete [] fTracksList;
     fTracksList = new Int_t[fMulTrack] ;
@@ -781,9 +781,9 @@ void  AliPHOSEmcRecPoint::EvalPrimaries(TClonesArray * digits)
 }
 
 //____________________________________________________________________________
-void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits )
+void AliPHOSEmcRecPoint::EvalAll(TClonesArray * digits )
 {
-  EvalCoreEnergy(logWeight, digits);
+//   EvalCoreEnergy(logWeight, digits);
   EvalTime(digits) ;
   EvalPrimaries(digits) ;
   AliPHOSRecPoint::EvalAll(digits) ;
@@ -857,7 +857,6 @@ void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TVector3 &vtx, TCl
   fLocPos.SetY(0.) ;
   fLocPos.SetZ(z - depthz)  ;
 
-  fLocPosM = 0 ;
 }
 
 //____________________________________________________________________________
@@ -949,10 +948,12 @@ Int_t  AliPHOSEmcRecPoint::GetNumberOfLocalMax( AliPHOSDigit **  maxAt, Float_t
   return iDigitN ;
 }
 //____________________________________________________________________________
-void AliPHOSEmcRecPoint::EvalTime(TClonesArray * digits)
+void AliPHOSEmcRecPoint::EvalTime(TClonesArray * /*digits*/)
 {
   // Define a rec.point time as a time in the cell with the maximum energy
+  //Time already evaluated during AddDigit()
 
+/*
   Float_t maxE = 0;
   Int_t maxAt = 0;
   for(Int_t idig=0; idig < fMulDigit; idig++){
@@ -962,7 +963,7 @@ void AliPHOSEmcRecPoint::EvalTime(TClonesArray * digits)
     }
   }
   fTime = ((AliPHOSDigit*) digits->At(fDigitsList[maxAt]))->GetTime() ;
-  
+*/  
 }
 //____________________________________________________________________________
 void AliPHOSEmcRecPoint::Purify(Float_t threshold){