]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALHit.cxx
Undo previous modifications ....
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALHit.cxx
CommitLineData
b13bbe81 1/**************************************************************************
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
ffa6d63b 20// A hit in EMCAL is the sum of all hits in a single segment
21// from a single enterring particle
b13bbe81 22//*-- Author: Sahal Yacoob (LBL / UCT)
23// Based on AliPHOSHit
24
25// --- Standard library ---
26#include <stdio.h>
27#include <string.h>
28#include <stdlib.h>
70479d0e 29#include <Rstrstream.h>
30#include <Riostream.h>
b13bbe81 31
32// --- ROOT system ---
33#include <TLorentzVector.h>
34
35// --- AliRoot header files ---
36#include "AliEMCALHit.h"
37#include "AliRun.h"
38#include "AliConst.h"
4c35d512 39#include "AliEMCALGeometry.h"
40#include "AliEMCALGetter.h"
b13bbe81 41
42ClassImp(AliEMCALHit)
43
44//______________________________________________________________________
45AliEMCALHit::AliEMCALHit(){
46 // Default ctor
47
48 fId = 0;
49 fELOS = 0.0;
773f6f3f 50 fTime = 0.0;
b13bbe81 51 fPrimary = 0;
52 fTrack = 0;
53 fX = 0.0;
54 fY = 0.0;
55 fZ = 0.0;
61e0abb5 56 fPx = 0.0;
57 fPy = 0.0;
58 fPz = 0.0;
59 fPe = 0.0;
60 fIparent = 0;
61 fIenergy = 0.0;
b13bbe81 62}
63//______________________________________________________________________
64AliEMCALHit::AliEMCALHit(const AliEMCALHit & hit){
65 // copy ctor
66
67 fId = hit.fId ;
68 fELOS = hit.fELOS ;
69 fPrimary = hit.fPrimary ;
70 fTrack = hit.fTrack ;
71 fX = hit.fX;
72 fY = hit.fY;
73 fZ = hit.fZ;
61e0abb5 74 fPx = hit.fPx;
75 fPy = hit.fPy;
76 fPz = hit.fPz;
77 fPe = hit.fPe;
78 fIparent = hit.fIparent;
79 fIenergy = hit.fIenergy;
773f6f3f 80 fTime = hit.fTime ;
b13bbe81 81}
82//______________________________________________________________________
61e0abb5 83AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
84 Float_t *hits,Float_t *p):AliHit(shunt, track){
b13bbe81 85 //
ffa6d63b 86 // Create an EMCAL hit object
b13bbe81 87 //
b13bbe81 88 fX = hits[0];
89 fY = hits[1];
90 fZ = hits[2];
773f6f3f 91 fTime = hits[3] ;
b13bbe81 92 fId = id;
773f6f3f 93 fELOS = hits[4];
b13bbe81 94 fPrimary = primary;
61e0abb5 95 fPx = p[0];
96 fPy = p[1];
97 fPz = p[2];
98 fPe = p[3];
99 fIparent = iparent;
100 fIenergy = ienergy;
b13bbe81 101}
4c35d512 102
b13bbe81 103//______________________________________________________________________
104Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{
105 // Two hits are identical if they have the same Id and originat
ffa6d63b 106 // from the same enterring Particle
b13bbe81 107 Bool_t rv = kFALSE;
108
87c17b7b 109 if ( (fId == rValue.GetId()) && ( fIparent == rValue.GetIparent()) )
b13bbe81 110 rv = kTRUE;
111
112 return rv;
113}
114//______________________________________________________________________
115AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
116 // Add the energy of the hit
117
118 fELOS += rValue.GetEnergy() ;
773f6f3f 119
120 if(rValue.GetTime() < fTime)
121 fTime = rValue.GetTime() ;
122
b13bbe81 123 return *this;
124
125}
126//______________________________________________________________________
127ostream& operator << (ostream& out,AliEMCALHit& hit){
128 // Print out Id and energy
129
130 out << "AliEMCALHit:";
131 out << "id=" << hit.GetId();
132 out << ", Eloss=" << hit.GetEnergy();
773f6f3f 133 out << ", Time=" << hit.GetTime();
b13bbe81 134 out << "GeV , Track no.=" << hit.GetPrimary();
135 out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
136 out << ", fTrack=" << hit.GetTrack();
61e0abb5 137 out << ", P=(" << hit.GetPx() << "," << hit.GetPy() << "," << hit.GetPz()
138 << "," <<hit.GetPe() << ") GeV" ;
139 out << ", Enterring particle ID" << hit.GetIparent();
140 out << ", Enterring particle initial energy = " << hit.GetIenergy() << " GeV" ;
b13bbe81 141 out << endl;
142
143 return out;
144}