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 //-------------------------------------------------------------------------
30 #include "AliESDtrack.h"
31 #include "AliRsnPIDDefESD.h"
33 ClassImp(AliRsnPIDDefESD)
35 //_____________________________________________________________________________
36 AliRsnPIDDefESD::AliRsnPIDDefESD() :
40 // Default constructor.
41 // By default, it is set for using ESD weights,
42 // so, values in other members are meaningless.
46 for (i = 0; i < kDetectors; i++) {
49 fUseHigher[i] = kTRUE;
53 //_____________________________________________________________________________
54 AliRsnPIDDefESD::AliRsnPIDDefESD(const AliRsnPIDDefESD& copy) :
56 fUseESDWeights(copy.fUseESDWeights)
60 // Implemented to manage passing of this object to functions
64 for (i = 0; i < kDetectors; i++) {
65 fUseDet[i] = copy.fUseDet[i];
66 fDivValue[i] = copy.fDivValue[i];
67 fUseHigher[i] = copy.fUseHigher[i];
71 //_____________________________________________________________________________
72 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)
164 // Computes the global PID weights using the given ranges
167 if (fUseESDWeights) {
168 track->GetESDpid(weights);
172 Double_t pt = track->Pt();
173 Double_t w[kDetectors][AliPID::kSPECIES];
174 track->GetITSpid(w[kITS]);
175 track->GetTPCpid(w[kTPC]);
176 track->GetTRDpid(w[kTRD]);
177 track->GetTOFpid(w[kTOF]);
178 track->GetHMPIDpid(w[kHMPID]);
181 for (i = 0; i < kDetectors; i++) {
182 // if (!fUseDet[i] || pt < fDivValue[i])
183 if (!fUseDet[i] || !CheckDivValue((EDetector)i,pt)) {
184 for (j = 0; j < AliPID::kSPECIES; j++) {
190 for (i = 0; i < AliPID::kSPECIES; i++) {
191 weights[i] = w[kITS][i] * w[kTPC][i] * w[kTRD][i] * w[kTOF][i] * w[kHMPID][i];
195 //_____________________________________________________________________________
196 void AliRsnPIDDefESD::PrintStatus()
199 // Print informations about this object configurations
202 AliInfo("===== PIDDef status messages -- BEGIN");
204 if (fUseESDWeights) {
205 AliInfo("Using ESD weights");
207 AliInfo("NOT using ESD weights");
211 for (i = 0; i < kDetectors; i++) {
212 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")));
215 AliInfo("===== PIDDef status messages -- END");
218 //_____________________________________________________________________________
219 const char* AliRsnPIDDefESD::DetName(EDetector det) const
222 // Detector name for messages
226 case kITS: return "ITS";
227 case kTPC: return "TPC";
228 case kTRD: return "TRD";
229 case kTOF: return "TOF";
230 case kHMPID: return "HMPID";
231 default: return "undef";
235 //_____________________________________________________________________________
236 const char* AliRsnPIDDefESD::SchemeName()
239 // Scheme name for messages
246 for (i = 0; i < kDetectors; i++)
248 if (ndet > 0) out += '_';
249 out.Append(DetName((EDetector)i));
255 //_____________________________________________________________________________
256 void AliRsnPIDDefESD::SetDivValue(EDetector det, Double_t value, Bool_t userHigher)
259 // Sets div.value properties for detector
261 if (CheckBounds(det)) {
262 fDivValue[det] = value;
263 fUseHigher[det] = userHigher;
267 //_____________________________________________________________________________
268 Bool_t AliRsnPIDDefESD::CheckDivValue(EDetector det,Double_t value)
271 // Sets div.value properties for detector
273 if (CheckBounds(det)) {
274 if (fUseHigher[det]) {
275 if (value > fDivValue[det]) return kTRUE;
278 if (value < fDivValue[det]) return kTRUE;