]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSDigit.cxx
No cast to AliMagFCM.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDigit.cxx
index 83ac5d132dbc5665e9cebe8f8da0e72b84f7baf9..dd21e8089840efa78d72a0406c2a059fe925f652 100644 (file)
@@ -21,7 +21,7 @@
 //              3 identifiers for the primary particle(s) at the origine of the digit
 //  The digits are made in FinishEvent() by summing all the hits in a single PHOS crystal or PPSD gas cell
 //
-//*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH)
+//*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
 
 
 // --- ROOT system ---
@@ -48,12 +48,13 @@ ClassImp(AliPHOSDigit)
 }
 
 //____________________________________________________________________________
-AliPHOSDigit::AliPHOSDigit(Int_t primary, Int_t id, Int_t DigEnergy, Int_t index) 
+AliPHOSDigit::AliPHOSDigit(Int_t primary, Int_t id, Int_t digEnergy, Float_t time, Int_t index) 
 {  
   // ctor with all data 
 
   fNMaxPrimary = 5 ; 
-  fAmp         = DigEnergy ;
+  fAmp         = digEnergy ;
+  fTime        = time ;
   fId          = id ;
   fIndexInList = index ; 
   if( primary != -1){
@@ -80,6 +81,7 @@ AliPHOSDigit::AliPHOSDigit(const AliPHOSDigit & digit)
   for ( i = 0; i < fNMaxPrimary ; i++)
     fPrimary[i]  = digit.fPrimary[i] ;
   fAmp         = digit.fAmp ;
+  fTime        = digit.fTime ;
   fId          = digit.fId;
   fIndexInList = digit.fIndexInList ; 
   fNprimary    = digit.fNprimary ;
@@ -120,7 +122,7 @@ Int_t AliPHOSDigit::GetPrimary(Int_t index) const
 {
   // retrieves the primary particle number given its index in the list 
   Int_t rv = -1 ;
-  if ( index <= fNprimary ){
+  if ( index <= fNprimary && index > 0){
     rv = fPrimary[index-1] ;
   } 
 
@@ -128,12 +130,17 @@ Int_t AliPHOSDigit::GetPrimary(Int_t index) const
   
 }
 //____________________________________________________________________________
+void AliPHOSDigit::Print(Option_t *option) const
+{
+  printf("PHOS digit: Amp=%d, Id=%d\n",fAmp,fId);
+}
+//____________________________________________________________________________
 void AliPHOSDigit::ShiftPrimary(Int_t shift)
 {
   //shifts primary number to BIG offset, to separate primary in different TreeK
   Int_t index  ;
   for(index = 0; index <fNprimary; index ++ ){
-    fPrimary[index] = fPrimary[index]+ shift * 10000000   ;
+    fPrimary[index] = fPrimary[index]+ shift ;
   } 
 }
 //____________________________________________________________________________
@@ -154,6 +161,8 @@ AliPHOSDigit& AliPHOSDigit::operator+(AliPHOSDigit const & digit)
   // if amplitude is larger than 
   
   fAmp += digit.fAmp ;
+  if(fTime > digit.fTime)
+    fTime = digit.fTime ;
   
   Int_t max1 = fNprimary ; 
   
@@ -183,7 +192,7 @@ ostream& operator << ( ostream& out , const AliPHOSDigit & digit)
 {
   // Prints the data of the digit
   
-  out << "ID " << digit.fId << " Energy = " << digit.fAmp << endl ; 
+  out << "ID " << digit.fId << " Energy = " << digit.fAmp << " Time = " << digit.fTime << endl ; 
   Int_t i ;
   for(i=0;i<digit.fNprimary;i++)
     out << "Primary " << i+1 << " = " << digit.fPrimary[i] << endl ;