]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSHit.cxx
coding conventions corrections
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
index 669553ea341b777c1234433ee65c95eb8cf0506c..18a6070c29c37e0ef5b954846149a4c5ed390dfd 100644 (file)
 //_________________________________________________________________________
 //  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 "TVector3.h"
 
 // --- Standard library ---
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <strstream.h>
 
 // --- AliRoot header files ---
 #include "AliPHOSHit.h"
 #include "AliRun.h"
-#include "AliConst.h"
-
+#include "AliPHOS.h"
+#include "AliPHOSGeometry.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 ; 
-  fX       = hit.fX ; 
-  fY       = hit.fY ; 
-  fZ       = hit.fZ ; 
-  fPid     = hit.fPid ;
+  fTime    = hit.fTime  ;
+  
 } 
 
 //____________________________________________________________________________
-AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits, Int_t pid, TLorentzVector p, Float_t *xy): AliHit(shunt, track)
+AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits): AliHit(shunt, track)
 {
   //
   // 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 ;
-  fPid        = pid ; 
-  fMomentum  = p;
-  fX         = xy[0];  //position of particle first entering cristall/pad
-  fY         = xy[1];
-  fZ         = 9999.;  //Fake Z to avoid FPE
 }
-
+//____________________________________________________________________________
+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
 { 
@@ -77,29 +113,23 @@ Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
 
   Bool_t rv = kFALSE ; 
 
-  if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) && (fPid*rValue.fPid ! = 0) )
+  if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) )
     rv = kTRUE;
   
   return rv;
 }
 
 //____________________________________________________________________________
-AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
+AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue)
 {
   // Add the energy of the hit
   
-  AliPHOSHit added(*this);
-
-  // the accumulated hit position is the position of the first hi
-  //    added.fX    = rValue.fX  ;
-  //    added.fY    = rValue.fY ;
-  //    added.fZ    = rValue.fZ ;
+  fELOS += rValue.GetEnergy() ;
 
-   added.fELOS += rValue.GetEnergy() ;
+  if(rValue.GetTime() < fTime)
+    fTime = rValue.GetTime() ;
     
-   if(fPid == 0) fPid = rValue.fPid ;
-
-   return added;
+   return *this;
 
 }
 
@@ -108,9 +138,29 @@ 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 ;
+  Warning("operator <<", "Implement differently") ; 
   return out ;
 }
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+