]>
Commit | Line | Data |
---|---|---|
8a764dbc | 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 | ||
17 | /////////////////////////////////////////////////////////////////////////// | |
18 | // Detector PID // | |
19 | // // | |
20 | // // | |
21 | /* | |
22 | ||
23 | This class is supposed to store the detector pid values for all detectors | |
24 | and all particle species. | |
25 | It is meant to be used to buffer the PID values as a transient object in | |
26 | AliESDtrack and AliAODTrack, respectively. | |
27 | The calculation filling and association to the track is done in | |
28 | AliAnalysisTaskPID response. | |
29 | The idea of this object is to save computing time in an analysis train with | |
30 | many analyses where access to pid is done often | |
31 | ||
32 | ||
33 | ||
34 | */ | |
35 | // // | |
36 | /////////////////////////////////////////////////////////////////////////// | |
37 | ||
38 | #include "AliPIDValues.h" | |
39 | ||
40 | #include "AliDetectorPID.h" | |
41 | ||
42 | ClassImp(AliDetectorPID) | |
43 | ||
44 | ||
45 | AliDetectorPID::AliDetectorPID() : | |
46 | TObject(), | |
47 | fArrNsigmas("AliPIDValues",AliPIDResponse::kNdetectors), | |
48 | fArrRawProbabilities("AliPIDValues",AliPIDResponse::kNdetectors) | |
49 | { | |
50 | // | |
51 | // default constructor | |
52 | // | |
53 | ||
54 | } | |
55 | ||
56 | //_______________________________________________________________________ | |
57 | AliDetectorPID::AliDetectorPID(const AliDetectorPID &pid) : | |
58 | TObject(pid), | |
59 | fArrNsigmas(pid.fArrNsigmas), | |
60 | fArrRawProbabilities(pid.fArrRawProbabilities) | |
61 | { | |
62 | // | |
63 | // copy constructor | |
64 | // | |
65 | ||
66 | } | |
67 | ||
68 | //_______________________________________________________________________ | |
69 | AliDetectorPID::~AliDetectorPID() | |
70 | { | |
71 | // | |
72 | // destructor | |
73 | // | |
74 | fArrNsigmas.Delete(); | |
75 | fArrRawProbabilities.Delete(); | |
76 | } | |
77 | ||
78 | //_______________________________________________________________________ | |
79 | AliDetectorPID& AliDetectorPID::operator= (const AliDetectorPID &pid) | |
80 | { | |
81 | // | |
82 | // assignment operator | |
83 | // | |
84 | ||
85 | if (this==&pid) return *this; | |
86 | ||
87 | TObject::operator=(pid); | |
88 | ||
89 | fArrNsigmas.Clear(); | |
90 | fArrRawProbabilities.Clear(); | |
91 | ||
92 | AliPIDValues *val=0x0; | |
93 | for (Int_t idet=0; idet<(Int_t)AliPIDResponse::kNdetectors; ++idet){ | |
94 | val=static_cast<AliPIDValues*>(pid.fArrNsigmas.UncheckedAt(idet)); | |
95 | if (val) new (fArrNsigmas[idet]) AliPIDValues(*val); | |
96 | ||
97 | val=static_cast<AliPIDValues*>(pid.fArrRawProbabilities.UncheckedAt(idet)); | |
98 | if (val) new (fArrRawProbabilities[idet]) AliPIDValues(*val); | |
99 | } | |
100 | ||
101 | return *this; | |
102 | } | |
103 | ||
104 | //_______________________________________________________________________ | |
105 | void AliDetectorPID::SetRawProbability(AliPIDResponse::EDetector det, const Double_t prob[], | |
106 | Int_t nspecies, AliPIDResponse::EDetPidStatus status) | |
107 | { | |
108 | // | |
109 | // set raw probabilities for nspecies for 'det'ector | |
110 | // | |
111 | ||
112 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt(det)); | |
113 | if (!val) | |
114 | val=new (fArrRawProbabilities[(Int_t)det]) AliPIDValues; | |
115 | ||
116 | val->SetValues(prob,nspecies,status); | |
117 | } | |
118 | ||
119 | //_______________________________________________________________________ | |
355b831b | 120 | void AliDetectorPID::SetNumberOfSigmas(AliPIDResponse::EDetector det, const Double_t nsig[], Int_t nspecies, |
121 | AliPIDResponse::EDetPidStatus status) | |
8a764dbc | 122 | { |
123 | // | |
124 | // set number of sigmas for nspecies for 'det'ector | |
125 | // | |
126 | ||
127 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt(det)); | |
128 | if (!val) | |
129 | val=new (fArrNsigmas[(Int_t)det]) AliPIDValues; | |
130 | ||
131 | val->SetValues(nsig,nspecies); | |
355b831b | 132 | val->SetPIDStatus(status); |
8a764dbc | 133 | } |
134 | ||
135 | //_______________________________________________________________________ | |
136 | AliPIDResponse::EDetPidStatus AliDetectorPID::GetRawProbability(AliPIDResponse::EDetector det, Double_t prob[], Int_t nspecies) const | |
137 | { | |
138 | // | |
139 | // get raw probabilities for nspecies for 'det'ector | |
140 | // | |
141 | ||
142 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt((Int_t)det)); | |
143 | if (!val) { | |
144 | for (Int_t i=0; i<nspecies; ++i) prob[i]=1.; //TODO: Is '1' the correct values or better 1/nspecies | |
145 | return AliPIDResponse::kDetNoSignal; | |
146 | } | |
147 | ||
148 | return val->GetValues(prob,nspecies); | |
149 | } | |
150 | ||
151 | //_______________________________________________________________________ | |
355b831b | 152 | AliPIDResponse::EDetPidStatus AliDetectorPID::GetNumberOfSigmas(AliPIDResponse::EDetector det, Double_t nsig[], Int_t nspecies) const |
8a764dbc | 153 | { |
8a764dbc | 154 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt((Int_t)det)); |
155 | if (!val) { | |
156 | for (Int_t i=0; i<nspecies; ++i) nsig[i]=-999.; | |
355b831b | 157 | return AliPIDResponse::kDetNoSignal; |
8a764dbc | 158 | } |
355b831b | 159 | |
160 | return val->GetValues(nsig,nspecies); | |
8a764dbc | 161 | } |
162 | ||
163 | //_______________________________________________________________________ | |
164 | Double_t AliDetectorPID::GetRawProbability(AliPIDResponse::EDetector det, AliPID::EParticleType type) const | |
165 | { | |
166 | // | |
167 | // get 'det'ector raw probability for particle 'type' | |
168 | // | |
169 | ||
170 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt((Int_t)det)); | |
171 | if (!val) { | |
172 | return 0.; //TODO: Is '0' the correct value? | |
173 | } | |
174 | ||
175 | return val->GetValue(type); | |
176 | } | |
177 | ||
178 | //_______________________________________________________________________ | |
179 | Double_t AliDetectorPID::GetNumberOfSigmas(AliPIDResponse::EDetector det, AliPID::EParticleType type) const | |
180 | { | |
181 | // | |
182 | // get 'det'ector number of sigmas for particle 'type' | |
183 | // | |
184 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt((Int_t)det)); | |
185 | if (!val) { | |
186 | return -999.; //TODO: Is '-999.' the correct value? | |
187 | } | |
188 | ||
189 | return val->GetValue(type); | |
190 | } | |
191 | ||
355b831b | 192 | //_______________________________________________________________________ |
193 | AliPIDResponse::EDetPidStatus AliDetectorPID::GetRawProbability(AliPIDResponse::EDetector det, AliPID::EParticleType type, Double_t &prob) const | |
194 | { | |
195 | // | |
196 | // get 'det'ector raw probability for particle 'type' | |
197 | // | |
198 | ||
199 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt((Int_t)det)); | |
200 | if (!val) { | |
201 | prob=0.; | |
202 | return AliPIDResponse::kDetNoSignal; | |
203 | } | |
204 | ||
205 | prob=val->GetValue(type); | |
206 | return val->GetPIDStatus(); | |
207 | } | |
208 | ||
209 | //_______________________________________________________________________ | |
210 | AliPIDResponse::EDetPidStatus AliDetectorPID::GetNumberOfSigmas(AliPIDResponse::EDetector det, AliPID::EParticleType type, Double_t &nsig) const | |
211 | { | |
212 | // | |
213 | // get 'det'ector number of sigmas for particle 'type' | |
214 | // | |
215 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt((Int_t)det)); | |
216 | if (!val) { | |
217 | nsig=-999.; | |
218 | return AliPIDResponse::kDetNoSignal; | |
219 | } | |
220 | ||
221 | nsig=val->GetValue(type); | |
222 | return val->GetPIDStatus(); | |
223 | } | |
224 | ||
225 | ||
226 | //_______________________________________________________________________ | |
227 | AliPIDResponse::EDetPidStatus AliDetectorPID::GetPIDStatus(AliPIDResponse::EDetector det) const | |
228 | { | |
229 | // | |
230 | // return the detector PID status | |
231 | // | |
232 | ||
233 | AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt((Int_t)det)); | |
234 | if (!val) val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt((Int_t)det)); | |
235 | if (val) return val->GetPIDStatus(); | |
236 | ||
237 | return AliPIDResponse::kDetNoSignal; | |
238 | } | |
8a764dbc | 239 |