]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALHit.cxx
Moved the EMCAL back to 60 < phi < 180
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHit.cxx
index 5616adf23f8e67aebdc8971abc892a279f46af77..dec3473d8d788b4b25afd874926d1d31a510929e 100644 (file)
@@ -17,8 +17,8 @@
 
 //_________________________________________________________________________
 //  Hits class for EMCAL    
-//  A hit in EMCAL is the sum of all hits in a single crystal
-//               
+//  A hit in EMCAL is the sum of all hits in a single segment
+//  from a single enterring particle             
 //*-- Author: Sahal Yacoob (LBL / UCT)
 // Based on AliPHOSHit
 
@@ -26,8 +26,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <strstream.h>
-#include <iostream.h>
+#include <Rstrstream.h>
+#include <Riostream.h>
 
 // --- ROOT system ---
 #include <TLorentzVector.h>
@@ -36,7 +36,8 @@
 #include "AliEMCALHit.h"
 #include "AliRun.h"
 #include "AliConst.h"
-
+#include "AliEMCALGeometry.h"
+#include "AliEMCALGetter.h"
 
 ClassImp(AliEMCALHit)
 
@@ -46,15 +47,21 @@ AliEMCALHit::AliEMCALHit(){
    
     fId      = 0;
     fELOS    = 0.0;
+    fTime    = 0.0;
     fPrimary = 0;
     fTrack   = 0;
     fX       = 0.0;
     fY       = 0.0;
     fZ       = 0.0;
-    fP       = 0.0;
+    fPx       = 0.0;
+    fPy       = 0.0;
+    fPz       = 0.0;
+    fPe       = 0.0;
+    fIparent = 0;
+    fIenergy = 0.0;
 }
 //______________________________________________________________________
-AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
+AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit) : AliHit(hit){
     // copy ctor
    
     fId      = hit.fId ; 
@@ -64,30 +71,42 @@ AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
     fX       = hit.fX;
     fY       = hit.fY;
     fZ       = hit.fZ;
-    fP       = hit.fP;
+    fPx       = hit.fPx;
+    fPy       = hit.fPy;
+    fPz       = hit.fPz;
+    fPe       = hit.fPe;
+    fIparent = hit.fIparent;
+    fIenergy = hit.fIenergy;
+    fTime    = hit.fTime  ;
 }
 //______________________________________________________________________
-AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t id,
-                        Float_t *hits,TLorentzVector *p):AliHit(shunt, track){
+AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
+                        Float_t *hits,Float_t *p):AliHit(shunt, track){
     //
-    // Create a CPV hit object
+    // Create an EMCAL  hit object
     //
-
     fX          = hits[0];
     fY          = hits[1];
     fZ          = hits[2];
+    fTime       = hits[3] ;
     fId         = id;
-    fELOS       = hits[3];
+    fELOS       = hits[4];
     fPrimary    = primary;
-    fP          = *p;
+    fPx          = p[0];
+    fPy          = p[1];
+    fPz          = p[2];
+    fPe          = p[3];
+    fIparent    = iparent;
+    fIenergy    = ienergy;
 }
+
 //______________________________________________________________________
 Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{ 
     // Two hits are identical if they have the same Id and originat
-    // from the same primary
+    // from the same enterring Particle 
     Bool_t rv = kFALSE;
 
-    if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary()) )
+    if ( (fId == rValue.GetId()) && ( fIparent == rValue.GetIparent()) )
        rv = kTRUE;
 
     return rv;
@@ -97,7 +116,10 @@ AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
     // Add the energy of the hit
 
     fELOS += rValue.GetEnergy() ;
-
+    if(rValue.GetTime() < fTime)
+      fTime = rValue.GetTime() ;
     return *this;
 
 }
@@ -108,11 +130,14 @@ ostream& operator << (ostream& out,AliEMCALHit& hit){
     out << "AliEMCALHit:";
     out << "id=" <<  hit.GetId();
     out << ", Eloss=" <<  hit.GetEnergy();
+    out << ", Time=" << hit.GetTime();
     out << "GeV , Track no.=" << hit.GetPrimary();
     out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
     out << ", fTrack=" << hit.GetTrack();
-    out << ", P=(" << hit.GetP().Px() << "," << hit.GetP().Py() <<","
-                   << hit.GetP().Pz() << "," << hit.GetP().E();
+    out << ", P=(" << hit.GetPx() << "," << hit.GetPy() << "," << hit.GetPz()
+                  << "," <<hit.GetPe() << ") GeV"  ;
+    out << ", Enterring particle ID" << hit.GetIparent();
+    out << ", Enterring particle initial energy = " << hit.GetIenergy() << " GeV" ;
     out << endl;
 
     return out;