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 AliRsnPIDWeightsMgr
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 "AliRsnPIDWeightsMgr.h"
35 ClassImp(AliRsnPIDWeightsMgr)
37 //_____________________________________________________________________________
38 AliRsnPIDWeightsMgr::AliRsnPIDWeightsMgr()
41 // Default and unique constructor which initializes arrays
44 for (i = 0; i < kDetectors; i++) {
45 for (j = 0; j < AliRsnPID::kSpecies; j++) fWeights[i][j] = 0.0;
52 //_____________________________________________________________________________
53 void AliRsnPIDWeightsMgr::SetDetectorWeights(EDetector det, Double_t *weights)
56 // Copy into the array the PID weights of a detector
60 if (!CheckBounds(det)) return;
61 for (i = 0; i < AliRsnPID::kSpecies; i++) fWeights[det][i] = weights[i];
64 //_____________________________________________________________________________
65 void AliRsnPIDWeightsMgr::SetAcceptanceRange(EDetector det, Double_t ptmin, Double_t ptmax)
68 // Sets a range in pt for which the PID weights of this detector
69 // are accepted in the global computation, in the case that one
70 // did not accept to use the global ESD pid.
73 if (!CheckBounds(det)) return;
75 // swap values if necessary
77 AliWarning("Values passed in wrong order. Swapping");
78 Double_t temp = ptmin;
82 fDetPtMin[det] = ptmin;
83 fDetPtMax[det] = ptmax;
86 //_____________________________________________________________________________
87 Double_t AliRsnPIDWeightsMgr::GetWeight(AliRsnPID::EType type, Double_t pt)
90 // Computes the global PID weights using the given ranges
93 if (type < 0 or type >= AliRsnPID::kSpecies) {
94 AliError("Index out of range");
100 for (i = 0; i < kDetectors; i++) {
101 //AliInfo(Form("weights[%d] = %f %f %f %f %f", i, fWeights[i][0], fWeights[i][1], fWeights[i][2], fWeights[i][3], fWeights[i][4], fWeights[i][5]));
102 if (!fUseDet[i]) continue;
103 if (pt < fDetPtMin[i] || pt > fDetPtMax[i]) continue;
104 prob *= fWeights[i][type];
110 //_____________________________________________________________________________
111 Bool_t AliRsnPIDWeightsMgr::CheckBounds(EDetector det)
117 if (det < 0 or det >= kDetectors) {
118 AliError("Index out of range");