]>
Commit | Line | Data |
---|---|---|
85c60a8e | 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 | /* $Log $ */ | |
18 | ||
19 | //----------------------------------------------------------------- | |
20 | // Implementation of the ESD Calorimeter cluster class | |
21 | // ESD = Event Summary Data | |
22 | // This is the class to deal with during the phisics analysis of data | |
23 | // | |
24 | // J.L. Klay (LLNL) | |
25 | //----------------------------------------------------------------- | |
26 | ||
bab0b5f0 | 27 | #include <TLorentzVector.h> |
85c60a8e | 28 | #include "AliESDCaloCluster.h" |
29 | ||
30 | ClassImp(AliESDCaloCluster) | |
31 | ||
32 | //_______________________________________________________________________ | |
33 | AliESDCaloCluster::AliESDCaloCluster() : | |
34 | fID(0), | |
35 | fClusterType(-1), | |
36 | fEMCALCluster(kFALSE), | |
fe12e09c | 37 | fPHOSCluster(kFALSE), |
85c60a8e | 38 | fEnergy(-1), |
39 | fDispersion(-1), | |
40 | fChi2(-1), | |
e3e93796 | 41 | fPrimaryIndex(-1), |
42 | fM20(0), | |
43 | fM02(0), | |
44 | fM11(0), | |
45 | fNExMax(0), | |
46 | fEmcCpvDistance(9999), | |
64df000d | 47 | fNumberOfPrimaries(-1), |
48 | fListOfPrimaries(0x0), | |
85c60a8e | 49 | fNumberOfDigits(0), |
fe12e09c | 50 | fDigitAmplitude(0x0), |
51 | fDigitTime(0x0), | |
52 | fDigitIndex(0x0) | |
85c60a8e | 53 | { |
54 | // | |
55 | // The default ESD constructor | |
56 | // | |
57 | fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.; | |
58 | for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.; | |
59 | } | |
60 | ||
61 | //_______________________________________________________________________ | |
62 | AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) : | |
63 | TObject(clus), | |
64 | fID(clus.fID), | |
65 | fClusterType(clus.fClusterType), | |
66 | fEMCALCluster(clus.fEMCALCluster), | |
fe12e09c | 67 | fPHOSCluster(clus.fPHOSCluster), |
85c60a8e | 68 | fEnergy(clus.fEnergy), |
69 | fDispersion(clus.fDispersion), | |
70 | fChi2(clus.fChi2), | |
e3e93796 | 71 | fPrimaryIndex(clus.fPrimaryIndex), |
72 | fM20(clus.fM20), | |
73 | fM02(clus.fM02), | |
e0af7ed2 | 74 | fM11(clus.fM11), |
e3e93796 | 75 | fNExMax(clus.fNExMax), |
76 | fEmcCpvDistance(clus.fEmcCpvDistance), | |
64df000d | 77 | fNumberOfPrimaries(clus.fNumberOfPrimaries), |
78 | fListOfPrimaries(0x0), | |
fe12e09c | 79 | fNumberOfDigits(clus.fNumberOfDigits), |
80 | fDigitAmplitude(0x0), | |
81 | fDigitTime(0x0), | |
82 | fDigitIndex(0x0) | |
85c60a8e | 83 | { |
84 | // | |
85 | // The copy constructor | |
86 | // | |
87 | fGlobalPos[0] = clus.fGlobalPos[0]; | |
88 | fGlobalPos[1] = clus.fGlobalPos[1]; | |
89 | fGlobalPos[2] = clus.fGlobalPos[2]; | |
90 | ||
91 | for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i]; | |
92 | ||
e0af7ed2 | 93 | if (clus.fNumberOfDigits > 0) { |
94 | if (clus.fDigitAmplitude) { | |
95 | fDigitAmplitude = new UShort_t[clus.fNumberOfDigits]; | |
96 | for (Int_t i=0; i<clus.fNumberOfDigits; i++) | |
97 | fDigitAmplitude[i]=clus.fDigitAmplitude[i]; | |
98 | } | |
99 | if (clus.fDigitTime) { | |
100 | fDigitTime = new UShort_t[clus.fNumberOfDigits]; | |
101 | for (Int_t i=0; i<clus.fNumberOfDigits; i++) | |
102 | fDigitTime[i]=clus.fDigitTime[i]; | |
103 | } | |
104 | if (clus.fDigitIndex) { | |
105 | fDigitIndex = new UShort_t[clus.fNumberOfDigits]; | |
106 | for (Int_t i=0; i<clus.fNumberOfDigits; i++) | |
107 | fDigitIndex[i]=clus.fDigitIndex[i]; | |
108 | } | |
64df000d | 109 | if (clus.fListOfPrimaries) { |
110 | fListOfPrimaries = new UShort_t[clus.fNumberOfPrimaries]; | |
111 | for (Int_t i=0; i<clus.fNumberOfPrimaries; i++) | |
112 | fListOfPrimaries[i]=clus.fListOfPrimaries[i]; | |
113 | } | |
e0af7ed2 | 114 | } |
85c60a8e | 115 | } |
116 | ||
fe12e09c | 117 | //_______________________________________________________________________ |
118 | AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source) | |
119 | { | |
120 | // assignment operator | |
121 | ||
122 | if(&source == this) return *this; | |
123 | ||
124 | fID = source.fID; | |
125 | fClusterType = source.fClusterType; | |
126 | fEMCALCluster = source.fEMCALCluster; | |
127 | fPHOSCluster = source.fPHOSCluster; | |
128 | fEnergy = source.fEnergy; | |
129 | fDispersion = source.fDispersion; | |
130 | fChi2 = source.fChi2; | |
131 | fPrimaryIndex = source.fPrimaryIndex; | |
132 | fM20 = source.fM20; | |
133 | fM02 = source.fM02; | |
134 | fM11 = source.fM11; | |
135 | fNExMax = source.fNExMax; | |
136 | fEmcCpvDistance = source.fEmcCpvDistance; | |
64df000d | 137 | |
138 | fNumberOfPrimaries = source.fNumberOfPrimaries; | |
139 | delete fListOfPrimaries; fListOfPrimaries=0x0; | |
140 | ||
fe12e09c | 141 | fNumberOfDigits = source.fNumberOfDigits; |
142 | delete fDigitAmplitude; fDigitAmplitude=0x0; | |
143 | delete fDigitTime; fDigitTime = 0x0; | |
144 | delete fDigitIndex; fDigitIndex = 0x0; | |
145 | ||
146 | fGlobalPos[0] = source.fGlobalPos[0]; | |
147 | fGlobalPos[1] = source.fGlobalPos[1]; | |
148 | fGlobalPos[2] = source.fGlobalPos[2]; | |
149 | ||
150 | for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i]; | |
151 | ||
152 | if (source.fNumberOfDigits > 0) { | |
153 | if (source.fDigitAmplitude) { | |
154 | fDigitAmplitude = new UShort_t[source.fNumberOfDigits]; | |
155 | for (Int_t i=0; i<source.fNumberOfDigits; i++) | |
156 | fDigitAmplitude[i]=source.fDigitAmplitude[i]; | |
157 | } | |
158 | if (source.fDigitTime) { | |
159 | fDigitTime = new UShort_t[source.fNumberOfDigits]; | |
160 | for (Int_t i=0; i<source.fNumberOfDigits; i++) | |
161 | fDigitTime[i]=source.fDigitTime[i]; | |
162 | } | |
163 | if (source.fDigitIndex) { | |
164 | fDigitIndex = new UShort_t[source.fNumberOfDigits]; | |
165 | for (Int_t i=0; i<source.fNumberOfDigits; i++) | |
166 | fDigitIndex[i]=source.fDigitIndex[i]; | |
167 | } | |
64df000d | 168 | if (source.fListOfPrimaries) { |
169 | fListOfPrimaries = new UShort_t[source.fNumberOfPrimaries]; | |
170 | for (Int_t i=0; i<source.fNumberOfPrimaries; i++) | |
171 | fListOfPrimaries[i]=source.fListOfPrimaries[i]; | |
172 | } | |
fe12e09c | 173 | } |
174 | ||
175 | return *this; | |
176 | ||
177 | } | |
178 | ||
85c60a8e | 179 | |
180 | //_______________________________________________________________________ | |
181 | AliESDCaloCluster::~AliESDCaloCluster(){ | |
182 | // | |
183 | // This is destructor according Coding Conventrions | |
184 | // | |
e0af7ed2 | 185 | // AliESDCaloCluster is the owner of the arrays |
186 | // even if they are created outside | |
64df000d | 187 | delete[] fListOfPrimaries; |
e0af7ed2 | 188 | delete[] fDigitAmplitude; |
189 | delete[] fDigitTime; | |
190 | delete[] fDigitIndex; | |
191 | ||
85c60a8e | 192 | } |
193 | ||
194 | //_______________________________________________________________________ | |
195 | void AliESDCaloCluster::SetPid(const Float_t *p) { | |
196 | // Sets the probability of each particle type | |
197 | // Copied from AliESDtrack SetPIDValues | |
198 | // This function copies "n" PID weights from "scr" to "dest" | |
199 | // and normalizes their sum to 1 thus producing conditional | |
200 | // probabilities. | |
201 | // The negative weights are set to 0. | |
202 | // In case all the weights are non-positive they are replaced by | |
203 | // uniform probabilities | |
204 | ||
205 | Int_t n = AliPID::kSPECIESN; | |
206 | ||
207 | Float_t uniform = 1./(Float_t)n; | |
208 | ||
209 | Float_t sum = 0; | |
210 | for (Int_t i=0; i<n; i++) | |
211 | if (p[i]>=0) { | |
212 | sum+=p[i]; | |
213 | fPID[i] = p[i]; | |
214 | } | |
215 | else { | |
216 | fPID[i] = 0; | |
217 | } | |
218 | ||
219 | if(sum>0) | |
220 | for (Int_t i=0; i<n; i++) fPID[i] /= sum; | |
221 | else | |
222 | for (Int_t i=0; i<n; i++) fPID[i] = uniform; | |
223 | ||
224 | } | |
bab0b5f0 | 225 | |
226 | //_______________________________________________________________________ | |
227 | void AliESDCaloCluster::GetMomentum(TLorentzVector& p) { | |
228 | // Returns TLorentzVector with momentum of the cluster. Only valid for clusters | |
229 | // identified as photons or pi0 (overlapped gamma) produced on the vertex | |
230 | ||
231 | Double_t r = TMath::Sqrt(fGlobalPos[0]*fGlobalPos[0]+ | |
232 | fGlobalPos[1]*fGlobalPos[1]+ | |
233 | fGlobalPos[2]*fGlobalPos[2] ) ; | |
234 | ||
235 | p.SetPxPyPzE( fEnergy*fGlobalPos[0]/r, fEnergy*fGlobalPos[1]/r, fEnergy*fGlobalPos[2]/r, fEnergy) ; | |
236 | ||
237 | } |