1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //-------------------------------------------------------------------------
17 // Class AliRsnPIDDefESD
18 // -------------------
19 // Simple collection of reconstructed tracks
20 // selected from an ESD event
21 // to be used for analysis.
22 // .........................................
24 // author: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
25 //-------------------------------------------------------------------------
29 #include <TClonesArray.h>
30 #include <TDatabasePDG.h>
33 #include "AliESDtrack.h"
34 #include "AliRsnDaughter.h"
35 #include "AliRsnPIDDefESD.h"
37 ClassImp(AliRsnPIDDefESD)
39 //_____________________________________________________________________________
40 AliRsnPIDDefESD::AliRsnPIDDefESD() : fUseESDWeights(kTRUE) {
42 // Default constructor.
43 // By default, it is set for using ESD weights,
44 // so, values in other members are meaningless.
48 for (i = 0; i < kDetectors; i++) {
51 fUseHigher[i] = kTRUE;
55 //_____________________________________________________________________________
56 AliRsnPIDDefESD::AliRsnPIDDefESD(const AliRsnPIDDefESD& copy) :
58 fUseESDWeights(copy.fUseESDWeights) {
61 // Implemented to manage passing of this object to functions
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];
72 //_____________________________________________________________________________
73 void AliRsnPIDDefESD::SetScheme(EScheme scheme, Double_t divValue) {
75 // Set one of the predefined schemes
80 fUseESDWeights = kTRUE;
83 fUseESDWeights = kFALSE;
86 SetDivValue(kITS, 0.0);
89 fUseESDWeights = kFALSE;
92 SetDivValue(kTPC, 0.0);
95 fUseESDWeights = kFALSE;
98 SetDivValue(kTOF, 0.0);
100 case kSchemeITSandTPC:
101 fUseESDWeights = kFALSE;
105 SetDivValue(kITS, 0.0);
106 SetDivValue(kTPC, 0.0);
108 case kSchemeITSandTOF:
109 fUseESDWeights = kFALSE;
113 SetDivValue(kITS, 0.0);
114 SetDivValue(kTOF, 0.0);
116 case kSchemeTPCandTOF:
117 fUseESDWeights = kFALSE;
121 SetDivValue(kTPC, 0.0);
122 SetDivValue(kTOF, 0.0);
124 case kSchemeITSandTPCandTOF:
125 fUseESDWeights = kFALSE;
130 SetDivValue(kITS, 0.0);
131 SetDivValue(kTPC, 0.0);
132 SetDivValue(kTOF, 0.0);
134 case kSchemeITSandTPCandTOFwithSP:
135 fUseESDWeights = kFALSE;
140 SetDivValue(kITS, 0.0);
141 SetDivValue(kTPC, 0.0);
142 SetDivValue(kTOF, divValue);
144 case kSchemeITSandTPCorTOFwithSP:
145 fUseESDWeights = kFALSE;
150 SetDivValue(kITS, divValue, kFALSE);
151 SetDivValue(kTPC, divValue, kFALSE);
152 SetDivValue(kTOF, divValue, kTRUE);
155 AliWarning("PID scheme unrecognized. Set to ESD");
156 fUseESDWeights = kTRUE;
160 //_____________________________________________________________________________
161 void AliRsnPIDDefESD::ComputeWeights(AliESDtrack *track, Double_t *weights) {
163 // Computes the global PID weights using the given ranges
166 if (fUseESDWeights) {
167 track->GetESDpid(weights);
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]);
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++) {
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];
194 //_____________________________________________________________________________
195 void AliRsnPIDDefESD::PrintStatus() {
197 // Print informations about this object configurations
200 AliInfo("===== PIDDef status messages -- BEGIN");
202 if (fUseESDWeights) {
203 AliInfo("Using ESD weights");
205 AliInfo("NOT using ESD weights");
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")));
213 AliInfo("===== PIDDef status messages -- END");
216 //_____________________________________________________________________________
217 const char* AliRsnPIDDefESD::DetName(EDetector det) {
219 // Detector name for messages
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";
232 //_____________________________________________________________________________
233 const char* AliRsnPIDDefESD::SchemeName() {
235 // Scheme name for messages
242 for (i = 0; i < kDetectors; i++)
245 if (ndet > 0) out += '_';
246 out.Append(DetName((EDetector)i));
252 //_____________________________________________________________________________
253 void AliRsnPIDDefESD::SetDivValue(EDetector det, Double_t value, Bool_t userHigher) {
255 // Sets div.value properties for detector
257 if (CheckBounds(det)) {
258 fDivValue[det] = value;
259 fUseHigher[det] = userHigher;
263 //_____________________________________________________________________________
264 Bool_t AliRsnPIDDefESD::CheckDivValue(EDetector det,Double_t value) {
266 // Sets div.value properties for detector
268 if (CheckBounds(det)) {
269 if (fUseHigher[det]) {
270 if (value > fDivValue[det]) return kTRUE;
273 if (value < fDivValue[det]) return kTRUE;