]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSHit.cxx
Use access functions to AliMUONHit member data.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
index afe9fae822117115e665f7b5d185837592a2cc2a..762689547b02a6cd98dee7a8f826cfea50a2d865 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+/* $Id$ */
+
 //_________________________________________________________________________
-// Hit classes for PHOS
-//*-- Author : Maxim Volkov, RRC KI
-//////////////////////////////////////////////////////////////////////////////
+//  Hits class for PHOS     
+//  A hit in PHOS is the sum of all hits in a single crystal
+//               
+//*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH)
 
 // --- ROOT system ---
 
 // --- Standard library ---
-#include <cstdio>
-#include <cstring>
-#include <cstdlib>
-#include <strstream>
-#include <cassert>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <strstream.h>
 
 // --- AliRoot header files ---
 #include "AliPHOSHit.h"
 ClassImp(AliPHOSHit)
 
 //____________________________________________________________________________
-AliPHOSHit::AliPHOSHit(Int_t primary, Int_t id, Float_t *hits)
+AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) 
 {
+   // copy ctor
+   
+  fId      = hit.fId ; 
+  fELOS    = hit.fELOS ;
+  fPrimary = hit.fPrimary ; 
+  fTrack   = hit.fTrack ; 
+  fX       = hit.fX ; 
+  fY       = hit.fY ; 
+  fZ       = hit.fZ ; 
+  fPid     = hit.fPid ;
+} 
 
+//____________________________________________________________________________
+AliPHOSHit::AliPHOSHit(Int_t Shunt, Int_t primary, Int_t Track, Int_t id, Float_t *hits, Int_t pid) : AliHit(Shunt, Track)
+{
+  // ctor
+  
    fId         = id ;
    fX          = hits[0] ;
    fY          = hits[1] ;
    fZ          = hits[2] ;
    fELOS       = hits[3] ;
    fPrimary    = primary ;
+   fPid        = pid ; 
 }
 
 //____________________________________________________________________________
 Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
 { 
+  // Two hits are identical if they have the same Id and originate from the same primary
+
   Bool_t rv = kFALSE ; 
 
-  if ( fId == rValue.GetId() && fPrimary == rValue.GetPrimary() ) 
+  if ( fId == rValue.GetId() && fPrimary == rValue.GetPrimary() )
     rv = kTRUE;
   
   return rv;
@@ -61,17 +83,17 @@ Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
 //____________________________________________________________________________
 AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
 {
+  // Add the energy of the hit
   
   AliPHOSHit added(*this);
 
-   added.fX    = rValue.fX  ;
-   added.fY    = rValue.fY ;
-   added.fZ    = rValue.fZ ;
+  // the accumulated hit position is the position of the first hi
+  //    added.fX    = rValue.fX  ;
+  //    added.fY    = rValue.fY ;
+  //    added.fZ    = rValue.fZ ;
 
    added.fELOS += rValue.GetEnergy() ;
     
-   assert ( added.fPrimary == rValue.fPrimary ) ; 
-
    return added;
 
 }
@@ -79,6 +101,8 @@ AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
 //____________________________________________________________________________
 ostream& operator << (ostream& out, const AliPHOSHit& hit) 
 {
+  // Print out Id and energy 
+  
   out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
   return out ;
 }