]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSHit.cxx
Modified plots and made jet finder use SDigits
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
index afe9fae822117115e665f7b5d185837592a2cc2a..d0d817105e27c9b39abf9a1c687c5a57fdbba516 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) & Dmitri Peressounko (RRC KI & SUBATECH)
 
 // --- ROOT system ---
+#include "TVector3.h"
 
 // --- Standard library ---
-#include <cstdio>
-#include <cstring>
-#include <cstdlib>
-#include <strstream>
-#include <cassert>
 
 // --- AliRoot header files ---
 #include "AliPHOSHit.h"
 #include "AliRun.h"
-#include "AliConst.h"
-
+#include "AliPHOSGeometry.h"
+#include "AliPHOS.h"
 
 ClassImp(AliPHOSHit)
+  
+  //____________________________________________________________________________
+  AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) : AliHit(hit)
+{
+  // 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  ;
+  
+} 
 
 //____________________________________________________________________________
-AliPHOSHit::AliPHOSHit(Int_t primary, Int_t id, Float_t *hits)
+AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits): AliHit(shunt, track)
 {
-
-   fId         = id ;
-   fX          = hits[0] ;
-   fY          = hits[1] ;
-   fZ          = hits[2] ;
-   fELOS       = hits[3] ;
-   fPrimary    = primary ;
+  //
+  // Create a CPV hit object
+  //
+  
+  fX          = hits[0] ;
+  fY          = hits[1] ;
+  fZ          = hits[2] ;
+  fTime       = hits[3] ;
+  fId         = id ;
+  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
 { 
+  // 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;
 }
 
 //____________________________________________________________________________
-AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
+AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue)
 {
+  // Add the energy of the hit
   
-  AliPHOSHit added(*this);
+  fELOS += rValue.GetEnergy() ;
 
-   added.fX    = rValue.fX  ;
-   added.fY    = rValue.fY ;
-   added.fZ    = rValue.fZ ;
-
-   added.fELOS += rValue.GetEnergy() ;
+  if(rValue.GetTime() < fTime)
+    fTime = rValue.GetTime() ;
     
-   assert ( added.fPrimary == rValue.fPrimary ) ; 
-
-   return added;
+   return *this;
 
 }
 
 //____________________________________________________________________________
-ostream& operator << (ostream& out, const AliPHOSHit& hit) 
-{
-  out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
-  return out ;
-}
+// Commented out by Yu.Kharlov 4.09.2003
+// ostream& operator << (ostream& out, const AliPHOSHit& hit) 
+// {
+//   // Print out Id and energy 
+  
+//   //out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << "  " << hit.GetTime() << endl ;
+//   Warning("operator <<", "Implement differently") ; 
+//   return out ;
+// }