]>
Commit | Line | Data |
---|---|---|
809a4336 | 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 | **************************************************************************/ | |
50685501 | 15 | // |
16 | // Class for TPC PID | |
17 | // Implements the abstract base class AliHFEpidBase | |
18 | // | |
19 | // Class contains TPC specific cuts and QA histograms | |
20 | // Two selection strategies are offered: Selection of certain value | |
21 | // regions in the TPC dE/dx (by IsSelected), and likelihoods | |
22 | // | |
23 | // Authors: | |
24 | // | |
25 | // Markus Fasel <M.Fasel@gsi.de> | |
26 | // Markus Heide <mheide@uni-muenster.de> | |
27 | // | |
faee3b18 | 28 | #include <TF1.h> |
809a4336 | 29 | #include <TMath.h> |
30 | ||
6555e2ad | 31 | #include "AliAODPid.h" |
722347d8 | 32 | #include "AliAODTrack.h" |
33 | #include "AliAODMCParticle.h" | |
809a4336 | 34 | #include "AliESDtrack.h" |
35 | #include "AliExternalTrackParam.h" | |
36 | #include "AliLog.h" | |
722347d8 | 37 | #include "AliMCParticle.h" |
809a4336 | 38 | #include "AliPID.h" |
8c1c76e9 | 39 | #include "AliPIDResponse.h" |
809a4336 | 40 | |
41 | #include "AliHFEpidTPC.h" | |
3a72645a | 42 | #include "AliHFEpidQAmanager.h" |
809a4336 | 43 | |
faee3b18 | 44 | ClassImp(AliHFEpidTPC) |
809a4336 | 45 | |
3a72645a | 46 | //___________________________________________________________________ |
47 | AliHFEpidTPC::AliHFEpidTPC() : | |
48 | // add a list here | |
49 | AliHFEpidBase() | |
3a72645a | 50 | , fLineCrossingsEnabled(0) |
e156c3bb | 51 | , fHasCutModel(kFALSE) |
3a72645a | 52 | , fNsigmaTPC(3) |
53 | , fRejectionEnabled(0) | |
3a72645a | 54 | { |
55 | // | |
56 | // default constructor | |
57 | // | |
e156c3bb | 58 | |
59 | memset(fkUpperSigmaCut, 0, sizeof(const TF1 *) * 12); | |
60 | memset(fkLowerSigmaCut, 0, sizeof(const TF1 *) * 12); | |
61 | ||
bf892a6a | 62 | memset(fRejection, 0, sizeof(Float_t) * 4 * AliPID::kSPECIES); |
63 | memset(fLineCrossingSigma, 0, sizeof(Double_t) * AliPID::kSPECIES); | |
64 | memset(fPAsigCut, 0, sizeof(Float_t) * 2); | |
65 | memset(fNAsigmaTPC, 0, sizeof(Float_t) * 2); | |
66 | ||
3a72645a | 67 | } |
68 | ||
809a4336 | 69 | //___________________________________________________________________ |
70 | AliHFEpidTPC::AliHFEpidTPC(const char* name) : | |
71 | // add a list here | |
9bcfd1ab | 72 | AliHFEpidBase(name) |
809a4336 | 73 | , fLineCrossingsEnabled(0) |
e156c3bb | 74 | , fHasCutModel(kFALSE) |
75d81601 | 75 | , fNsigmaTPC(3) |
0792aa82 | 76 | , fRejectionEnabled(0) |
809a4336 | 77 | { |
78 | // | |
79 | // default constructor | |
80 | // | |
bf892a6a | 81 | // |
e156c3bb | 82 | memset(fkUpperSigmaCut, 0, sizeof(const TF1 *) * 12); |
83 | memset(fkLowerSigmaCut, 0, sizeof(const TF1 *) * 12); | |
84 | ||
bf892a6a | 85 | memset(fRejection, 0, sizeof(Float_t) * 4 * AliPID::kSPECIES); |
809a4336 | 86 | memset(fLineCrossingSigma, 0, sizeof(Double_t) * AliPID::kSPECIES); |
722347d8 | 87 | memset(fPAsigCut, 0, sizeof(Float_t) * 2); |
88 | memset(fNAsigmaTPC, 0, sizeof(Float_t) * 2); | |
809a4336 | 89 | } |
90 | ||
91 | //___________________________________________________________________ | |
92 | AliHFEpidTPC::AliHFEpidTPC(const AliHFEpidTPC &ref) : | |
9bcfd1ab | 93 | AliHFEpidBase("") |
809a4336 | 94 | , fLineCrossingsEnabled(0) |
e156c3bb | 95 | , fHasCutModel(ref.fHasCutModel) |
809a4336 | 96 | , fNsigmaTPC(2) |
0792aa82 | 97 | , fRejectionEnabled(0) |
809a4336 | 98 | { |
99 | // | |
100 | // Copy constructor | |
101 | // | |
102 | ref.Copy(*this); | |
103 | } | |
104 | ||
105 | //___________________________________________________________________ | |
106 | AliHFEpidTPC &AliHFEpidTPC::operator=(const AliHFEpidTPC &ref){ | |
107 | // | |
108 | // Assignment operator | |
109 | // | |
110 | if(this != &ref){ | |
111 | ref.Copy(*this); | |
112 | } | |
113 | return *this; | |
114 | } | |
75d81601 | 115 | //___________________________________________________________________ |
809a4336 | 116 | void AliHFEpidTPC::Copy(TObject &o) const{ |
117 | // | |
118 | // Copy function | |
119 | // called in copy constructor and assigment operator | |
120 | // | |
121 | AliHFEpidTPC &target = dynamic_cast<AliHFEpidTPC &>(o); | |
122 | ||
123 | target.fLineCrossingsEnabled = fLineCrossingsEnabled; | |
e156c3bb | 124 | target.fHasCutModel = fHasCutModel; |
809a4336 | 125 | target.fNsigmaTPC = fNsigmaTPC; |
0792aa82 | 126 | target.fRejectionEnabled = fRejectionEnabled; |
e156c3bb | 127 | |
128 | memcpy(target.fkUpperSigmaCut, fkUpperSigmaCut, sizeof(const TF1 *) * 12); | |
129 | memcpy(target.fkLowerSigmaCut, fkLowerSigmaCut, sizeof(const TF1 *) * 12); | |
130 | ||
75d81601 | 131 | memcpy(target.fLineCrossingSigma, fLineCrossingSigma, sizeof(Double_t) * AliPID::kSPECIES); |
722347d8 | 132 | memcpy(target.fPAsigCut, fPAsigCut, sizeof(Float_t) * 2); |
133 | memcpy(target.fNAsigmaTPC, fNAsigmaTPC, sizeof(Float_t) * 2); | |
134 | ||
809a4336 | 135 | AliHFEpidBase::Copy(target); |
136 | } | |
137 | ||
138 | //___________________________________________________________________ | |
139 | AliHFEpidTPC::~AliHFEpidTPC(){ | |
140 | // | |
141 | // Destructor | |
142 | // | |
809a4336 | 143 | } |
144 | ||
145 | //___________________________________________________________________ | |
8c1c76e9 | 146 | Bool_t AliHFEpidTPC::InitializePID(Int_t /*run*/){ |
809a4336 | 147 | // |
148 | // Add TPC dE/dx Line crossings | |
149 | // | |
75d81601 | 150 | //AddTPCdEdxLineCrossing(AliPID::kKaon, 0.3, 0.018); |
151 | //AddTPCdEdxLineCrossing(AliPID::kProton, 0.9, 0.054); | |
809a4336 | 152 | return kTRUE; |
153 | } | |
154 | ||
155 | //___________________________________________________________________ | |
6555e2ad | 156 | Int_t AliHFEpidTPC::IsSelected(const AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) const |
809a4336 | 157 | { |
158 | // | |
159 | // For the TPC pid we use the 2-sigma band around the bethe bloch curve | |
160 | // for electrons | |
161 | // exclusion of the crossing points | |
162 | // | |
3a72645a | 163 | |
8c1c76e9 | 164 | if(!fkPIDResponse) return 0; |
3a72645a | 165 | |
166 | // QA before selection | |
167 | if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTPCpid, AliHFEdetPIDqa::kBeforePID); | |
e3fc062d | 168 | AliDebug(1, "Doing TPC PID based on n-Sigma cut approach"); |
3a72645a | 169 | AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; |
8c1c76e9 | 170 | Float_t nsigma = fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron); |
3a72645a | 171 | AliDebug(1, Form("TPC NSigma: %f", nsigma)); |
809a4336 | 172 | // exclude crossing points: |
173 | // Determine the bethe values for each particle species | |
809a4336 | 174 | Bool_t isLineCrossing = kFALSE; |
175 | for(Int_t ispecies = 0; ispecies < AliPID::kSPECIES; ispecies++){ | |
75d81601 | 176 | if(ispecies == AliPID::kElectron) continue; |
809a4336 | 177 | if(!(fLineCrossingsEnabled & 1 << ispecies)) continue; |
8c1c76e9 | 178 | if(TMath::Abs(fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), (AliPID::EParticleType)ispecies)) < fLineCrossingSigma[ispecies] && TMath::Abs(nsigma) < fNsigmaTPC){ |
9bcfd1ab | 179 | // Point in a line crossing region, no PID possible, but !PID still possible ;-) |
70da6c5a | 180 | isLineCrossing = kTRUE; |
809a4336 | 181 | break; |
182 | } | |
183 | } | |
184 | if(isLineCrossing) return 0; | |
0792aa82 | 185 | |
186 | // Check particle rejection | |
187 | if(HasParticleRejection()){ | |
3a72645a | 188 | Int_t reject = Reject(track->GetRecTrack(), anatype); |
0792aa82 | 189 | if(reject != 0) return reject; |
190 | } | |
722347d8 | 191 | |
faee3b18 | 192 | // Check if we have an asymmetric sigma model set |
0792aa82 | 193 | Int_t pdg = 0; |
e156c3bb | 194 | if(fHasCutModel){ |
195 | pdg = CutSigmaModel(track) ? 11 : 0; | |
faee3b18 | 196 | } else { |
197 | // Perform Asymmetric n-sigma cut if required, else perform symmetric TPC sigma cut | |
198 | Float_t p = 0.; | |
3a72645a | 199 | if(HasAsymmetricSigmaCut() && (p = track->GetRecTrack()->P()) >= fPAsigCut[0] && p <= fPAsigCut[1]){ |
faee3b18 | 200 | if(nsigma >= fNAsigmaTPC[0] && nsigma <= fNAsigmaTPC[1]) pdg = 11; |
201 | } else { | |
202 | if(TMath::Abs(nsigma) < fNsigmaTPC ) pdg = 11; | |
203 | } | |
70da6c5a | 204 | } |
3a72645a | 205 | if(pidqa && pdg != 0) pidqa->ProcessTrack(track, AliHFEpid::kTPCpid, AliHFEdetPIDqa::kAfterPID); |
0792aa82 | 206 | return pdg; |
722347d8 | 207 | |
809a4336 | 208 | } |
209 | ||
faee3b18 | 210 | //___________________________________________________________________ |
e156c3bb | 211 | Bool_t AliHFEpidTPC::CutSigmaModel(const AliHFEpidObject * const track) const { |
faee3b18 | 212 | // |
213 | // N SigmaCut using parametrization of the cuts | |
214 | // | |
215 | Bool_t isSelected = kTRUE; | |
e156c3bb | 216 | AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; |
8c1c76e9 | 217 | Float_t nsigma = fkPIDResponse->NumberOfSigmasTPC(track->GetRecTrack(), AliPID::kElectron); |
e156c3bb | 218 | Double_t p = GetP(track->GetRecTrack(), anatype); |
219 | Int_t centrality = track->IsPbPb() ? track->GetCentrality() + 1 : 0; | |
220 | AliDebug(2, Form("Centrality: %d\n", centrality)); | |
8c1c76e9 | 221 | if(centrality > 11) return kFALSE; |
e156c3bb | 222 | const TF1 *cutfunction; |
223 | if((cutfunction = fkUpperSigmaCut[centrality]) && nsigma > cutfunction->Eval(p)) isSelected = kFALSE; | |
224 | if((cutfunction = fkLowerSigmaCut[centrality]) && nsigma < cutfunction->Eval(p)) isSelected = kFALSE; | |
faee3b18 | 225 | return isSelected; |
226 | } | |
227 | ||
0792aa82 | 228 | //___________________________________________________________________ |
6555e2ad | 229 | Int_t AliHFEpidTPC::Reject(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anaType) const{ |
0792aa82 | 230 | // |
231 | // reject particles based on asymmetric sigma cut | |
232 | // | |
233 | Int_t pdc[AliPID::kSPECIES] = {11,13,211,321,2212}; | |
6555e2ad | 234 | Double_t p = GetP(track, anaType); |
0792aa82 | 235 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ |
236 | if(!TESTBIT(fRejectionEnabled, ispec)) continue; | |
0792aa82 | 237 | // Particle rejection enabled |
238 | if(p < fRejection[4*ispec] || p > fRejection[4*ispec+2]) continue; | |
8c1c76e9 | 239 | Double_t sigma = fkPIDResponse->NumberOfSigmasTPC(track, static_cast<AliPID::EParticleType>(ispec)); |
0792aa82 | 240 | if(sigma >= fRejection[4*ispec+1] && sigma <= fRejection[4*ispec+3]) return pdc[ispec] * track->Charge(); |
241 | } | |
242 | return 0; | |
243 | } | |
244 | ||
809a4336 | 245 | //___________________________________________________________________ |
75d81601 | 246 | void AliHFEpidTPC::AddTPCdEdxLineCrossing(Int_t species, Double_t sigma){ |
809a4336 | 247 | // |
248 | // Add exclusion point for the TPC PID where a dEdx line crosses the electron line | |
249 | // Stores line center and line sigma | |
250 | // | |
251 | if(species >= AliPID::kSPECIES){ | |
252 | AliError("Species doesn't exist"); | |
253 | return; | |
254 | } | |
255 | fLineCrossingsEnabled |= 1 << species; | |
75d81601 | 256 | fLineCrossingSigma[species] = sigma; |
809a4336 | 257 | } |
258 | ||
6555e2ad | 259 | //___________________________________________________________________ |
260 | Double_t AliHFEpidTPC::GetP(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anatype) const { | |
261 | // | |
262 | // Get the momentum at the inner wall of the TPC | |
263 | // | |
264 | Double_t p = -1; | |
265 | if(anatype == AliHFEpidObject::kESDanalysis){ | |
266 | // ESD analysis: Use Inner Params for the momentum estimate | |
267 | const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track); | |
bf892a6a | 268 | if(esdtrack) p = esdtrack->GetInnerParam() ? esdtrack->GetInnerParam()->GetP() : esdtrack->P(); |
6555e2ad | 269 | } else { |
270 | // AOD analysis: Use TPC momentum stored in the AliAODpid object | |
271 | const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track); | |
bf892a6a | 272 | if(aodtrack) p = aodtrack->GetDetPid() ? aodtrack->GetDetPid()->GetTPCmomentum() : aodtrack->P(); |
6555e2ad | 273 | } |
274 | return p; | |
275 | } |