]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALHit.cxx
Fix for TRD/noTRD related histos + cleanup of comments
[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 using std::endl;
34 ClassImp(AliEMCALHit)
35
36 //______________________________________________________________________
37 AliEMCALHit::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 {
49     // Default ctor
50 }
51
52 //______________________________________________________________________
53 AliEMCALHit::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 {
66     // copy ctor
67 }
68 //_____________________________________________________________________
69 AliEMCALHit& AliEMCALHit::operator = (const AliEMCALHit &source)
70 { // assignment operator; use copy ctor
71   if (&source == this) return *this;
72
73   new (this) AliEMCALHit(source);
74   return *this;
75 }
76 //______________________________________________________________________
77 AliEMCALHit::AliEMCALHit(Int_t shunt, Int_t primary, Int_t track,Int_t iparent, Float_t ienergy, Int_t id,
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 {
91     //
92     // Create an EMCAL  hit object
93     //
94     fX          = hits[0];
95     fY          = hits[1];
96     fZ          = hits[2];
97     fTime       = hits[3] ;
98     fELOS       = hits[4];
99     fPx          = p[0];
100     fPy          = p[1];
101     fPz          = p[2];
102     fPe          = p[3];
103 }
104
105 //______________________________________________________________________
106 Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{ 
107     // Two hits are identical if they have the same Id and originat
108     // from the same enterring Particle 
109     Bool_t rv = kFALSE;
110
111     if ( (fId == rValue.GetId()) && ( fIparent == rValue.GetIparent()))
112         rv = kTRUE;
113
114     return rv;
115 }
116 //______________________________________________________________________
117 AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){
118     // Add the energy of the hit
119
120     fELOS += rValue.GetEnergy() ;
121  
122     if(rValue.GetTime() < fTime)
123       fTime = rValue.GetTime() ;
124  
125     return *this;
126
127 }
128 //______________________________________________________________________
129 ostream& 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();
135     out << ", Time=" << hit.GetTime();
136     out << "GeV , Track no.=" << hit.GetPrimary();
137     out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm";
138     out << ", fTrack=" << hit.GetTrack();
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" ;
143     out << endl;
144
145     return out;
146 }