]>
Commit | Line | Data |
---|---|---|
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> | |
29 | #include <strstream.h> | |
30 | #include <iostream.h> | |
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 | |
42 | ClassImp(AliEMCALHit) | |
43 | ||
44 | //______________________________________________________________________ | |
45 | AliEMCALHit::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 | //______________________________________________________________________ | |
64 | AliEMCALHit::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 | 83 | AliEMCALHit::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 | |
103 | //______________________________________________________________________ | |
104 | const Bool_t AliEMCALHit::IsInPreShower() const | |
105 | { | |
106 | Bool_t rv = kFALSE ; | |
107 | ||
108 | const AliEMCALGeometry * geom = AliEMCALGetter::GetInstance()->EMCALGeometry() ; | |
109 | if((GetId()/geom->GetNPhi()) < (2*geom->GetNZ())) | |
110 | rv = kTRUE; | |
111 | return rv; | |
112 | } | |
113 | ||
b13bbe81 | 114 | //______________________________________________________________________ |
115 | Bool_t AliEMCALHit::operator==(AliEMCALHit const &rValue) const{ | |
116 | // Two hits are identical if they have the same Id and originat | |
ffa6d63b | 117 | // from the same enterring Particle |
b13bbe81 | 118 | Bool_t rv = kFALSE; |
119 | ||
87c17b7b | 120 | if ( (fId == rValue.GetId()) && ( fIparent == rValue.GetIparent()) ) |
b13bbe81 | 121 | rv = kTRUE; |
122 | ||
123 | return rv; | |
124 | } | |
125 | //______________________________________________________________________ | |
126 | AliEMCALHit AliEMCALHit::operator+(const AliEMCALHit &rValue){ | |
127 | // Add the energy of the hit | |
128 | ||
129 | fELOS += rValue.GetEnergy() ; | |
773f6f3f | 130 | |
131 | if(rValue.GetTime() < fTime) | |
132 | fTime = rValue.GetTime() ; | |
133 | ||
b13bbe81 | 134 | return *this; |
135 | ||
136 | } | |
137 | //______________________________________________________________________ | |
138 | ostream& operator << (ostream& out,AliEMCALHit& hit){ | |
139 | // Print out Id and energy | |
140 | ||
141 | out << "AliEMCALHit:"; | |
142 | out << "id=" << hit.GetId(); | |
143 | out << ", Eloss=" << hit.GetEnergy(); | |
773f6f3f | 144 | out << ", Time=" << hit.GetTime(); |
b13bbe81 | 145 | out << "GeV , Track no.=" << hit.GetPrimary(); |
146 | out << ", (xyz)=(" << hit.X()<< ","<< hit.Y()<< ","<<hit.Z()<<") cm"; | |
147 | out << ", fTrack=" << hit.GetTrack(); | |
61e0abb5 | 148 | out << ", P=(" << hit.GetPx() << "," << hit.GetPy() << "," << hit.GetPz() |
149 | << "," <<hit.GetPe() << ") GeV" ; | |
150 | out << ", Enterring particle ID" << hit.GetIparent(); | |
151 | out << ", Enterring particle initial energy = " << hit.GetIenergy() << " GeV" ; | |
b13bbe81 | 152 | out << endl; |
153 | ||
154 | return out; | |
155 | } |