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