]>
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 | ||
3a72645a | 31 | #include "AliAODpidUtil.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" |
10d100d4 | 39 | #include "AliESDpid.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() | |
50 | , fLineCrossingType(0) | |
51 | , fLineCrossingsEnabled(0) | |
52 | , fUpperSigmaCut(NULL) | |
53 | , fLowerSigmaCut(NULL) | |
54 | , fNsigmaTPC(3) | |
55 | , fRejectionEnabled(0) | |
56 | , fPID(NULL) | |
57 | { | |
58 | // | |
59 | // default constructor | |
60 | // | |
61 | } | |
62 | ||
809a4336 | 63 | //___________________________________________________________________ |
64 | AliHFEpidTPC::AliHFEpidTPC(const char* name) : | |
65 | // add a list here | |
9bcfd1ab | 66 | AliHFEpidBase(name) |
67 | , fLineCrossingType(0) | |
809a4336 | 68 | , fLineCrossingsEnabled(0) |
faee3b18 | 69 | , fUpperSigmaCut(NULL) |
70 | , fLowerSigmaCut(NULL) | |
75d81601 | 71 | , fNsigmaTPC(3) |
0792aa82 | 72 | , fRejectionEnabled(0) |
75d81601 | 73 | , fPID(NULL) |
809a4336 | 74 | { |
75 | // | |
76 | // default constructor | |
77 | // | |
809a4336 | 78 | memset(fLineCrossingSigma, 0, sizeof(Double_t) * AliPID::kSPECIES); |
722347d8 | 79 | memset(fPAsigCut, 0, sizeof(Float_t) * 2); |
80 | memset(fNAsigmaTPC, 0, sizeof(Float_t) * 2); | |
809a4336 | 81 | fPID = new AliPID; |
809a4336 | 82 | } |
83 | ||
84 | //___________________________________________________________________ | |
85 | AliHFEpidTPC::AliHFEpidTPC(const AliHFEpidTPC &ref) : | |
9bcfd1ab | 86 | AliHFEpidBase("") |
87 | , fLineCrossingType(0) | |
809a4336 | 88 | , fLineCrossingsEnabled(0) |
faee3b18 | 89 | , fUpperSigmaCut(NULL) |
90 | , fLowerSigmaCut(NULL) | |
809a4336 | 91 | , fNsigmaTPC(2) |
0792aa82 | 92 | , fRejectionEnabled(0) |
75d81601 | 93 | , fPID(NULL) |
809a4336 | 94 | { |
95 | // | |
96 | // Copy constructor | |
97 | // | |
98 | ref.Copy(*this); | |
99 | } | |
100 | ||
101 | //___________________________________________________________________ | |
102 | AliHFEpidTPC &AliHFEpidTPC::operator=(const AliHFEpidTPC &ref){ | |
103 | // | |
104 | // Assignment operator | |
105 | // | |
106 | if(this != &ref){ | |
107 | ref.Copy(*this); | |
108 | } | |
109 | return *this; | |
110 | } | |
75d81601 | 111 | //___________________________________________________________________ |
809a4336 | 112 | void AliHFEpidTPC::Copy(TObject &o) const{ |
113 | // | |
114 | // Copy function | |
115 | // called in copy constructor and assigment operator | |
116 | // | |
117 | AliHFEpidTPC &target = dynamic_cast<AliHFEpidTPC &>(o); | |
118 | ||
119 | target.fLineCrossingsEnabled = fLineCrossingsEnabled; | |
faee3b18 | 120 | target.fUpperSigmaCut = fUpperSigmaCut; |
121 | target.fLowerSigmaCut = fLowerSigmaCut; | |
809a4336 | 122 | target.fNsigmaTPC = fNsigmaTPC; |
0792aa82 | 123 | target.fRejectionEnabled = fRejectionEnabled; |
809a4336 | 124 | target.fPID = new AliPID(*fPID); |
75d81601 | 125 | memcpy(target.fLineCrossingSigma, fLineCrossingSigma, sizeof(Double_t) * AliPID::kSPECIES); |
722347d8 | 126 | memcpy(target.fPAsigCut, fPAsigCut, sizeof(Float_t) * 2); |
127 | memcpy(target.fNAsigmaTPC, fNAsigmaTPC, sizeof(Float_t) * 2); | |
128 | ||
809a4336 | 129 | AliHFEpidBase::Copy(target); |
130 | } | |
131 | ||
132 | //___________________________________________________________________ | |
133 | AliHFEpidTPC::~AliHFEpidTPC(){ | |
134 | // | |
135 | // Destructor | |
136 | // | |
137 | if(fPID) delete fPID; | |
809a4336 | 138 | } |
139 | ||
140 | //___________________________________________________________________ | |
141 | Bool_t AliHFEpidTPC::InitializePID(){ | |
142 | // | |
143 | // Add TPC dE/dx Line crossings | |
144 | // | |
75d81601 | 145 | //AddTPCdEdxLineCrossing(AliPID::kKaon, 0.3, 0.018); |
146 | //AddTPCdEdxLineCrossing(AliPID::kProton, 0.9, 0.054); | |
809a4336 | 147 | return kTRUE; |
148 | } | |
149 | ||
150 | //___________________________________________________________________ | |
3a72645a | 151 | Int_t AliHFEpidTPC::IsSelected(AliHFEpidObject *track, AliHFEpidQAmanager *pidqa) |
809a4336 | 152 | { |
153 | // | |
154 | // For the TPC pid we use the 2-sigma band around the bethe bloch curve | |
155 | // for electrons | |
156 | // exclusion of the crossing points | |
157 | // | |
3a72645a | 158 | |
159 | if((!fESDpid && track->IsESDanalysis()) || (!fAODpid && track->IsAODanalysis())) return 0; | |
160 | ||
161 | // QA before selection | |
162 | if(pidqa) pidqa->ProcessTrack(track, AliHFEpid::kTPCpid, AliHFEdetPIDqa::kBeforePID); | |
e3fc062d | 163 | AliDebug(1, "Doing TPC PID based on n-Sigma cut approach"); |
3a72645a | 164 | AliHFEpidObject::AnalysisType_t anatype = track->IsESDanalysis() ? AliHFEpidObject::kESDanalysis : AliHFEpidObject::kAODanalysis; |
165 | Float_t nsigma = NumberOfSigmas(track->GetRecTrack(), AliPID::kElectron, anatype); | |
166 | AliDebug(1, Form("TPC NSigma: %f", nsigma)); | |
809a4336 | 167 | // exclude crossing points: |
168 | // Determine the bethe values for each particle species | |
809a4336 | 169 | Bool_t isLineCrossing = kFALSE; |
9bcfd1ab | 170 | fLineCrossingType = 0; // default value |
809a4336 | 171 | for(Int_t ispecies = 0; ispecies < AliPID::kSPECIES; ispecies++){ |
75d81601 | 172 | if(ispecies == AliPID::kElectron) continue; |
809a4336 | 173 | if(!(fLineCrossingsEnabled & 1 << ispecies)) continue; |
3a72645a | 174 | if(TMath::Abs(NumberOfSigmas(track->GetRecTrack(), (AliPID::EParticleType)ispecies, anatype)) < fLineCrossingSigma[ispecies] && TMath::Abs(nsigma) < fNsigmaTPC){ |
9bcfd1ab | 175 | // Point in a line crossing region, no PID possible, but !PID still possible ;-) |
70da6c5a | 176 | isLineCrossing = kTRUE; |
9bcfd1ab | 177 | fLineCrossingType = ispecies; |
809a4336 | 178 | break; |
179 | } | |
180 | } | |
181 | if(isLineCrossing) return 0; | |
0792aa82 | 182 | |
183 | // Check particle rejection | |
184 | if(HasParticleRejection()){ | |
3a72645a | 185 | Int_t reject = Reject(track->GetRecTrack(), anatype); |
0792aa82 | 186 | if(reject != 0) return reject; |
187 | } | |
722347d8 | 188 | |
faee3b18 | 189 | // Check if we have an asymmetric sigma model set |
0792aa82 | 190 | Int_t pdg = 0; |
faee3b18 | 191 | if(fUpperSigmaCut || fLowerSigmaCut){ |
3a72645a | 192 | pdg = CutSigmaModel(track->GetRecTrack(), anatype) ? 11 : 0; |
faee3b18 | 193 | } else { |
194 | // Perform Asymmetric n-sigma cut if required, else perform symmetric TPC sigma cut | |
195 | Float_t p = 0.; | |
3a72645a | 196 | if(HasAsymmetricSigmaCut() && (p = track->GetRecTrack()->P()) >= fPAsigCut[0] && p <= fPAsigCut[1]){ |
faee3b18 | 197 | if(nsigma >= fNAsigmaTPC[0] && nsigma <= fNAsigmaTPC[1]) pdg = 11; |
198 | } else { | |
199 | if(TMath::Abs(nsigma) < fNsigmaTPC ) pdg = 11; | |
200 | } | |
70da6c5a | 201 | } |
3a72645a | 202 | if(pidqa && pdg != 0) pidqa->ProcessTrack(track, AliHFEpid::kTPCpid, AliHFEdetPIDqa::kAfterPID); |
0792aa82 | 203 | return pdg; |
722347d8 | 204 | |
809a4336 | 205 | } |
206 | ||
faee3b18 | 207 | //___________________________________________________________________ |
3a72645a | 208 | Bool_t AliHFEpidTPC::CutSigmaModel(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anaType){ |
faee3b18 | 209 | // |
210 | // N SigmaCut using parametrization of the cuts | |
211 | // | |
212 | Bool_t isSelected = kTRUE; | |
3a72645a | 213 | Float_t nsigma = NumberOfSigmas(track, AliPID::kElectron, anaType); |
214 | Double_t p = track->P(); | |
faee3b18 | 215 | if(fUpperSigmaCut && nsigma > fUpperSigmaCut->Eval(p)) isSelected = kFALSE; |
216 | if(fLowerSigmaCut && nsigma < fLowerSigmaCut->Eval(p)) isSelected = kFALSE; | |
217 | return isSelected; | |
218 | } | |
219 | ||
0792aa82 | 220 | //___________________________________________________________________ |
3a72645a | 221 | Int_t AliHFEpidTPC::Reject(const AliVParticle *track, AliHFEpidObject::AnalysisType_t anaType){ |
0792aa82 | 222 | // |
223 | // reject particles based on asymmetric sigma cut | |
224 | // | |
225 | Int_t pdc[AliPID::kSPECIES] = {11,13,211,321,2212}; | |
3a72645a | 226 | Double_t p = track->P(); |
0792aa82 | 227 | for(Int_t ispec = 0; ispec < AliPID::kSPECIES; ispec++){ |
228 | if(!TESTBIT(fRejectionEnabled, ispec)) continue; | |
0792aa82 | 229 | // Particle rejection enabled |
230 | if(p < fRejection[4*ispec] || p > fRejection[4*ispec+2]) continue; | |
3a72645a | 231 | Double_t sigma = NumberOfSigmas(track, static_cast<AliPID::EParticleType>(ispec), anaType); |
0792aa82 | 232 | if(sigma >= fRejection[4*ispec+1] && sigma <= fRejection[4*ispec+3]) return pdc[ispec] * track->Charge(); |
233 | } | |
234 | return 0; | |
235 | } | |
236 | ||
809a4336 | 237 | //___________________________________________________________________ |
75d81601 | 238 | void AliHFEpidTPC::AddTPCdEdxLineCrossing(Int_t species, Double_t sigma){ |
809a4336 | 239 | // |
240 | // Add exclusion point for the TPC PID where a dEdx line crosses the electron line | |
241 | // Stores line center and line sigma | |
242 | // | |
243 | if(species >= AliPID::kSPECIES){ | |
244 | AliError("Species doesn't exist"); | |
245 | return; | |
246 | } | |
247 | fLineCrossingsEnabled |= 1 << species; | |
75d81601 | 248 | fLineCrossingSigma[species] = sigma; |
809a4336 | 249 | } |
250 | ||
251 | //___________________________________________________________________ | |
3a72645a | 252 | Double_t AliHFEpidTPC::NumberOfSigmas(const AliVParticle *track, AliPID::EParticleType species, AliHFEpidObject::AnalysisType_t anaType){ |
253 | // | |
254 | // Get the number of sigmas | |
809a4336 | 255 | // |
3a72645a | 256 | Double_t nSigmas = 100; |
257 | if(anaType == AliHFEpidObject::kESDanalysis){ | |
258 | // ESD analysis | |
259 | const AliESDtrack *esdtrack = dynamic_cast<const AliESDtrack *>(track); | |
260 | if(esdtrack && fESDpid) nSigmas = fESDpid->NumberOfSigmasTPC(esdtrack, species); | |
261 | } else { | |
262 | const AliAODTrack *aodtrack = dynamic_cast<const AliAODTrack *>(track); | |
263 | if(aodtrack && fAODpid) nSigmas = fAODpid->NumberOfSigmasTPC(aodtrack, species); | |
809a4336 | 264 | } |
3a72645a | 265 | return nSigmas; |
809a4336 | 266 | } |