]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSHit.cxx
A new (final?) geometry developed
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
index 2c5711031860d2aa41cc73b7b5056d065304ebc1..246d2c1be32a7156d5c1fbc33d20270bf0584d9e 100644 (file)
@@ -18,8 +18,8 @@
 //_________________________________________________________________________
 //  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)
+//*--
+//*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
 
 // --- ROOT system ---
 
 #include "AliPHOSHit.h"
 #include "AliRun.h"
 #include "AliConst.h"
-
+#include "AliPHOSGetter.h"
+#include "AliPHOSGeometry.h"
+#include "AliPHOS.h"
 
 ClassImp(AliPHOSHit)
-
-//____________________________________________________________________________
-AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) 
+  
+  //____________________________________________________________________________
+  AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) 
 {
-   // copy ctor
-   
+  // copy ctor
+  fX       = hit.fX ; 
+  fY       = hit.fY ; 
+  fZ       = hit.fZ ; 
   fId      = hit.fId ; 
   fELOS    = hit.fELOS ;
   fPrimary = hit.fPrimary ; 
   fTrack   = hit.fTrack ; 
-
+  fTime    = hit.fTime  ;
+  
 } 
 
 //____________________________________________________________________________
@@ -56,12 +60,57 @@ AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_
   //
   // Create a CPV hit object
   //
-
+  
+  fX          = hits[0] ;
+  fY          = hits[1] ;
+  fZ          = hits[2] ;
+  fTime       = hits[3] ;
   fId         = id ;
-  fELOS       = hits[3] ;
+  fELOS       = hits[4] ;
   fPrimary    = primary ;
 }
-
+//____________________________________________________________________________
+Float_t AliPHOSHit::X() const
+{
+  //  if(fX < -1000.){
+    TVector3  pos ;
+    AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ;
+    phos->GetGeometry() ->RelPosInAlice(GetId(),  pos) ;
+    return pos.X() ;
+    //    fX = pos.X() ;
+    //    fY = pos.Y() ;
+    //    fZ = pos.Z() ;
+    //  }
+    //  return fX;
+}
+//____________________________________________________________________________
+Float_t AliPHOSHit::Y() const
+{
+  //  if(fY < -1000.){
+    TVector3  pos ;
+    AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ;
+    phos->GetGeometry() ->RelPosInAlice(GetId(),  pos) ;
+    return pos.Y(); 
+    //    fX = pos.X() ;
+    //    fY = pos.Y() ;
+    //    fZ = pos.Z() ;
+    //  }
+    //  return fY;
+}
+//____________________________________________________________________________
+Float_t AliPHOSHit::Z() const
+{
+  //  if(fY < -1000.){
+    TVector3  pos ;
+    AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ;
+    phos->GetGeometry() ->RelPosInAlice(GetId(),  pos) ;
+    return pos.Z() ;
+    //    fX = pos.X() ;
+    //    fY = pos.Y() ;
+    //    fZ = pos.Z() ;
+    //  }
+    //  return fZ;
+}
 //____________________________________________________________________________
 Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
 { 
@@ -81,6 +130,9 @@ AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue)
   // Add the energy of the hit
   
   fELOS += rValue.GetEnergy() ;
+
+  if(rValue.GetTime() < fTime)
+    fTime = rValue.GetTime() ;
     
    return *this;
 
@@ -91,7 +143,7 @@ ostream& operator << (ostream& out, const AliPHOSHit& hit)
 {
   // Print out Id and energy 
   
-  out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
+  out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << "  " << hit.GetTime() << endl ;
   return out ;
 }