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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////
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
36 ///////////////////////////////////////////////////////////////////////////
38 #include "AliPIDValues.h"
40 #include "AliDetectorPID.h"
42 ClassImp(AliDetectorPID)
45 AliDetectorPID::AliDetectorPID() :
47 fArrNsigmas("AliPIDValues",AliPIDResponse::kNdetectors),
48 fArrRawProbabilities("AliPIDValues",AliPIDResponse::kNdetectors)
51 // default constructor
56 //_______________________________________________________________________
57 AliDetectorPID::AliDetectorPID(const AliDetectorPID &pid) :
59 fArrNsigmas(pid.fArrNsigmas),
60 fArrRawProbabilities(pid.fArrRawProbabilities)
68 //_______________________________________________________________________
69 AliDetectorPID::~AliDetectorPID()
75 fArrRawProbabilities.Delete();
78 //_______________________________________________________________________
79 AliDetectorPID& AliDetectorPID::operator= (const AliDetectorPID &pid)
82 // assignment operator
85 if (this==&pid) return *this;
87 TObject::operator=(pid);
90 fArrRawProbabilities.Clear();
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);
97 val=static_cast<AliPIDValues*>(pid.fArrRawProbabilities.UncheckedAt(idet));
98 if (val) new (fArrRawProbabilities[idet]) AliPIDValues(*val);
104 //_______________________________________________________________________
105 void AliDetectorPID::SetRawProbability(AliPIDResponse::EDetector det, const Double_t prob[],
106 Int_t nspecies, AliPIDResponse::EDetPidStatus status)
109 // set raw probabilities for nspecies for 'det'ector
112 AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt(det));
114 val=new (fArrRawProbabilities[(Int_t)det]) AliPIDValues;
116 val->SetValues(prob,nspecies,status);
119 //_______________________________________________________________________
120 void AliDetectorPID::SetNumberOfSigmas(AliPIDResponse::EDetector det, const Double_t nsig[], Int_t nspecies)
123 // set number of sigmas for nspecies for 'det'ector
126 AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt(det));
128 val=new (fArrNsigmas[(Int_t)det]) AliPIDValues;
130 val->SetValues(nsig,nspecies);
133 //_______________________________________________________________________
134 AliPIDResponse::EDetPidStatus AliDetectorPID::GetRawProbability(AliPIDResponse::EDetector det, Double_t prob[], Int_t nspecies) const
137 // get raw probabilities for nspecies for 'det'ector
140 AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt((Int_t)det));
142 for (Int_t i=0; i<nspecies; ++i) prob[i]=1.; //TODO: Is '1' the correct values or better 1/nspecies
143 return AliPIDResponse::kDetNoSignal;
146 return val->GetValues(prob,nspecies);
149 //_______________________________________________________________________
150 void AliDetectorPID::GetNumberOfSigmas(AliPIDResponse::EDetector det, Double_t nsig[], Int_t nspecies) const
153 // get number of sigmas for nspecies for detector 'det'
156 AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt((Int_t)det));
158 for (Int_t i=0; i<nspecies; ++i) nsig[i]=-999.;
162 val->GetValues(nsig,nspecies);
165 //_______________________________________________________________________
166 Double_t AliDetectorPID::GetRawProbability(AliPIDResponse::EDetector det, AliPID::EParticleType type) const
169 // get 'det'ector raw probability for particle 'type'
172 AliPIDValues *val=static_cast<AliPIDValues*>(fArrRawProbabilities.UncheckedAt((Int_t)det));
174 return 0.; //TODO: Is '0' the correct value?
177 return val->GetValue(type);
180 //_______________________________________________________________________
181 Double_t AliDetectorPID::GetNumberOfSigmas(AliPIDResponse::EDetector det, AliPID::EParticleType type) const
184 // get 'det'ector number of sigmas for particle 'type'
186 AliPIDValues *val=static_cast<AliPIDValues*>(fArrNsigmas.UncheckedAt((Int_t)det));
188 return -999.; //TODO: Is '-999.' the correct value?
191 return val->GetValue(type);