]>
Commit | Line | Data |
---|---|---|
df9db588 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, 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 | //------------------------------------------------------------------------- | |
a9255000 | 19 | // AOD cluster base class |
df9db588 | 20 | // Author: Markus Oldenburg, CERN |
21 | //------------------------------------------------------------------------- | |
22 | ||
a9255000 | 23 | #include "AliAODCluster.h" |
df9db588 | 24 | |
a9255000 | 25 | ClassImp(AliAODCluster) |
df9db588 | 26 | |
27 | //______________________________________________________________________________ | |
c8fe2783 | 28 | AliAODCluster::AliAODCluster() : |
29 | AliVCluster(), | |
df9db588 | 30 | fEnergy(0), |
31 | fChi2(-999.), | |
32 | fID(-999), | |
4cfedff1 | 33 | fNLabel(0), |
34 | fLabel(0x0), | |
35 | fFilterMap(0), | |
7eff06f2 | 36 | fType(kUndef), |
37 | fMCEnergyFraction(0.) | |
df9db588 | 38 | { |
39 | // default constructor | |
40 | ||
c8fe2783 | 41 | SetPosition(NULL); |
42 | SetPID(NULL); | |
df9db588 | 43 | } |
44 | ||
45 | //______________________________________________________________________________ | |
a9255000 | 46 | AliAODCluster::AliAODCluster(Int_t id, |
4cfedff1 | 47 | UInt_t nLabel, |
48 | Int_t *label, | |
df9db588 | 49 | Double_t energy, |
50 | Double_t x[3], | |
83dd7da3 | 51 | Double_t pid[13], |
4cfedff1 | 52 | Char_t ttype, |
53 | UInt_t selectInfo) : | |
c8fe2783 | 54 | AliVCluster(), |
df9db588 | 55 | fEnergy(energy), |
56 | fChi2(-999.), | |
57 | fID(id), | |
4cfedff1 | 58 | fNLabel(0), |
59 | fLabel(0x0), | |
60 | fFilterMap(selectInfo), | |
7eff06f2 | 61 | fType(ttype), |
62 | fMCEnergyFraction(0.) | |
df9db588 | 63 | { |
64 | // constructor | |
7ba6f91a | 65 | for (Int_t i = 0; i < 3; i++) fPosition[i] = 0.; |
66 | for (Int_t i = 0; i < 13; i++) fPID[i] = 0; | |
df9db588 | 67 | |
c8fe2783 | 68 | if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);} |
69 | if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);} | |
4cfedff1 | 70 | SetLabel(label, nLabel); |
df9db588 | 71 | } |
72 | ||
73 | //______________________________________________________________________________ | |
a9255000 | 74 | AliAODCluster::AliAODCluster(Int_t id, |
4cfedff1 | 75 | UInt_t nLabel, |
76 | Int_t *label, | |
df9db588 | 77 | Float_t energy, |
78 | Float_t x[3], | |
83dd7da3 | 79 | Float_t pid[13], |
4cfedff1 | 80 | Char_t ttype, |
81 | UInt_t selectInfo) : | |
c8fe2783 | 82 | AliVCluster(), |
df9db588 | 83 | fEnergy(energy), |
84 | fChi2(-999.), | |
85 | fID(id), | |
4cfedff1 | 86 | fNLabel(0), |
87 | fLabel(0x0), | |
88 | fFilterMap(selectInfo), | |
7eff06f2 | 89 | fType(ttype), |
90 | fMCEnergyFraction(0.) | |
df9db588 | 91 | { |
92 | // constructor | |
7ba6f91a | 93 | for (Int_t i = 0; i < 3; i++) fPosition[i] = 0.; |
94 | for (Int_t i = 0; i < 13; i++) fPID[i] = 0; | |
95 | ||
c8fe2783 | 96 | if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);} |
97 | if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);} | |
4cfedff1 | 98 | SetLabel(label, nLabel); |
df9db588 | 99 | } |
100 | ||
101 | ||
102 | //______________________________________________________________________________ | |
a9255000 | 103 | AliAODCluster::~AliAODCluster() |
df9db588 | 104 | { |
105 | // destructor | |
4cfedff1 | 106 | |
107 | RemoveLabel(); | |
df9db588 | 108 | } |
109 | ||
8dd6eba0 | 110 | //______________________________________________________________________________ |
111 | void AliAODCluster::Clear(const Option_t*) | |
112 | { | |
113 | // Clear | |
114 | ||
115 | RemoveLabel(); | |
116 | } | |
117 | ||
df9db588 | 118 | |
119 | //______________________________________________________________________________ | |
14d55e62 | 120 | AliAODCluster::AliAODCluster(const AliAODCluster& clus) : |
c8fe2783 | 121 | AliVCluster(clus), |
14d55e62 | 122 | fEnergy(clus.fEnergy), |
123 | fChi2(clus.fChi2), | |
124 | fID(clus.fID), | |
4cfedff1 | 125 | fNLabel(0), |
126 | fLabel(0x0), | |
127 | fFilterMap(clus.fFilterMap), | |
7eff06f2 | 128 | fType(clus.fType), |
129 | fMCEnergyFraction(clus.fMCEnergyFraction) | |
df9db588 | 130 | { |
131 | // Copy constructor | |
132 | ||
f1c9dd31 | 133 | for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i]; |
134 | for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i]; | |
c8fe2783 | 135 | |
4cfedff1 | 136 | SetLabel(clus.fLabel, clus.fNLabel); |
df9db588 | 137 | } |
138 | ||
139 | //______________________________________________________________________________ | |
14d55e62 | 140 | AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus) |
df9db588 | 141 | { |
142 | // Assignment operator | |
14d55e62 | 143 | if(this!=&clus) { |
c8fe2783 | 144 | |
f1c9dd31 | 145 | for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i]; |
7ba6f91a | 146 | for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i]; |
c8fe2783 | 147 | |
14d55e62 | 148 | fEnergy = clus.fEnergy; |
149 | fChi2 = clus.fChi2; | |
df9db588 | 150 | |
14d55e62 | 151 | fID = clus.fID; |
4cfedff1 | 152 | SetLabel(clus.fLabel, clus.fNLabel); |
153 | fFilterMap = clus.fFilterMap; | |
9333290e | 154 | |
155 | fType = clus.fType; | |
7eff06f2 | 156 | |
157 | fMCEnergyFraction = clus.fMCEnergyFraction; | |
df9db588 | 158 | } |
159 | ||
160 | return *this; | |
161 | } | |
162 | ||
163 | //______________________________________________________________________________ | |
c8fe2783 | 164 | void AliAODCluster::SetPosition(Float_t *x) |
df9db588 | 165 | { |
166 | // set the position | |
c8fe2783 | 167 | |
df9db588 | 168 | if (x) { |
c8fe2783 | 169 | fPosition[0] = x[0]; |
170 | fPosition[1] = x[1]; | |
171 | fPosition[2] = x[2]; | |
df9db588 | 172 | } else { |
df9db588 | 173 | fPosition[0] = -999.; |
174 | fPosition[1] = -999.; | |
175 | fPosition[2] = -999.; | |
176 | } | |
177 | } | |
178 | ||
14d55e62 | 179 | //______________________________________________________________________________ |
c8fe2783 | 180 | UShort_t AliAODCluster::GetMostProbablePID() const |
14d55e62 | 181 | { |
182 | // Returns the most probable PID array element. | |
183 | ||
83dd7da3 | 184 | Int_t nPID = 13; |
c8fe2783 | 185 | UShort_t unknown = AliVCluster::kUnknown; |
186 | ||
7ba6f91a | 187 | UShort_t loc = unknown; |
188 | Double_t max = 0.; | |
189 | Bool_t allTheSame = kTRUE; | |
190 | ||
191 | for (Int_t iPID = 0; iPID < nPID; iPID++) { | |
192 | if (fPID[iPID] >= max) { | |
193 | if (fPID[iPID] > max) { | |
194 | allTheSame = kFALSE; | |
195 | max = fPID[iPID]; | |
196 | loc = (UShort_t)iPID; | |
197 | } else { | |
198 | allTheSame = kTRUE; | |
14d55e62 | 199 | } |
200 | } | |
14d55e62 | 201 | } |
7ba6f91a | 202 | return allTheSame ? unknown : loc; |
14d55e62 | 203 | } |
204 | ||
4cfedff1 | 205 | //______________________________________________________________________________ |
206 | void AliAODCluster::SetLabel(Int_t *label, UInt_t size) | |
207 | { | |
208 | if (label && size>0) { | |
209 | if (size != (UInt_t)fNLabel) { | |
210 | RemoveLabel(); | |
211 | fNLabel = size; | |
212 | fLabel = new Int_t[fNLabel]; | |
213 | } | |
214 | ||
215 | for (Int_t i = 0; i < fNLabel; i++) { | |
216 | fLabel[i] = label[i]; | |
217 | } | |
218 | } else { | |
219 | RemoveLabel(); | |
220 | } | |
221 | ||
222 | return; | |
223 | } | |
224 | ||
225 | //______________________________________________________________________________ | |
c8fe2783 | 226 | Int_t AliAODCluster::GetLabelAt(UInt_t i) const |
4cfedff1 | 227 | { |
228 | if (fLabel && i < (UInt_t)fNLabel) { | |
229 | return fLabel[i]; | |
230 | } else { | |
231 | return -999; | |
232 | } | |
233 | } | |
234 | ||
235 | //______________________________________________________________________________ | |
236 | void AliAODCluster::RemoveLabel() | |
237 | { | |
238 | delete[] fLabel; | |
239 | fLabel = 0x0; | |
240 | fNLabel = 0; | |
241 | ||
242 | return; | |
243 | } | |
244 | ||
df9db588 | 245 | //______________________________________________________________________________ |
a9255000 | 246 | void AliAODCluster::Print(Option_t* /* option */) const |
df9db588 | 247 | { |
a9255000 | 248 | // prints information about AliAODCluster |
df9db588 | 249 | |
4cfedff1 | 250 | printf("Cluster type: %d\n", GetType()); |
251 | printf(" energy = %f\n", E()); | |
252 | printf(" chi2 = %f\n", Chi2()); | |
c8fe2783 | 253 | const Double_t *pid = GetPID(); |
254 | printf("PID weights: photon %0.2f, pi0 %0.2f, electron %0.2f, conversion electron %0.2f\n, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n", | |
255 | pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0], | |
256 | pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon], | |
257 | pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton], | |
258 | pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]); | |
df9db588 | 259 | } |