avoid warnings with modern compilers due to unused variables or wrong comparison...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHit.cxx
CommitLineData
fdebddeb 1 /**************************************************************************
b13bbe81 2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id: */
17
18//_________________________________________________________________________
19// Hits class for EMCAL
19a2fe5a 20// A hit in EMCAL is the sum of all hits in a tower
21// from a single entering particle
b13bbe81 22//*-- Author: Sahal Yacoob (LBL / UCT)
23// Based on AliPHOSHit
24
25// --- Standard library ---
70479d0e 26#include <Riostream.h>
b13bbe81 27
28// --- ROOT system ---
b13bbe81 29
30// --- AliRoot header files ---
31#include "AliEMCALHit.h"
b13bbe81 32
0267cfa6 33using std::endl;
b13bbe81 34ClassImp(AliEMCALHit)
35
36//______________________________________________________________________
18a21c7c 37AliEMCALHit::AliEMCALHit()
38 : fId(0),
39 fELOS(0.),
40 fPrimary(0),
41 fPx(0.),
42 fPy(0.),
43 fPz(0.),
44 fPe(0.),
45 fIparent(0),
46 fIenergy(0.),
47 fTime(0.)
48{
b13bbe81 49 // Default ctor
b13bbe81 50}
18a21c7c 51
b13bbe81 52//______________________________________________________________________
18a21c7c 53AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit)
54 : AliHit(hit),
55 fId(hit.fId),
56 fELOS(hit.fELOS),
57 fPrimary(hit.fPrimary),
58 fPx(hit.fPx),
59 fPy(hit.fPy),
60 fPz(hit.fPz),
61 fPe(hit.fPe),
62 fIparent(hit.fIparent),
63 fIenergy(hit.fIenergy),
64 fTime(hit.fTime)
65{
b13bbe81 66 // copy ctor
b13bbe81 67}
f1d9131f 68//_____________________________________________________________________
69AliEMCALHit& AliEMCALHit::operator = (const AliEMCALHit &source)
70{ // assignment operator; use copy ctor
71 if (&source == this) return *this;
18a21c7c 72
f1d9131f 73 new (this) AliEMCALHit(source);
74 return *this;
75}
b13bbe81 76//______________________________________________________________________
61e0abb5 77AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
18a21c7c 78 Float_t *hits,Float_t *p)
79 : AliHit(shunt, track),
80 fId(id),
81 fELOS(0.),
82 fPrimary(primary),
83 fPx(0.),
84 fPy(0.),
85 fPz(0.),
86 fPe(0.),
87 fIparent(iparent),
88 fIenergy(ienergy),
89 fTime(0.)
90{
b13bbe81 91 //
ffa6d63b 92 // Create an EMCAL hit object
b13bbe81 93 //
b13bbe81 94 fX = hits[0];
95 fY = hits[1];
96 fZ = hits[2];
773f6f3f 97 fTime = hits[3] ;
773f6f3f 98 fELOS = hits[4];
61e0abb5 99 fPx = p[0];
100 fPy = p[1];
101 fPz = p[2];
102 fPe = p[3];
b13bbe81 103}
4c35d512 104
105//______________________________________________________________________
b13bbe81 106Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{
107 // Two hits are identical if they have the same Id and originat
ffa6d63b 108 // from the same enterring Particle
b13bbe81 109 Bool_t rv = kFALSE;
110
fdebddeb 111 if ( (fId == rValue.GetId()) && ( fIparent == rValue.GetIparent()))
b13bbe81 112 rv = kTRUE;
113
114 return rv;
115}
116//______________________________________________________________________
117AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
118 // Add the energy of the hit
119
120 fELOS += rValue.GetEnergy() ;
773f6f3f 121
122 if(rValue.GetTime() < fTime)
123 fTime = rValue.GetTime() ;
124
b13bbe81 125 return *this;
126
127}
128//______________________________________________________________________
129ostream& operator << (ostream& out,AliEMCALHit& hit){
130 // Print out Id and energy
131
132 out << "AliEMCALHit:";
133 out << "id=" << hit.GetId();
134 out << ", Eloss=" << hit.GetEnergy();
773f6f3f 135 out << ", Time=" << hit.GetTime();
b13bbe81 136 out << "GeV , Track no.=" << hit.GetPrimary();
137 out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
138 out << ", fTrack=" << hit.GetTrack();
61e0abb5 139 out << ", P=(" << hit.GetPx() << "," << hit.GetPy() << "," << hit.GetPz()
140 << "," <<hit.GetPe() << ") GeV" ;
141 out << ", Enterring particle ID" << hit.GetIparent();
142 out << ", Enterring particle initial energy = " << hit.GetIenergy() << " GeV" ;
b13bbe81 143 out << endl;
144
145 return out;
146}