]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnPIDDefESD.cxx
removed obsolete commented methods
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPIDDefESD.cxx
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 //                      Class AliRsnPIDDefESD
18 //                     -------------------
19 //           Simple collection of reconstructed tracks
20 //           selected from an ESD event
21 //           to be used for analysis.
22 //           .........................................
23 //
24 // author: A. Pulvirenti             (email: alberto.pulvirenti@ct.infn.it)
25 //-------------------------------------------------------------------------
26
27 #include <TMath.h>
28 #include <TString.h>
29 #include <TClonesArray.h>
30 #include <TDatabasePDG.h>
31
32 #include "AliLog.h"
33 #include "AliESDtrack.h"
34 #include "AliRsnDaughter.h"
35 #include "AliRsnPIDDefESD.h"
36
37 ClassImp(AliRsnPIDDefESD)
38
39 //_____________________________________________________________________________
40 AliRsnPIDDefESD::AliRsnPIDDefESD() : fUseESDWeights(kTRUE) {
41 //
42 // Default constructor.
43 // By default, it is set for using ESD weights,
44 // so, values in other members are meaningless.
45 //
46
47   Int_t i;
48   for (i = 0; i < kDetectors; i++) {
49     fUseDet[i] = kTRUE;
50     fDivValue[i] = 0.0;
51     fUseHigher[i] = kTRUE;
52   }
53 }
54
55 //_____________________________________________________________________________
56 AliRsnPIDDefESD::AliRsnPIDDefESD(const AliRsnPIDDefESD& copy) :
57     TObject(copy),
58     fUseESDWeights(copy.fUseESDWeights) {
59 //
60 // Copy constructor.
61 // Implemented to manage passing of this object to functions
62 //
63
64   Int_t i;
65   for (i = 0; i < kDetectors; i++) {
66     fUseDet[i] = copy.fUseDet[i];
67     fDivValue[i] = copy.fDivValue[i];
68     fUseHigher[i] = copy.fUseHigher[i];
69   }
70 }
71
72 //_____________________________________________________________________________
73 void AliRsnPIDDefESD::SetScheme(EScheme scheme, Double_t divValue) {
74 //
75 // Set one of the predefined schemes
76 //
77
78   switch (scheme) {
79     case kSchemeESD:
80       fUseESDWeights = kTRUE;
81       break;
82     case kSchemeITS:
83       fUseESDWeights = kFALSE;
84       ExcludeAll();
85       IncludeDet(kITS);
86       SetDivValue(kITS, 0.0);
87       break;
88     case kSchemeTPC:
89       fUseESDWeights = kFALSE;
90       ExcludeAll();
91       IncludeDet(kTPC);
92       SetDivValue(kTPC, 0.0);
93       break;
94     case kSchemeTOF:
95       fUseESDWeights = kFALSE;
96       ExcludeAll();
97       IncludeDet(kTOF);
98       SetDivValue(kTOF, 0.0);
99       break;
100     case kSchemeITSandTPC:
101       fUseESDWeights = kFALSE;
102       ExcludeAll();
103       IncludeDet(kITS);
104       IncludeDet(kTPC);
105       SetDivValue(kITS, 0.0);
106       SetDivValue(kTPC, 0.0);
107       break;
108     case kSchemeITSandTOF:
109       fUseESDWeights = kFALSE;
110       ExcludeAll();
111       IncludeDet(kITS);
112       IncludeDet(kTOF);
113       SetDivValue(kITS, 0.0);
114       SetDivValue(kTOF, 0.0);
115       break;
116     case kSchemeTPCandTOF:
117       fUseESDWeights = kFALSE;
118       ExcludeAll();
119       IncludeDet(kTPC);
120       IncludeDet(kTOF);
121       SetDivValue(kTPC, 0.0);
122       SetDivValue(kTOF, 0.0);
123       break;
124     case kSchemeITSandTPCandTOF:
125       fUseESDWeights = kFALSE;
126       ExcludeAll();
127       IncludeDet(kITS);
128       IncludeDet(kTPC);
129       IncludeDet(kTOF);
130       SetDivValue(kITS, 0.0);
131       SetDivValue(kTPC, 0.0);
132       SetDivValue(kTOF, 0.0);
133       break;
134     case kSchemeITSandTPCandTOFwithSP:
135       fUseESDWeights = kFALSE;
136       ExcludeAll();
137       IncludeDet(kITS);
138       IncludeDet(kTPC);
139       IncludeDet(kTOF);
140       SetDivValue(kITS, 0.0);
141       SetDivValue(kTPC, 0.0);
142       SetDivValue(kTOF, divValue);
143       break;
144     case kSchemeITSandTPCorTOFwithSP:
145       fUseESDWeights = kFALSE;
146       ExcludeAll();
147       IncludeDet(kITS);
148       IncludeDet(kTPC);
149       IncludeDet(kTOF);
150       SetDivValue(kITS, divValue, kFALSE);
151       SetDivValue(kTPC, divValue, kFALSE);
152       SetDivValue(kTOF, divValue, kTRUE);
153       break;
154     default:
155       AliWarning("PID scheme unrecognized. Set to ESD");
156       fUseESDWeights = kTRUE;
157   }
158 }
159
160 //_____________________________________________________________________________
161 void AliRsnPIDDefESD::ComputeWeights(AliESDtrack *track, Double_t *weights) {
162 //
163 // Computes the global PID weights using the given ranges
164 //
165
166   if (fUseESDWeights) {
167     track->GetESDpid(weights);
168     return;
169   }
170
171   Double_t pt = track->Pt();
172   Double_t w[kDetectors][AliPID::kSPECIES];
173   track->GetITSpid(w[kITS]);
174   track->GetTPCpid(w[kTPC]);
175   track->GetTRDpid(w[kTRD]);
176   track->GetTOFpid(w[kTOF]);
177   track->GetHMPIDpid(w[kHMPID]);
178
179   Int_t i, j;
180   for (i = 0; i < kDetectors; i++) {
181 //     if (!fUseDet[i] || pt < fDivValue[i])
182     if (!fUseDet[i] || !CheckDivValue((EDetector)i,pt)) {
183       for (j = 0; j < AliPID::kSPECIES; j++) {
184         w[i][j] = 1.0;
185       }
186     }
187   }
188
189   for (i = 0; i < AliPID::kSPECIES; i++) {
190     weights[i] = w[kITS][i] * w[kTPC][i] * w[kTRD][i] * w[kTOF][i] * w[kHMPID][i];
191   }
192 }
193
194 //_____________________________________________________________________________
195 void AliRsnPIDDefESD::PrintStatus() {
196 //
197 // Print informations about this object configurations
198 //
199
200   AliInfo("===== PIDDef status messages -- BEGIN");
201
202   if (fUseESDWeights) {
203     AliInfo("Using ESD weights");
204   } else {
205     AliInfo("NOT using ESD weights");
206   }
207
208   Int_t i;
209   for (i = 0; i < kDetectors; i++) {
210     AliInfo(Form("Detector name: %s -- accepted: %s -- divValue = %3.1f useHigher = %s", DetName((EDetector)i), (fUseDet[i]?"YES":"NO"), fDivValue[i],(fUseHigher[i]?"YES":"NO")));
211   }
212
213   AliInfo("===== PIDDef status messages -- END");
214 }
215
216 //_____________________________________________________________________________
217 const char* AliRsnPIDDefESD::DetName(EDetector det) {
218 //
219 // Detector name for messages
220 //
221
222   switch (det) {
223     case kITS: return "ITS";
224     case kTPC: return "TPC";
225     case kTRD: return "TRD";
226     case kTOF: return "TOF";
227     case kHMPID: return "HMPID";
228     default: return "undef";
229   }
230 }
231
232 //_____________________________________________________________________________
233 const char* AliRsnPIDDefESD::SchemeName() {
234 //
235 // Scheme name for messages
236 //
237
238   TString out;
239
240   Int_t i, ndet = 0;
241
242   for (i = 0; i < kDetectors; i++)
243     if (fUseDet[i])
244     {
245       if (ndet > 0) out += '_';
246       out.Append(DetName((EDetector)i));
247     }
248
249   return out.Data();
250 }
251
252 //_____________________________________________________________________________
253 void AliRsnPIDDefESD::SetDivValue(EDetector det, Double_t value, Bool_t userHigher) {
254 //
255 // Sets div.value properties for detector
256 //
257   if (CheckBounds(det)) {
258     fDivValue[det] = value;
259     fUseHigher[det] = userHigher;
260   }
261 }
262
263 //_____________________________________________________________________________
264 Bool_t AliRsnPIDDefESD::CheckDivValue(EDetector det,Double_t value) {
265 //
266 // Sets div.value properties for detector
267 //
268   if (CheckBounds(det)) {
269     if (fUseHigher[det]) {
270       if (value > fDivValue[det]) return kTRUE;
271       else return kFALSE;
272     } else {
273       if (value < fDivValue[det]) return kTRUE;
274       else return kFALSE;
275     }
276   }
277
278   return kTRUE;
279 }