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