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